Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. from random import randint
  2. from sys import exit
  3. """
  4. A adventure game called \" The dark rooms \"
  5. """
  6. class Scene(object):
  7. pass
  8.  
  9. class FirstRoom(Scene):
  10. #starting room, involves intro and choice of 2 doors to open.
  11. def enter(self):
  12. print "\t\t\t The dark rooms"
  13. print "\n\n You are in a role of a traveler named Charles. After searching for a mysterious dungeon"
  14. print "based on legends for several years you finally have found it. Here stands, right infront of you."
  15. print "You go trough and as the door closes you hear a loud noise. The door has dissapeared"
  16. print "In front of you there are two doors though. which one do you take?"
  17.  
  18. while True:
  19. door = raw_input("> ")
  20.  
  21. if door == "1":
  22. return 'armory'
  23. elif door == "2":
  24. return 'zombies'
  25. else:
  26. print "You must choose between 1 and 2"
  27.  
  28.  
  29. class RiddleScene(Scene):
  30. #A room where you have to guess a riddle correctly to pass. if answered wrong a combat scene happens.
  31. def enter(self):
  32. print "You have entered another room."
  33. print "Infront of you stands a very old man. He says:"
  34. print "To pass this room you must answer one of my riddles."
  35. #define riddles.
  36. a = "Something rotten that was once alive now is dead but yet it walks"
  37. b = "White on the outside, but dark on the inside"
  38. c = "A man in a dark coat who visits every man before his new journey to the unknown nothingness."
  39.  
  40. riddles = [a, b, c]
  41.  
  42. #choose riddle randomly, print it.
  43. riddle = riddles[randint(0,2)]
  44. print riddle
  45.  
  46. #get the answer and find out if it's correct or not.
  47. answer = raw_input("> ")
  48. x = answer.lower()
  49.  
  50. if riddle == a and answer.lower() == "zombie":
  51. print "The old man disapears and a door appears behind where he stood."
  52. return 'choice'
  53.  
  54. elif riddle == b and answer.lower() == "skeleton":
  55. print "The old man disapears and a door appears behind where he stood."
  56. return 'choice'
  57.  
  58. elif riddle == c and answer.lower() == "death":
  59. print "The old man disapears and a door appears behind where he stood."
  60. return 'choice'
  61.  
  62. elif x != "zombie" or "skeleton" or "death":
  63. print "The old man smiles and vanishes. A group of skeletons appear."
  64. return 'combat2'
  65.  
  66. class ZombieRoom(Scene):
  67. #just a story about the room, then sends to combat scene.
  68. def enter(self):
  69. print "You enter the second door. As you close the door it disapears again with the same noise."
  70. print "You are starting to regret this journey. All those years spent and this is the outcome:"
  71. print "being stuck in a dark cave with no idea how this is going to end... probably death..."
  72. print "How else could this end? Suddenly you hear groaning. You turn and see a zombie."
  73. return 'combat1'
  74.  
  75.  
  76. class Combat(Scene):
  77.  
  78. def __init__(self, next_room):
  79. self.next_room = next_room
  80. #combat scene, checks if you have sword or armor
  81. def enter(self):
  82. player_hp = 10
  83. undead_hp = 10
  84. armament = 0
  85. armament2 = 0
  86. if len(attributes) > 0:
  87. if attributes[0] == 'sword':
  88. armament += 1
  89. elif attributes[0] == 'armor':
  90. armament2 += 1
  91.  
  92. print 'Choose between "hit" and "dodge" each turn.'
  93.  
  94. while player_hp > 0 and undead_hp > 0:
  95. #players choice of combat.
  96. style = raw_input("> ")
  97. #hit does random damage from 1 to 3
  98. if style.lower() == "hit":
  99. x = randint(1, 3) + armament
  100. undead_hp -= x
  101. print 'Your opponent lost %d HP' % x
  102. #dodge does random damage from 0 to 1
  103. elif style.lower() == "dodge":
  104. x = randint(0, 1) + armament
  105. a = randint(1, 4)
  106. undead_hp -= x
  107. player_hp += a
  108. print "Your opponent lost %d HP and his next hit will be lessened by %d" % (x, a)
  109.  
  110. undead = randint(1, 2)
  111.  
  112. if undead == 1:
  113. x = randint(1, 3) - armament2
  114. player_hp -= x
  115. print "You lost %d HP" % x
  116. elif undead == 2:
  117. x = randint(0, 1) - armament2
  118. a = randint(1, 4)
  119. player_hp -= x
  120. undead_hp += a
  121. print "You lost %d HP and your next hit will be lessened by %d" % (x, a)
  122.  
  123. if undead_hp <= 0 and player_hp >= 0:
  124. return self.next_room
  125. elif undead_hp >= 0 and player_hp <= 0:
  126. return "death"
  127.  
  128. print "Your HP bar:" + "[]" * player_hp
  129. print "opponents HP bar:" + "[]" * undead_hp
  130.  
  131. attributes = []
  132.  
  133. class Armory(Scene):
  134.  
  135. def enter(self):
  136.  
  137. print "You have entered the Armory."
  138. print "You see alot of weapons."
  139. print "You can only carry either a sword. Armor reduces damage taken sword increases damage."
  140. print "which will you choose?"
  141.  
  142. choice = raw_input('> ')
  143. if choice.lower() == 'sword':
  144. attributes.append('sword')
  145. elif choice.lower() == 'armor':
  146. attributes.append('armor')
  147.  
  148. return 'someone'
  149.  
  150.  
  151. class Someone(Scene):
  152.  
  153. def enter(self):
  154. print "Another door, another room. This one is lit up well."
  155. print "In a coner of a room you see a small, tenous shaking figure."
  156. print "You go up to the coner and ask: \n\"what's your name?\""
  157. print '"Eimy"'
  158. print '"How did you end up here?"'
  159. print '"I don\'t remember. I woke up in this corner, I can\'t remember a thing."'
  160. print '"Ok, well i\'ll try to get us out of here.'
  161. print "You go trough the next door.. you wonder how many are there yet to open."
  162. return 'riddle'
  163.  
  164.  
  165.  
  166. class Sacrifice(Scene):
  167.  
  168. def enter(self):
  169. print "Another door done, another stands at the end of room."
  170. print "\"How much more are there?!\" you think."
  171. print "there seems to be nothing in the room. Just a single door at the end of the room."
  172. print "You go to the door. It has something written on it."
  173. print '"To pass this door there must be sacrifices made."'
  174. print '"To open I want the wine that flows inside of living."'
  175. print '"All that there is in it."'
  176. print "If alone you are theres no exit of here for you."
  177. print "If more than one you are choose who to sacrifice."
  178.  
  179. while True:
  180. choice = raw_input("> ")
  181. if choice == "myself":
  182. print "You cut your veins and bleed out. as last sigh you see Eimy laughing and disapearing."
  183. return 'death'
  184.  
  185. elif choice == "her":
  186. print "You cut trough her heart, hoping for an easy death for her."
  187. return 'end'
  188. else:
  189. print 'type "myself" or "her" as your choice.'
  190.  
  191. class End(Scene):
  192.  
  193. def enter(self):
  194. print "You open the door. You see the sun. \"finally\" you think to yourself."
  195. print "\t\t\t \"CONGRATULATIONS, YOU WON.\" "
  196.  
  197. class Death(Scene):
  198.  
  199.  
  200. def enter(self):
  201. print "This was your last journey."
  202. print "\t\t\t \"GAME OVER\" "
  203. exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement