mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
AirAssault autoplanner support for non-frontline CPs
Aims to solve the issue where AirAssault won't plan against CPs that don't have an active frontline, including isolated CPs.
This commit is contained in:
parent
f63939ce3c
commit
d35962b784
@ -7,7 +7,6 @@ from game.commander.tasks.compound.destroyenemygroundunits import (
|
|||||||
from game.commander.tasks.compound.reduceenemyfrontlinecapacity import (
|
from game.commander.tasks.compound.reduceenemyfrontlinecapacity import (
|
||||||
ReduceEnemyFrontLineCapacity,
|
ReduceEnemyFrontLineCapacity,
|
||||||
)
|
)
|
||||||
from game.commander.tasks.primitive.airassault import PlanAirAssault
|
|
||||||
from game.commander.tasks.primitive.breakthroughattack import BreakthroughAttack
|
from game.commander.tasks.primitive.breakthroughattack import BreakthroughAttack
|
||||||
from game.commander.theaterstate import TheaterState
|
from game.commander.theaterstate import TheaterState
|
||||||
from game.htn import CompoundTask, Method
|
from game.htn import CompoundTask, Method
|
||||||
@ -23,7 +22,6 @@ class CaptureBase(CompoundTask[TheaterState]):
|
|||||||
yield [DestroyEnemyGroundUnits(self.front_line)]
|
yield [DestroyEnemyGroundUnits(self.front_line)]
|
||||||
if self.worth_destroying_ammo_depots(state):
|
if self.worth_destroying_ammo_depots(state):
|
||||||
yield [ReduceEnemyFrontLineCapacity(self.enemy_cp(state))]
|
yield [ReduceEnemyFrontLineCapacity(self.enemy_cp(state))]
|
||||||
yield [PlanAirAssault(self.enemy_cp(state))]
|
|
||||||
|
|
||||||
def enemy_cp(self, state: TheaterState) -> ControlPoint:
|
def enemy_cp(self, state: TheaterState) -> ControlPoint:
|
||||||
return self.front_line.control_point_hostile_to(state.context.coalition.player)
|
return self.front_line.control_point_hostile_to(state.context.coalition.player)
|
||||||
|
|||||||
@ -2,6 +2,7 @@ from collections.abc import Iterator
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from game.commander.tasks.compound.capturebase import CaptureBase
|
from game.commander.tasks.compound.capturebase import CaptureBase
|
||||||
|
from game.commander.tasks.primitive.airassault import PlanAirAssault
|
||||||
from game.commander.theaterstate import TheaterState
|
from game.commander.theaterstate import TheaterState
|
||||||
from game.htn import CompoundTask, Method
|
from game.htn import CompoundTask, Method
|
||||||
|
|
||||||
@ -11,3 +12,5 @@ class CaptureBases(CompoundTask[TheaterState]):
|
|||||||
def each_valid_method(self, state: TheaterState) -> Iterator[Method[TheaterState]]:
|
def each_valid_method(self, state: TheaterState) -> Iterator[Method[TheaterState]]:
|
||||||
for front in state.active_front_lines:
|
for front in state.active_front_lines:
|
||||||
yield [CaptureBase(front)]
|
yield [CaptureBase(front)]
|
||||||
|
for cp in state.vulnerable_control_points:
|
||||||
|
yield [PlanAirAssault(cp)]
|
||||||
|
|||||||
@ -21,6 +21,5 @@ class PlanAirAssault(PackagePlanningTask[ControlPoint]):
|
|||||||
state.vulnerable_control_points.remove(self.target)
|
state.vulnerable_control_points.remove(self.target)
|
||||||
|
|
||||||
def propose_flights(self) -> None:
|
def propose_flights(self) -> None:
|
||||||
size = self.get_flight_size()
|
self.propose_flight(FlightType.AIR_ASSAULT, self.get_flight_size())
|
||||||
self.propose_flight(FlightType.AIR_ASSAULT, size)
|
|
||||||
self.propose_common_escorts()
|
self.propose_common_escorts()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user