# -*- coding: utf-8 -*-
#
# game1.py
#
# Copyright 2014 [email protected]
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
from random import randint
import webbrowser
import sys
import os
def restart_program():
"""Restarts the current program.
Note: this function does not return. Any cleanup action (like
saving data) must be done before calling this function."""
python = sys.executable
os.execl(python, python, * sys.argv)
money = 0
# b1
cask = 1
# b2
snkskn = 1
#
inventory = ["Stalk","Robes"]
name = raw_input("Name? ")
age = raw_input("Age? ")
race = raw_input("What is your race? Choose: Human, Elf, or Dwarf --> ")
profile = { "Name": name, "Age": age, "Race": race}
races = ("human","Human","elf","Elf","Dwarf","dwarf")
indexrace = races.index(race)
if indexrace >= 0:
print "So you are a %s named %s aged %s. You are an elder vampire lord. Godspeed!" % (race, name, age)
else:
print "You got it wrong bitch!"
quit(0)
if indexrace == 0 or indexrace == 1:
profile.update({"Health":100, "Magicka":80})
elif indexrace == 2 or indexrace == 3:
profile.update({"Health" : 60, "Magicka": 120})
else:
profile.update({"Health" : 120, "Magicka": 60})
print "Your starting health for race %s is %s and magicka is %s" % (race, profile["Health"], profile["Magicka"])
#for i in profile:
# print i, " : ", profile[i]
print "\nWelcome to the dungeon! Try to find your way to the Treasure Trove at the top of the tallest tower!"
def dead(why):
print why
print "You are dead!"
print "\nPlay again?"
ded = raw_input("y/n ---> ")
if ded == "y":
webbrowser.open("http://youtu.be/ZZ5LpwO-An4")
restart_program()
else:
webbrowser.open("http://youtu.be/ZZ5LpwO-An4")
quit(0)
def b1dungeon():
print "\nYou are in the very bottom of the castle, the lowest dungeon of dungeons. It smells of butts."
print "You have a black as night cloak, %d coins, and a wooden stalk." % money
print "You take a look around you. There is an upside down casket in the corner of the room surrounded by rats, and 2 doors left and right."
b1 = raw_input("\nWhat do you choose to do? Casket, Right, or Left.-----> ")
global cask
if b1 == "Casket" or b1 == "casket" and cask == 1:
print "\nYou chose to open the casket in the corner!"
print "You kick it over, BANG!"
print "IT'S A TRAP!"
print "You are sprayed with poison. Lose 20 health."
profile.update({"Health":profile["Health"]-20})
print "You now have %s health left." % profile["Health"]
cask = 0
b1dungeon()
elif b1 == "right" or b1 == "Right":
b1adungeon()
elif b1 == "left" or b1 == "Left":
b2dungeon()
elif b1 == "Casket" or b1 == "casket" and cask == 0:
print "\nYou have already tried this!"
b1dungeon()
else:
print "\nI do not understand this!"
b1dungeon()
def b1adungeon():
dead("When you walk into the room, you are instantly impaled by a thousand arrows.")
def b2dungeon():
global snkskn
if snkskn == 1:
print "\nYou enter a room with a set of stairs! You also see a snakeskin on the ground to pick up."
b2 = raw_input("Stairs or Snakeskin?----> ")
else:
print "\nYou enter a room with a set of stairs!"
b2 = raw_input("Stairs?----> ")
if b2 == "Stairs" or b2 == "stairs":
guardroom()
elif b2 == "Snakeskin" or b2 == "snakeskin" and snkskn == 1:
print "\nYou picked up the snakeskin!"
print "Snakeskin added to inventory!"
inventory.append("Snakeskin")
snkskn = 0
b2dungeon()
elif b2 == "Snakeskin" or b2 == "snakeskin" and snkskn == 0:
print "\nYou already picked that up!"
b2dungeon()
else:
print "\nI can't understand that!"
b2dungeon()
def guardroom():
global money
print """\nYou enter a room lit up faintly with candles.
There is a man clad in chainmail that appears to be the jailer at a corner table napping. You tip-toe
to a near barrel to hide behind before you make up your mind on
what you want to do."""
print "There is a door at the end of the room across from you and past the sleeping guard"
print "The door appears locked, but there is a ring of keys hanging off the jailer's hauberk."
print "There also appears to be a dagger laying on the table nearest the jailer, right behind him."
gr = raw_input("Steal keys, steal dagger, or tickle guard? -----> " )
if gr == "tickle" or gr == "tickle guard" or gr == "Tickle guard" or gr == "Tickle Guard":
dead("The guard wakes up and laughing, and swings his sword out of his scabbard to stab you.")
elif gr == "steal keys" or gr == "keys" or gr == "Steal keys":
print "\nYou quietly sneak the keys off the guards haukerk."
opndrgr = raw_input("Open door?---> ")
if opndrgr == "open" or opndrgr == "door" or opndrgr == "Open door" or opndrgr == "open door":
dragonroom()
else:
dead("You took too long to decide! Guard woke up an stabbed you from behind!")
elif gr == "steal dagger" or gr == "dagger" or gr == "Steal dagger":
print "\nYou steal the dagger. What now?"
inventory.append("Steel Dagger")
daggrgr = raw_input("Are you going to attack? y/n ---> ")
if daggrgr == "y" or daggrgr == "yes":
print "\nYou kill the man, and suck his blood. Gain 20 Health."
profile.update({"Health":profile["Health"]+20})
print "You now have %s Health" % profile["Health"]
print "You loot his body and find 30 coin!"
money += 30
print "Steel Dagger added to inventory!"
print "You take the key ring from his body."
krng = raw_input("Opening door now...[ENTER]")
dragonroom()
else:
print "\nYou did not attack. Guard woke up and attacked you instead."
dead("Stabbed in the heart by jailer.")
else:
print "/n I don't understand that!"
guardroom()
def dragonroom():
print "\nYou enter a room devoid of most light with a small, golden dragon statue in the center."
print "You walk up to the statue, and touch it."
print "SUDDENLY you hear a voice in the back of your mind -- 'STOP. What sayeth your name?'"
print "Uhhhh my name, sir. is...."
nam1 = raw_input("%s, Billy, or Jordan?---->" % name)
if nam1 == name or nam1 == name.lower():
print "'You tell the truth, young vampire. You may take this as my gift to you.'"
profile.update({"Nightvision":True})
print "\n*Nightvision enabled! You can no see in dark, dark places!*"
print "\nThe room lights up due to your new ability. You see a door ahead of you."
nam2 = raw_input("Walking to the door...[ENTER]")
towerstair()
else:
print "\n*SQUUEEEELLCCHHHHasdfgfhngfgbc*"
dead("Your head explodes due to a psychic force.")
def towerstair():
print "\nYou enter a room with a spiral staircase surrounding a magical elevator in the middle."
twrstr = raw_input("What do? Stairs, or elevator?----> ")
if twrstr == "Stairs" or twrstr == "stairs":
print "\nYou decide to head up the staircase!"
dead("A rolling boulder comes down as you reach the half-way mark.")
elif twrstr == "Elevator" or twrstr == "elevator":
print "You go up to the elevator, and walk onto the platform. There seems to be a random number game instead of buttons..."
elev = raw_input("Play game, or leave?----> ")
if elev == "Play game" or elev == "play" or elev == "game" or elev == "play game":
print "\nYou play the random number game! A number is going to be chosen between 0 and 3. If you can guess the number, you get a ride to the top! If not... uh-oh."
print "*ring ring ring ring*"
print "The number has been chosen."
rnd = randint(0, 3)
# DEBUG
#print rnd
#
chs = raw_input("What is your choice of number; 0, 1, 2, or 3?----> ")
if int(chs) == rnd:
print "\n*RING RING RING*"
print "You WIN!"
print "The Elevator ascends to the top of the tower."
goldroom()
else:
print "*...........BEEP!*"
print "You lose!"
dead("You were poisoned by a toxic gas!")
elif elev == "Leave" or elev == "leave":
print "\nYou leave the elevator."
towerstair()
else:
print "\nI can't understand that!"
towerstair()
def goldroom():
needmuch = randint(5000,100000)
print "\nYou exit the elevator and enter a room filled with gold!"
print "A voice in your head tells you that you should take %s amount, but it's your choice..." % needmuch
howmuch = raw_input("How much do you take?----> ")
if int(howmuch) == needmuch:
print "YOU WIN!"
webbrowser.open('http://youtu.be/oHg5SJYRHA0')
else:
dead("LISTen Here BITCH")
b1dungeon()
Comments