diff --git a/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json b/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json index 1f3911d677..56ca62496f 100644 --- a/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json +++ b/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json @@ -77,6 +77,10 @@ Ukrainian:"Міст-держав" } + "One City Challenge":{ + + } + "No barbarians":{//it can be showed correct as usual, so I'm not translate it. Italian:"Niente barbari" French:"Pas de barbare" diff --git a/android/assets/jsons/Translations/Other.json b/android/assets/jsons/Translations/Other.json index eaef743bac..69ba9bdb2b 100644 --- a/android/assets/jsons/Translations/Other.json +++ b/android/assets/jsons/Translations/Other.json @@ -2576,6 +2576,14 @@ Russian:"Разорить" Czech:"Srovnat se zemí" Ukrainian:"Зруйнувати" +} + + "Destroy":{ + +} + + "Destroying the city instantly razes the city to the ground.":{ + } "Razing the city annexes it, and starts razing the city to the ground.":{ diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 769663d74b..8fe15e7666 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -235,10 +235,10 @@ class Battle(val gameInfo:GameInfo) { } city.hasJustBeenConquered = true - if (attacker.getCivInfo().isPlayerCivilization()) + if (attackerCiv.isPlayerCivilization()) attackerCiv.popupAlerts.add(PopupAlert(AlertType.CityConquered, city.name)) else { - city.puppetCity(attacker.getCivInfo()) + city.puppetCity(attackerCiv) if (city.population.population < 4) { city.annexCity() city.isBeingRazed = true @@ -254,9 +254,11 @@ class Battle(val gameInfo:GameInfo) { } private fun captureCivilianUnit(attacker: ICombatant, defender: ICombatant){ - // barbarians don't capture civilians, City-states don't capture settlers + // barbarians don't capture civilians + // City-states & OCC don't capture settlers if(attacker.getCivInfo().isBarbarian() - || (attacker.getCivInfo().isCityState() && defender.getName()==Constants.settler)){ + || ((attacker.getCivInfo().isCityState() || attacker.getCivInfo().isPlayerOneCityChallenger()) + && defender.getName()==Constants.settler)){ defender.takeDamage(100) return } diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index 9c26acae11..177b25e778 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -126,6 +126,10 @@ class CivilizationInfo { fun getCapital()=cities.first { it.isCapital() } fun isPlayerCivilization() = playerType==PlayerType.Human + fun isPlayerOneCityChallenger() = ( + playerType==PlayerType.Human && + !cities.isEmpty() && + gameInfo.gameParameters.oneCityChallenge) fun isCurrentPlayer() = gameInfo.getCurrentPlayerCivilization()==this fun isBarbarian() = nation.isBarbarian() fun isCityState(): Boolean = nation.isCityState() diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 02e2b823fb..3cb891903a 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() || chosenUnit != Constants.settler) { //City states don't get settler from ruins + if (!(civInfo.isCityState() || civInfo.isPlayerOneCityChallenger()) || 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 40a3743ce2..d41616f660 100644 --- a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt @@ -140,6 +140,7 @@ class BaseUnit : INamed, IConstruction, ICivilopedia { 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" return "" } diff --git a/core/src/com/unciv/models/metadata/GameParameters.kt b/core/src/com/unciv/models/metadata/GameParameters.kt index b7cb0fb374..04e407ba24 100644 --- a/core/src/com/unciv/models/metadata/GameParameters.kt +++ b/core/src/com/unciv/models/metadata/GameParameters.kt @@ -16,6 +16,7 @@ class GameParameters { // Default values are the default new game var numberOfCityStates = 0 var mapType = MapType.pangaea var noBarbarians = false + var oneCityChallenge = false var noRuins = false; var mapFileName: String? = null var victoryTypes: ArrayList = VictoryType.values().toCollection(ArrayList()) // By default, all victory types diff --git a/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt b/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt index 3a1bac2af0..8cb55cb115 100644 --- a/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt @@ -27,6 +27,7 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMul addCityStatesSelectBox() addVictoryTypeCheckboxes() addBarbariansCheckbox() + addOneCityChallengeCheckbox() addNoRuinsCheckbox() addIsOnlineMultiplayerCheckbox() @@ -45,6 +46,16 @@ class NewGameScreenOptionsTable(val newGameParameters: GameParameters, val onMul add(noBarbariansCheckbox).colspan(2).row() } + private fun addOneCityChallengeCheckbox() { + val oneCityChallengeCheckbox = CheckBox("One City Challenge".tr(), CameraStageBaseScreen.skin) + oneCityChallengeCheckbox.isChecked = newGameParameters.oneCityChallenge + oneCityChallengeCheckbox.addListener(object : ChangeListener() { + override fun changed(event: ChangeEvent?, actor: Actor?) { + newGameParameters.oneCityChallenge = oneCityChallengeCheckbox.isChecked + } + }) + add(oneCityChallengeCheckbox).colspan(2).row() + } private fun addNoRuinsCheckbox() { val noRuinsCheckbox = CheckBox("No ancient ruins".tr(), CameraStageBaseScreen.skin) noRuinsCheckbox.isChecked = newGameParameters.noRuins diff --git a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt index 61b82105ac..f6d8e280b5 100644 --- a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt @@ -76,36 +76,51 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu addSeparator() } - add(TextButton("Annex".tr(), skin).onClick { - city.puppetCity(conqueringCiv) - city.annexCity() - worldScreen.shouldUpdate=true - close() - }).row() - addGoodSizedLabel("Annexed cities become part of your regular empire.").row() - addGoodSizedLabel("Their citizens generate 2x the unhappiness, unless you build a courthouse.").row() - addSeparator() + if (!conqueringCiv.isPlayerOneCityChallenger()){ - add(TextButton("Puppet".tr(), skin).onClick { - city.puppetCity(conqueringCiv) - worldScreen.shouldUpdate=true - close() - }).row() - addGoodSizedLabel("Puppeted cities do not increase your tech or policy cost, but their citizens generate 1.5x the regular unhappiness.").row() - addGoodSizedLabel("You have no control over the the production of puppeted cities.").row() - addGoodSizedLabel("Puppeted cities also generate 25% less Gold and Science.").row() - addGoodSizedLabel("A puppeted city can be annexed at any time.").row() - addSeparator() + add(TextButton("Annex".tr(), skin).onClick { + city.puppetCity(conqueringCiv) + city.annexCity() + worldScreen.shouldUpdate=true + close() + }).row() + addGoodSizedLabel("Annexed cities become part of your regular empire.").row() + addGoodSizedLabel("Their citizens generate 2x the unhappiness, unless you build a courthouse.").row() + addSeparator() - add(TextButton("Raze".tr(), skin).onClick { - city.puppetCity(conqueringCiv) - city.annexCity() - city.isBeingRazed = true - worldScreen.shouldUpdate=true - close() - }).row() - addGoodSizedLabel("Razing the city annexes it, and starts razing the city to the ground.").row() - addGoodSizedLabel("The population will gradually dwindle until the city is destroyed.").row() + add(TextButton("Puppet".tr(), skin).onClick { + city.puppetCity(conqueringCiv) + worldScreen.shouldUpdate=true + close() + }).row() + addGoodSizedLabel("Puppeted cities do not increase your tech or policy cost, but their citizens generate 1.5x the regular unhappiness.").row() + addGoodSizedLabel("You have no control over the the production of puppeted cities.").row() + addGoodSizedLabel("Puppeted cities also generate 25% less Gold and Science.").row() + addGoodSizedLabel("A puppeted city can be annexed at any time.").row() + addSeparator() + + + add(TextButton("Raze".tr(), skin).onClick { + city.puppetCity(conqueringCiv) + city.annexCity() + city.isBeingRazed = true + worldScreen.shouldUpdate=true + close() + }).row() + addGoodSizedLabel("Razing the city annexes it, and starts razing the city to the ground.").row() + addGoodSizedLabel("The population will gradually dwindle until the city is destroyed.").row() + } else { + + add(TextButton("Destroy".tr(), skin).onClick { + city.puppetCity(conqueringCiv) + city.destroyCity() + worldScreen.shouldUpdate=true + close() + }).row() + addGoodSizedLabel("Destroying the city instantly razes the city to the ground.").row() + + } + } AlertType.BorderConflict -> { val civInfo = worldScreen.gameInfo.getCivilization(popupAlert.value)