From cd72926a6063c59d0a3382460eb3531c6eeab7b6 Mon Sep 17 00:00:00 2001 From: HadeanLake <69697985+HadeanLake@users.noreply.github.com> Date: Wed, 19 Aug 2020 15:25:17 +0300 Subject: [PATCH] Bugfixes (#3007) * Fixed "Can move immediately once bought" unique * Spectators no longer can adopt policies Close button is no longer disabled when player has free policy but has no adoptable policies FreePolicies are being spent properly in scenario editor mode * redundant --- core/src/com/unciv/logic/civilization/PolicyManager.kt | 4 ++-- core/src/com/unciv/models/ruleset/unit/BaseUnit.kt | 2 +- core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/PolicyManager.kt b/core/src/com/unciv/logic/civilization/PolicyManager.kt index aecb654f29..e07b88b6c1 100644 --- a/core/src/com/unciv/logic/civilization/PolicyManager.kt +++ b/core/src/com/unciv/logic/civilization/PolicyManager.kt @@ -109,9 +109,9 @@ class PolicyManager { fun adopt(policy: Policy, branchCompletion: Boolean = false) { - if (!branchCompletion && !civInfo.gameInfo.gameParameters.godMode) { + if (!branchCompletion) { if (freePolicies > 0) freePolicies-- - else { + else if (!civInfo.gameInfo.gameParameters.godMode) { val cultureNeededForNextPolicy = getCultureNeededForNextPolicy() if (cultureNeededForNextPolicy > storedCulture) throw Exception("How is this possible??????") diff --git a/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt b/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt index 68de0e0766..4770bb3770 100644 --- a/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt @@ -154,7 +154,7 @@ class BaseUnit : INamed, IConstruction { if (unit == null) return false // couldn't place the unit, so there's actually no unit =( //movement penalty - if (wasBought && !unit.hasUnique("Can move directly once bought") && !civInfo.gameInfo.gameParameters.godMode) + if (wasBought && !unit.hasUnique("Can move immediately once bought") && !civInfo.gameInfo.gameParameters.godMode) unit.currentMovement = 0f if (this.unitType.isCivilian()) return true // tiny optimization makes save files a few bytes smaller diff --git a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt index a3641cfae5..6c39999ccf 100644 --- a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt @@ -28,7 +28,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo setDefaultCloseAction() if (policies.freePolicies > 0) { rightSideButton.setText("Adopt free policy".tr()) - closeButton.disable() + if (policies.canAdoptPolicy()) closeButton.disable() } else onBackButtonClicked { UncivGame.Current.setWorldScreen() } @@ -82,6 +82,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo private fun pickPolicy(policy: Policy) { if (!worldScreen.isPlayersTurn + || worldScreen.viewingCiv.isSpectator() // viewingCiv var points to selectedCiv in case of spectator || viewingCiv.isDefeated() || viewingCiv.policies.isAdopted(policy.name) || policy.name.endsWith("Complete")