Mercurial > rinkhals
diff gamelib/animal.py @ 413:bdc4757e0497
Add Sniper Rifle and give guns limited ammunition.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 12:07:01 +0000 |
parents | bdc8bc78a796 |
children | 9096c237928c |
line wrap: on
line diff
--- a/gamelib/animal.py Sat Nov 21 11:34:12 2009 +0000 +++ b/gamelib/animal.py Sat Nov 21 12:07:01 2009 +0000 @@ -225,6 +225,15 @@ if weapon.hit(gameboard, self, fox): fox.damage(gameboard) + def reload_weapon(self): + """If we have a weapon that takes ammunition, reload it.""" + if not self.weapons(): + # Nothing to reload + return + for weapon in self.weapons(): + if hasattr(weapon, 'AMMUNITION'): + weapon.ammunition = weapon.AMMUNITION + class Egg(Animal): """An egg"""