Mercurial > fhrl
changeset 34:fff2b61633b8
make guns use up ammo
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Sat, 16 Mar 2013 09:40:05 +0100 |
| parents | b1bf0643bc26 |
| children | 196301562443 |
| files | fhrl/mobs.py |
| diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/fhrl/mobs.py Sat Mar 16 09:36:45 2013 +0100 +++ b/fhrl/mobs.py Sat Mar 16 09:40:05 2013 +0100 @@ -258,7 +258,24 @@ x, y = self.x + DX[direction], self.y + DY[direction] f = weapon.get('shoot') if f: + ammo = weapon.get('ammo') + if ammo == 'balls': + if self.balls: + self.balls -= 1 + else: + return [] + elif ammo == 'gasoline': + if self.gasoline: + self.gasoline -= 1 + else: + return [] + elif ammo == 'battery': + if self.battery: + self.battery -= 1 + else: + return [] return f((x, y), direction, level, display) + display.update_hud() return [] def _show_gun(self, display):
