Changes

Switch to showing pre-cap attack powers
Line 243: Line 243:  
function ShipCapabilities:_is_midget_submarine(equipment)
 
function ShipCapabilities:_is_midget_submarine(equipment)
 
return equipment:type() == 22
 
return equipment:type() == 22
end
  −
  −
function ShipCapabilities:_attack_power_cap(attack_power, cap)
  −
if attack_power > cap then
  −
return math.floor(cap + math.sqrt(attack_power - cap))
  −
end
  −
return math.floor(attack_power)
   
end
 
end
   Line 270: Line 263:  
end
 
end
 
end
 
end
return 1, self:_attack_power_cap(firepower + 5, 150)
+
return 1, firepower + 5
 
end
 
end
 
else
 
else
Line 301: Line 294:  
end
 
end
 
if has_planes then
 
if has_planes then
return is_installation and 3 or 2, self:_attack_power_cap(1.5 * (firepower + torpedo) + bombing * 2 + 55, 150)
+
return is_installation and 3 or 2, 1.5 * (firepower + torpedo) + bombing * 2 + 55
 
end
 
end
 
end
 
end
Line 330: Line 323:  
end
 
end
 
end
 
end
return self:_attack_power_cap(torpedo + 5, 150)
+
return torpedo + 5
 
end
 
end
 
return false
 
return false
Line 426: Line 419:  
if self:_is_carrier() then
 
if self:_is_carrier() then
 
if has_planes and self._ship:night_bombing() then
 
if has_planes and self._ship:night_bombing() then
return 8, self:_attack_power_cap(firepower + torpedo, 300)
+
return 8, firepower + torpedo
 
end
 
end
 
return false
 
return false
 
else
 
else
 
if torpedoes >= 2 and torpedo > 0 then
 
if torpedoes >= 2 and torpedo > 0 then
return 7, self:_attack_power_cap((firepower + torpedo) * 1.5, 300)
+
return 7, (firepower + torpedo) * 1.5
 
elseif main_guns >= 3 and firepower > 0 then
 
elseif main_guns >= 3 and firepower > 0 then
return 4, self:_attack_power_cap((firepower + torpedo) * 2, 300)
+
return 4, (firepower + torpedo) * 2
 
elseif main_guns >= 2 and secondary_guns >= 1 and firepower > 0 then
 
elseif main_guns >= 2 and secondary_guns >= 1 and firepower > 0 then
return 5, self:_attack_power_cap((firepower + torpedo) * 1.75, 300)
+
return 5, (firepower + torpedo) * 1.75
 
elseif main_guns >= 1 and torpedoes == 1 and firepower > 0 and torpedo > 0 then
 
elseif main_guns >= 1 and torpedoes == 1 and firepower > 0 and torpedo > 0 then
return 6, self:_attack_power_cap((firepower + torpedo) * 1.3, 300)
+
return 6, (firepower + torpedo) * 1.3
 
elseif main_guns + secondary_guns >= 2 and firepower > 0 then
 
elseif main_guns + secondary_guns >= 2 and firepower > 0 then
return 3, self:_attack_power_cap((firepower + torpedo) * 1.2, 300)
+
return 3, (firepower + torpedo) * 1.2
 
elseif torpedoes > 0 and torpedo > 0 then
 
elseif torpedoes > 0 and torpedo > 0 then
return 2, self:_attack_power_cap(firepower + torpedo, 300)
+
return 2, firepower + torpedo
 
elseif firepower > 0 then
 
elseif firepower > 0 then
return 1, self:_attack_power_cap(firepower + torpedo, 300)
+
return 1, firepower + torpedo
 
else
 
else
 
return false
 
return false
Line 488: Line 481:  
end
 
end
 
if opening_torpedo then
 
if opening_torpedo then
return self:_attack_power_cap(torpedo + 5, 150)
+
return torpedo + 5
 
end
 
end
 
return false
 
return false
Line 534: Line 527:  
depth_charge_sonar_boost = 1.15
 
depth_charge_sonar_boost = 1.15
 
end
 
end
return self:_attack_power_cap(depth_charge_sonar_boost * (base_asw + 2 * equipment_asw + ship_asw / 5), 100), day, night, not asw_leveled
+
return depth_charge_sonar_boost * (base_asw + 2 * equipment_asw + ship_asw / 5), day, night, not asw_leveled
 
end
 
end
   Line 568: Line 561:  
local attack_power = (equipment_torpedo + equipment_bombing) * math.sqrt(size) + 25
 
local attack_power = (equipment_torpedo + equipment_bombing) * math.sqrt(size) + 25
 
if self:_is_torpedo_bomber(equipment) then
 
if self:_is_torpedo_bomber(equipment) then
table.insert(airstrikes, self:_attack_power_cap(attack_power * 1.5, 150))
+
table.insert(airstrikes, attack_power * 1.5)
 
else
 
else
table.insert(airstrikes, self:_attack_power_cap(attack_power, 150))
+
table.insert(airstrikes, attack_power)
 
end
 
end
 
end
 
end
Anonymous user