mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-12 06:13:27 +00:00
Fixed a ZeroDivisionError bug which is triggered on certain maps.
This commit is contained in:
parent
cad1105d5c
commit
c13bf4d634
@ -302,7 +302,12 @@ class AI:
|
||||
for y in range(m.y):
|
||||
loc = wesnoth.get_location(x,y)
|
||||
speed += 1.0 / recruit.movement_cost(loc)
|
||||
defense += 100.0 / recruit.defense_modifier(loc) - 1
|
||||
rdm = recruit.defense_modifier(loc)
|
||||
if rdm:
|
||||
defense += 100.0 / rdm - 1
|
||||
|
||||
else:
|
||||
defense += 1.00
|
||||
|
||||
# speed is more important on larger maps
|
||||
speed *= self.mapsize * recruit.movement / n
|
||||
|
Loading…
x
Reference in New Issue
Block a user