mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +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.
14 lines
473 B
Python
14 lines
473 B
Python
from collections import Iterator
|
|
from dataclasses import dataclass
|
|
|
|
from game.commander.tasks.compound.defendbase import DefendBase
|
|
from game.commander.theaterstate import TheaterState
|
|
from game.htn import CompoundTask, Method
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class DefendBases(CompoundTask[TheaterState]):
|
|
def each_valid_method(self, state: TheaterState) -> Iterator[Method[TheaterState]]:
|
|
for front in state.active_front_lines:
|
|
yield [DefendBase(front)]
|