Mercurial > rinkhals
comparison gamelib/animal.py @ 414:9096c237928c
Dear most illustrious brother, I seek your cooperation with the refactoring of egg layerings and the reloading of guns. Please to provide bank details.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 12:48:12 +0000 |
parents | bdc4757e0497 |
children | 8f012ef1f64f |
comparison
equal
deleted
inserted
replaced
413:bdc4757e0497 | 414:9096c237928c |
---|---|
153 image_right = imagecache.load_image('sprites/chkn.png', | 153 image_right = imagecache.load_image('sprites/chkn.png', |
154 ("right_facing",)) | 154 ("right_facing",)) |
155 Animal.__init__(self, image_left, image_right, pos) | 155 Animal.__init__(self, image_left, image_right, pos) |
156 self.eggs = [] | 156 self.eggs = [] |
157 | 157 |
158 def start_night(self, gameboard): | |
159 self.lay(gameboard) | |
160 self.reload_weapon() | |
161 | |
158 def _game_death(self, gameboard): | 162 def _game_death(self, gameboard): |
159 gameboard.remove_chicken(self) | 163 gameboard.remove_chicken(self) |
160 | 164 |
161 def move(self, gameboard): | 165 def move(self, gameboard): |
162 """A free chicken will move away from other free chickens""" | 166 """A free chicken will move away from other free chickens""" |
163 pass | 167 pass |
164 | 168 |
165 def lay(self): | 169 def lay(self, gameboard): |
166 """See if the chicken lays an egg""" | 170 """See if the chicken lays an egg""" |
167 if not self.eggs: | 171 if self.abode and self.abode.building.HENHOUSE: |
168 for x in range(random.randint(1, 4)): | 172 if not self.eggs: |
169 self.eggs.append(Egg(self.pos)) | 173 for x in range(random.randint(1, 4)): |
170 self.equip(equipment.NestEgg()) | 174 self.eggs.append(Egg(self.pos)) |
175 self.equip(equipment.NestEgg()) | |
176 gameboard.eggs += self.get_num_eggs() | |
171 | 177 |
172 def remove_eggs(self): | 178 def remove_eggs(self): |
173 """Clean up the egg state""" | 179 """Clean up the egg state""" |
174 self.eggs = [] | 180 self.eggs = [] |
175 self.unequip_by_name("Nestegg") | 181 self.unequip_by_name("Nestegg") |