diff options
| author | Thomas Kluyver <takowl@gmail.com> | 2013-04-24 14:31:55 -0700 |
|---|---|---|
| committer | Thomas Kluyver <takowl@gmail.com> | 2013-04-24 14:31:55 -0700 |
| commit | 0436b931c9941f5ac49198cffe4c88fd555ed67b (patch) | |
| tree | 19d5bff7af4d5f3ca080a60774eb374f959b806c /weatbag | |
| parent | 32db2f567c844ece509a5001233606465474d18f (diff) | |
| parent | 871d2649c85c56c6b092cffa91a42e2a3210706d (diff) | |
Merge pull request #18 from lathan/bug_quest
Bug quest
Diffstat (limited to 'weatbag')
| -rw-r--r-- | weatbag/tiles/e1.py | 9 | ||||
| -rw-r--r-- | weatbag/tiles/s1.py | 14 | ||||
| -rw-r--r-- | weatbag/tiles/s1e1.py | 54 | ||||
| -rw-r--r-- | weatbag/tiles/s2.py | 31 | ||||
| -rw-r--r-- | weatbag/tiles/s2e1.py | 42 | ||||
| -rw-r--r-- | weatbag/tiles/w1.py | 2 |
6 files changed, 142 insertions, 10 deletions
diff --git a/weatbag/tiles/e1.py b/weatbag/tiles/e1.py index 39f73e5..8e69a9a 100644 --- a/weatbag/tiles/e1.py +++ b/weatbag/tiles/e1.py @@ -23,3 +23,12 @@ class Tile: print("Reaching up, you pick the berries.") else: print("There are no berries here.") + + def leave(self,player,direction): + if direction == 's': + print("You decide the path is too boring for you,\n" + "so you follow the stream south, looking for adventure...") + input() + return True + else: + return True diff --git a/weatbag/tiles/s1.py b/weatbag/tiles/s1.py index 556a3f3..d1354ec 100644 --- a/weatbag/tiles/s1.py +++ b/weatbag/tiles/s1.py @@ -6,3 +6,17 @@ class Tile: def action(self, player, do): # Nothing to do here yet. print("Sorry, I don't understand") + + def leave(self, player, direction): + restricted_directions = { 'e' } + + # I placed this restriction here to prevent + # early entrance to the bug quest + # which should be started by going South from e1 + if direction in restricted_directions: + print("The undergrowth in that direction " + "is impassable. You turn back.") + return False + else: + return True + diff --git a/weatbag/tiles/s1e1.py b/weatbag/tiles/s1e1.py new file mode 100644 index 0000000..8a217e0 --- /dev/null +++ b/weatbag/tiles/s1e1.py @@ -0,0 +1,54 @@ +# First bug quest tile. +# +# To future hackers: +# This is part of a short quest which beggins by +# going South from e1. Plase consider this when coding neighbouring tiles. +# thnx :) +from weatbag import words +import weatbag + +class Tile: + def __init__(self): + self.bug_is_here = True + self.first_visit = True + self.hasnt_gone_south = True + pass + + def describe(self): + print("There is a stream here. " + "It runs from South to North.") + + if self.bug_is_here: + print("You see a huge, ugly bug rush past you, " + "following the river South.") + self.bug_is_here = False + else: + print("You remember this is where you saw that bug going South.") + + # Nothing to do here. + def action(self, player, do): + pass + + # Player can only exit the bug quest going back North. + # Player gets different messages the first time they + # exit this tile, depending on their direction. + def leave(self, player, direction): + restricted_directions = { 'w', 'e' } + if direction in restricted_directions: + print("The undergrowth in that direction " + "is impassable. You turn back.") + return False + elif direction == 's' and self.hasnt_gone_south: + print("Bugs are the enemy and must be crushed!\n" + "So you decide to follow the bug upstream.") + input() + self.first_visit = False + self.hasnt_gone_south = False + return True + else: + if self.first_visit: + print("Bugs do not interest you very much.\n" + "Lets get out of here.") + self.first_visit = False + input() + return True diff --git a/weatbag/tiles/s2.py b/weatbag/tiles/s2.py index 13b6d83..4e417d0 100644 --- a/weatbag/tiles/s2.py +++ b/weatbag/tiles/s2.py @@ -3,14 +3,27 @@ from weatbag import words class Tile: - def describe(self): - print("To the South, the foliage begins to thin and the path winds " - "forwards up a steep hillside. A rugged granite rockformation tops " - "the hill, its centerpiece two slabs of rock leaning together " - "to form a crude arch." ) - - def action(self, player, do): - # Nothing to do here yet. - print("Sorry, I don't understand") + def describe(self): + print("To the South, the foliage begins to thin and the path winds " + "forward up a steep hillside. A rugged granite rock formation tops " + "the hill, its centerpiece two slabs of rock leaning together " + "to form a crude arch." ) + + def action(self, player, do): + # Nothing to do here yet. + print("Sorry, I don't understand") + def leave(self, player, direction): + restricted_directions = { 'e' } + + # I placed this restriction here to prevent + # early entrance to the bug quest + # which should be started by going South from e1 + if direction in restricted_directions: + print("The undergrowth in that direction " + "is impassable. You turn back.") + return False + else: + return True + diff --git a/weatbag/tiles/s2e1.py b/weatbag/tiles/s2e1.py new file mode 100644 index 0000000..f09581f --- /dev/null +++ b/weatbag/tiles/s2e1.py @@ -0,0 +1,42 @@ +# Second and final bug quest tile. +# +# To future hackers: +# This is part of a short quest which beggins by +# going South from e1. Plase consider this when coding neighbouring tiles. +# thnx :) +from weatbag import words + +class Tile: + def __init__(self): + self.first_time = True + + def describe(self): + print("You have reached upstream." + "You see the bug.") + + def action(self, player, do): + if ('bug' in do) and ( do[0] in words.attack or + do[0] in words.look or + do[0] == 'crush' or + do[0] == 'fix' ): + print("Traceback (most recent call last):\n" + " File \"matrix.py\", line 97397, in <module>\n" + " main()\n" + " File \"slacking_off.py\", line 23934, in main\n" + " print(excuse[723])\n" + "IndexError: list index out of range") + input() + if self.first_time == True: + print("Suddenly, you realize!") + self.first_time = False + input() + print("It's not a bug, it's a feature!") + + def leave(self, player, direction): + restricted_directions = { 'w', 'e', 's' } + if direction in restricted_directions: + print("The undergrowth in that direction " + "is impassable. You turn back.") + return False + else: + return True diff --git a/weatbag/tiles/w1.py b/weatbag/tiles/w1.py index b880840..e68fc73 100644 --- a/weatbag/tiles/w1.py +++ b/weatbag/tiles/w1.py @@ -11,7 +11,7 @@ class Tile: def leave(self, player, direction): if direction=='w': - print("You've forgotten how to swim") + print("You've forgotten how to swim.") return False return True |
