Mercurial > rinkhals
comparison gamelib/animal.py @ 457:fc648da2334c
Fix position cache removal, slightly optimise chicken range check.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Mon, 23 Nov 2009 16:12:37 +0000 |
parents | af2482444945 |
children | d4f04d81fe54 |
comparison
equal
deleted
inserted
replaced
456:96dbf2c8506e | 457:fc648da2334c |
---|---|
253 | 253 |
254 def _find_killable_fox(self, weapon, gameboard): | 254 def _find_killable_fox(self, weapon, gameboard): |
255 """Choose a random fox within range of this weapon.""" | 255 """Choose a random fox within range of this weapon.""" |
256 killable_foxes = [] | 256 killable_foxes = [] |
257 for fox in gameboard.foxes: | 257 for fox in gameboard.foxes: |
258 if not visible(self, fox, gameboard): | 258 if not weapon.in_range(gameboard, self, fox): |
259 continue | 259 continue |
260 if weapon.in_range(gameboard, self, fox): | 260 if visible(self, fox, gameboard): |
261 killable_foxes.append(fox) | 261 killable_foxes.append(fox) |
262 if not killable_foxes: | 262 if not killable_foxes: |
263 return None | 263 return None |
264 return random.choice(killable_foxes) | 264 return random.choice(killable_foxes) |
265 | 265 |