From ce977ac937093971a1dff75d32ff1f521ed569f9 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 5 Dec 2020 23:51:28 -0800 Subject: [PATCH] Remove the enemy forces multiplier option. This didn't do what it claimed to (it actually just determines the threshold for whether a control point shoudl be a *preferred* canidate for purchasing ground units), and the income multipliers offer the intended behavior. --- game/procurement.py | 25 ++++++++++++------------- game/settings.py | 1 - game/theater/start_generator.py | 1 - qt_ui/main.py | 1 - qt_ui/windows/newgame/QNewGameWizard.py | 5 ----- 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/game/procurement.py b/game/procurement.py index 8661352c..814a63e1 100644 --- a/game/procurement.py +++ b/game/procurement.py @@ -73,12 +73,11 @@ class ProcurementAi: if not self.faction.frontline_units: return budget - armor_limit = int(30 * self.game.settings.multiplier) - candidates = self.front_line_candidates(armor_limit) - if not candidates: - return budget - while budget > 0: + candidates = self.front_line_candidates() + if not candidates: + break + cp = random.choice(candidates) unit = self.random_affordable_ground_unit(budget) if unit is None: @@ -89,11 +88,6 @@ class ProcurementAi: assert cp.pending_unit_deliveries is not None cp.pending_unit_deliveries.deliver({unit: 1}) - if cp.base.total_armor >= armor_limit: - candidates.remove(cp) - if not candidates: - break - return budget def random_affordable_aircraft_group( @@ -115,7 +109,11 @@ class ProcurementAi: while budget > 0: group_size = 2 - cp = random.choice(self.airbase_candidates(group_size)) + candidates = self.airbase_candidates(group_size) + if not candidates: + break + + cp = random.choice(candidates) unit = self.random_affordable_aircraft_group(budget, group_size) if unit is None: # Can't afford any more aircraft. @@ -156,13 +154,14 @@ class ProcurementAi: # Otherwise buy them anywhere valid. return all_usable - def front_line_candidates(self, unit_limit: int) -> List[ControlPoint]: + def front_line_candidates(self) -> List[ControlPoint]: candidates = [] # Prefer to buy front line units at active front lines that are not # already overloaded. for cp in self.owned_points: - if cp.base.total_armor >= unit_limit: + if cp.base.total_armor >= 30: + # Control point is already sufficiently defended. continue for connected in cp.connected_points: if not connected.is_friendly(to_player=self.is_player): diff --git a/game/settings.py b/game/settings.py index 255159b5..42e23761 100644 --- a/game/settings.py +++ b/game/settings.py @@ -17,7 +17,6 @@ class Settings: night_disabled: bool = False external_views_allowed: bool = True supercarrier: bool = False - multiplier: float = 1.0 generate_marks: bool = True manpads: bool = True cold_start: bool = False # Legacy parameter do not use diff --git a/game/theater/start_generator.py b/game/theater/start_generator.py index 730c114a..d8cdd5aa 100644 --- a/game/theater/start_generator.py +++ b/game/theater/start_generator.py @@ -69,7 +69,6 @@ class GeneratorSettings: start_date: datetime player_budget: int enemy_budget: int - multiplier: float midgame: bool inverted: bool no_carrier: bool diff --git a/qt_ui/main.py b/qt_ui/main.py index aab24a62..2041aa4c 100644 --- a/qt_ui/main.py +++ b/qt_ui/main.py @@ -146,7 +146,6 @@ def create_game(campaign_path: Path, blue: str, red: str, start_date=datetime.today(), player_budget=DEFAULT_BUDGET, enemy_budget=DEFAULT_BUDGET, - multiplier=1.0, midgame=False, inverted=False, no_carrier=False, diff --git a/qt_ui/windows/newgame/QNewGameWizard.py b/qt_ui/windows/newgame/QNewGameWizard.py index 2ce64f99..3a14fafb 100644 --- a/qt_ui/windows/newgame/QNewGameWizard.py +++ b/qt_ui/windows/newgame/QNewGameWizard.py @@ -81,7 +81,6 @@ class NewGameWizard(QtWidgets.QWizard): enemy_budget=int(self.field("enemy_starting_money")), # QSlider forces integers, so we use 1 to 50 and divide by 10 to # give 0.1 to 5.0. - multiplier=self.field("multiplier") / 10, midgame=self.field("midGame"), inverted=self.field("invertMap"), no_carrier=self.field("no_carrier"), @@ -360,10 +359,6 @@ class DifficultyAndAutomationOptions(QtWidgets.QWizardPage): economy_layout = QtWidgets.QVBoxLayout() economy_group.setLayout(economy_layout) - multiplier = TenthsSpinSlider("Enemy forces multiplier", 1, 50, 10) - self.registerField('multiplier', multiplier.spinner) - economy_layout.addLayout(multiplier) - player_income = TenthsSpinSlider("Player income multiplier", 1, 50, 10) self.registerField("player_income_multiplier", player_income.spinner) economy_layout.addLayout(player_income)