summaryrefslogtreecommitdiffstats
path: root/weatbag
diff options
context:
space:
mode:
authorKleopatra Angelidi <akleop@gmail.com>2013-04-22 23:55:26 +0300
committerKleopatra Angelidi <akleop@gmail.com>2013-04-29 03:21:17 +0300
commit305bde6cd0ef0b1ee7697866e1c3e06a0ca575be (patch)
treeb54e38fd6aeb01814d92726ecab7debb05852a3c /weatbag
parentd9a5554c4bc5d9fef1bd3bed0061b1e3d84ef259 (diff)
added leave function on n2w4
Diffstat (limited to 'weatbag')
-rw-r--r--weatbag/tiles/n2w1.py2
-rw-r--r--weatbag/tiles/n2w4.py23
-rw-r--r--weatbag/tiles/n2w5.py27
3 files changed, 44 insertions, 8 deletions
diff --git a/weatbag/tiles/n2w1.py b/weatbag/tiles/n2w1.py
index 03630b5..86f7323 100644
--- a/weatbag/tiles/n2w1.py
+++ b/weatbag/tiles/n2w1.py
@@ -66,5 +66,3 @@ class Tile:
return False
else:
return True
-
-
diff --git a/weatbag/tiles/n2w4.py b/weatbag/tiles/n2w4.py
index 961409a..e44aa3f 100644
--- a/weatbag/tiles/n2w4.py
+++ b/weatbag/tiles/n2w4.py
@@ -4,17 +4,28 @@ from weatbag.utils import transfer
class Tile:
def describe(self):
- print("You are standing in front of the hut.\nIt has a door but you "
- "can't open it because the doorknob is missing.")
+ print("You are standing in front of the hut's door. The hut looks very "
+ "small and you wonder who could live there... It has a door but "
+ "you can't open it because the doorknob is missing.")
def action(self, player, do):
- if (do[0] in words.use) and do[1]=='doorknob':
+ if (do[0] in words.use) and do[1]=='doorknob':
if player.has('doorknob'):
- player.give('doorknob')
- print("Doorknob fits fine, clicks and voila! Door is open!")
+ player.take('doorknob')
+ print("Doorknob fits fine, clicks and voila... Door is open!\n"
+ "You are in a cozy living room with a cat and 5 kittens "
+ "resting on a couch.\nThere is another room at west.")
+
else:
print("You'll need a doorknob to open the door.")
else:
- print("Sorry, I don't understand.")
+ print("Sorry, I don't understand.")
+
+ def leave(self, player, direction):
+ if direction=='w' and player.has('doorknob'):
+ print("First you need to enter the hut.")
+ return False
+ else:
+ return True
test_items = ['doorknob']
diff --git a/weatbag/tiles/n2w5.py b/weatbag/tiles/n2w5.py
new file mode 100644
index 0000000..d1c94ab
--- /dev/null
+++ b/weatbag/tiles/n2w5.py
@@ -0,0 +1,27 @@
+from weatbag import words
+from weatbag.utils import transfer
+
+class Tile:
+ def __init__(self):
+ self.contents = {'catfood': 1}
+
+ def describe(self):
+ if self.contents['catfood']:
+ print("You look around and you see a shelf with catfood cans.\n"
+ "I don't know about you, but a catfood can is always handy! "
+ "Never know when you'll need to feed a kitty!")
+
+ def action(self, player, do):
+ if (do[0] in words.take) and ('catfood' in do):
+ self.take_catfood(player)
+ self.contents['catfood'] -= 1
+
+ else:
+ print("Sorry, I don't understand.")
+
+ def take_catfood(self, player):
+ if transfer('catfood', self.contents, player.inventory):
+ print("You did wise. You took the catfood!")
+ else:
+ print("There is nothing here.")
+