How to increase city healing rate?

Fairfax

Chieftain
Joined
Apr 28, 2013
Messages
50
I'd like to increase the amount of HP healed per turn as part of a trait for a custom civilization.
I've read that city healing is a percentage of its combat strength. Is there any way to increase that?
 
City healing is ...
CITY_HIT_POINTS_HEALED_PER_TURN (a global define)
plus 1 if a major capital
plus (additional defense from buildings / 500)
plus (additional defense from buildings * defense mod / 500)

So a major capital with walls and a castle will heal
20 + 1 + ((500 + 700) / 500) = 23 hit points per turn

A city with walls in a civ with the Red Fort will heal
20 + (500/500) + (500 * 25/100 / 500) = 21 hit points per turn

(in practice, due to rounding down, the defense mod part is irrelevant to the calculations)

So there's no way (via XML) to give extra healing to a city without also increasing it's defense dramatically.

But you can easily do it in Lua. Hook the PlayerDoTurn event, and just use pCity:ChangeDamage(-iTraitHealing)

(You don't need to check for final damage < 0 as ChangeDamage() caps the value between 0 and CityMaxHitPoints already)
 
City healing is ...
CITY_HIT_POINTS_HEALED_PER_TURN (a global define)
plus 1 if a major capital
plus (additional defense from buildings / 500)
plus (additional defense from buildings * defense mod / 500)

So a major capital with walls and a castle will heal
20 + 1 + ((500 + 700) / 500) = 23 hit points per turn

A city with walls in a civ with the Red Fort will heal
20 + (500/500) + (500 * 25/100 / 500) = 21 hit points per turn

(in practice, due to rounding down, the defense mod part is irrelevant to the calculations)

So there's no way (via XML) to give extra healing to a city without also increasing it's defense dramatically.

But you can easily do it in Lua. Hook the PlayerDoTurn event, and just use pCity:ChangeDamage(-iTraitHealing)

(You don't need to check for final damage < 0 as ChangeDamage() caps the value between 0 and CityMaxHitPoints already)
Thanks for the quick reply.

Can I use that to make a UA, though?
 
Yes. With a hook to the PlayerDoTurn event, you can check the player's Civilization (:GetCivilizationType) to make sure it's whatever your Civilization is, ensuring the bonuses only apply to players using your Civilization.
 
Back
Top Bottom