Changes

never lucky
Line 11: Line 11:  
local EquipmentByApiId = require('Module:Collection/EquipmentByApiId')
 
local EquipmentByApiId = require('Module:Collection/EquipmentByApiId')
   −
local function getShipCard(ship, hp, maxHp)
+
local function getShipCard(ship)
    local minHp = type(hp) == 'table' and U.imin(hp) or hp
   
     local id = tonumber(ship)
 
     local id = tonumber(ship)
 
     if id then
 
     if id then
 
         ship = ShipsByApiId[id]
 
         ship = ShipsByApiId[id]
 
     end
 
     end
     return ShipBattleCardKai:Asset({
+
     return ShipBattleCardKai:Asset({ ship, hd = true, size = '160px' })
        ship,
  −
        hd = true,
  −
        size = '160px',
  −
        damaged = hp / maxHp <= 0.5 and 'true' or 'false',
  −
        layers = hp / maxHp <= 0.5 and 'status_medium_damage' or hp / maxHp <= 0.75 and 'status_light_damage' or '',
  −
    })
   
end
 
end
   Line 92: Line 85:     
local function formatHp(hps, maxHp)
 
local function formatHp(hps, maxHp)
  local minHp = U.imin(hps)
+
     return string.format(
  if minHp / maxHp <= 0.5 then
+
        '<span class="explain" title="%s">~/%s</span>',
     return string.format('{{color|red|{{tooltip|~/%s|%s}}}}', maxHp, U.ijoin(hps, ', '))
+
        U.ijoin(hps, ', '),
  elseif minHp / maxHp <= 0.75 then
+
        maxHp
    return string.format('{{color|coral|{{tooltip|~/%s|%s}}}}', maxHp, U.ijoin(hps, ', '))
+
     )
  else
  −
     return string.format('{{tooltip|~/%s|%s}}', maxHp, U.ijoin(hps, ', '))
  −
  end
   
end
 
end
   Line 151: Line 141:  
                 table.insert(result, string.format(
 
                 table.insert(result, string.format(
 
                     '|-\n|%s||%s||style="text-align:left;white-space:nowrap"|%s||%s||%s||%s||%s||%s',
 
                     '|-\n|%s||%s||style="text-align:left;white-space:nowrap"|%s||%s||%s||%s||%s||%s',
                     getShipCard(ship.ship, ship.hp, ship.maxHp),
+
                     getShipCard(ship.ship),
 
                     ship.level,
 
                     ship.level,
 
                     U.ijoin(U.imap(ship.equipment, function(eq) return getEquipmentCard(eq, cardSize) end)),
 
                     U.ijoin(U.imap(ship.equipment, function(eq) return getEquipmentCard(eq, cardSize) end)),
cssedit, gkautomate
7,064

edits