mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
ground intercept mission
This commit is contained in:
parent
781ddce09d
commit
4ba0a5b90f
5
.idea/vcs.xml
generated
5
.idea/vcs.xml
generated
@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitSharedSettings">
|
||||
<option name="FORCE_PUSH_PROHIBITED_PATTERNS">
|
||||
<list />
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
|
||||
39
__init__.py
39
__init__.py
@ -35,19 +35,38 @@ theater.senaki.base.aa = {
|
||||
AirDefence.AAA_ZU_23_on_Ural_375: 2,
|
||||
}
|
||||
|
||||
"""
|
||||
op = game.mission.CaptureOperation(m, m.country("USA"), m.country("Russia"), theater.senaki, theater.batumi, {A_10C: 2}, {F_15C: 2}, {Armor.MBT_M1A2_Abrams: 4}, {Su_27: 4}, {Armor.MBT_T_55: 4}, {})
|
||||
op.generate()
|
||||
"""
|
||||
op = game.mission.CaptureOperation(
|
||||
mission=m,
|
||||
attacker=m.country("USA"),
|
||||
defender=m.country("Russia"),
|
||||
from_cp=theater.senaki,
|
||||
to_cp=theater.batumi,
|
||||
cas={A_10C: 2},
|
||||
escort={F_15C: 2},
|
||||
attack={Armor.MBT_M1A2_Abrams: 4},
|
||||
intercept={Su_27: 4},
|
||||
defense={Armor.MBT_T_55: 4},
|
||||
aa={AirDefence.AAA_ZU_23_Insurgent_on_Ural_375: 3})
|
||||
|
||||
op = game.mission.InterceptOperation(m,
|
||||
m.country("USA"),
|
||||
m.country("Russia"),
|
||||
theater.batumi,
|
||||
m.terrain.batumi(),
|
||||
op = game.mission.InterceptOperation(
|
||||
mission=m,
|
||||
attacker=m.country("USA"),
|
||||
defender=m.country("Russia"),
|
||||
destination=theater.batumi,
|
||||
destination_port=m.terrain.batumi(),
|
||||
escort={Su_27: 2},
|
||||
transport={An_26B: 2},
|
||||
interceptors={M_2000C: 2})
|
||||
interceptors={M_2000C: 2}
|
||||
)
|
||||
|
||||
op = game.mission.GroundInterceptOperation(
|
||||
mission=m,
|
||||
attacker=m.country("USA"),
|
||||
defender=m.country("Russia"),
|
||||
position=m.terrain.batumi().position,
|
||||
target={Unarmed.Transport_ZIL_4331: 10},
|
||||
strikegroup={A_10C: 2}
|
||||
)
|
||||
op.generate()
|
||||
|
||||
if not os.path.exists("./build"):
|
||||
|
||||
@ -12,6 +12,7 @@ from gen.aircraft import *
|
||||
from gen.aaa import *
|
||||
from gen.conflictgen import *
|
||||
|
||||
|
||||
class Operation:
|
||||
def __init__(self, mission: Mission, conflict: Conflict):
|
||||
self.mission = mission
|
||||
@ -20,6 +21,7 @@ class Operation:
|
||||
self.airgen = AircraftConflictGenerator(self.mission, self.conflict)
|
||||
self.aagen = AAConflictGenerator(self.mission, self.conflict)
|
||||
|
||||
|
||||
class CaptureOperation(Operation):
|
||||
def __init__(self,
|
||||
mission: Mission,
|
||||
@ -54,6 +56,7 @@ class CaptureOperation(Operation):
|
||||
self.airgen.generate_defense(self.intercept)
|
||||
self.aagen.generate(self.aa)
|
||||
|
||||
|
||||
class InterceptOperation(Operation):
|
||||
def __init__(self,
|
||||
mission: Mission,
|
||||
@ -68,7 +71,7 @@ class InterceptOperation(Operation):
|
||||
attacker=attacker,
|
||||
defender=defender,
|
||||
position=destination.position,
|
||||
heading=0
|
||||
heading=randint(0, 360)
|
||||
)
|
||||
|
||||
super(InterceptOperation, self).__init__(mission, conflict)
|
||||
@ -81,3 +84,28 @@ class InterceptOperation(Operation):
|
||||
self.airgen.generate_transport(self.transport, self.destination_port)
|
||||
self.airgen.generate_transport_escort(self.escort)
|
||||
self.airgen.generate_interception(self.interceptors)
|
||||
|
||||
|
||||
class GroundInterceptOperation(Operation):
|
||||
def __init__(self,
|
||||
mission: Mission,
|
||||
attacker: Country,
|
||||
defender: Country,
|
||||
position: Point,
|
||||
target: typing.Dict[VehicleType, int],
|
||||
strikegroup: typing.Dict[PlaneType, int]):
|
||||
conflict = Conflict.ground_intercept_conflict(
|
||||
attacker=attacker,
|
||||
defender=defender,
|
||||
position=position,
|
||||
heading=randint(0, 360)
|
||||
)
|
||||
|
||||
super(GroundInterceptOperation, self).__init__(mission, conflict)
|
||||
self.strikegroup = strikegroup
|
||||
self.target = target
|
||||
|
||||
def generate(self):
|
||||
self.airgen.generate_cas(self.strikegroup)
|
||||
self.armorgen.generate({}, self.target)
|
||||
|
||||
|
||||
@ -57,3 +57,19 @@ class Conflict:
|
||||
instance.air_defenders_location = instance.position.point_from_heading(random.randint(*INTERCEPT_DEFENDERS_HEADING) + heading, INTERCEPT_DEFENDERS_DISTANCE)
|
||||
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
def ground_intercept_conflict(self, attacker: Country, defender: Country, position: Point, heading):
|
||||
from theater.conflicttheater import SIZE_SMALL
|
||||
|
||||
instance = self()
|
||||
instance.attackers_side = attacker
|
||||
instance.defenders_side = defender
|
||||
|
||||
instance.position = position
|
||||
instance.size = SIZE_SMALL
|
||||
|
||||
instance.air_attackers_location = instance.position.point_from_heading(random.randint(*INTERCEPT_ATTACKERS_HEADING) + heading, AIR_DISTANCE)
|
||||
instance.ground_defenders_location = instance.position
|
||||
|
||||
return instance
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user