Changes
Undo: there are still something wrong...
function ShipCapabilities:_is_ap_shell(equipment)
function ShipCapabilities:_is_ap_shell(equipment)
return equipment:type() == 19
return equipment:type() == 19
end
function ShipCapabilities:_is_midget_submarine(equipment)
return equipment:type() == 22
end
end
function ShipCapabilities:_is_wg(equipment)
function ShipCapabilities:_is_wg(equipment)
return equipment:type() == 37
return equipment:type() == 37
end
end
-- Basic attack power for opening torpedo, including fleet torpedo.
-- Basic attack power for opening torpedo, including fleet torpedo.
function ShipCapabilities:opening_torpedo(fleet_torpedo)
function ShipCapabilities:opening_torpedo(fleet_torpedo)
local torpedo = self._ship:torpedo_leveled()
local opening_torpedo = self._ship:opening_torpedo()
if (opening_torpedo ~= true) and (opening_torpedo == false or not torpedo or torpedo <= 0) then
return false
end
if self:_is_submarine() then
local level = self._ship:level()
if level and level >= 10 then
opening_torpedo = true
end
end
for i = 1, self._ship:slots_length() or 0 do
local equipment, size = self._ship:slot(i)
if equipment then
if self:_is_midget_submarine(equipment) then
opening_torpedo = true
end
local equipment_torpedo = equipment:torpedo_leveled()
if equipment_torpedo and torpedo then
torpedo = torpedo + equipment_torpedo
end
end
end
if opening_torpedo then
return 5 + (fleet_torpedo or 0) + (torpedo or 0)
end
return false
end
end