mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Rework (OPFOR) autoplanner aggressiveness setting
Also introduces a setting for OWNFOR
This commit is contained in:
parent
d35962b784
commit
f5bb653ad8
@ -129,7 +129,13 @@ class PackagePlanningTask(TheaterCommanderTask, Generic[MissionTargetT]):
|
|||||||
if range_type is RangeType.Detection:
|
if range_type is RangeType.Detection:
|
||||||
target_range = target.max_detection_range()
|
target_range = target.max_detection_range()
|
||||||
elif range_type is RangeType.Threat:
|
elif range_type is RangeType.Threat:
|
||||||
target_range = target.max_threat_range()
|
settings = state.context.coalition.game.settings
|
||||||
|
margin = 100 - (
|
||||||
|
settings.ownfor_autoplanner_aggressiveness
|
||||||
|
if state.context.coalition.player
|
||||||
|
else settings.opfor_autoplanner_aggressiveness
|
||||||
|
)
|
||||||
|
target_range = target.max_threat_range() * (margin / 100)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown RangeType: {range_type}")
|
raise ValueError(f"Unknown RangeType: {range_type}")
|
||||||
if not target_range:
|
if not target_range:
|
||||||
@ -173,15 +179,7 @@ class PackagePlanningTask(TheaterCommanderTask, Generic[MissionTargetT]):
|
|||||||
|
|
||||||
if not ignore_iads:
|
if not ignore_iads:
|
||||||
for iads_threat in self.iter_iads_threats(state):
|
for iads_threat in self.iter_iads_threats(state):
|
||||||
# Only consider blue faction flights threatened.
|
threatened = True
|
||||||
# Red might still plan missions into hostile territory,
|
|
||||||
# depending on the aggressiveness setting.
|
|
||||||
if (
|
|
||||||
state.context.coalition.player
|
|
||||||
or random.randint(1, 100)
|
|
||||||
> state.context.coalition.game.settings.opfor_autoplanner_aggressiveness
|
|
||||||
):
|
|
||||||
threatened = True
|
|
||||||
if iads_threat not in state.threatening_air_defenses:
|
if iads_threat not in state.threatening_air_defenses:
|
||||||
state.threatening_air_defenses.append(iads_threat)
|
state.threatening_air_defenses.append(iads_threat)
|
||||||
return not threatened
|
return not threatened
|
||||||
|
|||||||
@ -259,6 +259,19 @@ class Settings:
|
|||||||
"the auto-planner to plan an OCA strike against it."
|
"the auto-planner to plan an OCA strike against it."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
ownfor_autoplanner_aggressiveness: int = bounded_int_option(
|
||||||
|
"OWNFOR auto-planner aggressiveness (%)",
|
||||||
|
page=CAMPAIGN_DOCTRINE_PAGE,
|
||||||
|
section=GENERAL_SECTION,
|
||||||
|
default=20,
|
||||||
|
min=0,
|
||||||
|
max=100,
|
||||||
|
detail=(
|
||||||
|
"Ratio of the threat-radius that will be ignored by the OWNFOR "
|
||||||
|
"AI-autoplanner. 0% means the entire threat-radius is considered, "
|
||||||
|
"while 100% would have the autoplanner completely ignore OPFOR air defences."
|
||||||
|
),
|
||||||
|
)
|
||||||
opfor_autoplanner_aggressiveness: int = bounded_int_option(
|
opfor_autoplanner_aggressiveness: int = bounded_int_option(
|
||||||
"OPFOR auto-planner aggressiveness (%)",
|
"OPFOR auto-planner aggressiveness (%)",
|
||||||
page=CAMPAIGN_DOCTRINE_PAGE,
|
page=CAMPAIGN_DOCTRINE_PAGE,
|
||||||
@ -267,9 +280,9 @@ class Settings:
|
|||||||
min=0,
|
min=0,
|
||||||
max=100,
|
max=100,
|
||||||
detail=(
|
detail=(
|
||||||
"Chance (larger number -> higher chance) that the OPFOR AI "
|
"Ratio of the threat-radius that will be ignored by the OPFOR "
|
||||||
"auto-planner will take risks and plan flights against targets "
|
"AI-autoplanner. 0% means the entire threat-radius is considered, "
|
||||||
"within threatened airspace."
|
"while 100% would have the autoplanner completely ignore OWNFOR air defences."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
heli_combat_alt_agl: int = bounded_int_option(
|
heli_combat_alt_agl: int = bounded_int_option(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user