ExpAI recruiting: prevent potential divide-by-zero
This commit is contained in:
parent
703e7e3664
commit
b56a44ed66
1 changed files with 2 additions and 0 deletions
|
@ -331,6 +331,8 @@ return {
|
|||
|
||||
my_hp = my_hp + sum_gold_for_sides({{"allied_with", {side = wesnoth.current.side} }})*2.3
|
||||
enemy_hp = enemy_hp+sum_gold_for_sides({{"enemy_of", {side = wesnoth.current.side} }})*2.3
|
||||
-- Need to prevent potential divide-by-zero
|
||||
if (enemy_hp == 0) then enemy_hp = 1 end
|
||||
return my_hp / enemy_hp
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue