mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 09:18:43 +07:00
City health updates when finishing health-increasing buildings (#7310)
* Set full health if city builds health increasing building while at full health * Proportional health addition * Move function to postBuildEvent function
This commit is contained in:

committed by
GitHub

parent
23026202ec
commit
48744f658c
@ -661,6 +661,12 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cityHealth > 0) {
|
||||||
|
// city built a building that increases health so add a portion of this added health that is
|
||||||
|
// proportional to the city's current health
|
||||||
|
cityConstructions.cityInfo.health += (cityHealth.toFloat() * cityConstructions.cityInfo.health.toFloat() / cityConstructions.cityInfo.getMaxHealth().toFloat()).toInt()
|
||||||
|
}
|
||||||
|
|
||||||
cityConstructions.addBuilding(name)
|
cityConstructions.addBuilding(name)
|
||||||
|
|
||||||
/** Support for [UniqueType.CreatesOneImprovement] */
|
/** Support for [UniqueType.CreatesOneImprovement] */
|
||||||
|
Reference in New Issue
Block a user