mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-16 18:59:15 +07:00
Add city resistance.
This commit is contained in:
@ -143,6 +143,8 @@ class Battle(val gameInfo:GameInfo) {
|
||||
}
|
||||
|
||||
city.moveToCiv(attacker.getCivilization())
|
||||
city.resistanceCounter = city.population.population
|
||||
city.cityStats.update()
|
||||
}
|
||||
|
||||
if(city.cityConstructions.isBuilt("Palace")){
|
||||
|
@ -21,6 +21,7 @@ class CityInfo {
|
||||
var location: Vector2 = Vector2.Zero
|
||||
var name: String = ""
|
||||
var health = 200
|
||||
var resistanceCounter = 0
|
||||
|
||||
var population = PopulationManager()
|
||||
var cityConstructions = CityConstructions()
|
||||
@ -182,6 +183,7 @@ class CityInfo {
|
||||
}
|
||||
}
|
||||
else population.nextTurn(stats.food)
|
||||
if (resistanceCounter > 0) resistanceCounter--
|
||||
|
||||
if(this in civInfo.cities) { // city was not destroyed
|
||||
health = min(health + 20, getMaxHealth())
|
||||
|
@ -316,7 +316,8 @@ class CityStats {
|
||||
baseStatList = newBaseStatList
|
||||
|
||||
val newCurrentCityStats = Stats() // again, we don't edit the existing currentCityStats directly, in order to avoid concurrency exceptions
|
||||
for (stat in baseStatList.values) newCurrentCityStats.add(stat)
|
||||
if (cityInfo.resistanceCounter <= 0)
|
||||
for (stat in baseStatList.values) newCurrentCityStats.add(stat)
|
||||
|
||||
if(newCurrentCityStats.production<1) newCurrentCityStats.production=1f
|
||||
currentCityStats = newCurrentCityStats
|
||||
|
Reference in New Issue
Block a user