diff options
| author | Ben Friedland <ben174@gmail.com> | 2013-01-07 05:16:17 -0800 |
|---|---|---|
| committer | Ben Friedland <ben174@gmail.com> | 2013-01-07 05:16:17 -0800 |
| commit | bf461cbd055b2f1a4c5b092f5e5f44a4c64f1a03 (patch) | |
| tree | 303a64de519dd47aeff578004256bdfdc808e032 /weatbag/__init__.py | |
| parent | cbe1bce30306133a02de664008ca552f3618302c (diff) | |
Orc battle at entrance of cave. Player now has hit_points.
Diffstat (limited to 'weatbag/__init__.py')
| -rw-r--r-- | weatbag/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/weatbag/__init__.py b/weatbag/__init__.py index 7c39d21..f9c34bf 100644 --- a/weatbag/__init__.py +++ b/weatbag/__init__.py @@ -8,6 +8,7 @@ class Player: self.name = name self.inventory = Counter() self.position = (0,0) + self.hit_points = 6 def has(self, item): "Does the player have any of item?" @@ -24,6 +25,24 @@ class Player: else: raise KeyError(item) + def state_string(self): + "Returns a string reporting the players health." + if self.hit_points >= 6: + return "feeling great" + elif self.hit_points == 5: + return "feeling good" + elif self.hit_points == 4: + return "feeling ok" + elif self.hit_points == 3: + return "feeling poor" + elif self.hit_points == 2: + return "feeling very unhealthy" + elif self.hit_points == 1: + return "nearly dead" + elif self.hit_points == 0: + return "dead" + + class World: def __init__(self): self.tiles = {} |
