mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
fixes and improvements for fronline CAP
This commit is contained in:
parent
932bec2f84
commit
f40f83bb09
@ -15,7 +15,7 @@ class FrontlineAttackEvent(Event):
|
|||||||
TARGET_AMOUNT_FACTOR = 0.5
|
TARGET_AMOUNT_FACTOR = 0.5
|
||||||
ATTACKER_AMOUNT_FACTOR = 0.4
|
ATTACKER_AMOUNT_FACTOR = 0.4
|
||||||
ATTACKER_DEFENDER_FACTOR = 0.7
|
ATTACKER_DEFENDER_FACTOR = 0.7
|
||||||
STRENGTH_INFLUENCE = 0.3
|
STRENGTH_INFLUENCE = 0.2
|
||||||
SUCCESS_TARGETS_HIT_PERCENTAGE = 0.25
|
SUCCESS_TARGETS_HIT_PERCENTAGE = 0.25
|
||||||
|
|
||||||
defenders = None # type: db.ArmorDict
|
defenders = None # type: db.ArmorDict
|
||||||
@ -58,7 +58,7 @@ class FrontlineAttackEvent(Event):
|
|||||||
self.to_cp.base.affect_strength(-0.1)
|
self.to_cp.base.affect_strength(-0.1)
|
||||||
|
|
||||||
def player_attacking(self, armor: db.ArmorDict, strikegroup: db.PlaneDict, clients: db.PlaneDict):
|
def player_attacking(self, armor: db.ArmorDict, strikegroup: db.PlaneDict, clients: db.PlaneDict):
|
||||||
self.defenders = self.to_cp.base.assemble_cap()
|
self.defenders = self.to_cp.base.assemble_attack()
|
||||||
|
|
||||||
op = FrontlineAttackOperation(game=self.game,
|
op = FrontlineAttackOperation(game=self.game,
|
||||||
attacker_name=self.attacker_name,
|
attacker_name=self.attacker_name,
|
||||||
|
|||||||
@ -12,8 +12,8 @@ from userdata.debriefing import Debriefing
|
|||||||
|
|
||||||
class FrontlinePatrolEvent(Event):
|
class FrontlinePatrolEvent(Event):
|
||||||
ESCORT_FACTOR = 0.5
|
ESCORT_FACTOR = 0.5
|
||||||
STRENGTH_INFLUENCE = 0.3
|
STRENGTH_INFLUENCE = 0.2
|
||||||
SUCCESS_TARGETS_HIT_PERCENTAGE = 0.6
|
SUCCESS_TARGETS_HIT_PERCENTAGE = 0.33
|
||||||
|
|
||||||
cas = None # type: db.PlaneDict
|
cas = None # type: db.PlaneDict
|
||||||
escort = None # type: db.PlaneDict
|
escort = None # type: db.PlaneDict
|
||||||
@ -61,12 +61,14 @@ class FrontlinePatrolEvent(Event):
|
|||||||
op = FrontlinePatrolOperation(game=self.game,
|
op = FrontlinePatrolOperation(game=self.game,
|
||||||
attacker_name=self.attacker_name,
|
attacker_name=self.attacker_name,
|
||||||
defender_name=self.defender_name,
|
defender_name=self.defender_name,
|
||||||
attacker_clients={},
|
attacker_clients=clients,
|
||||||
defender_clients=clients,
|
defender_clients={},
|
||||||
from_cp=self.from_cp,
|
from_cp=self.from_cp,
|
||||||
to_cp=self.to_cp)
|
to_cp=self.to_cp)
|
||||||
op.setup(cas=self.cas,
|
op.setup(cas=self.cas,
|
||||||
escort=self.escort,
|
escort=self.escort,
|
||||||
interceptors=interceptors)
|
interceptors=interceptors,
|
||||||
|
armor_attackers=self.from_cp.base.assemble_attack(),
|
||||||
|
armor_defenders=self.to_cp.base.assemble_attack())
|
||||||
|
|
||||||
self.operation = op
|
self.operation = op
|
||||||
|
|||||||
@ -23,11 +23,17 @@ class FrontlinePatrolOperation(Operation):
|
|||||||
escort = None # type: db.PlaneDict
|
escort = None # type: db.PlaneDict
|
||||||
interceptors = None # type: db.PlaneDict
|
interceptors = None # type: db.PlaneDict
|
||||||
|
|
||||||
def setup(self, cas: db.PlaneDict, escort: db.PlaneDict, interceptors: db.PlaneDict):
|
armor_attackers = None # type: db.ArmorDict
|
||||||
|
armor_defenders = None # type: db.ArmorDict
|
||||||
|
|
||||||
|
def setup(self, cas: db.PlaneDict, escort: db.PlaneDict, interceptors: db.PlaneDict, armor_attackers: db.ArmorDict, armor_defenders: db.ArmorDict):
|
||||||
self.cas = cas
|
self.cas = cas
|
||||||
self.escort = escort
|
self.escort = escort
|
||||||
self.interceptors = interceptors
|
self.interceptors = interceptors
|
||||||
|
|
||||||
|
self.armor_attackers = armor_attackers
|
||||||
|
self.armor_defenders = armor_defenders
|
||||||
|
|
||||||
def prepare(self, terrain: Terrain, is_quick: bool):
|
def prepare(self, terrain: Terrain, is_quick: bool):
|
||||||
super(FrontlinePatrolOperation, self).prepare(terrain, is_quick)
|
super(FrontlinePatrolOperation, self).prepare(terrain, is_quick)
|
||||||
self.defenders_starting_position = None
|
self.defenders_starting_position = None
|
||||||
@ -46,8 +52,7 @@ class FrontlinePatrolOperation(Operation):
|
|||||||
def generate(self):
|
def generate(self):
|
||||||
self.airgen.generate_defenders_cas(self.cas, {}, self.defenders_starting_position)
|
self.airgen.generate_defenders_cas(self.cas, {}, self.defenders_starting_position)
|
||||||
self.airgen.generate_defenders_escort(self.escort, {}, self.defenders_starting_position)
|
self.airgen.generate_defenders_escort(self.escort, {}, self.defenders_starting_position)
|
||||||
self.airgen.generate_patrol(self.interceptors, self.defender_clients, self.attackers_starting_position)
|
self.airgen.generate_patrol(self.interceptors, self.attacker_clients, self.attackers_starting_position)
|
||||||
|
|
||||||
# todo: generate armor
|
|
||||||
|
|
||||||
|
self.armorgen.generate_vec(self.armor_attackers, self.armor_defenders)
|
||||||
super(FrontlinePatrolOperation, self).generate()
|
super(FrontlinePatrolOperation, self).generate()
|
||||||
|
|||||||
@ -264,8 +264,10 @@ class AircraftConflictGenerator:
|
|||||||
|
|
||||||
pos = self.conflict.air_defenders_location.point_from_heading(self.conflict.heading-90, CAP_CAS_DISTANCE)
|
pos = self.conflict.air_defenders_location.point_from_heading(self.conflict.heading-90, CAP_CAS_DISTANCE)
|
||||||
waypoint = group.add_waypoint(pos, CAS_ALTITUDE, WARM_START_AIRSPEED)
|
waypoint = group.add_waypoint(pos, CAS_ALTITUDE, WARM_START_AIRSPEED)
|
||||||
|
|
||||||
if self.conflict.is_vector:
|
if self.conflict.is_vector:
|
||||||
group.add_waypoint(self.conflict.tail, CAS_ALTITUDE, WARM_START_AIRSPEED)
|
destination_tail = self.conflict.tail.distance_to_point(pos) > self.conflict.position.distance_to_point(pos)
|
||||||
|
group.add_waypoint(destination_tail and self.conflict.tail or self.conflict.position, CAS_ALTITUDE, WARM_START_AIRSPEED)
|
||||||
|
|
||||||
group.task = CAS.name
|
group.task = CAS.name
|
||||||
self._setup_group(group, CAS, client_count)
|
self._setup_group(group, CAS, client_count)
|
||||||
|
|||||||
14
gen/armor.py
14
gen/armor.py
@ -50,22 +50,28 @@ class ArmorConflictGenerator:
|
|||||||
|
|
||||||
def _generate_fight_at(self, attackers: db.ArmorDict, defenders: db.ArmorDict, position: Point):
|
def _generate_fight_at(self, attackers: db.ArmorDict, defenders: db.ArmorDict, position: Point):
|
||||||
if attackers:
|
if attackers:
|
||||||
|
attack_pos = position.point_from_heading(self.conflict.heading - 90, 8000)
|
||||||
|
attack_dest = position.point_from_heading(self.conflict.heading + 90, 25000)
|
||||||
for type, count in attackers.items():
|
for type, count in attackers.items():
|
||||||
self._generate_group(
|
self._generate_group(
|
||||||
side=self.conflict.attackers_side,
|
side=self.conflict.attackers_side,
|
||||||
unit=type,
|
unit=type,
|
||||||
count=count,
|
count=count,
|
||||||
at=position.point_from_heading(self.conflict.heading - 90, 5000),
|
at=attack_pos,
|
||||||
to=position)
|
to=attack_dest,
|
||||||
|
)
|
||||||
|
|
||||||
if defenders:
|
if defenders:
|
||||||
|
def_pos = position.point_from_heading(self.conflict.heading + 90, 4000)
|
||||||
|
def_dest = position.point_from_heading(self.conflict.heading + 90, 25000)
|
||||||
for type, count in defenders.items():
|
for type, count in defenders.items():
|
||||||
self._generate_group(
|
self._generate_group(
|
||||||
side=self.conflict.defenders_side,
|
side=self.conflict.defenders_side,
|
||||||
unit=type,
|
unit=type,
|
||||||
count=count,
|
count=count,
|
||||||
at=position.point_from_heading(self.conflict.heading + 90, 1000),
|
at=def_pos,
|
||||||
to=position)
|
to=def_dest,
|
||||||
|
)
|
||||||
|
|
||||||
def generate(self, attackers: db.ArmorDict, defenders: db.ArmorDict):
|
def generate(self, attackers: db.ArmorDict, defenders: db.ArmorDict):
|
||||||
for type, count in attackers.items():
|
for type, count in attackers.items():
|
||||||
|
|||||||
@ -18,7 +18,7 @@ from gen import *
|
|||||||
WEATHER_CLOUD_BASE = 2000, 3000
|
WEATHER_CLOUD_BASE = 2000, 3000
|
||||||
WEATHER_CLOUD_DENSITY = 1, 8
|
WEATHER_CLOUD_DENSITY = 1, 8
|
||||||
WEATHER_CLOUD_THICKNESS = 100, 400
|
WEATHER_CLOUD_THICKNESS = 100, 400
|
||||||
WEATHER_CLOUD_BASE_MIN = 1200
|
WEATHER_CLOUD_BASE_MIN = 2400
|
||||||
|
|
||||||
RANDOM_TIME = {
|
RANDOM_TIME = {
|
||||||
"night": 5,
|
"night": 5,
|
||||||
|
|||||||
@ -167,7 +167,7 @@ class Base:
|
|||||||
def scramble_interceptors(self, multiplier: float) -> typing.Dict[PlaneType, int]:
|
def scramble_interceptors(self, multiplier: float) -> typing.Dict[PlaneType, int]:
|
||||||
return self._find_best_planes(CAP, self.scramble_count(multiplier, CAP))
|
return self._find_best_planes(CAP, self.scramble_count(multiplier, CAP))
|
||||||
|
|
||||||
def assemble_cap(self) -> typing.Dict[Armor, int]:
|
def assemble_attack(self) -> typing.Dict[Armor, int]:
|
||||||
return self._find_best_armor(PinpointStrike, self.assemble_count())
|
return self._find_best_armor(PinpointStrike, self.assemble_count())
|
||||||
|
|
||||||
def assemble_defense(self) -> typing.Dict[Armor, int]:
|
def assemble_defense(self) -> typing.Dict[Armor, int]:
|
||||||
|
|||||||
@ -7,13 +7,13 @@ from game.event import *
|
|||||||
|
|
||||||
|
|
||||||
UNITTYPES_FOR_EVENTS = {
|
UNITTYPES_FOR_EVENTS = {
|
||||||
FrontlineAttackEvent: CAS,
|
FrontlineAttackEvent: [CAS, PinpointStrike],
|
||||||
FrontlinePatrolEvent: CAP,
|
FrontlinePatrolEvent: [CAP],
|
||||||
InterceptEvent: CAP,
|
InterceptEvent: [CAP],
|
||||||
InsurgentAttackEvent: CAS,
|
InsurgentAttackEvent: [CAS],
|
||||||
NavalInterceptEvent: CAS,
|
NavalInterceptEvent: [CAS],
|
||||||
AntiAAStrikeEvent: CAS,
|
AntiAAStrikeEvent: [CAS],
|
||||||
InfantryTransportEvent: Embarking,
|
InfantryTransportEvent: [Embarking],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ class EventMenu(Menu):
|
|||||||
|
|
||||||
filter_to = UNITTYPES_FOR_EVENTS[self.event.__class__]
|
filter_to = UNITTYPES_FOR_EVENTS[self.event.__class__]
|
||||||
for unit_type, count in self.base.aircraft.items():
|
for unit_type, count in self.base.aircraft.items():
|
||||||
if filter_to and db.unit_task(unit_type) != filter_to:
|
if filter_to and db.unit_task(unit_type) not in filter_to:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if unit_type in helicopter_map and self.event.__class__ != InsurgentAttackEvent:
|
if unit_type in helicopter_map and self.event.__class__ != InsurgentAttackEvent:
|
||||||
@ -115,6 +115,9 @@ class EventMenu(Menu):
|
|||||||
|
|
||||||
label("Armor")
|
label("Armor")
|
||||||
for unit_type, count in self.base.armor.items():
|
for unit_type, count in self.base.armor.items():
|
||||||
|
if filter_to and db.unit_task(unit_type) not in filter_to:
|
||||||
|
continue
|
||||||
|
|
||||||
scramble_armor_row(unit_type, count)
|
scramble_armor_row(unit_type, count)
|
||||||
|
|
||||||
if not self.base.total_armor:
|
if not self.base.total_armor:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user