Changes

automatic installation and night bombing
Line 141: Line 141:  
or ship_type == 14
 
or ship_type == 14
 
end
 
end
+
 
 +
-- Automatically make units with 0 speed installations
 +
-- todo: the effect of type 3 shell
 
function ShipCapabilities:_is_installation(ship)
 
function ShipCapabilities:_is_installation(ship)
 
if not ship then
 
if not ship then
 
ship = self._ship
 
ship = self._ship
 
end
 
end
return ship:is_installation()
+
return ship:speed() == 0 and not ship:is_pillbox()
 +
end
 +
 
 +
-- The logic is copied from Kan Colle Kai
 +
-- Automatically make most of enemy carriers night bombing
 +
-- _night_bombing is now used to disable night bombing caused by firepower and torpedo, and not related to night ASW
 +
function ShipCapabilities:_is_night_bombing(ship)
 +
if not ship then
 +
ship = self._ship
 +
end
 +
return ship:night_bombing() ~= false
 +
and self:_is_carrier(ship)
 +
and (ship:firepower() or 0) + (ship:torpedo() or 0) > 0
 
end
 
end
 
   
 
   
Line 485: Line 499:  
end
 
end
 
if self:_is_carrier() then
 
if self:_is_carrier() then
if has_planes and self._ship:night_bombing() then
+
if has_planes and self:_is_night_bombing() then
 
return 8, firepower + torpedo
 
return 8, firepower + torpedo
 
end
 
end
Line 579: Line 593:  
elseif self:_is_asw_aviation_ship() then
 
elseif self:_is_asw_aviation_ship() then
 
base_asw = 8
 
base_asw = 8
if not self._ship:night_bombing() or self._ship:asw_leveled() == 0 then
+
if not self:_is_night_bombing() or self._ship:asw_leveled() == 0 then
 
night = false
 
night = false
 
end
 
end
Anonymous user