Advertisement
Guest User

Mildwind

a guest
Mar 13th, 2015
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.11 KB | None | 0 0
  1. import random
  2.  
  3. '''
  4. Todo:
  5. -Finish game (duh)
  6. -Decrease lines of code used
  7. -Add newgame function
  8. -Add all hints
  9. -finish help
  10. '''
  11.  
  12. version = "Alpha 0.2.1"
  13.  
  14. #intro
  15. print("=< Mildwind by Ratchet Miles >=")
  16. print("\"You can't bring me down\" -Ratchet")
  17. print("Version: %s\n" % (version))
  18.  
  19. #stats
  20. health = 100
  21. armor = 1
  22. strength = 1
  23. potion = 0
  24. attack = strength * 10
  25. hint = 3
  26. haskey = 0
  27. hasitems = 0
  28. stolen = 0
  29.  
  30. #actual game
  31. name = input("Identify yourself\n>")
  32.  
  33. #presets
  34. 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."
  35. printhint = "You have %s hint(s) left."
  36. printnohint = "You currently don't have any hints to use."
  37. showstats = "=< STATS >=\nName: %s\nHealth: %s\nArmor: %s\nStrength: %s\nPotions: %s\nHints: %s"
  38. noentry = "Invalid entry. (Need help? Try 'hint' or 'help'.)"
  39. newnamen = "Name left unchanged"
  40. newnamey = "Your name is now %s"
  41.  
  42. #part1
  43. 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.")
  44. while True:
  45. command = input(">").lower()
  46. if command == "hint":
  47. if hint > 0:
  48. hint = hint - 1
  49. 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."]
  50. print(random.choice(randhint))
  51. print(printhint % (hint))
  52. else:
  53. print(printnohint)
  54. elif command == "potion" or command == "use potion":
  55. if health == 100:
  56. print("You already have max health.")
  57. elif potion > 0 and health + 50 >= 100:
  58. potion = potion - 1
  59. health = 100
  60. print("Potion used. Your health is now %s" % (int(round(health))))
  61. elif potion > 0 and health + 50 <= 100:
  62. potion = potion - 1
  63. health = health + 50
  64. print("Potion used. Your health is now %s" % (int(round(health))))
  65. else:
  66. print("You don't have any potions to use.")
  67. elif command == "stats":
  68. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  69. elif command == "help":
  70. print(help)
  71. elif command == "newname":
  72. newname = input("Please enter your new name\n>")
  73. while True:
  74. check = input("Are you sure (y/n)?\n>").lower()
  75. if check == "y":
  76. name = newname
  77. print(newnamey % (name))
  78. break
  79. elif check == "n":
  80. print(newnamen)
  81. break
  82. else:
  83. print(noentry)
  84. elif command == "exit" or command == "quit" or command == "kill" or command == "close":
  85. while True:
  86. check = input("Are you sure (y/n)?\n>").lower()
  87. if check == "y":
  88. quit()
  89. elif check == "n":
  90. break
  91. else:
  92. print(noentry)
  93. elif command == "bash head into wall" or command == "bang head into wall" or command == "bang head against wall" or command == "bash head against wall":
  94. if health > 0:
  95. health = health - (5 / armor)
  96. print("You bashed your head into the wall out of misery. It hurts a little.")
  97. else:
  98. print("You bashed your head to death out of misery.")
  99. print("\"Hopeless and Stupid\" ending")
  100. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  101. input("You lose. Press enter to quit.")
  102. quit()
  103. elif command == "talk to prisoner":
  104. if hasitems >= 1:
  105. print("I have nothing else to say...")
  106. else:
  107. hasitems = 1
  108. potion = potion + 1
  109. 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))
  110. print("You were given a potion.")
  111. elif command == "wait":
  112. 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))
  113. strength = 4
  114. hint = hint + 1
  115. armor = 1.5
  116. print("Strength increased to 4, armor increased to 1.5, and a hint added.")
  117. break
  118. elif command == "pickpocket guard" or command == "steal" or command == "pickpocket" or command == "steal from guard":
  119. if stolen >= 1:
  120. print("The guard shouts \"Hey, I saw that!\" and shanks you for stealing.")
  121. health = health - (50 / armor)
  122. hint = hint - 1
  123. while True:
  124. if health > 0:
  125. break
  126. else:
  127. print("You were shanked to death.\n")
  128. print("\"Greedy\" ending")
  129. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  130. input("You lose. Press enter to quit.")
  131. quit()
  132. else:
  133. print("As the guard passes by, you reach in his pocket and grabbed some items. You found a dagger, scroll, and key.")
  134. strength = 2
  135. hint = hint + 1
  136. haskey = 1
  137. stolen = 1
  138. print("Strength increased to 2, you obtained a key, and a hint added.")
  139. elif command == "open door" or command == "unlock door":
  140. if haskey >= 1:
  141. print("You open the door. The guard sees you and begins to run towards you. What do you do? (run/attack)")
  142. while True:
  143. choice = input(">")
  144. if choice == "run":
  145. 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))
  146. break
  147. elif choice == "attack":
  148. health = health - (50 / armor)
  149. print("You were stabbed by the guard. You lost some health.")
  150. while True:
  151. if health > 0:
  152. print("Maybe attacking isn't such a good idea.")
  153. break
  154. else:
  155. print("You were stabbed to death.\n")
  156. print("\"Failed Escape\" ending")
  157. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  158. input("You lose. Press enter to quit.")
  159. quit()
  160. elif choice == "potion" or choice == "use potion":
  161. if potion > 0 and health + 50 >= 100:
  162. potion = potion - 1
  163. health = 100
  164. print("Potion used. Your health is now %s" % (int(round(health))))
  165. elif potion > 0 and health + 50 <= 100:
  166. potion = potion - 1
  167. health = health + 50
  168. print("Potion used. Your health is now %s" % (int(round(health))))
  169. else:
  170. print("You don't have any potions to use.")
  171. elif choice == "stats":
  172. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  173. else:
  174. print(noentry)
  175. break
  176. else:
  177. print("You don't have a key.")
  178. else:
  179. print(noentry)
  180.  
  181. #part2
  182. 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))
  183. hasitems = 0
  184. haskey = 0
  185. stolen = 0
  186. while True:
  187. command = input(">").lower()
  188. if command == "hint":
  189. if hint > 0:
  190. hint = hint - 1
  191. randhint = ["This is your chance you run free and be your own man", "You could follow Ruffin on his quest"]
  192. print(random.choice(randhint))
  193. print(printhint % (hint))
  194. else:
  195. print(printnohint)
  196. elif command == "potion" or command == "use potion":
  197. if health == 100:
  198. print("You already have max health.")
  199. elif potion > 0 and health + 50 >= 100:
  200. potion = potion - 1
  201. health = 100
  202. print("Potion used. Your health is now %s" % (int(round(health))))
  203. elif potion > 0 and health + 50 <= 100:
  204. potion = potion - 1
  205. health = health + 50
  206. print("Potion used. Your health is now %s" % (int(round(health))))
  207. else:
  208. print("You don't have any potions to use.")
  209. elif command == "stats":
  210. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  211. elif command == "help":
  212. print(help)
  213. elif command == "newname":
  214. newname = input("Please enter your new name\n>")
  215. while True:
  216. check = input("Are you sure (y/n)?\n>").lower()
  217. if check == "y":
  218. name = newname
  219. print(newnamey % (name))
  220. break
  221. elif check == "n":
  222. print(newnamen)
  223. break
  224. else:
  225. print(noentry)
  226. elif command == "exit" or command == "quit" or command == "kill" or command == "close":
  227. while True:
  228. check = input("Are you sure (y/n)?\n>").lower()
  229. if check == "y":
  230. quit()
  231. elif check == "n":
  232. break
  233. else:
  234. print(noentry)
  235. elif command == "follow ruffin" or command == "follow":
  236. print("You follow Ruffin to the Dungeon that the dragon resides in.")
  237. break
  238. elif command == "run free":
  239. print("You are a free man now.")
  240. print("\"Careless\" ending")
  241. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  242. input("You win. Press enter to quit.")
  243. quit()
  244. else:
  245. print(noentry)
  246.  
  247. #part3
  248. 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.")
  249. packhealth = 100
  250. packdead = 0
  251. while True:
  252. command = input(">").lower()
  253. if command == "hint":
  254. if hint > 0:
  255. hint = hint - 1
  256. randhint = ["Try to fight your way out", "Once you've killed em off, maybe you can press forward"]
  257. print(random.choice(randhint))
  258. print(printhint % (hint))
  259. else:
  260. print(printnohint)
  261. elif command == "potion" or command == "use potion":
  262. if health == 100:
  263. print("You already have max health.")
  264. elif potion > 0 and health + 50 >= 100:
  265. potion = potion - 1
  266. health = 100
  267. print("Potion used. Your health is now %s" % (int(round(health))))
  268. elif potion > 0 and health + 50 <= 100:
  269. potion = potion - 1
  270. health = health + 50
  271. print("Potion used. Your health is now %s" % (int(round(health))))
  272. else:
  273. print("You don't have any potions to use.")
  274. elif command == "stats":
  275. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  276. elif command == "help":
  277. print(help)
  278. elif command == "newname":
  279. newname = input("Please enter your new name\n>")
  280. while True:
  281. check = input("Are you sure (y/n)?\n>").lower()
  282. if check == "y":
  283. name = newname
  284. print(newnamey % (name))
  285. break
  286. elif check == "n":
  287. print(newnamen)
  288. break
  289. else:
  290. print(noentry)
  291. elif command == "exit" or command == "quit" or command == "kill" or command == "close":
  292. while True:
  293. check = input("Are you sure (y/n)?\n>").lower()
  294. if check == "y":
  295. quit()
  296. elif check == "n":
  297. break
  298. else:
  299. print(noentry)
  300. elif command == "attack" or command == "fight":
  301. enattack = [1, 2, 5]
  302. packhealth = packhealth - (attack + 15)
  303. health = health - (random.choice(enattack) / armor)
  304. if packdead == 1:
  305. print("You and Ruffin look at the dead wolf pack.")
  306. elif health <= 0:
  307. print("You were bitten to death.")
  308. print("\"THIS BITES!\" ending")
  309. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  310. input("You lose. Press enter to quit.")
  311. quit()
  312. elif packhealth <= 0:
  313. packdead = 1
  314. potion = potion + 2
  315. 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))))
  316. elif packhealth > 0:
  317. 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))))
  318. else:
  319. print("What did you do to get this message?")
  320. elif command == "run" or command == "continue" or command == "press forward":
  321. if packhealth > 0:
  322. health = health - (4 / armor)
  323. if health <= 0:
  324. print("You were killed by the pack of wolves.")
  325. print("\"Manbaby\" ending")
  326. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  327. input("You lose. Press enter to quit.")
  328. quit()
  329. else:
  330. print("The wolves bit you in the back. Your health is now %s." % (int(round(health))))
  331. print("You can't leave until the wolves are dead.")
  332. else:
  333. print("You continue your journey to defeat Dracord.")
  334. break
  335. else:
  336. print(noentry)
  337.  
  338. #end
  339. print(showstats % (name, int(round(health)), armor, strength, potion, hint))
  340. input("The game isn't done.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement