From 6cd711a1e27d487b47ac39196d3cc34cb5f74575 Mon Sep 17 00:00:00 2001 From: jsjlewis96 Date: Sat, 19 Jun 2021 10:55:54 +0100 Subject: [PATCH] Added option to disable AI pilot levelling --- changelog.md | 1 + game/settings.py | 1 + gen/aircraft.py | 5 ++++- qt_ui/windows/settings/QSettingsWindow.py | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index b44b55c5..955f900c 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ Saves from 3.x are not compatible with 4.0. ## Features/Improvements * **[Campaign]** Squadrons now have a maximum size and killed pilots replenish at a limited rate. +* **[Campaign]** Added an option to disable levelling up of AI pilots. * **[Campaign AI]** AI will plan Tanker flights. * **[Economy]** Adjusted prices for aircraft to balance out some price inconsistencies. * **[Factions]** Added more tankers to factions. diff --git a/game/settings.py b/game/settings.py index 1bda55bf..3de9f3cd 100644 --- a/game/settings.py +++ b/game/settings.py @@ -20,6 +20,7 @@ class Settings: # Difficulty settings player_skill: str = "Good" enemy_skill: str = "Average" + ai_pilot_levelling: bool = True enemy_vehicle_skill: str = "Average" map_coalition_visibility: ForcedOptions.Views = ForcedOptions.Views.All labels: str = "Full" diff --git a/gen/aircraft.py b/gen/aircraft.py index 7d4115d0..fc590af1 100644 --- a/gen/aircraft.py +++ b/gen/aircraft.py @@ -305,7 +305,10 @@ class AircraftConflictGenerator: current_level = levels.index(base_skill) missions_for_skill_increase = 4 increase = pilot.record.missions_flown // missions_for_skill_increase - new_level = min(current_level + increase, len(levels) - 1) + capped_increase = min(current_level + increase, len(levels) - 1) + new_level = (capped_increase, current_level)[ + self.game.settings.ai_pilot_levelling + ] return levels[new_level] def set_skill(self, unit: FlyingUnit, pilot: Optional[Pilot], blue: bool) -> None: diff --git a/qt_ui/windows/settings/QSettingsWindow.py b/qt_ui/windows/settings/QSettingsWindow.py index d09c564d..dc1392c4 100644 --- a/qt_ui/windows/settings/QSettingsWindow.py +++ b/qt_ui/windows/settings/QSettingsWindow.py @@ -565,6 +565,23 @@ class QSettingsWindow(QDialog): general_layout.addWidget(squadron_replenishment_rate_label, 4, 0) general_layout.addWidget(squadron_replenishment_rate, 4, 1, Qt.AlignRight) + ai_pilot_levelling = QCheckBox() + ai_pilot_levelling.setChecked(self.game.settings.ai_pilot_levelling) + ai_pilot_levelling.toggled.connect(self.applySettings) + + ai_pilot_levelling_info = ( + "Set whether or not AI pilots will level up after completing a number of" + " sorties. Since pilot level affects the AI skill, you may wish to disable" + " this, lest you face an Ace!" + ) + + ai_pilot_levelling.setToolTip(ai_pilot_levelling_info) + ai_pilot_levelling_label = QLabel("Allow AI pilot levelling") + ai_pilot_levelling_label.setToolTip(ai_pilot_levelling_info) + + general_layout.addWidget(ai_pilot_levelling_label, 5, 0) + general_layout.addWidget(ai_pilot_levelling, 5, 1, Qt.AlignRight) + campaign_layout.addWidget(HqAutomationSettingsBox(self.game)) def initGeneratorLayout(self):