Advertisement
Joe_McBobski

Clyocurf

Jun 21st, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 11.55 KB | None | 0 0
  1. # Imports necessary modules
  2.  
  3. from sys import exit
  4.  
  5. # Technical
  6. # Defines formulaic functions (pause, death, etc.)
  7.  
  8. money = 50
  9. def pause():
  10.     """Waits until the user presses enter to continue the story."""
  11.     pause = raw_input("Press enter to continue") # Cheatcodes?
  12.    
  13.    
  14. # Should all elses use this?    
  15. def badchoice(b):
  16.     """Kills player for not choosing a listed option. ALso used for debug purposes."""
  17.     print "Unfortunately, %s is not an available option." % b
  18.     die("God", "being a smartass.")
  19.  
  20. def die(a, b):
  21.     """The thing, a, kills the player for the reason, b."""
  22.     print "%s kills you for %s" % (a, b)
  23.     exit
  24.  
  25. # I'm pretty sure this can be done better. Requires some revision in later versions.
  26. def lwd():
  27.     """defines the choice list for the woods."""
  28.     global a
  29.     a = ["straight", "straight", "back", "back", "left", "right", "left"]
  30.  
  31. def dvilchoices():
  32.     dvillage = raw_input("You decide to go towards the ")
  33.     #Future versions may allow for the user to try again when they make an invalid choice, instead of killing them.
  34.     if "statue" in dvillage or "man" in dvillage or "fountain" in dvillage:
  35.         dvilman()
  36.     elif "door" in dvillage:
  37.         dvildoor()
  38.     elif "CLYOCURF" in dvillage:
  39.         shop()
  40.     else:
  41.         badchoice(dvillage)
  42. # Plot
  43. # Defines plot functions (points in story)
  44.  
  45. # Note: In future versions, use database for walls of text. this == hard to scroll.
  46. def dvillage():
  47.     """takes you to the dwarf village section of the game"""
  48.     pause()
  49.     print "\tYou notice three available paths. The first path leads to a similarly-sloped spiraled path leading out of the village, in the other direction. A thin shaft of light shines from the door at the end, which seems as if it was opened but never shut. The light lands in the middle of a small garden in the center of the town, illuminating an ornate, stone fountain that lacks water. On the sides of the fountain, images of people can be seen carved into the rock of the fountain, or shaped into pieces of metal. The fountain seems to depict a history, with various sections carved into different metals. One side is dark, making it difficult to see the figures carved onto that side. Resting next to the fountain is what looks like a stone statue of an old, wizened man locked in a pose of contemplation.\n\tThe second path you see leads towards the center of the town, where the statue and the fountain sit. The final path leads from the fountain to a stone building, with large glass windows and objects behind them. The letters CLYOCURF seem to be carved into the wall above the building. It appears to be a shop, with various merchandise on display. You decide to call it the CLYOCURF."
  50.     dvilchoices()
  51.  
  52. def dvilman():
  53.     """Starts a conversation with the old dwarf in the village"""
  54.     print "\tYou approach the fountain, and begin to admire its splendor. It would be pretty great if it had some water. And if you could see the other side. You decide that this calls for additional investigation, but now is probably not the time." # TO-DO: add a puzzle that uses the fountain and the doors.
  55.     pause()
  56.     print "\tSuddenly, you hear a grunt from behind you. The statue depicting an old man has moved. You proceed towards the statue, and it begins to speak. It goes into a long, lengthy story about how he was the last of a race of dwarves and that you need to go destroy a crystal or something equally cliched to save everyone. He tells you that if you want to save everyone, you must take the right path. He also recommends you check out the clyocurf for some better defenses, but you assume that he just wants your money. After all, everything could technically belong to him, right?\n\tYou can go to the clyocurf or the door."
  57.     global quest1
  58.     quest1 = True
  59.     dvillage2 = raw_input("After hearing his lengthy story, you decide to go towards the ")
  60.     if "clyocurf" in dvillage2:
  61.         shop()
  62.     elif "door" in dvillage2:
  63.         dvildoor()
  64.     else:
  65.         badchoice(dvillage2)
  66.  
  67. def dvildoor():
  68.     print "\tYou come to a large door."
  69.     if quest1 == True:
  70.         print "The door creaks open, allowing you to walk out into the sunlight beyond. You come to a long road, stretching in two different directions. You can go back to the village, or continue forward along the road."
  71.         rdirection = raw_input("You decide to go ")
  72.         if rdirection == "forward":
  73.             print "You continue along the path."
  74.             plotdevbattle()
  75.         else:
  76.             print "You decide to head back to the village."
  77.             dvilchoices()
  78.     else:
  79.         print "You think about going through the door, but decide to turn back."
  80.         dvilchoices()
  81.        
  82. def plotdevbattle():
  83.     print "Suddenly, a wild plot development appears! The plot development attacks."
  84.     if defense == True:
  85.         print "The plot development does no damage. Guess your armor was just that strong."
  86.         print "You smack the plot development hard on the head with your shield. It falls to the ground, dead."
  87.         pause()
  88.         print "Congratulations! You have killed the plot! Now here's the end of the game."
  89.         print "You come to a large forest, similar to the one you came to at the start of the game. In fact, it might just be the forest at the start of the game. You're coming on from a different side, though."
  90.         lwoods("end")        
  91.        
  92. def shop():
  93.     if quest1 != True:
  94.         print "You have no money!"
  95.     else:
  96.         print "\tWhen you enter the clyocurf, the first thing you notice is that there is a weak light coming from the ceiling. You can't seem to identify the source of the light, however. You notice a table at the end farthest from the window, with two large, rusted metal boxes lying on it. \n\tAfter close examination, you notice that the boxes rest on large plates, probably part of a counterweight system. There is a small bowl sitting besides the boxes, bearing a number, probably the price of each box. You check your pockets. Just enough to buy one of the boxes. The one on the left has a picture of a shield covering the front face, while the other bears an image of a sword. You realize you have just enough money for one of the two."
  97.         shop = raw_input("You decide to ")
  98.         global defense
  99.         global offense
  100.         if "buy" in shop:
  101.             if "shield" in shop:
  102.                 print "You take the box with the shield, leaving your money in the bowl. You have no more money left."
  103.                 global defense
  104.                 defense = True
  105.             elif "sword" in shop:
  106.                 print "Yo take the box with the sword, leaving your money in the bowl. You have no more money left."
  107.                 offense = True
  108.             else:
  109.                 badchoice(shop)
  110.         elif "steal" in shop:
  111.             if "shield" in shop:
  112.                 print "You take the box with the shield."
  113.                 global defense
  114.                 defense = True
  115.             elif "sword" in shop:
  116.                 print "You take the box with the sword."
  117.                 offense = True
  118.             else:
  119.                 badchoice(shop)
  120.                 print "Before you exit the clyocurf, a metal mesh slides over the door to it."
  121.                 if offense == True:
  122.                     print "You manage to destroy the mesh with your sword, and proceed out of the shop."
  123.                 elif defense == True:
  124.                     print "Since you bought a box of armor, it is impossible for you to get out of the shop."
  125.                     die("your body", "starving to death")
  126.         else:
  127.             bachoice(shop)
  128.     print "You exit the shop, coming back to the center of the village."
  129.     dvilchoices()        
  130. # The current layout might lead to a file with only one function. Some revision may be required.
  131. def start():
  132.     """Starts the game"""
  133.     global offense
  134.     global defense
  135.     global  quest1
  136.     offense = False
  137.     quest1 = False
  138.     defense = False
  139.     print "\tThere are two paths leading out of the clearing. The northern path leads winds away towards the mountains, while the southern path leads deep into the forest."
  140.     path = raw_input("You decide to go ")
  141.     if path == "north":
  142.         print "\tYour travel is uneventful, which you find strange, as the road seems to be well-worn and indicating that many travellers have passed through here. You eventually come to a large rock wall. You consider climbing the wall, however you find it almost completely smooth and devoid of handholds. You have nothing that can help you."
  143.         pause()
  144.         print "\tYou decide to turn back, however the sound of something behind you draws your attention. A shifting, as if of stone, and the flowing of water can be vaguely heard. You watch as the stone wall shifts aside, revealing a cave with a sloping path overlooking and leading into a small town, the buildings seemingly carved into the walls and enormous stalagmites of the cave. Through the center of the city runs a shallow stream, a small bridge in the center of the town allowing access over it. You head down the path, coming to a large road through the middle of the city."
  145.         dvillage()
  146.     elif path == "south":
  147.         print "You come to the entrance of the forest, and find three available paths."
  148.         lwoods(0)
  149.     elif path == "magic_flute":
  150.         print "You play the magic flute and come to the warp zone."
  151.         print "1: start. 2: village. 3: man. 4: woods. 5: end. 6: shop."
  152.         warp = raw_input()
  153.         if warp == "1":
  154.             start()
  155.         elif warp == "2":
  156.             dvillage()
  157.         elif warp == "3":
  158.             dvilman()
  159.         elif warp == "4":
  160.             lwoods(0)
  161.         elif warp == "5":
  162.             lwoods("end")
  163.         elif warp == "6":
  164.             shop()
  165.         else:
  166.             exit
  167.     else:
  168.         badchoice(path)
  169.        
  170. # Lost woods part of story. Should this be in the technical functions?
  171. def lwoods(s):
  172.     """Runs the woods part of the plotline."""
  173.     if s == "end":
  174.         print "You enter a section of the woods that seems extremely close to the center. It is very dark, and you can barely make out the different paths. There seems to be a left, right, and straight path."
  175.         p = raw_input("You decide to go ")
  176.         if "right" in p: # Can this be done better?
  177.             print "You come to a large black crystal, that seems to be engulfed in a strange purple flame. You have the strange compulsion to kick it."
  178.             pause()
  179.             print "You do as such. The crystal violently explodes. An old man approaches you, and thanks you for freeing his people."
  180.             pause()
  181.             print "Congratulations. You have won."
  182.             exit
  183.         else:
  184.             die("A wolf", "being something other than a bear.")
  185.     else:
  186.         lwd()
  187.         global bearattack
  188.         bearattack = False
  189.         for q in a:
  190.             global f
  191.             f = q
  192.             print "You can go left, right, or straight. You can also choose to go back. Choosing the path with the bear looks particularly foreboding."
  193.             lw = raw_input("You decide to go ")
  194.             if lw != f:
  195.                 bearattack = True
  196.             else:
  197.         if bearattack == True:
  198.             print "You run straight into a large, angry bear."
  199.             die("The bear", "being there when it was hungry.")
  200.         else:
  201.             lwoods("end")
  202. print "You awake in a wide clearing. You don't know how you got here, and your head hurts a little. There is nothing else in sight for miles, besides a small road that you are lying beside."
  203. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement