From d632f04a5bb3b2ab0b2b0c08499e1ab4f2b2966c Mon Sep 17 00:00:00 2001 From: yairm210 Date: Mon, 11 Nov 2024 13:16:57 +0200 Subject: [PATCH 1/2] Fix 'raze city' --- core/src/com/unciv/logic/battle/Nuke.kt | 2 +- core/src/com/unciv/logic/city/managers/CityTurnManager.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/battle/Nuke.kt b/core/src/com/unciv/logic/battle/Nuke.kt index 76439f38d3fcd..f23555cbffb41 100644 --- a/core/src/com/unciv/logic/battle/Nuke.kt +++ b/core/src/com/unciv/logic/battle/Nuke.kt @@ -297,7 +297,7 @@ object Nuke { 2 -> (60 + Random.Default.nextInt(10) + Random.Default.nextInt(10)) / 100f else -> 1f // hypothetical nukeStrength 3 -> always to 1 pop } - ).toInt().coerceAtMost(targetedCity.population.population - 1) + ).toInt() targetedCity.population.addPopulation(-populationLoss) } diff --git a/core/src/com/unciv/logic/city/managers/CityTurnManager.kt b/core/src/com/unciv/logic/city/managers/CityTurnManager.kt index afb269be7b33f..5f0ff57669a4c 100644 --- a/core/src/com/unciv/logic/city/managers/CityTurnManager.kt +++ b/core/src/com/unciv/logic/city/managers/CityTurnManager.kt @@ -124,9 +124,8 @@ class CityTurnManager(val city: City) { val removedPopulation = 1 + city.civ.getMatchingUniques(UniqueType.CitiesAreRazedXTimesFaster) .sumOf { it.params[0].toInt() - 1 } - city.population.addPopulation(-1 * removedPopulation) - if (city.population.population <= 0) { + if (city.population.population <= removedPopulation) { city.espionage.removeAllPresentSpies(SpyFleeReason.CityCaptured) city.civ.addNotification( "[${city.name}] has been razed to the ground!", @@ -135,6 +134,7 @@ class CityTurnManager(val city: City) { ) city.destroyCity() } else { //if not razed yet: + city.population.addPopulation(-1 * removedPopulation) if (city.population.foodStored >= city.population.getFoodToNextPopulation()) { //if surplus in the granary... city.population.foodStored = city.population.getFoodToNextPopulation() - 1 //...reduce below the new growth threshold From 1e4e7df79e407fbeb5f075eeb6738d37f76645ac Mon Sep 17 00:00:00 2001 From: yairm210 Date: Mon, 11 Nov 2024 13:18:24 +0200 Subject: [PATCH 2/2] . --- core/src/com/unciv/logic/city/managers/CityTurnManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/city/managers/CityTurnManager.kt b/core/src/com/unciv/logic/city/managers/CityTurnManager.kt index 5f0ff57669a4c..3eb165e011453 100644 --- a/core/src/com/unciv/logic/city/managers/CityTurnManager.kt +++ b/core/src/com/unciv/logic/city/managers/CityTurnManager.kt @@ -134,7 +134,7 @@ class CityTurnManager(val city: City) { ) city.destroyCity() } else { //if not razed yet: - city.population.addPopulation(-1 * removedPopulation) + city.population.addPopulation(-removedPopulation) if (city.population.foodStored >= city.population.getFoodToNextPopulation()) { //if surplus in the granary... city.population.foodStored = city.population.getFoodToNextPopulation() - 1 //...reduce below the new growth threshold