Mercurial > rinkhals
comparison gamelib/animal.py @ 419:d110d55c8449
Move hatching logic into chickens.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 15:22:41 +0000 |
parents | 8f012ef1f64f |
children | f20ccd43a282 |
comparison
equal
deleted
inserted
replaced
418:2ccfadcae3b2 | 419:d110d55c8449 |
---|---|
166 | 166 |
167 def start_night(self, gameboard): | 167 def start_night(self, gameboard): |
168 self.lay(gameboard) | 168 self.lay(gameboard) |
169 self.reload_weapon() | 169 self.reload_weapon() |
170 | 170 |
171 def start_day(self, gameboard): | |
172 self.hatch(gameboard) | |
173 | |
171 def _game_death(self, gameboard): | 174 def _game_death(self, gameboard): |
172 gameboard.remove_chicken(self) | 175 gameboard.remove_chicken(self) |
173 | 176 |
174 def move(self, gameboard): | 177 def move(self, gameboard): |
175 """A free chicken will move away from other free chickens""" | 178 """A free chicken will move away from other free chickens""" |
209 gameboard.eggs -= 1 | 212 gameboard.eggs -= 1 |
210 # Sell other eggs | 213 # Sell other eggs |
211 for egg in self.eggs[:]: | 214 for egg in self.eggs[:]: |
212 gameboard.sell_one_egg(self) | 215 gameboard.sell_one_egg(self) |
213 self.remove_eggs() # clean up stale images, etc. | 216 self.remove_eggs() # clean up stale images, etc. |
214 return chick | 217 gameboard.place_hatched_chicken(chick, self.abode.building) |
215 return None | |
216 | 218 |
217 def _find_killable_fox(self, weapon, gameboard): | 219 def _find_killable_fox(self, weapon, gameboard): |
218 """Choose a random fox within range of this weapon.""" | 220 """Choose a random fox within range of this weapon.""" |
219 killable_foxes = [] | 221 killable_foxes = [] |
220 for fox in gameboard.foxes: | 222 for fox in gameboard.foxes: |