mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
This improves the AI behavior by choosing the stances non-randomly: * Breakthrough will be used if the base is expected to be capturable and the coalition outnumbers the enemy by 20%. * Elimination will be used if the coalition has at least as many units as the enemy. * Defensive will be used if the coalition has at least half as many units as the enemy. * Retreat will be used if the coalition is significantly outnumbers. This also exposes the option to the player.
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
from collections import Iterator
|
|
from dataclasses import dataclass
|
|
|
|
from game.commander.tasks.compound.attackairinfrastructure import (
|
|
AttackAirInfrastructure,
|
|
)
|
|
from game.commander.tasks.compound.attackbuildings import AttackBuildings
|
|
from game.commander.tasks.compound.attackgarrisons import AttackGarrisons
|
|
from game.commander.tasks.compound.capturebases import CaptureBases
|
|
from game.commander.tasks.compound.defendbases import DefendBases
|
|
from game.commander.tasks.compound.degradeiads import DegradeIads
|
|
from game.commander.tasks.compound.interdictreinforcements import (
|
|
InterdictReinforcements,
|
|
)
|
|
from game.commander.tasks.compound.protectairspace import ProtectAirSpace
|
|
from game.commander.tasks.compound.theatersupport import TheaterSupport
|
|
from game.commander.theaterstate import TheaterState
|
|
from game.htn import CompoundTask, Method
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class PlanNextAction(CompoundTask[TheaterState]):
|
|
aircraft_cold_start: bool
|
|
|
|
def each_valid_method(self, state: TheaterState) -> Iterator[Method[TheaterState]]:
|
|
yield [TheaterSupport()]
|
|
yield [ProtectAirSpace()]
|
|
yield [CaptureBases()]
|
|
yield [DefendBases()]
|
|
yield [InterdictReinforcements()]
|
|
yield [AttackGarrisons()]
|
|
yield [AttackAirInfrastructure(self.aircraft_cold_start)]
|
|
yield [AttackBuildings()]
|
|
yield [DegradeIads()]
|