diff options
| author | Thomas Kluyver <takowl@gmail.com> | 2013-04-30 10:15:21 -0700 |
|---|---|---|
| committer | Thomas Kluyver <takowl@gmail.com> | 2013-04-30 10:15:21 -0700 |
| commit | e8676fe2073467b093af0abc8ccb19443ed4ecb7 (patch) | |
| tree | c25d9794e1b8c77d70c2862f07f197fc0c69f067 /weatbag | |
| parent | e3612c7544341abf9e84234d4bda5f65ce8ee47a (diff) | |
| parent | 3d626b5229add94f08acc3ae3731566507fc2f7e (diff) | |
Merge pull request #22 from ratmonkey/island_rebased
Island area
Diffstat (limited to 'weatbag')
| -rw-r--r-- | weatbag/tiles/n1w1.py | 18 | ||||
| -rw-r--r-- | weatbag/tiles/n2.py | 4 | ||||
| -rw-r--r-- | weatbag/tiles/n2w1.py | 74 | ||||
| -rw-r--r-- | weatbag/tiles/n2w2.py | 33 | ||||
| -rw-r--r-- | weatbag/tiles/n2w3.py | 27 | ||||
| -rw-r--r-- | weatbag/tiles/n2w4.py | 44 | ||||
| -rw-r--r-- | weatbag/tiles/n2w5.py | 33 | ||||
| -rw-r--r-- | weatbag/tiles/n3.py | 6 | ||||
| -rw-r--r-- | weatbag/tiles/n3w1.py | 41 | ||||
| -rw-r--r-- | weatbag/tiles/n3w2.py | 53 | ||||
| -rw-r--r-- | weatbag/tiles/n3w3.py | 34 | ||||
| -rw-r--r-- | weatbag/tiles/n3w4.py | 17 |
12 files changed, 380 insertions, 4 deletions
diff --git a/weatbag/tiles/n1w1.py b/weatbag/tiles/n1w1.py new file mode 100644 index 0000000..f809dc4 --- /dev/null +++ b/weatbag/tiles/n1w1.py @@ -0,0 +1,18 @@ +class Tile: + def describe(self): + print("There is a small island northwest.\n" + "Unfortunatelly, you can't swim because the sea is full of " + "electric eels so you need a transport to go there.\n" + "Luckilly to the north you see 2 children with a raft sitting " + "under a tree.\n" ) + + def action(self, player, do): + print("Waitwat?!") + + def leave(self, player, direction): + if direction == "w": + print ("You can't go there by swimming, that part is full of " + "electric eels.\n") + return False + else: + return True diff --git a/weatbag/tiles/n2.py b/weatbag/tiles/n2.py index 99ed0af..7ae7b81 100644 --- a/weatbag/tiles/n2.py +++ b/weatbag/tiles/n2.py @@ -15,8 +15,8 @@ class Tile: def leave(self, player, direction): if direction=='n' and not player.has('flaming torch'): print("You can't explore the cave without being able to see. " - "You'll need that stalwart friend of the adventurer, " - "the flaming torch.") + "You'll need that stalwart friend of the adventurer, " + "the flaming torch.") return False else: return True diff --git a/weatbag/tiles/n2w1.py b/weatbag/tiles/n2w1.py new file mode 100644 index 0000000..00198a8 --- /dev/null +++ b/weatbag/tiles/n2w1.py @@ -0,0 +1,74 @@ +from weatbag import words + +class Tile: + def __init__(self): + self.challenge_completed = False + self.minutes = "40" + + def describe(self): + print("You see two children who you notice now are a boy and a girl.\n" + "They are playing and running around a raft.\n") + if not self.challenge_completed: + self.challenge() + else: + print("\nThe children will take you to the western island!") + + def challenge(self): + print("You ask them to give it to you." + "The little boy laughs and replies: \n" + "So you think you are brave enough to go to that island? " + "Very well, but we cannot give you our raft. " + "What we can do is transport you there ourselves. But first you " + "must answer this:\n\n" + "Ignore weight and weather variables and listen carefully.\n" + "It takes me exactly one hour to transport a person to " + "the island.\n" + "It takes my sister double that time.\n" + "If we combine our power, " + "how many minutes will it take to transport you to the island?\n" + "For your answer, type a number followed by 'minutes'.\n") + + def action(self, player, do): + if not self.challenge_completed: + try: + if do[1] == "minutes": + if do[0] == self.minutes: + print("Your answer has pleased me and my sister! " + "\nLet's go!") + print("The brother and sister will take you to the " + "island.\n") + self.challenge_completed = True + else: + print("We're afraid this is not the correct answer. " + "Try another one.\n") + elif (do[0] in words.take) and (do[1] == "sister" or + do[1] == "girl"): + print("You bastard! Let my sister down!\n" + "What kind of an asshole are you? " + "Taking advantage of little children?\n" + "We will transport you for free.\n") + print("The brother and sister will take you " + "to the island!\n") + self.challenge_completed = True + elif (do[0] in words.take) and (do[1] == "brother" or + do[1] == "boy"): + print("You bastard, put me down!\n" + "We will trasnport you for free!\n") + print("The brother and sister will take you " + "to the island!\n") + self.challenge_completed = True + elif (do[0] in words.take) and not self.challenge_completed: + print("I told you we won't give you our raft, " + "you have to find the correct amount of time!\n") + except: + print("Please try typing a number, like '42 minutes'\n.") + else: + print("Sorry, I don't understand.") + + def leave(self, player, direction): + if direction == "w" and not self.challenge_completed: + print ("You can't go there by swimming, that part is full of " + "electric eels.\n") + return False + else: + return True diff --git a/weatbag/tiles/n2w2.py b/weatbag/tiles/n2w2.py new file mode 100644 index 0000000..31e3cff --- /dev/null +++ b/weatbag/tiles/n2w2.py @@ -0,0 +1,33 @@ +class Tile: + def __init__(self): + self.first_visit = True + + def describe(self): + if self.first_visit: + print("You are now on the island. The children are returning back " + "to the mainland with their raft.\n" + "In front of you there are some trees and a small path.\n" + "Feeling adventurous?\n") + self.first_visit = False + else: + print("The beach is quiet. Nothing seems to be going on.") + + def action(self, player, do): + if do[0] in ('Yes', 'yes', 'y', 'Y', 'Yup', 'yup', 'ye', 'Ye'): + print("Awesome! Follow the path!") + elif do[0] in ('No', 'no', 'n', 'N', 'Nope', 'nope'): + print("You might be in the wrong place then. Pack your stuff and " + "quit the game.") + else: + print("Sorry, wat?!") + + def leave(self, player, direction): + if direction == "e": + print("You can't go back by swimming, that part is full of " + "electric eels.\n") + return False + elif direction == "s": + print("I'm afraid I can't let you go there Dave.\n") + return False + else: + return True diff --git a/weatbag/tiles/n2w3.py b/weatbag/tiles/n2w3.py new file mode 100644 index 0000000..2030fea --- /dev/null +++ b/weatbag/tiles/n2w3.py @@ -0,0 +1,27 @@ +class Tile: + def __init__(self): + self.first_visit = True + self.tree_fallen = False + + def describe(self): + print("You are walking through the trees. It looks like the path on " + "your west leads to a small wooden hut.\n") + if not self.first_visit and not self.tree_fallen: + print("You saw a tree fall and it didn't make any sound and " + "WOW... that was weird because you were there and " + "observed it!\n") + self.tree_fallen = True + self.first_visit = False + # "If a tree falls in a forest and no one is around to hear it, + # does it make a sound?" is a philosophical thought experiment that + # raises questions regarding observation and knowledge of reality. + def action(self, player, do): + print("Wat?!") + + def leave(self, player, direction): + if direction == "s": + print("STAHP! Hammer Time!\n(Meaning you just can't go to that " + "direction yet. Sorry! :))\n") + return False + else: + return True diff --git a/weatbag/tiles/n2w4.py b/weatbag/tiles/n2w4.py new file mode 100644 index 0000000..59904c2 --- /dev/null +++ b/weatbag/tiles/n2w4.py @@ -0,0 +1,44 @@ +from weatbag import words +from weatbag.utils import transfer + +class Tile: + def __init__(self): + self.opendoor = False + + def describe(self): + if self.opendoor: + print("The hut's door is open and the kitties are playing with " + "their momcat!\n") + else: + print("You are standing in front of the hut's door. The hut " + "looks very small and you wonder who could live here...\n" + "It has a door but you can't open it because the doorknob " + "is missing.\n") + + def action(self, player, do): + if (do[0] in words.use) and do[1]=='doorknob': + if player.has('doorknob'): + player.take('doorknob') + print("Doorknob fits fine, clicks and voila... Door is open!\n" + "\nYou are in a cozy living room with a cat and five " + "kittens resting on a couch.\n" + "There is another room to the west.\n") + self.opendoor = True + else: + print("You'll need a doorknob to open the door.\n") + self.opendoor = False + else: + print("Sorry, I don't understand.\n") + + def leave(self, player, direction): + if direction == 'w' and not self.opendoor: + print("First you need to enter the hut.\n") + return False + elif direction == 's': + print("Meeeeh, nothing of importance is going on there, try " + "another direction.\n") + 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..12ae7d2 --- /dev/null +++ b/weatbag/tiles/n2w5.py @@ -0,0 +1,33 @@ +from weatbag import words +from weatbag.utils import transfer + +class Tile: + def __init__(self): + self.contents = {'catfood': 2} + + def describe(self): + if self.contents['catfood']>0: + 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!\n" + "Never know when you'll need to feed a kitty!\n") + else: + print("You see an empty self.") + + def action(self, player, do): + if (do[0] in words.take) and ('catfood' in do): + self.take_catfood(player) + else: + print("Sorry, I don't understand.\n") + + def take_catfood(self, player): + if transfer('catfood', self.contents, player.inventory, n=2): + print("You did wise. You took the catfood!\n") + else: + print("There is nothing here.\n") + + def leave(self, player, direction): + if direction == 'w'or direction == 's' or direction == 'n': + print("Area 51. No trespassing beyond this point.\n") + return False + else: + return True diff --git a/weatbag/tiles/n3.py b/weatbag/tiles/n3.py index 7d78b84..f85dd42 100644 --- a/weatbag/tiles/n3.py +++ b/weatbag/tiles/n3.py @@ -42,7 +42,10 @@ class Tile: print("You are %s" % (player.state_string())) def leave(self, player, direction): - if not self.enemy_dead: + if direction =='w': + print("Cave wall this way.") + return False + elif not self.enemy_dead: if not random.choice((True,False)): print("The orc blocks your way!") self.enemy_swing(player) @@ -50,7 +53,6 @@ class Tile: else: print("You manage to flee!") return True - return True no_path_msg = "There is no path leading in that direction." diff --git a/weatbag/tiles/n3w1.py b/weatbag/tiles/n3w1.py new file mode 100644 index 0000000..98877eb --- /dev/null +++ b/weatbag/tiles/n3w1.py @@ -0,0 +1,41 @@ +class Tile: + def describe(self): + print("The beach is quiet. To the south children are playing.\n") + + def action(self, player, do): + print("wo0t w0ot?! o_O") + + def leave(self, player, direction): + if direction == 'w': + print("I'm afraid you can't go west.\nThe sea on that part is " + "full of electric eels and you don't have a transport.\n") + return False + elif direction == 'e': + print("There's a steep mountainside here which you can't climb.") + return False + elif direction == 'n': + print(" , , \n" + " _/(( \)\ \n" + " _.---. .' `\ / '. .---._ \n" + " .' ` ^ T= =P ^ ` '. \n" + " / \ .--' `--. / \ \n" + "| / )'-. .-'( \ | \n" + "; , <__..-( '-.) (.-' )-..__> , ; \n" + " \ \-.__) ``--._) (_.--`` (__.-/ / \n" + " '.'-.__.-. .-.__.-'.' \n" + " '-...-' '-...-' \n" + " , , \n" + " _/(( \)\ \n" + " _.---. .' `\ / '. .---._ \n" + " .' ` ^ T= =P ^ ` '. \n" + " / \ .--' `--. / \ \n" + "| / )'-. .-'( \ | \n" + "; , <__..-( '-.) (.-' )-..__> , ; \n" + " \ \-.__) ``--._) (_.--`` (__.-/ / \n" + " '.'-.__.-. .-.__.-'.' \n" + " '-...-' '-...-' \n") + print("A wall of kitties doesn't allow you to go North.\n" + "But that doesn't make you mad... " + "You can't be mad at kitties, rite?!\n") + return False + return True diff --git a/weatbag/tiles/n3w2.py b/weatbag/tiles/n3w2.py new file mode 100644 index 0000000..9ff35a5 --- /dev/null +++ b/weatbag/tiles/n3w2.py @@ -0,0 +1,53 @@ +from weatbag import words +from weatbag.utils import transfer + +class Tile: + def __init__(self): + self.give_catfood = False + + def describe(self): + if not self.give_catfood: + print("You are at the beach and there is an old man with an " + "enormous beard that is getting his little boat ready to go " + "across to the mainland.\nNaturally, you ask him to " + "take you in his boat.\nThe old man replies:\nOf course I " + "can take you with me, my dear adventurer but first I need " + "some catfood so I can feed the kitties across on the " + "mainland!\n") + else: + print("There's the old fisherman with his boat, he can take you " + "across if you like!\n") + +# I only added words.use because player might +# use the word "use" insteed of "give". + def action(self, player, do): + + 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!\n") + else: + player.take('catfood') + print("Oh how nice of you. You are the best!\n") + elif len(do) > 1: + print("I have no use for that.\n") + else: + print("Sorry, I don't understand.\n") + + + 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 " + "transport to go across.\n") + return False + if direction == 'n': + print("Nothing to do there.\n") + return False + else: + return True + +#two catfoods! +test_items = ['catfood','catfood'] diff --git a/weatbag/tiles/n3w3.py b/weatbag/tiles/n3w3.py new file mode 100644 index 0000000..d2977c4 --- /dev/null +++ b/weatbag/tiles/n3w3.py @@ -0,0 +1,34 @@ +from weatbag import words +from weatbag.utils import transfer + +class Tile: + def __init__(self): + self.contents = {'doorknob': 1} + + def describe(self): + if self.contents['doorknob']: + print("As you walk through the path you find something shiny on " + "the ground beside some rocks.\n" + "It looks like a brass doorknob.\n") + else: + print("There is nothing to do here, all you see is your path and " + "the trees around!\n") + def action(self, player, do): + if (do[0] in words.take) and ('doorknob' in do): + self.take_doorknob(player) + + else: + print("Sorry, I don't understand.\n") + + def take_doorknob(self, player): + if transfer('doorknob', self.contents, player.inventory): + print("You pick up the doorknob.\n") + else: + print("There is nothing here.\n") + + def leave(self, player, direction): + if direction == "n": + print("Oops! You can't go there. There is a rocky wall.\n") + return False + else: + return True diff --git a/weatbag/tiles/n3w4.py b/weatbag/tiles/n3w4.py new file mode 100644 index 0000000..aeb58f9 --- /dev/null +++ b/weatbag/tiles/n3w4.py @@ -0,0 +1,17 @@ +class Tile: + def describe(self): + print("Looks like you are in a walking mood because you still follow " + "the path.\nYou hear birds singing, some small waves on the " + "background, there is a nice flowery smell, rays of sun make the " + "tree sceenery heavenly...\n" + "I totaly get you, it's a nice path to have a walk!\n") + + def action(self, player, do): + print("Sorry, I don't understand.\n") + + def leave(self, player, direction): + if direction in ('n', 'w'): + print("No trespasing. Violators will vanish without a trace.\n") + return False + else: + return True |
