issue 2922: make BAI plannable against missile and costal sites

This commit is contained in:
zhexu14 2023-05-29 23:25:29 +10:00 committed by Raffson
parent aa64f28a4b
commit a54f836cde
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
2 changed files with 18 additions and 1 deletions

View File

@ -448,6 +448,14 @@ class MissileSiteGroundObject(TheaterGroundObject):
def should_head_to_conflict(self) -> bool:
return True
def mission_types(self, for_player: bool) -> Iterator[FlightType]:
from game.ato import FlightType
if not self.is_friendly(for_player):
yield FlightType.BAI
for mission_type in super().mission_types(for_player):
yield mission_type
class CoastalSiteGroundObject(TheaterGroundObject):
def __init__(
@ -480,6 +488,14 @@ class CoastalSiteGroundObject(TheaterGroundObject):
def should_head_to_conflict(self) -> bool:
return True
def mission_types(self, for_player: bool) -> Iterator[FlightType]:
from game.ato import FlightType
if not self.is_friendly(for_player):
yield FlightType.BAI
for mission_type in super().mission_types(for_player):
yield mission_type
class IadsGroundObject(TheaterGroundObject, ABC):
def __init__(

View File

@ -181,7 +181,8 @@ def test_mission_types_enemy(mocker: Any) -> None:
control_point=dummy_control_point,
)
mission_types = list(ground_object.mission_types(for_player=False))
assert len(mission_types) == 6
assert len(mission_types) == 7
assert FlightType.BAI in mission_types
assert FlightType.STRIKE in mission_types
assert FlightType.REFUELING in mission_types
assert FlightType.ESCORT in mission_types