diff options
| -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") |
