   else
     'success'
 
-window.addEventListener 'layout.change', (e) ->
-  {layout} = e.detail
+getInfo = (shipName, shipLv, friend, enemy, enemyLv) ->
+  {$ships, _ships} = window
+  for shipId, i in friend
+    continue if shipId == -1
+    idx = _.sortedIndex _ships, {api_id: shipId}, 'api_id'
+    shipName[i] = $ships[_ships[idx].api_ship_id].api_name
+    shipLv[i] = _ships[idx].api_lv
+  for shipId, i in enemy
+    continue if shipId == -1
+    shipLv[i + 5] = enemyLv[i]
+    if $ships[shipId].api_yomi == "-"
+      shipName[i + 5] = $ships[shipId].api_name
+    else
+      shipName[i + 5] = $ships[shipId].api_name + $ships[shipId].api_yomi
+  [shipName, shipLv]
+
+getHp = (maxHp, nowHp, maxHps, nowHps) ->
+  for tmp, i in maxHps
+    continue if i == 0
+    maxHp[i] = tmp
+    nowHp[i] = nowHps[i]
+  [maxHp, nowHp]
+
+koukuAttack = (afterHp, kouku) ->
+  if kouku.api_edam?
+    for damage, i in kouku.api_edam
+      damage = Math.floor(damage)
+      continue if damage <= 0
+      afterHp[i + 5] -= damage
+  if kouku.api_fdam?
+    for damage, i in kouku.api_fdam
+      damage = Math.floor(damage)
+      continue if damage <= 0
+      afterHp[i - 1] -= damage
+  afterHp
+
+openAttack = (afterHp, openingAttack) ->
+  if openingAttack.api_edam?
+    for damage, i in openingAttack.api_edam
+      damage = Math.floor(damage)
+      continue if damage <= 0
+      afterHp[i + 5] -= damage
+  if openingAttack.api_fdam?
+    for damage, i in openingAttack.api_fdam
+      damage = Math.floor(damage)
+      continue if damage <= 0
+      afterHp[i - 1] -= damage
+  afterHp
+
+hougekiAttack = (afterHp, hougeki) ->
+  for damageFrom, i in hougeki.api_at_list
+    continue if damageFrom == -1
+    for damage, j in hougeki.api_damage[i]
+      damage = Math.floor(damage)
+      damageTo = hougeki.api_df_list[i][j]
+      continue if damage <= 0
+      afterHp[damageTo - 1] -= damage
+  afterHp
+
+raigekiAttack = (afterHp, raigeki) ->
+  if raigeki.api_edam?
+    for damage, i in raigeki.api_edam
+      damage = Math.floor(damage)
+      continue if damage <= 0
+      afterHp[i + 1] -= damage
+  if raigeki.api_fdam?
+    for damage, i in raigeki.api_fdam
+      damage = Math.floor(damage)
+      continue if damage <= 0
+      afterHp[i - 1] -= damage
+  afterHp
+
+getDamage = (damageHp, nowHp, afterHp, minHp) ->
+  for tmp, i in afterHp
+    if minHp == 1
+      afterHp[i] = Math.max(tmp, minHp)
+    damageHp[i] = nowHp[i] - afterHp[i]
+    afterHp[i] = Math.max(tmp, minHp)
+  damageHp
 
 module.exports =
   name: 'prophet'


      return unless flag
      @setState
        afterFriendHp: afterFriendHp
        nowFriendHp: nowFriendHp
        maxFriendHp: maxFriendHp
        afterEnemyHp: afterEnemyHp
        nowEnemyHp: nowEnemyHp
        maxEnemyHp: maxEnemyHp
        damageFriend: damageFriend
        damageEnemy: damageEnemy
        enemyShipName: enemyShipName
        enemyShipLv: enemyShipLv
        friendShipName: friendShipName
        friendShipLv: friendShipLv
        enemyInfo: enemyInfo
        getShip: getShip
    componentDidMount: ->
      window.addEventListener 'game.response', @handleResponse


{_, $, $$, React, ReactBootstrap, ROOT, resolveTime, layout, toggleModal} = window

{Table, ProgressBar, Grid, Input, Col, Alert} = ReactBootstrap

window.addEventListener 'layout.change', (e) ->
  {layout} = e.detail

getHpStyle = (percent) ->
  if percent <= 25
    'danger'
