Mercurial > rinkhals
comparison gamelib/gameboard.py @ 224:c279ad59b8e2
Chicks fill hen house, then adjacent spaces, then die.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 22:59:14 +0000 |
parents | 527a5d4e3fa3 |
children | 97a22d0b0471 |
comparison
equal
deleted
inserted
replaced
223:527a5d4e3fa3 | 224:c279ad59b8e2 |
---|---|
710 try: | 710 try: |
711 building.add_occupant(new_chick) | 711 building.add_occupant(new_chick) |
712 self.add_chicken(new_chick) | 712 self.add_chicken(new_chick) |
713 new_chick.equip(equipment.Nest()) | 713 new_chick.equip(equipment.Nest()) |
714 except buildings.BuildingFullError: | 714 except buildings.BuildingFullError: |
715 # No space in the hen house, look nearby | |
716 for tile_pos in building.adjacent_tiles(): | |
717 if self.tv.get(tile_pos) != self.GRASSLAND: | |
718 continue | |
719 if self.get_outside_chicken(tile_pos) is None: | |
720 self.add_chicken(new_chick) | |
721 self.relocate_animal(new_chick, tile_pos=tile_pos) | |
722 break | |
715 # if there isn't a space for the | 723 # if there isn't a space for the |
716 # new chick it dies. :/ Farm life | 724 # new chick it dies. :/ Farm life |
717 # is cruel. | 725 # is cruel. |
718 pass | |
719 self.toolbar.update_egg_counter(self.eggs) | 726 self.toolbar.update_egg_counter(self.eggs) |
720 | 727 |
721 def kill_fox(self, fox): | 728 def kill_fox(self, fox): |
722 if fox in self.foxes: | 729 if fox in self.foxes: |
723 if not fox.survive_damage(): | 730 if not fox.survive_damage(): |