Changes

m
overseas
Line 3: Line 3:  
local Ship
 
local Ship
 
local ShipClass = require('Module:ShipClass')
 
local ShipClass = require('Module:ShipClass')
 +
local dropData
 +
local sortIds = require("Module:DropList/Sort")
    
local BaseData = require("Module:BaseData")
 
local BaseData = require("Module:BaseData")
Line 75: Line 77:  
elseif self._seasonal then
 
elseif self._seasonal then
 
    return self:base_link()
 
    return self:base_link()
 +
    elseif self._vita then
 +
        return string.format('KanColle Kai:%s', self:base_link()), self:unique_name()
 
     else
 
     else
 
return self:unique_name()
 
return self:unique_name()
Line 128: Line 132:  
function ShipData:true_id()
 
function ShipData:true_id()
 
return self._true_id
 
return self._true_id
 +
end
 +
 +
function ShipData:sort_id()
 +
return sortIds[self._api_id] or 0
 
end
 
end
   Line 152: Line 160:  
function ShipData:type()
 
function ShipData:type()
 
return self._type
 
return self._type
 +
end
 +
 +
function ShipData:code()
 +
return Formatting:format_ship_code(self._type)
 +
end
 +
 +
function ShipData:formatted_type()
 +
return Formatting:format_ship_type(self._type)
 +
end
 +
 +
function ShipData:is_battleship()
 +
return self._type == 8 or self._type == 9 or self._type == 10 or self._type == 12
 +
end
 +
 +
function ShipData:is_carrier()
 +
return self._type == 7 or self._type == 11 or self._type == 18
 +
end
 +
 +
function ShipData:is_auxiliary()
 +
return self._type == 22 or self._type == 16 or self._type == 17 or self._type == 19 or self._type == 20
 +
end
 +
 +
function ShipData:is_submarine()
 +
return self._type == 13 or self._type == 14
 +
end
 +
 +
function ShipData:is_CL()
 +
return self._type == 3 or self._type == 4 or self._type == 21
 +
end
 +
 +
function ShipData:is_CA()
 +
return self._type == 5 or self._type == 6
 
end
 
end
   Line 204: Line 244:  
end
 
end
 
api_id = self:api_id()
 
api_id = self:api_id()
if api_id then
+
if api_id or hd then
 
return Formatting:ship_battle_card(api_id, self:unique_name(), self:type(), self._battle_card_extension, false, hd)
 
return Formatting:ship_battle_card(api_id, self:unique_name(), self:type(), self._battle_card_extension, false, hd)
 
end
 
end
Line 222: Line 262:  
end
 
end
 
api_id = self:api_id()
 
api_id = self:api_id()
if api_id then
+
if api_id or hd then
 +
    if self._can_debuff and api_id > 1500 then
 +
            return string.format("Enemy Banner %s Debuffed.png", self:unique_name():gsub("- Damaged", "Damaged"))
 +
        end
 
return Formatting:ship_battle_card_damaged(api_id, self:unique_name(), self:type(), self._battle_card_damaged_extension, false, hd)
 
return Formatting:ship_battle_card_damaged(api_id, self:unique_name(), self:type(), self._battle_card_damaged_extension, false, hd)
 
end
 
end
Line 255: Line 298:  
        return Formatting:ship_cg_damaged(nil, self:unique_name(), nil, self._cg_damaged_extension, true, hd)
 
        return Formatting:ship_cg_damaged(nil, self:unique_name(), nil, self._cg_damaged_extension, true, hd)
 
    elseif api_id or simple_naming then
 
    elseif api_id or simple_naming then
 +
        if self._can_debuff and api_id > 1500 then
 +
                return string.format("Enemy Full %s Debuffed.png", self:unique_name():gsub("- Damaged", "Damaged"))
 +
        end
 
    return Formatting:ship_cg_damaged(api_id, self:unique_name(), self:type(), self._cg_damaged_extension, simple_naming, hd)
 
    return Formatting:ship_cg_damaged(api_id, self:unique_name(), self:type(), self._cg_damaged_extension, simple_naming, hd)
 
    end
 
    end
Line 486: Line 532:  
function ShipData:buildable_lsc()
 
function ShipData:buildable_lsc()
 
return self._buildable_lsc
 
return self._buildable_lsc
 +
end
 +
 +
function ShipData:buildable_or()
 +
return self._buildable or self._buildable_lsc
 +
end
 +
 +
function ShipData:buildable_and()
 +
return self._buildable and self._buildable_lsc
 
end
 
end
    
function ShipData:build_time()
 
function ShipData:build_time()
 
return self._build_time
 
return self._build_time
 +
end
 +
 +
local function prepareDropData()
 +
if not dropData then
 +
dropData = require('Module:Data/ShipDrop')
 +
end
 +
end
 +
 +
function ShipData:dropable()
 +
prepareDropData()
 +
return dropData[self._name] and true or false
 
end
 
end
   Line 512: Line 577:  
    devmat = self._remodel_development_material,
 
    devmat = self._remodel_development_material,
 
    conmat = self._remodel_construction_material or false,
 
    conmat = self._remodel_construction_material or false,
    screw = false
+
    screw = self._remodel_screw or false,
 +
    }
 +
end
 +
 
 +
function ShipData:all_remodel_cost()
 +
return {
 +
    ammo = self._remodel_ammo,
 +
    steel = self._remodel_steel,
 +
    devmat = self._remodel_development_material,
 +
    conmat = self._remodel_construction_material or false,
 +
    screw = self._remodel_screw or false,
 +
    blueprint = self._remodel_blueprint,
 +
    catapult = self._remodel_catapult,
 +
    report = self._remodel_report or false,
 +
    gunmat = self._remodel_gunmat or false,
 +
    airmat = self._remodel_airmat or false,
 +
    armament = self._remodel_armament or false,
 +
    overseas = self._remodel_overseas or false,
 
     }
 
     }
 
