mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Plan more ANTI-SHIP against ship-groups with air-defences
This commit is contained in:
parent
dd7e4c908e
commit
a06e9d0ec7
@ -8,8 +8,4 @@ from game.htn import CompoundTask, Method
|
||||
class AttackShips(CompoundTask[TheaterState]):
|
||||
def each_valid_method(self, state: TheaterState) -> Iterator[Method[TheaterState]]:
|
||||
for ship in state.enemy_ships:
|
||||
# Ammo depots are targeted based on the needs of the front line by
|
||||
# ReduceEnemyFrontLineCapacity. No reason to target them before that front
|
||||
# line is active.
|
||||
if ship.has_live_radar_sam:
|
||||
yield [PlanAntiShip(ship)]
|
||||
yield [PlanAntiShip(ship)]
|
||||
|
||||
@ -7,12 +7,16 @@ from game.commander.missionproposals import EscortType
|
||||
from game.commander.tasks.packageplanningtask import PackagePlanningTask
|
||||
from game.commander.theaterstate import TheaterState
|
||||
from game.theater.theatergroundobject import NavalGroundObject
|
||||
from game.utils import meters
|
||||
|
||||
|
||||
@dataclass
|
||||
class PlanAntiShip(PackagePlanningTask[NavalGroundObject]):
|
||||
def preconditions_met(self, state: TheaterState) -> bool:
|
||||
if self.target not in state.threatening_air_defenses:
|
||||
if (
|
||||
self.target not in state.threatening_air_defenses
|
||||
and not self.target.is_naval_control_point
|
||||
):
|
||||
return False
|
||||
if not self.target_area_preconditions_met(state, ignore_iads=True):
|
||||
return False
|
||||
@ -24,5 +28,11 @@ class PlanAntiShip(PackagePlanningTask[NavalGroundObject]):
|
||||
|
||||
def propose_flights(self) -> None:
|
||||
size = self.get_flight_size()
|
||||
if self.target.max_detection_range() > meters(0):
|
||||
size = 4 # attempt to saturate ship's air-defences
|
||||
self.propose_flight(FlightType.ANTISHIP, size)
|
||||
self.propose_flight(FlightType.ESCORT, 2, EscortType.AirToAir)
|
||||
self.propose_flight(FlightType.ANTISHIP, size)
|
||||
self.propose_flight(FlightType.ESCORT, 2, EscortType.AirToAir)
|
||||
if self.target.max_detection_range() > meters(0):
|
||||
self.propose_flight(FlightType.SEAD, 2, EscortType.Sead)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user