Changes

m
retry
Line 579: Line 579:  
end
 
end
 
return "Unknown"
 
return "Unknown"
 +
end
 +
 +
function ShipCapabilities:_opening_torpedo_conditon(ship)
 +
    if not ship then
 +
        ship = self._ship
 +
    end
 +
 +
    local has_special_equipment = false
 +
    for i = 1, ship:slot_length() or 0 do
 +
        local equipment, size = ship:slot(i)
 +
        if equipment and (equipment:id() == 41 or equipment:id() == 541) then
 +
            has_special_equipment = true
 +
        end
 +
    end
 +
    -- copied from Vita ver
 +
    -- Kouhyouteki and Abyssal Cuttelfish Torpedo,
 +
    -- but not midget submarines, are treated solely.
 +
    -- It seems that Abyssal Ambush Torpedo and High-speed Abyssal Torpedo mod.2
 +
    -- cannot perform opening torpedo.
 +
 +
    if ship:type() == 13 or ship:type() == 14 then
 +
        if ship:id() > 1500 then
 +
            return string.find(ship:suffix(), "[Ff]lagshp|[Ee]lite") ~= nil
 +
            -- copied from Vita ver
 +
        else
 +
            local level = ship:level()
 +
            return has_special_equipment or (level and level >= 10)
 +
        end
 +
    else
 +
        return has_special_equipment
 +
    end
 
end
 
end
   Line 584: Line 615:  
function ShipCapabilities:opening_torpedo(fleet_torpedo)
 
function ShipCapabilities:opening_torpedo(fleet_torpedo)
 
local torpedo = self._ship:torpedo_leveled()
 
local torpedo = self._ship:torpedo_leveled()
local opening_torpedo = self._ship:opening_torpedo()
+
if not torpedo or torpedo <= 0 then
if (opening_torpedo ~= true) and (opening_torpedo == false or not torpedo or torpedo <= 0) then
   
return false
 
return false
end
  −
if self:_is_submarine() then
  −
local level = self._ship:level()
  −
if level and level >= 10 then
  −
opening_torpedo = true
  −
end
   
end
 
end
 
for i = 1, self._ship:slots_length() or 0 do
 
for i = 1, self._ship:slots_length() or 0 do
 
local equipment, size = self._ship:slot(i)
 
local equipment, size = self._ship:slot(i)
 
if equipment then
 
if equipment then
if self:_is_midget_submarine(equipment) then
  −
opening_torpedo = true
  −
end
   
local equipment_torpedo = equipment:torpedo_leveled()
 
local equipment_torpedo = equipment:torpedo_leveled()
 
if equipment_torpedo and torpedo then
 
if equipment_torpedo and torpedo then
Line 606: Line 627:  
end
 
end
 
end
 
end
if opening_torpedo then
+
if self:_opening_torpedo_conditon(self._ship) then
 
return 5 + (fleet_torpedo or 0) + (torpedo or 0)
 
return 5 + (fleet_torpedo or 0) + (torpedo or 0)
 
end
 
end
Anonymous user