mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
63 lines
2.5 KiB
Python
63 lines
2.5 KiB
Python
from game.db import assigned_units_split
|
|
|
|
from .operation import *
|
|
|
|
|
|
class InterceptOperation(Operation):
|
|
escort = None # type: db.AssignedUnitsDict
|
|
transport = None # type: db.PlaneDict
|
|
interceptors = None # type: db.AssignedUnitsDict
|
|
airdefense = None # type: db.AirDefenseDict
|
|
|
|
trigger_radius = TRIGGER_RADIUS_LARGE
|
|
|
|
def setup(self,
|
|
escort: db.AssignedUnitsDict,
|
|
transport: db.PlaneDict,
|
|
airdefense: db.AirDefenseDict,
|
|
interceptors: db.AssignedUnitsDict):
|
|
self.escort = escort
|
|
self.transport = transport
|
|
self.airdefense = airdefense
|
|
self.interceptors = interceptors
|
|
|
|
def prepare(self, terrain: Terrain, is_quick: bool):
|
|
super(InterceptOperation, self).prepare(terrain, is_quick)
|
|
self.defenders_starting_position = None
|
|
if self.defender_name == self.game.player:
|
|
self.attackers_starting_position = None
|
|
|
|
conflict = Conflict.intercept_conflict(
|
|
attacker=self.mission.country(self.attacker_name),
|
|
defender=self.mission.country(self.defender_name),
|
|
from_cp=self.from_cp,
|
|
to_cp=self.to_cp,
|
|
theater=self.game.theater
|
|
)
|
|
|
|
self.initialize(mission=self.mission,
|
|
conflict=conflict)
|
|
|
|
def generate(self):
|
|
for global_cp in self.game.theater.controlpoints:
|
|
if not global_cp.is_global:
|
|
continue
|
|
|
|
ship = self.shipgen.generate_carrier(type=db.find_unittype(Carriage, self.game.player)[0],
|
|
country=self.game.player,
|
|
at=global_cp.at)
|
|
|
|
if global_cp == self.from_cp and not self.is_quick:
|
|
self.attackers_starting_position = ship
|
|
|
|
self.airgen.generate_transport(self.transport, self.to_cp.at)
|
|
self.airgen.generate_defenders_escort(*assigned_units_split(self.escort), at=self.defenders_starting_position)
|
|
|
|
self.airgen.generate_interception(*assigned_units_split(self.interceptors), at=self.attackers_starting_position)
|
|
|
|
self.briefinggen.title = "Air Intercept"
|
|
self.briefinggen.description = "Intercept enemy supply transport aircraft. Escort will also be present if there are available planes on the base. Operation will be considered successful if most of the targets are destroyed, lowering targets strength as a result"
|
|
|
|
super(InterceptOperation, self).generate()
|
|
|