[heal_unit]: ensure that heal amount is an integer

This commit is contained in:
Jyrki Vesterinen 2018-04-16 20:52:17 +03:00
parent f2284e2e79
commit 76ed49a45f

View file

@ -31,7 +31,7 @@ function wesnoth.wml_actions.heal_unit(cfg)
new_hitpoints = u.max_hitpoints
else
heal_amount = tonumber(cfg.amount) or heal_amount
new_hitpoints = math.max(1, math.min(u.max_hitpoints, u.hitpoints + heal_amount))
new_hitpoints = math.floor(math.max(1, math.min(u.max_hitpoints, u.hitpoints + heal_amount)))
heal_amount = new_hitpoints - u.hitpoints
end