Raffson d35962b784
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.
2024-09-15 22:05:41 +02:00

17 lines
640 B
Python

from collections.abc import Iterator
from dataclasses import dataclass
from game.commander.tasks.compound.capturebase import CaptureBase
from game.commander.tasks.primitive.airassault import PlanAirAssault
from game.commander.theaterstate import TheaterState
from game.htn import CompoundTask, Method
@dataclass(frozen=True)
class CaptureBases(CompoundTask[TheaterState]):
def each_valid_method(self, state: TheaterState) -> Iterator[Method[TheaterState]]:
for front in state.active_front_lines:
yield [CaptureBase(front)]
for cp in state.vulnerable_control_points:
yield [PlanAirAssault(cp)]