comparison gamelib/animal.py @ 290:664bba9be40a

Fences are eclectic.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 05 Sep 2009 16:07:48 +0000
parents 445f746449fa
children 78c49d87e175
comparison
equal deleted inserted replaced
289:37d88a9fc097 290:664bba9be40a
421 self.tick = 5 421 self.tick = 5
422 self.dig_pos = dig_pos 422 self.dig_pos = dig_pos
423 423
424 def _make_hole(self, gameboard): 424 def _make_hole(self, gameboard):
425 """Make a hole in the fence""" 425 """Make a hole in the fence"""
426 gameboard.tv.set(self.dig_pos.to_tuple(), 426 gameboard.tv.set(self.dig_pos.to_tuple(), gameboard.BROKEN_FENCE)
427 tiles.REVERSE_TILE_MAP['broken fence'])
428 self.dig_pos = None 427 self.dig_pos = None
429 428
430 def move(self, gameboard): 429 def move(self, gameboard):
431 """Foxes will aim to move towards the closest henhouse or free 430 """Foxes will aim to move towards the closest henhouse or free
432 chicken""" 431 chicken"""
489 self.chickens_eaten += 1 488 self.chickens_eaten += 1
490 if self.chickens_eaten > 2: 489 if self.chickens_eaten > 2:
491 self.hunting = False 490 self.hunting = False
492 self.last_steps = [] 491 self.last_steps = []
493 492
493 class Rinkhals(Fox):
494 """The Rinkhals has eclectic tastes"""
495 STEALTH = 80
496 IMAGE_FILE = 'sprites/rinkhals.png'
497
498 def _catch_chicken(self, chicken, gameboard):
499 """The Rinkhals hunts for sport, catch and release style"""
500 self.closest = None
501 self.hunting = False
502 self.last_steps = []
503
504 def _make_hole(self, gameboard):
505 """The Rinkhals eats fences"""
506 gameboard.tv.set(self.dig_pos.to_tuple(), gameboard.GRASSLAND)
507 self.dig_pos = None
508
509 def damage(self, gameboard):
510 """The Rinkhals is invincible!"""
511 return True
512
494 def _get_vision_param(parameter, watcher): 513 def _get_vision_param(parameter, watcher):
495 param = getattr(watcher, parameter) 514 param = getattr(watcher, parameter)
496 if watcher.abode: 515 if watcher.abode:
497 modifier = getattr(watcher.abode.building, 'MODIFY_'+parameter, lambda r: r) 516 modifier = getattr(watcher.abode.building, 'MODIFY_'+parameter, lambda r: r)
498 param = modifier(param) 517 param = modifier(param)