diff options
| author | Thomas Kluyver <takowl@gmail.com> | 2013-05-26 14:43:55 -0700 |
|---|---|---|
| committer | Thomas Kluyver <takowl@gmail.com> | 2013-05-26 14:43:55 -0700 |
| commit | 0f8ea0492007d5a330558665e00012b0b7b92fef (patch) | |
| tree | 7845c107d6bfe9def38fbbc4af13fa36d68d1c74 /weatbag/tiles/n1w5.py | |
| parent | 8cdd5546c6993898e6d319853ab6c7e639ab7bf0 (diff) | |
| parent | 74288b83d9e99f790ef4a96fe7bfc96814bcb3d6 (diff) | |
Merge pull request #24 from ratmonkey/kittens
Kittens
Diffstat (limited to 'weatbag/tiles/n1w5.py')
| -rw-r--r-- | weatbag/tiles/n1w5.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/weatbag/tiles/n1w5.py b/weatbag/tiles/n1w5.py new file mode 100644 index 0000000..634b4f7 --- /dev/null +++ b/weatbag/tiles/n1w5.py @@ -0,0 +1,48 @@ +from weatbag import words +from weatbag.utils import transfer + +class Tile: + map_word = "Mouse traps" + + def __init__(self): + self.contents = {'mice': 2} + + def describe(self): + if self.contents['mice']: + print("As you walk the rocky path at the edge of the cliff you " + "hear a squeaking sound and you notice two mouse traps on " + "the ground. Each has one mouse trapped inside.\n" + "You could take the silly rodents but really... what the " + "hell are you gonna do with them?\n") + else: + print("You walk the path at the edge of the cliff. Nothing " + "to do here.\n") + + def action(self, player, do): + if (do[0] in words.take) and ('mice' in do): + self.take_mice(player) + else: + print("Sorry, I don't understand.") + + def take_mice(self, player): + if transfer('mice', self.contents, player.inventory, n=2): + print("Ok then. You took the mice.\n") + else: + print("No more mice for now. Got to leave the traps do their " + "job.\n") + + def leave(self, player, direction): + if direction == "s": + print("My dear traveler, you can't go south, you will fall off the " + "cliff!") + return False + elif direction == "n": + print("It looks like the side of a wooden hut.\n" + "Since you don't walk though walls (yet) " + "you can't go there.") + return False + elif direction == "e": + print("You follow the path downhill.") + return True + else: + return True |
