Changes

WIP: support for enemy night aviation personnel
Line 261: Line 261:  
function Self._is_active_midget_submarine(equipment)
 
function Self._is_active_midget_submarine(equipment)
 
return equipment:id() == 41 or equipment:id() == 541
 
return equipment:id() == 41 or equipment:id() == 541
 +
end
 +
 +
function Self._is_night_aviation_personnel(equipment)
 +
return equipment:id() == 258
 +
or equipment:id() == 259
 +
or equipment:id() == 608
 
end
 
end
 
   
 
   
Line 504: Line 510:  
-- Or basic attack power for night battle attack, including night special attack, anti-installation and contact modifiers.
 
-- Or basic attack power for night battle attack, including night special attack, anti-installation and contact modifiers.
 
function ShipCapabilities:night_battle(vs_installation, contact)
 
function ShipCapabilities:night_battle(vs_installation, contact)
local main_guns, secondary_guns, torpedoes, has_planes, firepower, torpedo = 0, 0, 0, false, self._ship:firepower_leveled(), self._ship:torpedo_leveled()
+
local main_guns, secondary_guns, torpedoes, has_night_aviation_personnel, has_planes, firepower, torpedo = 0, 0, 0, false, self._ship:night_aviation_personnel(), self._ship:firepower_leveled(), self._ship:torpedo_leveled()
 
if not firepower or not torpedo then
 
if not firepower or not torpedo then
 
return nil
 
return nil
Line 528: Line 534:  
equipment_torpedo = 0
 
equipment_torpedo = 0
 
end
 
end
 +
    elseif self:_is_night_aviation_personnel(equipment) then
 +
        has_night_aviation_personnel = true
 
end
 
end
 
if equipment_firepower then
 
if equipment_firepower then
Line 570: Line 578:  
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
 +
-- WIP: just a hack for enemy CVs, no plane checked, only NF + NTB (120%) supported
 +
elseif self:_is_carrier(self._ship) and has_night_aviation_personnel then
 +
    return 9, ((firepower + torpedo) * anti_installation_modifier + anti_installation_bonus) * 1.2
 
-- Single Attack, Single Torpedo and Bombing are actually same
 
-- Single Attack, Single Torpedo and Bombing are actually same
 
else
 
else
Anonymous user