Resolved #1336 - can no longer get Settlers from Collective Rule policy when in One City challenge

This commit is contained in:
Yair Morgenstern 2019-11-16 18:44:56 +02:00
parent e7b6450a71
commit 3a4d79c14f
5 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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)
}

View file

@ -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 ""
}

View file

@ -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)