Fix behaviour of [heal_unit]amount= for negative/zero values (#979)

This commit is contained in:
Celtic Minstrel 2017-04-10 21:58:46 -04:00 committed by GitHub
parent 3f61eda282
commit 3d0bd73803

View file

@ -661,8 +661,10 @@ function wml_actions.heal_unit(cfg)
if heal_full then
u.hitpoints = u.max_hitpoints
else
heal_amount = math.min(math.max(0, cfg.amount), heal_amount)
u.hitpoints = u.hitpoints + heal_amount
heal_amount = tonumber(cfg.amount) or heal_amount
local new_hitpoints = math.max(1, math.min(u.max_hitpoints, u.hitpoints + heal_amount))
heal_amount = new_hitpoints - u.hitpoints
u.hitpoints = new_hitpoints
end
if moves_full then