diff options
| author | Julian Irwin <julian.irwin@gmail.com> | 2013-01-11 17:46:24 -0600 |
|---|---|---|
| committer | Julian Irwin <julian.irwin@gmail.com> | 2013-01-11 17:46:24 -0600 |
| commit | 7f6cb008d54bb650662605ecd702089f87eea70d (patch) | |
| tree | c855969a848e67c51968e497bdcb8b558b98d7f7 /weatbag | |
| parent | e98bcfb9149fdfe5c842a2dc93ce79728f804d8e (diff) | |
| parent | d327e21c9c8fec8dea82035e87bfd1a3ba2b813c (diff) | |
Merge remote-tracking branch 'upstream/master' into southern-tiles-1
Diffstat (limited to 'weatbag')
| -rw-r--r-- | weatbag/__init__.py | 3 | ||||
| -rw-r--r-- | weatbag/tiles/n3.py | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/weatbag/__init__.py b/weatbag/__init__.py index 511e8bc..7ed1c6a 100644 --- a/weatbag/__init__.py +++ b/weatbag/__init__.py @@ -5,11 +5,12 @@ import re from . import action class Player: + MAX_HIT_POINT = 6 def __init__(self, name): self.name = name self.inventory = Counter() self.position = (0,0) - self.hit_points = 6 + self.hit_points = Player.MAX_HIT_POINT def has(self, item): "Does the player have any of item?" diff --git a/weatbag/tiles/n3.py b/weatbag/tiles/n3.py index 125898b..a1d8602 100644 --- a/weatbag/tiles/n3.py +++ b/weatbag/tiles/n3.py @@ -63,6 +63,14 @@ class Tile: if do[0] in words.attack: self.player_swing(player) self.enemy_swing(player) - + elif do[0] in words.use and do[1]=="berries": + if player.has("berries"): + player.take("berries") + player.hit_points += 2 + if player.hit_points > player.MAX_HIT_POINT: + player.hit_points = player.MAX_HIT_POINT + print("You ate the berries and feel better now.") + else: + print("Sorry you don't have any berries.") else: print("Sorry, I don't understand") |
