From 305bde6cd0ef0b1ee7697866e1c3e06a0ca575be Mon Sep 17 00:00:00 2001 From: Kleopatra Angelidi Date: Mon, 22 Apr 2013 23:55:26 +0300 Subject: added leave function on n2w4 --- weatbag/tiles/n2w5.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 weatbag/tiles/n2w5.py (limited to 'weatbag/tiles/n2w5.py') 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.") + -- cgit v1.3