diff --git a/game/procurement.py b/game/procurement.py index 613b6ef8..e8d9c248 100644 --- a/game/procurement.py +++ b/game/procurement.py @@ -73,13 +73,15 @@ class ProcurementAi: cp_aircraft = cp.allocated_aircraft() aircraft_investment += cp_aircraft.total_value - total_investment = aircraft_investment + armor_investment - if total_investment == 0: + air = self.game.settings.auto_procurement_balance / 100.0 + ground = 1 - air + weighted_investment = aircraft_investment * air + armor_investment * ground + if weighted_investment == 0: # Turn 0 or all units were destroyed. Either way, split 30/70. - return 0.3 + return min(0.3, ground) # the more planes we have, the more ground units we want and vice versa - ground_unit_share = aircraft_investment / total_investment + ground_unit_share = aircraft_investment * air / weighted_investment if ground_unit_share > 1.0: raise ValueError diff --git a/game/settings/settings.py b/game/settings/settings.py index f8b88574..c01a0b9f 100644 --- a/game/settings/settings.py +++ b/game/settings/settings.py @@ -273,6 +273,19 @@ class Settings: HQ_AUTOMATION_SECTION, default=True, ) + auto_procurement_balance: int = bounded_int_option( + "AI ground unit procurement budget ratio (%)", + CAMPAIGN_MANAGEMENT_PAGE, + HQ_AUTOMATION_SECTION, + min=0, + max=100, + default=50, + detail=( + "Ratio (larger number -> more budget for ground units) " + "that indicates how the AI procurement planner should " + "spend its budget." + ), + ) reserves_procurement_target: int = 10 # Mission Generator