From 7a4413f5d8963cb276580526213e69789182e5a3 Mon Sep 17 00:00:00 2001 From: Kleopatra Angelidi Date: Sun, 21 Apr 2013 17:57:34 +0300 Subject: new tile n2w2 --- weatbag/tiles/n2w2.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 weatbag/tiles/n2w2.py diff --git a/weatbag/tiles/n2w2.py b/weatbag/tiles/n2w2.py new file mode 100644 index 0000000..e16f4b8 --- /dev/null +++ b/weatbag/tiles/n2w2.py @@ -0,0 +1,31 @@ +from weatbag import words +from weatbag.utils import transfer + +class Tile: + def __init__(self): + self.contents = {'key': 1} + + def describe(self): + print("You are now on the island.") + if self.contents['key']: + print("As you walk around you find something shiny on the ground. Looks like a key.") + + def action(self, player, do): + if (do[0] in words.take) and ('key' in do): + self.take_key(player) + else: + print("Sorry, I don't understand.") + + def take_key(self, player): + if transfer('key', self.contents, player.inventory): + print("You pick up the key.") + else: + print("There is nothing here.") + + def leave(self, player, direction): + if direction == "e": + print ("You can't go back by swimming, that part is full of " + "electric eels.") + return False + else: + return True -- cgit v1.3