Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'raze city' #12450

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/com/unciv/logic/battle/Nuke.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/com/unciv/logic/city/managers/CityTurnManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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!",
Expand All @@ -135,6 +134,7 @@ class CityTurnManager(val city: City) {
)
city.destroyCity()
} else { //if not razed yet:
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
Expand Down
Loading