From 3a4d79c14f3e8b1a1e680be4948973881b3dc411 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 16 Nov 2019 18:44:56 +0200 Subject: [PATCH] Resolved #1336 - can no longer get Settlers from Collective Rule policy when in One City challenge --- core/src/com/unciv/logic/civilization/CivilizationInfo.kt | 2 +- core/src/com/unciv/logic/civilization/PolicyManager.kt | 3 ++- core/src/com/unciv/logic/map/MapUnit.kt | 2 +- core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt | 2 +- core/src/com/unciv/ui/worldscreen/AlertPopup.kt | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 660097cd..364f7cb8 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -128,7 +128,7 @@ class CivilizationInfo { fun getCapital()=cities.first { it.isCapital() } fun isPlayerCivilization() = playerType==PlayerType.Human - fun isPlayerOneCityChallenger() = ( + fun isOneCityChallenger() = ( playerType==PlayerType.Human && gameInfo.gameParameters.oneCityChallenge) fun isCurrentPlayer() = gameInfo.getCurrentPlayerCivilization()==this diff --git a/core/src/com/unciv/logic/civilization/PolicyManager.kt b/core/src/com/unciv/logic/civilization/PolicyManager.kt index b0c8d5ca..214c5a8f 100644 --- a/core/src/com/unciv/logic/civilization/PolicyManager.kt +++ b/core/src/com/unciv/logic/civilization/PolicyManager.kt @@ -76,7 +76,8 @@ class PolicyManager { val hasCapital = civInfo.cities.any{it.isCapital()} when (policy.name) { - "Collective Rule" -> if(hasCapital) civInfo.placeUnitNearTile(civInfo.getCapital().location, Constants.settler) + "Collective Rule" -> if(hasCapital && !civInfo.isOneCityChallenger()) + civInfo.placeUnitNearTile(civInfo.getCapital().location, Constants.settler) "Citizenship" -> if(hasCapital) civInfo.placeUnitNearTile(civInfo.getCapital().location, Constants.worker) "Representation", "Reformation" -> civInfo.goldenAges.enterGoldenAge() "Scientific Revolution" -> civInfo.tech.freeTechs += 2 diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 3cb89190..ecccbaa6 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -467,7 +467,7 @@ class MapUnit { actions.add { val chosenUnit = listOf(Constants.settler, Constants.worker,"Warrior").random() - if (!(civInfo.isCityState() || civInfo.isPlayerOneCityChallenger()) || chosenUnit != Constants.settler) { //City states and OCC don't get settler from ruins + if (!(civInfo.isCityState() || civInfo.isOneCityChallenger()) || chosenUnit != Constants.settler) { //City states and OCC don't get settler from ruins civInfo.placeUnitNearTile(tile.position, chosenUnit) civInfo.addNotification("A [$chosenUnit] has joined us!", tile.position, Color.BROWN) } diff --git a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt index 0d3d0fce..821dee3c 100644 --- a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt @@ -133,7 +133,7 @@ class BaseUnit : INamed, IConstruction { if (GameBasics.Units.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return "Our unique unit replaces this" if (requiredResource!=null && !civInfo.hasResource(requiredResource!!)) return "Requires [$requiredResource]" if (name == Constants.settler && civInfo.isCityState()) return "No settler for city-states" - if (name == Constants.settler && civInfo.isPlayerOneCityChallenger()) return "No settler for players in One City Challenge" + if (name == Constants.settler && civInfo.isOneCityChallenger()) return "No settler for players in One City Challenge" return "" } diff --git a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt index 2c25776e..b2792f21 100644 --- a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt @@ -76,7 +76,7 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu addSeparator() } - if (!conqueringCiv.isPlayerOneCityChallenger()){ + if (!conqueringCiv.isOneCityChallenger()){ add(TextButton("Annex".tr(), skin).onClick { city.puppetCity(conqueringCiv)