summaryrefslogtreecommitdiffstats
path: root/weatbag/__init__.py
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-01-09 02:28:35 -0800
committerThomas Kluyver <takowl@gmail.com>2013-01-09 02:28:35 -0800
commit1da208f02a091c1dc9a9912d7066805a445d09bd (patch)
treed99de9ea9b8d8073680f156395ee35022e37556a /weatbag/__init__.py
parent3400844980917bb3d59da322a3e33f55f81afe12 (diff)
parent6d1a17c456b15841763b953a1427e8bd856f2263 (diff)
Merge pull request #4 from ben174/master
Add new n3 tile with Orc battle at entrance of cave. Player now has hit_points.
Diffstat (limited to 'weatbag/__init__.py')
-rw-r--r--weatbag/__init__.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/weatbag/__init__.py b/weatbag/__init__.py
index 72912c6..9a743e0 100644
--- a/weatbag/__init__.py
+++ b/weatbag/__init__.py
@@ -9,6 +9,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?"
@@ -25,6 +26,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"
+ else:
+ return "dead"
+
+
class World:
def __init__(self):
self.tiles = {}