From a0b3849ab9e7ac2c36c7dc27b30cf486f619db30 Mon Sep 17 00:00:00 2001 From: Kleopatra Angelidi Date: Tue, 23 Apr 2013 23:57:44 +0300 Subject: corrected if cases / added catfood --- weatbag/tiles/n3w2.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'weatbag/tiles/n3w2.py') diff --git a/weatbag/tiles/n3w2.py b/weatbag/tiles/n3w2.py index 61775f6..d1266f2 100644 --- a/weatbag/tiles/n3w2.py +++ b/weatbag/tiles/n3w2.py @@ -18,19 +18,26 @@ class Tile: print("There's the old fisherman with his boat, he can take you " "across if you like!") - def action(self, player, do): - if (do[0] in words.use or do[0] in words.give) and do[1]=='catfood': - # I only added words.use because player might # use the word "use" insteed of "give". + def action(self, player, do): - if player.has('catfood'): - player.take('catfood') - print("Great! Now we can sail!") - self.give_catfood = True + if do[0] in words.use or do[0] in words.give: + if 'catfood' in do: + if player.has('catfood'): + if self.give_catfood == False: + player.take('catfood') + self.give_catfood = True + print("Great! Now we can sail!") + else: + player.take('catfood') + print("Oh how nice of you. You are the best!") + elif len(do) > 1: + print("I have no use for that.") else: print("Sorry, I don't understand.") + def leave(self, player, direction): if direction=='e'and not self.give_catfood: print("You can't swim, remember the electric eels? You need a " @@ -38,4 +45,5 @@ class Tile: return False return True -test_items = ['catfood'] +#two catfoods! +test_items = ['catfood','catfood'] -- cgit v1.3