Civ is properly destroyed when liberating the last city of the civ

This commit is contained in:
Yair Morgenstern 2020-07-05 23:03:28 +03:00
parent 75c6ab8acb
commit 1b7b9bfcd5

View file

@ -392,7 +392,6 @@ class CityInfo {
moveToCiv(conqueringCiv)
Battle.destroyIfDefeated(oldCiv, conqueringCiv)
if(population.population>1) population.population -= 1 + population.population/4 // so from 2-4 population, remove 1, from 5-8, remove 2, etc.
reassignPopulation()
@ -439,25 +438,27 @@ class CityInfo {
}
val oldCiv = civInfo
diplomaticRepercussionsForLiberatingCity(conqueringCiv)
val foundingCiv = civInfo.gameInfo.civilizations.first { it.civName == foundingCiv }
moveToCiv(foundingCiv)
health = getMaxHealth() / 2 // I think that cities recover to half health when conquered?
Battle.destroyIfDefeated(oldCiv, conqueringCiv)
health = getMaxHealth() / 2 // I think that cities recover to half health when conquered?
reassignPopulation()
if(foundingCiv.cities.size == 1) cityConstructions.addBuilding("Palace") // Resurrection!
if (foundingCiv.cities.size == 1) cityConstructions.addBuilding("Palace") // Resurrection!
isPuppet = false
cityStats.update()
// Move units out of the city when liberated
for(unit in getTiles().flatMap { it.getUnits() }.toList())
if(!unit.movement.canPassThrough(unit.currentTile))
for (unit in getTiles().flatMap { it.getUnits() }.toList())
if (!unit.movement.canPassThrough(unit.currentTile))
unit.movement.teleportToClosestMoveableTile()
UncivGame.Current.worldScreen.shouldUpdate=true
UncivGame.Current.worldScreen.shouldUpdate = true
}
private fun diplomaticRepercussionsForLiberatingCity(conqueringCiv: CivilizationInfo) {