Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- from sys import exit
- """
- A adventure game called \" The dark rooms \"
- """
- class Scene(object):
- pass
- class FirstRoom(Scene):
- #starting room, involves intro and choice of 2 doors to open.
- def enter(self):
- print "\t\t\t The dark rooms"
- print "\n\n You are in a role of a traveler named Charles. After searching for a mysterious dungeon"
- print "based on legends for several years you finally have found it. Here stands, right infront of you."
- print "You go trough and as the door closes you hear a loud noise. The door has dissapeared"
- print "In front of you there are two doors though. which one do you take?"
- while True:
- door = raw_input("> ")
- if door == "1":
- return 'armory'
- elif door == "2":
- return 'zombies'
- else:
- print "You must choose between 1 and 2"
- class RiddleScene(Scene):
- #A room where you have to guess a riddle correctly to pass. if answered wrong a combat scene happens.
- def enter(self):
- print "You have entered another room."
- print "Infront of you stands a very old man. He says:"
- print "To pass this room you must answer one of my riddles."
- #define riddles.
- a = "Something rotten that was once alive now is dead but yet it walks"
- b = "White on the outside, but dark on the inside"
- c = "A man in a dark coat who visits every man before his new journey to the unknown nothingness."
- riddles = [a, b, c]
- #choose riddle randomly, print it.
- riddle = riddles[randint(0,2)]
- print riddle
- #get the answer and find out if it's correct or not.
- answer = raw_input("> ")
- x = answer.lower()
- if riddle == a and answer.lower() == "zombie":
- print "The old man disapears and a door appears behind where he stood."
- return 'choice'
- elif riddle == b and answer.lower() == "skeleton":
- print "The old man disapears and a door appears behind where he stood."
- return 'choice'
- elif riddle == c and answer.lower() == "death":
- print "The old man disapears and a door appears behind where he stood."
- return 'choice'
- elif x != "zombie" or "skeleton" or "death":
- print "The old man smiles and vanishes. A group of skeletons appear."
- return 'combat2'
- class ZombieRoom(Scene):
- #just a story about the room, then sends to combat scene.
- def enter(self):
- print "You enter the second door. As you close the door it disapears again with the same noise."
- print "You are starting to regret this journey. All those years spent and this is the outcome:"
- print "being stuck in a dark cave with no idea how this is going to end... probably death..."
- print "How else could this end? Suddenly you hear groaning. You turn and see a zombie."
- return 'combat1'
- class Combat(Scene):
- def __init__(self, next_room):
- self.next_room = next_room
- #combat scene, checks if you have sword or armor
- def enter(self):
- player_hp = 10
- undead_hp = 10
- armament = 0
- armament2 = 0
- if len(attributes) > 0:
- if attributes[0] == 'sword':
- armament += 1
- elif attributes[0] == 'armor':
- armament2 += 1
- print 'Choose between "hit" and "dodge" each turn.'
- while player_hp > 0 and undead_hp > 0:
- #players choice of combat.
- style = raw_input("> ")
- #hit does random damage from 1 to 3
- if style.lower() == "hit":
- x = randint(1, 3) + armament
- undead_hp -= x
- print 'Your opponent lost %d HP' % x
- #dodge does random damage from 0 to 1
- elif style.lower() == "dodge":
- x = randint(0, 1) + armament
- a = randint(1, 4)
- undead_hp -= x
- player_hp += a
- print "Your opponent lost %d HP and his next hit will be lessened by %d" % (x, a)
- undead = randint(1, 2)
- if undead == 1:
- x = randint(1, 3) - armament2
- player_hp -= x
- print "You lost %d HP" % x
- elif undead == 2:
- x = randint(0, 1) - armament2
- a = randint(1, 4)
- player_hp -= x
- undead_hp += a
- print "You lost %d HP and your next hit will be lessened by %d" % (x, a)
- if undead_hp <= 0 and player_hp >= 0:
- return self.next_room
- elif undead_hp >= 0 and player_hp <= 0:
- return "death"
- print "Your HP bar:" + "[]" * player_hp
- print "opponents HP bar:" + "[]" * undead_hp
- attributes = []
- class Armory(Scene):
- def enter(self):
- print "You have entered the Armory."
- print "You see alot of weapons."
- print "You can only carry either a sword. Armor reduces damage taken sword increases damage."
- print "which will you choose?"
- choice = raw_input('> ')
- if choice.lower() == 'sword':
- attributes.append('sword')
- elif choice.lower() == 'armor':
- attributes.append('armor')
- return 'someone'
- class Someone(Scene):
- def enter(self):
- print "Another door, another room. This one is lit up well."
- print "In a coner of a room you see a small, tenous shaking figure."
- print "You go up to the coner and ask: \n\"what's your name?\""
- print '"Eimy"'
- print '"How did you end up here?"'
- print '"I don\'t remember. I woke up in this corner, I can\'t remember a thing."'
- print '"Ok, well i\'ll try to get us out of here.'
- print "You go trough the next door.. you wonder how many are there yet to open."
- return 'riddle'
- class Sacrifice(Scene):
- def enter(self):
- print "Another door done, another stands at the end of room."
- print "\"How much more are there?!\" you think."
- print "there seems to be nothing in the room. Just a single door at the end of the room."
- print "You go to the door. It has something written on it."
- print '"To pass this door there must be sacrifices made."'
- print '"To open I want the wine that flows inside of living."'
- print '"All that there is in it."'
- print "If alone you are theres no exit of here for you."
- print "If more than one you are choose who to sacrifice."
- while True:
- choice = raw_input("> ")
- if choice == "myself":
- print "You cut your veins and bleed out. as last sigh you see Eimy laughing and disapearing."
- return 'death'
- elif choice == "her":
- print "You cut trough her heart, hoping for an easy death for her."
- return 'end'
- else:
- print 'type "myself" or "her" as your choice.'
- class End(Scene):
- def enter(self):
- print "You open the door. You see the sun. \"finally\" you think to yourself."
- print "\t\t\t \"CONGRATULATIONS, YOU WON.\" "
- class Death(Scene):
- def enter(self):
- print "This was your last journey."
- print "\t\t\t \"GAME OVER\" "
- exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement