comparison gamelib/animal.py @ 216:962934b8c7dc

Implement UI part of egg selling
author Neil Muller <drnlmuller@gmail.com>
date Fri, 04 Sep 2009 22:04:04 +0000
parents fe1e9c18d4d7
children 9a6ac9c9ff46
comparison
equal deleted inserted replaced
215:85a5299caf4a 216:962934b8c7dc
141 141
142 def lay(self): 142 def lay(self):
143 """See if the chicken lays an egg""" 143 """See if the chicken lays an egg"""
144 if not self.egg: 144 if not self.egg:
145 self.egg = Egg(self.pos) 145 self.egg = Egg(self.pos)
146 self.equip(equipment.NestEgg())
147
148 def remove_egg(self):
149 """Clean up the egg state"""
150 self.egg = None
151 self.unequip_by_name("nestegg")
146 152
147 def hatch(self): 153 def hatch(self):
148 """See if we have an egg to hatch""" 154 """See if we have an egg to hatch"""
149 if self.egg: 155 if self.egg:
150 chick = self.egg.hatch() 156 chick = self.egg.hatch()
151 if chick: 157 if chick:
152 self.egg = None 158 self.remove_egg()
153 return chick 159 return chick
154 return None 160 return None
155 161
156 def _find_killable_fox(self, weapon, gameboard): 162 def _find_killable_fox(self, weapon, gameboard):
157 """Choose a random fox within range of this weapon.""" 163 """Choose a random fox within range of this weapon."""