special flight for AI to SEAD; AI bomb task

This commit is contained in:
Vasyl Horbachenko
2019-03-27 11:53:00 +02:00
parent b697a8b40a
commit c7c2b9a248
9 changed files with 76 additions and 19 deletions

View File

@@ -71,6 +71,10 @@ class Event:
def ai_banned_tasks(self) -> typing.Collection[typing.Type[Task]]:
return []
@property
def player_banned_tasks(self) -> typing.Collection[typing.Type[Task]]:
return []
@property
def global_cp_available(self) -> bool:
return False

View File

@@ -20,7 +20,7 @@ class StrikeEvent(Event):
@property
def tasks(self):
if self.is_player_attacking:
return [CAP, CAS]
return [CAP, CAS, SEAD]
else:
return [CAP]
@@ -28,6 +28,10 @@ class StrikeEvent(Event):
def ai_banned_tasks(self):
return [CAS]
@property
def player_banned_tasks(self):
return [SEAD]
@property
def global_cp_available(self) -> bool:
return True
@@ -38,6 +42,8 @@ class StrikeEvent(Event):
return "Escort flight"
else:
return "CAP flight"
elif for_task == SEAD:
return "SEAD flight"
elif for_task == CAS:
return "Strike flight"
@@ -47,7 +53,7 @@ class StrikeEvent(Event):
self.to_cp.base.affect_strength(-self.SINGLE_OBJECT_STRENGTH_INFLUENCE * len(debriefing.destroyed_objects))
def player_attacking(self, flights: db.TaskForceDict):
assert CAP in flights and CAS in flights and len(flights) == 2, "Invalid flights"
assert CAP in flights and CAS in flights and SEAD in flights and len(flights) == 3, "Invalid flights"
op = StrikeOperation(
self.game,
@@ -60,6 +66,7 @@ class StrikeEvent(Event):
interceptors = self.to_cp.base.scramble_interceptors(self.game.settings.multiplier)
op.setup(strikegroup=flights[CAS],
sead=flights[SEAD],
escort=flights[CAP],
interceptors=assigned_units_from(interceptors))