end
 
end
Line 534: Line 616:  
function ShipData:remodel_airmat()
 
function ShipData:remodel_airmat()
 
return self._remodel_airmat
 
return self._remodel_airmat
 +
end
 +
 +
function ShipData:remodel_armament()
 +
return self._remodel_armament
 +
end
 +
 +
function ShipData:remodel_development_material()
 +
return self._remodel_development_material
 +
end
 +
 +
function ShipData:remodel_construction_material()
 +
return self._remodel_construction_material
 +
end
 +
 +
function ShipData:remodel_screw()
 +
return self._remodel_screw
 
end
 
end
   Line 548: Line 646:  
    devmat = self._remodel_to_development_material,
 
    devmat = self._remodel_to_development_material,
 
    conmat = self._remodel_to_construction_material or false,
 
    conmat = self._remodel_to_construction_material or false,
    screw = false
+
    screw = self._remodel_to_screw or false,
 +
    }
 +
end
 +
 
 +
function ShipData:all_remodel_to_cost()
 +
return {
 +
    ammo = self._remodel_to_ammo,
 +
    steel = self._remodel_to_steel,
 +
    devmat = self._remodel_to_development_material,
 +
    conmat = self._remodel_to_construction_material or false,
 +
    screw = self._remodel_to_screw or false,
 +
    blueprint = self._remodel_to_blueprint,
 +
    catapult = self._remodel_to_catapult,
 +
    report = self._remodel_to_report or false,
 +
    gunmat = self._remodel_to_gunmat or false,
 +
    airmat = self._remodel_to_airmat or false,
 +
    armament = self._remodel_to_armament or false,
 +
    overseas = self._remodel_to_overseas or false,
 
     }
 
     }
 
end
 
end
Line 604: Line 719:  
if type(equipment_slot.equipment) == "string" then
 
if type(equipment_slot.equipment) == "string" then
 
self:_prepare_Equipment()
 
self:_prepare_Equipment()
equipment_slot.equipment = Equipment(equipment_slot.equipment)
+
equipment_slot.equipment = Equipment(equipment_slot.equipment, self._enemy)
 
end
 
end
 
return equipment_slot.equipment, equipment_slot.size, equipment_slot.estimation, equipment_slot.stars
 
return equipment_slot.equipment, equipment_slot.size, equipment_slot.estimation, equipment_slot.stars
Line 644: Line 759:  
function ShipData:speed()
 
function ShipData:speed()
 
return self._speed
 
return self._speed
 +
end
 +
 +
function ShipData:formatted_speed()
 +
return Formatting:format_speed(self._speed)
 
end
 
end
    
function ShipData:range()
 
function ShipData:range()
 
return self._range
 
return self._range
 +
end
 +
 +
function ShipData:formatted_range()
 +
return Formatting:format_range(self._range)
 +
end
 +
 +
function ShipData:equipment_armor()
 +
    local armor = 0
 +
    for i = 1, self:slots_length() or 0 do
 +
        local equipment = self:slot(i)
 +
        if equipment then
 +
            armor = armor + (equipment:armor() or 0)
 +
        end
 +
    end
 +
    return armor
 
end
 
end
   Line 674: Line 808:  
                 slot_equipment_type == 8 or  
 
                 slot_equipment_type == 8 or  
 
                 slot_equipment_type == 11 or
 
                 slot_equipment_type == 11 or
 +
                slot_equipment_type == 47 or
 
                 count_recons and slot_equipment_type == 10) then
 
                 count_recons and slot_equipment_type == 10) then
 
                 air_power = air_power +  
 
                 air_power = air_power +  
Line 685: Line 820:  
     end
 
     end
 
     return air_power
 
     return air_power
 +
end
 +
 +
function ShipData:has_lbas_ha_bomber()
 +
    for i = 1, self:slots_length() or 0 do
 +
        local equipment = self:slot(i)
 +
        if equipment and equipment:is_lbas_ha_bomber() then
 +
            return true
 +
        end
 +
    end
 +
    return false
 
end
 
end
    
function ShipData:air_power_estimation(count_recons)
 
function ShipData:air_power_estimation(count_recons)
     return self._air_power_estimation and self:air_power(count_recons)
+
     return self._air_power_estimation
 
end
 
end
   Line 701: Line 846:  
function ShipData:night_bombing()
 
function ShipData:night_bombing()
 
return self._night_bombing
 
return self._night_bombing
 +
end
 +
 +
function ShipData:night_aviation_personnel()
 +
return self._night_aviation_personnel
 
end
 
end
   Line 757: Line 906:  
end
 
end
   −
--The implementation date for this ship. A 3-tuple of year, month, day (JST) as a table, or nil if unknown.
  −
--EXPERIMENTAL, DO NOT USE. Spec for this feature may rapidly change.
   
function ShipData:implementation_date()
 
function ShipData:implementation_date()
 
if self._implementation_date ~= nil then
 
if self._implementation_date ~= nil then
Line 767: Line 914:  
end
 
end
 
     return self._implementation_date
 
     return self._implementation_date
 +
end
 +
 +
function ShipData:implementation_date_string()
 +
local date = self:implementation_date()
 +
    return not date and "??" or string.format("%s/%s/%s", date[1], date[2] < 10 and "0" .. date[2] or date[2], date[3] < 10 and "0" .. date[3] or date[3])
 
end
 
end
  
42,754

edits