Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- '''
- Todo:
- -Finish game (duh)
- -Decrease lines of code used
- -Add newgame function
- -Add all hints
- -finish help
- '''
- version = "Alpha 0.2.1"
- #intro
- print("=< Mildwind by Ratchet Miles >=")
- print("\"You can't bring me down\" -Ratchet")
- print("Version: %s\n" % (version))
- #stats
- health = 100
- armor = 1
- strength = 1
- potion = 0
- attack = strength * 10
- hint = 3
- haskey = 0
- hasitems = 0
- stolen = 0
- #actual game
- name = input("Identify yourself\n>")
- #presets
- help = "Commands:\nPotion: add 50 health\n\nHint: tells you a hint when you're stuck. Note: You have a limited amount of hints.\n\nStats: Display your current stats, such as health.\n\nNewname: change your name.\n\nExit: quit the game."
- printhint = "You have %s hint(s) left."
- printnohint = "You currently don't have any hints to use."
- showstats = "=< STATS >=\nName: %s\nHealth: %s\nArmor: %s\nStrength: %s\nPotions: %s\nHints: %s"
- noentry = "Invalid entry. (Need help? Try 'hint' or 'help'.)"
- newnamen = "Name left unchanged"
- newnamey = "Your name is now %s"
- #part1
- print("You awaken in a dungeon. Behind you is a tiny barred window, and in front of you is a barred door. There is a prisoner in the cell across from you and a guard that marches back and forth in the hall.")
- while True:
- command = input(">").lower()
- if command == "hint":
- if hint > 0:
- hint = hint - 1
- randhint = ["Maybe the guard has something of use?", "Wait for something to happen?", "Maybe the prisoner has something to say?", "The door can be unlocked.", "I guess all you can do is bash your head against the wall."]
- print(random.choice(randhint))
- print(printhint % (hint))
- else:
- print(printnohint)
- elif command == "potion" or command == "use potion":
- if health == 100:
- print("You already have max health.")
- elif potion > 0 and health + 50 >= 100:
- potion = potion - 1
- health = 100
- print("Potion used. Your health is now %s" % (int(round(health))))
- elif potion > 0 and health + 50 <= 100:
- potion = potion - 1
- health = health + 50
- print("Potion used. Your health is now %s" % (int(round(health))))
- else:
- print("You don't have any potions to use.")
- elif command == "stats":
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- elif command == "help":
- print(help)
- elif command == "newname":
- newname = input("Please enter your new name\n>")
- while True:
- check = input("Are you sure (y/n)?\n>").lower()
- if check == "y":
- name = newname
- print(newnamey % (name))
- break
- elif check == "n":
- print(newnamen)
- break
- else:
- print(noentry)
- elif command == "exit" or command == "quit" or command == "kill" or command == "close":
- while True:
- check = input("Are you sure (y/n)?\n>").lower()
- if check == "y":
- quit()
- elif check == "n":
- break
- else:
- print(noentry)
- elif command == "bash head into wall" or command == "bang head into wall" or command == "bang head against wall" or command == "bash head against wall":
- if health > 0:
- health = health - (5 / armor)
- print("You bashed your head into the wall out of misery. It hurts a little.")
- else:
- print("You bashed your head to death out of misery.")
- print("\"Hopeless and Stupid\" ending")
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- input("You lose. Press enter to quit.")
- quit()
- elif command == "talk to prisoner":
- if hasitems >= 1:
- print("I have nothing else to say...")
- else:
- hasitems = 1
- potion = potion + 1
- print("Greetings %s, today is my last day alive... I must face my death sentence... Take this. It won't be of use to me in my afterlife." % (name))
- print("You were given a potion.")
- elif command == "wait":
- print("You hear a noise coming from the window, when suddenly, the wall breaks down. A man with a wooden metal-plated battering ram bashes the wall down. \"%s, We need your help, only you are capable of killing the dragon. No time to explain right now. Take these items.\"\nYou have been given a steel sword, cheap armor, and a scroll." % (name))
- strength = 4
- hint = hint + 1
- armor = 1.5
- print("Strength increased to 4, armor increased to 1.5, and a hint added.")
- break
- elif command == "pickpocket guard" or command == "steal" or command == "pickpocket" or command == "steal from guard":
- if stolen >= 1:
- print("The guard shouts \"Hey, I saw that!\" and shanks you for stealing.")
- health = health - (50 / armor)
- hint = hint - 1
- while True:
- if health > 0:
- break
- else:
- print("You were shanked to death.\n")
- print("\"Greedy\" ending")
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- input("You lose. Press enter to quit.")
- quit()
- else:
- print("As the guard passes by, you reach in his pocket and grabbed some items. You found a dagger, scroll, and key.")
- strength = 2
- hint = hint + 1
- haskey = 1
- stolen = 1
- print("Strength increased to 2, you obtained a key, and a hint added.")
- elif command == "open door" or command == "unlock door":
- if haskey >= 1:
- print("You open the door. The guard sees you and begins to run towards you. What do you do? (run/attack)")
- while True:
- choice = input(">")
- if choice == "run":
- print("As you run, a man came from behind and killed the guard. The man says \"Follow me %s\", and you ran to the exit." % (name))
- break
- elif choice == "attack":
- health = health - (50 / armor)
- print("You were stabbed by the guard. You lost some health.")
- while True:
- if health > 0:
- print("Maybe attacking isn't such a good idea.")
- break
- else:
- print("You were stabbed to death.\n")
- print("\"Failed Escape\" ending")
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- input("You lose. Press enter to quit.")
- quit()
- elif choice == "potion" or choice == "use potion":
- if potion > 0 and health + 50 >= 100:
- potion = potion - 1
- health = 100
- print("Potion used. Your health is now %s" % (int(round(health))))
- elif potion > 0 and health + 50 <= 100:
- potion = potion - 1
- health = health + 50
- print("Potion used. Your health is now %s" % (int(round(health))))
- else:
- print("You don't have any potions to use.")
- elif choice == "stats":
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- else:
- print(noentry)
- break
- else:
- print("You don't have a key.")
- else:
- print(noentry)
- #part2
- print("\nYou just escaped the dungeon, you meet the man who helped you escape. \"%s, you are the world's only hope of defeating the dragon Dracord. Dracord has risen from the dead thanks to a curse casted upon the world. My name is Ruffin and the prophecy says that you can save humanity, that is why I saved you.\"" % (name))
- hasitems = 0
- haskey = 0
- stolen = 0
- while True:
- command = input(">").lower()
- if command == "hint":
- if hint > 0:
- hint = hint - 1
- randhint = ["This is your chance you run free and be your own man", "You could follow Ruffin on his quest"]
- print(random.choice(randhint))
- print(printhint % (hint))
- else:
- print(printnohint)
- elif command == "potion" or command == "use potion":
- if health == 100:
- print("You already have max health.")
- elif potion > 0 and health + 50 >= 100:
- potion = potion - 1
- health = 100
- print("Potion used. Your health is now %s" % (int(round(health))))
- elif potion > 0 and health + 50 <= 100:
- potion = potion - 1
- health = health + 50
- print("Potion used. Your health is now %s" % (int(round(health))))
- else:
- print("You don't have any potions to use.")
- elif command == "stats":
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- elif command == "help":
- print(help)
- elif command == "newname":
- newname = input("Please enter your new name\n>")
- while True:
- check = input("Are you sure (y/n)?\n>").lower()
- if check == "y":
- name = newname
- print(newnamey % (name))
- break
- elif check == "n":
- print(newnamen)
- break
- else:
- print(noentry)
- elif command == "exit" or command == "quit" or command == "kill" or command == "close":
- while True:
- check = input("Are you sure (y/n)?\n>").lower()
- if check == "y":
- quit()
- elif check == "n":
- break
- else:
- print(noentry)
- elif command == "follow ruffin" or command == "follow":
- print("You follow Ruffin to the Dungeon that the dragon resides in.")
- break
- elif command == "run free":
- print("You are a free man now.")
- print("\"Careless\" ending")
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- input("You win. Press enter to quit.")
- quit()
- else:
- print(noentry)
- #part3
- print("\nYou have chosen to follow Ruffin. On your way to the cave that Dracord resides in, you are stopped by a pack of wolves.")
- packhealth = 100
- packdead = 0
- while True:
- command = input(">").lower()
- if command == "hint":
- if hint > 0:
- hint = hint - 1
- randhint = ["Try to fight your way out", "Once you've killed em off, maybe you can press forward"]
- print(random.choice(randhint))
- print(printhint % (hint))
- else:
- print(printnohint)
- elif command == "potion" or command == "use potion":
- if health == 100:
- print("You already have max health.")
- elif potion > 0 and health + 50 >= 100:
- potion = potion - 1
- health = 100
- print("Potion used. Your health is now %s" % (int(round(health))))
- elif potion > 0 and health + 50 <= 100:
- potion = potion - 1
- health = health + 50
- print("Potion used. Your health is now %s" % (int(round(health))))
- else:
- print("You don't have any potions to use.")
- elif command == "stats":
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- elif command == "help":
- print(help)
- elif command == "newname":
- newname = input("Please enter your new name\n>")
- while True:
- check = input("Are you sure (y/n)?\n>").lower()
- if check == "y":
- name = newname
- print(newnamey % (name))
- break
- elif check == "n":
- print(newnamen)
- break
- else:
- print(noentry)
- elif command == "exit" or command == "quit" or command == "kill" or command == "close":
- while True:
- check = input("Are you sure (y/n)?\n>").lower()
- if check == "y":
- quit()
- elif check == "n":
- break
- else:
- print(noentry)
- elif command == "attack" or command == "fight":
- enattack = [1, 2, 5]
- packhealth = packhealth - (attack + 15)
- health = health - (random.choice(enattack) / armor)
- if packdead == 1:
- print("You and Ruffin look at the dead wolf pack.")
- elif health <= 0:
- print("You were bitten to death.")
- print("\"THIS BITES!\" ending")
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- input("You lose. Press enter to quit.")
- quit()
- elif packhealth <= 0:
- packdead = 1
- potion = potion + 2
- print("You and Ruffin attacked the wolves. They are now dead, and you have a health of %s. You also picked up 2 potions." % (int(round(health))))
- elif packhealth > 0:
- print("You and Ruffin attacked the wolves. The wolves have a health of %s, and you have a health of %s." % (packhealth, int(round(health))))
- else:
- print("What did you do to get this message?")
- elif command == "run" or command == "continue" or command == "press forward":
- if packhealth > 0:
- health = health - (4 / armor)
- if health <= 0:
- print("You were killed by the pack of wolves.")
- print("\"Manbaby\" ending")
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- input("You lose. Press enter to quit.")
- quit()
- else:
- print("The wolves bit you in the back. Your health is now %s." % (int(round(health))))
- print("You can't leave until the wolves are dead.")
- else:
- print("You continue your journey to defeat Dracord.")
- break
- else:
- print(noentry)
- #end
- print(showstats % (name, int(round(health)), armor, strength, potion, hint))
- input("The game isn't done.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement