Remove AirAssault completly from AutoPlanner

see #2506 for mor details
This commit is contained in:
RndName 2022-11-03 11:05:52 +01:00
parent ea6662c38b
commit 4531fc7f37
5 changed files with 6 additions and 52 deletions

View File

@ -93,6 +93,11 @@ class Builder(IBuilder[AirAssaultFlightPlan, AirAssaultLayout]):
pickup = None pickup = None
pickup_position = self.flight.departure.position pickup_position = self.flight.departure.position
else: else:
# TODO The calculation of the Pickup LZ is currently randomized. This
# leads to the problem that we can not gurantee that the LZ is clear of
# obstacles. This has to be improved in the future so that the Mission can
# be autoplanned. In the current state the User has to check the created
# Waypoints for the Pickup and Dropoff LZs are free of obstacles.
# Create a special pickup zone for Helos from Airbase / FOB # Create a special pickup zone for Helos from Airbase / FOB
pickup = builder.cargo_pickup( pickup = builder.cargo_pickup(
MissionTarget( MissionTarget(
@ -105,11 +110,7 @@ class Builder(IBuilder[AirAssaultFlightPlan, AirAssaultLayout]):
assault_area = builder.assault_area(self.package.target) assault_area = builder.assault_area(self.package.target)
heading = self.package.target.position.heading_between_point(pickup_position) heading = self.package.target.position.heading_between_point(pickup_position)
# Once there is a plane which is capable of AirDrop Paratrooper # TODO we can not gurantee a safe LZ for DropOff. See comment above.
# we can make use of the AIRDROP Wayppoint type.
# This would also need a special Waypointbuilder.
# Currently AirAssault can only be used by Helos so we just create
# the drop_off Landing Zone
drop_off_zone = MissionTarget( drop_off_zone = MissionTarget(
"Dropoff zone", "Dropoff zone",
self.package.target.position.point_from_heading(heading, 1200), self.package.target.position.point_from_heading(heading, 1200),

View File

@ -139,14 +139,6 @@ class ObjectiveFinder:
"""Iterates over all active front lines in the theater.""" """Iterates over all active front lines in the theater."""
yield from self.game.theater.conflicts() yield from self.game.theater.conflicts()
def air_assault_targets(self) -> Iterator[ControlPoint]:
"""Iterates over all capturable controlpoints for all active front lines"""
if not self.game.settings.plugin_option("ctld"):
# Air Assault should only be tasked with CTLD enabled
return
for front_line in self.front_lines():
yield front_line.control_point_hostile_to(self.is_player)
def vulnerable_control_points(self) -> Iterator[ControlPoint]: def vulnerable_control_points(self) -> Iterator[ControlPoint]:
"""Iterates over friendly CPs that are vulnerable to enemy CPs. """Iterates over friendly CPs that are vulnerable to enemy CPs.

View File

@ -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
@ -19,7 +18,6 @@ class CaptureBase(CompoundTask[TheaterState]):
front_line: FrontLine front_line: FrontLine
def each_valid_method(self, state: TheaterState) -> Iterator[Method[TheaterState]]: def each_valid_method(self, state: TheaterState) -> Iterator[Method[TheaterState]]:
yield [PlanAirAssault(self.enemy_cp(state))]
yield [BreakthroughAttack(self.front_line, state.context.coalition.player)] yield [BreakthroughAttack(self.front_line, state.context.coalition.player)]
yield [DestroyEnemyGroundUnits(self.front_line)] yield [DestroyEnemyGroundUnits(self.front_line)]
if self.worth_destroying_ammo_depots(state): if self.worth_destroying_ammo_depots(state):

View File

@ -1,34 +0,0 @@
from __future__ import annotations
from dataclasses import dataclass
from game.commander.tasks.packageplanningtask import PackagePlanningTask
from game.commander.theaterstate import TheaterState
from game.theater import ControlPoint
from game.ato.flighttype import FlightType
@dataclass
class PlanAirAssault(PackagePlanningTask[ControlPoint]):
def preconditions_met(self, state: TheaterState) -> bool:
if self.target not in state.air_assault_targets:
return False
if self.capture_blocked(state):
# Do not task if there are enemy battle_positions blocking the capture
return False
if not self.target_area_preconditions_met(state):
# Do not task if air defense is present in the target area
return False
return super().preconditions_met(state)
def capture_blocked(self, state: TheaterState) -> bool:
battle_positions = state.enemy_battle_positions[self.target]
return len(battle_positions.blocking_capture) > 0
def apply_effects(self, state: TheaterState) -> None:
state.air_assault_targets.remove(self.target)
def propose_flights(self) -> None:
self.propose_flight(FlightType.AIR_ASSAULT, 2)
# TODO Validate this.. / is Heli escort possible?
self.propose_flight(FlightType.TARCAP, 2)

View File

@ -45,7 +45,6 @@ class TheaterState(WorldState["TheaterState"]):
context: PersistentContext context: PersistentContext
barcaps_needed: dict[ControlPoint, int] barcaps_needed: dict[ControlPoint, int]
active_front_lines: list[FrontLine] active_front_lines: list[FrontLine]
air_assault_targets: list[ControlPoint]
front_line_stances: dict[FrontLine, Optional[CombatStance]] front_line_stances: dict[FrontLine, Optional[CombatStance]]
vulnerable_front_lines: list[FrontLine] vulnerable_front_lines: list[FrontLine]
aewc_targets: list[MissionTarget] aewc_targets: list[MissionTarget]
@ -110,7 +109,6 @@ class TheaterState(WorldState["TheaterState"]):
context=self.context, context=self.context,
barcaps_needed=dict(self.barcaps_needed), barcaps_needed=dict(self.barcaps_needed),
active_front_lines=list(self.active_front_lines), active_front_lines=list(self.active_front_lines),
air_assault_targets=list(self.air_assault_targets),
front_line_stances=dict(self.front_line_stances), front_line_stances=dict(self.front_line_stances),
vulnerable_front_lines=list(self.vulnerable_front_lines), vulnerable_front_lines=list(self.vulnerable_front_lines),
aewc_targets=list(self.aewc_targets), aewc_targets=list(self.aewc_targets),
@ -161,7 +159,6 @@ class TheaterState(WorldState["TheaterState"]):
cp: barcap_rounds for cp in finder.vulnerable_control_points() cp: barcap_rounds for cp in finder.vulnerable_control_points()
}, },
active_front_lines=list(finder.front_lines()), active_front_lines=list(finder.front_lines()),
air_assault_targets=list(finder.air_assault_targets()),
front_line_stances={f: None for f in finder.front_lines()}, front_line_stances={f: None for f in finder.front_lines()},
vulnerable_front_lines=list(finder.front_lines()), vulnerable_front_lines=list(finder.front_lines()),
aewc_targets=[finder.farthest_friendly_control_point()], aewc_targets=[finder.farthest_friendly_control_point()],