Changes

try fixing German CVE Hime's night DA
Line 271: Line 271:  
end
 
end
 
return { type_3_shell_equiped = type_3_shells > 0, wg_equiped = wgs > 0 }
 
return { type_3_shell_equiped = type_3_shells > 0, wg_equiped = wgs > 0 }
 +
end
 +
 +
-- Single Attack, Single Torpedo and Bombing are actually same
 +
-- https://github.com/andanteyk/ElectronicObserver/blob/master/ElectronicObserver/Other/Information/kcmemo.md#%E5%A4%9C%E6%88%A6
 +
function ShipCapabilities:_single_attack_style(ship)
 +
    if not ship then
 +
        ship = self._ship
 +
    end
 +
    local ship_type = ship:type()
 +
    if ship_type == 13 or ship_type == 14 then
 +
        return 2
 +
    end
 +
    if ship_type == 7 or ship_type == 11 or ship_type == 18 then
 +
        -- currently hard coding, lack of Graf Zeppelin (Kai) and Saratoga
 +
        -- a flag like _cv_night_shelling might be better?
 +
        local ship_name = ship:name() or ""
 +
        if ship_name:match("Lycoris Princess") or ship_name:match("Abyssal Jellyfish Princess") then
 +
            return 1
 +
        else
 +
            return 8
 +
        end
 +
    end
 +
    for i = 1, ship:slots_length() or 0 do
 +
        local equipment, size = ship:slot(i)
 +
        if self:_is_main_gun(equipment) or self:_is_secondary_gun(equipment) then
 +
            return 1
 +
        elseif self:_is_torpedo(equipment) then
 +
            return 2
 +
        end
 +
    end
 +
    return 1
 
end
 
end
 
   
 
   
Line 468: Line 499:  
return nil
 
return nil
 
end
 
end
 +
if firepower + torpedo <= 0 then
 +
    return false
 +
    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)
Line 497: Line 531:  
firepower = firepower + 5
 
firepower = firepower + 5
 
end
 
end
if self:_is_carrier() then
+
if self:night_bombing() == false then
if has_planes and self:_is_night_bombing() then
+
    -- if night bombing is forbidden
return 8, firepower + torpedo
  −
end
   
return false
 
return false
 
else
 
else
Line 529: Line 561:  
elseif main_guns + secondary_guns >= 2 and firepower > 0 then
 
elseif main_guns + secondary_guns >= 2 and firepower > 0 then
 
return 3, ((firepower + torpedo) * anti_installation_modifier + anti_installation_bonus) * 1.2
 
return 3, ((firepower + torpedo) * anti_installation_modifier + anti_installation_bonus) * 1.2
elseif torpedoes > 0 and torpedo > 0 then
+
-- Single Attack, Single Torpedo and Bombing are actually same
if vs_installation then
  −
return false
  −
else
  −
return 2, firepower + torpedo
  −
end
  −
elseif firepower > 0 then
  −
return 1, (firepower + torpedo) * anti_installation_modifier + anti_installation_bonus
   
else
 
else
return false
+
return self:_single_attack_style(), (firepower + torpedo) * anti_installation_modifier + anti_installation_bonus
 
end
 
end
 
end
 
end
Anonymous user