• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
Move air_power down from EnemyShipData, add installation property
Line 96: Line 96:  
function ShipData:type()
 
function ShipData:type()
 
return self._type
 
return self._type
 +
end
 +
 +
function ShipData:is_installation()
 +
return self._installation
 
end
 
end
   Line 434: Line 438:  
end
 
end
    +
function ShipData:air_power()
 +
    local air_power = 0
 +
    for i = 1, self:slots() or 0 do
 +
        local slot_equipment, slot_space = self:slot(i)
 +
        if slot_equipment == nil or slot_space == nil then
 +
            --we have missing information, fall back to hard-coded air power
 +
            air_power = self._as_rating
 +
            break
 +
        elseif slot_equipment ~= false then
 +
            --if there is an equipment
 +
            local slot_equipment_type = slot_equipment:type()
 +
            local slot_equipment_aa = slot_equipment:aa()
 +
            if slot_equipment_aa and
 +
              (slot_equipment_type == 6 or
 +
                slot_equipment_type == 7 or
 +
                slot_equipment_type == 8 or
 +
                slot_equipment_type == 11) then
 +
                air_power = air_power +
 +
                  math.floor(math.sqrt(slot_space) * slot_equipment_aa)
 +
            elseif slot_equipment_aa == nil then
 +
            --we have missing information, fall back to hard-coded air power
 +
                air_power = self._as_rating
 +
                break
 +
            end
 +
        end
 +
    end
 +
    return air_power
 +
end
 +
 
function ShipData:night_bombing()
 
function ShipData:night_bombing()
 
return self._night_bombing
 
return self._night_bombing
Anonymous user

Navigation menu