Guest User

dungeon_slayer

a guest
Feb 18th, 2019
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.81 KB | None | 0 0
  1. """
  2. This game is a text-based game that will run users through a series of events.
  3. The purpose of this game is to, successfully, get through all of the events and reach the
  4. amulet of time and space.
  5. """
  6.  
  7. import sys
  8.  
  9.  
  10. class RunGame:
  11.  
  12.     def __init__(self):
  13.         self.initial_start()
  14.         self.water_path()
  15.         self.dark_path()
  16.         self.battle_room()
  17.         self.final_room()
  18.         self.final_decision()
  19.         self.retry()
  20.  
  21.     def initial_start(self):
  22.  
  23.         print("Hello, young traveler. "
  24.               "I am the voice of reason to help you during your quest.")
  25.  
  26.         print("\nYou enter a dungeon and see two paths.")
  27.         print("The path on your left is well lit, but has water that is waist high.")
  28.         print("The path on your right is dark, but seems to be quite dry.")
  29.  
  30.         while True:
  31.             first_choice = input("\nPlease pick your starting direction (L/R): ").upper()
  32.  
  33.             if first_choice == "L":
  34.                 print("You have chosen the path that contains water, be weary of the dungeon"
  35.                       " crocodiles.")
  36.                 self.water_path()
  37.  
  38.             elif first_choice == "R":
  39.                 print("You have chosen the path of darkness, be weary of dungeon bats.")
  40.                 self.dark_path()
  41.  
  42.             else:
  43.                 print("please enter either 'L' or 'R'.")
  44.  
  45.     def water_path(self):
  46.         print("\nYou move through the water slowly only to see a right turn ahead.")
  47.  
  48.         while True:
  49.             water_choice_options = input("\nDo you take the path on the right (R) or continue straight (S) "
  50.                                          "(R/S)?: ").upper()
  51.             if water_choice_options == "R":
  52.                 print("You see a long corridor with a light at the end. You continue "
  53.                       "toward the light.")
  54.                 self.battle_room()
  55.  
  56.             elif water_choice_options == "S":
  57.                 print("You meet your demise at the hands of a dungeon crocodile.")
  58.                 self.retry()
  59.  
  60.             else:
  61.                 print("Please enter either 'R' or 'S'.")
  62.  
  63.     def dark_path(self):
  64.         print("\nYou continue down the dark path, ahead you see a corridor to your left.")
  65.         dark_choice_option = input("\nDo you continue straight down the dark corridor (S) or do you turn left down "
  66.                                    "the corridor (L) (L/S)?: ").upper()
  67.         while True:
  68.             if dark_choice_option == "L":
  69.                 print("You see a long corridor with a light at the end. You continue "
  70.                       "toward the light.")
  71.                 self.battle_room()
  72.  
  73.             elif dark_choice_option == "S":
  74.                 print("You have met you demise at the hands of a half man, half bat hybrid.")
  75.                 self.retry()
  76.  
  77.             else:
  78.                 print("Please enter either 'L' or 'S'.")
  79.  
  80.     def battle_room(self):
  81.         print("\nYou follow the light and enter a large room.")
  82.         print("Upon entering the room you are met by three large enemies.")
  83.         print("Before battle you see a large sword and shield.")
  84.         while True:
  85.             battle_room_options = input("\nDo you pick the sword and shield up and fight (F) or do you run (R) "
  86.                                         "(F/R)?: ").upper()
  87.             if battle_room_options == "F":
  88.                 print("Your training has paid off, you have defeated the enemies.")
  89.                 self.final_room()
  90.  
  91.             elif battle_room_options == "R":
  92.                 print("You're slower than you look, the enemies make waste of you.")
  93.                 self.retry()
  94.  
  95.             else:
  96.                 print("Please enter either 'F' or 'R'.")
  97.  
  98.     def final_room(self):
  99.         print("\nAfter defeating the enemies, you see a large set of wooden doors.")
  100.         print("You push through the doors to see the amulet of time before you on a stone podium.")
  101.         print("As you step closer you see the dark wizard who guards the amulet of time.")
  102.  
  103.         while True:
  104.             final_battle = input("\nDo you choose to initiate battle (B) with the wizard or do you try and reason (R) "
  105.                                  "with him (F/R)?: ").upper()
  106.  
  107.             if final_battle == "F":
  108.                 print("You come to battle with only a sword and shield and actually expected to win? Regardless you "
  109.                       "are now a toad.")
  110.                 self.retry()
  111.  
  112.             elif final_battle == "R":
  113.                 print("Turns out the wizard was a nice guy and you two exchange contact information to catch lunch "
  114.                       "later, he gives you the amulet as a gift.")
  115.                 self.final_decision()
  116.  
  117.             else:
  118.                 print("Please enter either 'F' or 'R'.")
  119.  
  120.     def final_decision(self):
  121.         last_decision = input("You have now collected the amulet and even gained a 'bestie' do you choose to use the "
  122.                               "amulet of time (U) or do you choose to 'call it a day' (Q) (U/Q)?: ").upper()
  123.  
  124.         if last_decision == "U":
  125.             print("\nFool! You do not know how to use the amulet... of... ti...")
  126.             self.initial_start()
  127.  
  128.         elif last_decision == "Q":
  129.             print("\nYou deserve a day off, thank you for completing the quest. Happy travels!")
  130.             sys.exit()
  131.  
  132.         else:
  133.             print("Please enter either 'U' or 'Q'.")
  134.  
  135.     @staticmethod
  136.     def retry():
  137.         while True:
  138.             restart = input("\nWould you like to begin your quest again (Y/N)?: ").upper()
  139.             if restart == "Y":
  140.                 RunGame()
  141.             elif restart == "N":
  142.                 print("Thanks for playing!")
  143.                 sys.exit()
  144.             else:
  145.                 print("Please enter either 'Y' or 'N'.")
  146.  
  147.  
  148. RunGame()
Advertisement
Add Comment
Please, Sign In to add comment