mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Consider BAI missions planned this turn when determining if a control point is still garrisioned for preventing breakthrough. This isn't very accurate yet since the HTN isn't checking for aircraft fulfillment yet, so it might *plan* a mission to kill the garrison, but there's no way to know if it will be fulfilled.
27 lines
983 B
Python
27 lines
983 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
|
|
from game.commander.tasks.packageplanningtask import PackagePlanningTask
|
|
from game.commander.theaterstate import TheaterState
|
|
from game.data.doctrine import Doctrine
|
|
from game.theater.theatergroundobject import VehicleGroupGroundObject
|
|
from gen.flights.flight import FlightType
|
|
|
|
|
|
@dataclass
|
|
class PlanBai(PackagePlanningTask[VehicleGroupGroundObject]):
|
|
def preconditions_met(self, state: TheaterState) -> bool:
|
|
if not super().preconditions_met(state):
|
|
return False
|
|
if not state.has_garrison(self.target):
|
|
return False
|
|
return self.target_area_preconditions_met(state)
|
|
|
|
def apply_effects(self, state: TheaterState) -> None:
|
|
state.eliminate_garrison(self.target)
|
|
|
|
def propose_flights(self, doctrine: Doctrine) -> None:
|
|
self.propose_flight(FlightType.BAI, 2, doctrine.mission_ranges.offensive)
|
|
self.propose_common_escorts(doctrine)
|