Account for planned missions for breakthrough.

Consider BAI missions planned this turn when determining if a control
point is still garrisioned for preventing breakthrough.

This isn't very accurate yet since the HTN isn't checking for aircraft
fulfillment yet, so it might *plan* a mission to kill the garrison, but
there's no way to know if it will be fulfilled.
This commit is contained in:
Dan Albert
2021-07-13 13:50:50 -07:00
parent c180eb466d
commit 4534758c21
7 changed files with 59 additions and 59 deletions

View File

@@ -223,17 +223,18 @@ class ObjectiveFinder:
if not c.is_friendly(self.is_player)
)
def all_possible_targets(self) -> Iterator[MissionTarget]:
"""Iterates over all possible mission targets in the theater.
Valid mission targets are control points (airfields and carriers), front
lines, and ground objects (SAM sites, factories, resource extraction
sites, etc).
"""
for cp in self.game.theater.controlpoints:
yield cp
yield from cp.ground_objects
yield from self.front_lines()
def prioritized_unisolated_points(self) -> list[ControlPoint]:
prioritized = []
capturable_later = []
for cp in self.game.theater.control_points_for(not self.is_player):
if cp.is_isolated:
continue
if cp.has_active_frontline:
prioritized.append(cp)
else:
capturable_later.append(cp)
prioritized.extend(self._targets_by_range(capturable_later))
return prioritized
@staticmethod
def closest_airfields_to(location: MissionTarget) -> ClosestAirfields: