Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.42 KB | None | 0 0
  1. import random
  2. import time
  3. from colorama import Fore
  4. from colorama import Style
  5.  
  6. monster = {
  7. "hp": 0, "attack": 0, "name": "None"
  8. }
  9.  
  10. player = {
  11. "hp": 100, "name": "", "attack": 13, "heal": 7, "superpower": "None",
  12. }
  13.  
  14. names = ["Danial", "Osvaldo", "Alan", "Hollis", "Emory", "Antony", "Donovan", "Hilario", "Kelley", "Chadwick", "Shirley", "Marcel", "Florentino", "Guadalupe", "Andy", "Claudio", "Kris"]
  15.  
  16.  
  17. def define_name():
  18. print(f"{Fore.CYAN}Hello, What's should your ingame name be?{Style.RESET_ALL}")
  19. name = input(f"{Fore.YELLOW}{Style.BRIGHT}>>> {Style.RESET_ALL}")
  20. player["name"] = name
  21. main()
  22.  
  23.  
  24. def superpower():
  25. print("")
  26. print("")
  27. print(
  28. f"{Fore.CYAN}SMASH! is a Superpower that deals massive damage. The damage is random, from 20 to 30!.{Style.RESET_ALL}")
  29. print(
  30. f"{Fore.CYAN}Freeze is a Superpower that freezes your enemy for 1 round. You can heal yourself or attack.{Style.RESET_ALL}")
  31. print(
  32. f"{Fore.CYAN}Meditate is a Superpower that heals yourself for a relatively large amount of HP. This amount will be decied randomly from 20 to 30! You will lose the turn anyway and can get attacked by the monster.{Style.RESET_ALL}")
  33. print(
  34. f"{Fore.CYAN}Escape is a Superpower that allows you to flee from a monster. Use it wisely.{Style.RESET_ALL}")
  35. print(
  36. f"{Fore.RED}REMEMBER! This are one time Superpowers, you will be able to get more throughout the game tho.{Style.RESET_ALL}")
  37. time.sleep(1)
  38.  
  39. randomsp = random.randint(1, 4)
  40. if randomsp == 1:
  41. print(f"{Fore.GREEN}You got: SMASH!{Style.RESET_ALL}")
  42. print(f"{Fore.RED}You got super lucky! You got the best Superpower in the game. Use it well.{Style.RESET_ALL}")
  43. player["superpower"] = "Smash"
  44. elif randomsp == 2:
  45. print(f"{Fore.GREEN}You got: Freeze{Style.RESET_ALL}")
  46. player["superpower"] = "Freeze"
  47. elif randomsp == 3:
  48. print(f"{Fore.GREEN}You got: Meditate{Style.RESET_ALL}")
  49. player["superpower"] = "Meditate"
  50. elif randomsp == 4:
  51. print(f"{Fore.GREEN}You got: Flee{Style.RESET_ALL}")
  52. player["superpower"] = "Flee"
  53.  
  54.  
  55. def spstat():
  56. if player["superpower"] == "None":
  57. pass
  58. else:
  59. print(" Superpower: ", player["superpower"])
  60.  
  61.  
  62. def stats():
  63. print(f"{Fore.CYAN}Your stats: ", "HP: ", player["hp"])
  64. print(" Attack: ", player["attack"])
  65. print(" Heal: ", player["heal"])
  66. spstat()
  67. print(f"{Fore.RED}Your enemies stats: ", "HP: ", monster["hp"])
  68. print(" Attack: ", monster["attack"])
  69.  
  70.  
  71. def options():
  72. print(f"{Fore.YELLOW}What do you want to do?{Style.RESET_ALL}")
  73. print(f"{Fore.MAGENTA}{Style.BRIGHT}(1){Style.RESET_ALL}{Fore.YELLOW}Attack{Style.RESET_ALL}")
  74. print(f"{Fore.MAGENTA}{Style.BRIGHT}(2){Style.RESET_ALL}{Fore.YELLOW}Heal{Style.RESET_ALL}")
  75. if player["superpower"] == "None":
  76. pass
  77. else:
  78. print(f"{Fore.MAGENTA}{Style.BRIGHT}(3){Style.RESET_ALL}{Fore.YELLOW}Superpower: {Style.RESET_ALL}", player["superpower"])
  79.  
  80.  
  81. def monster_gen():
  82. name = random.choice(names)
  83. monster["name"] = name
  84. hp = random.randint(60, 180)
  85. monster["hp"] = hp
  86. attack = random.randint(6, 15)
  87. monster["attack"] = attack
  88.  
  89.  
  90. def playagain():
  91.  
  92. print(f"{Fore.MAGENTA}Want to play again? (y/n){Style.RESET_ALL}")
  93. answer = input(f"{Fore.YELLOW}>>> {Style.RESET_ALL}")
  94. if answer == "y":
  95. main()
  96. elif answer == "n":
  97. print(f"{Fore.GREEN}Thanks for playing{Style.RESET_ALL}")
  98. exit()
  99. else:
  100. print(f"{Fore.GREEN}Sorry, I did not understand you.{Style.RESET_ALL}")
  101. playagain()
  102.  
  103.  
  104. def frozen():
  105. options()
  106. answer = input(f"{Fore.YELLOW}>>> ")
  107. if answer == "1":
  108. monster["hp"] = monster["hp"] - player["attack"]
  109. stats()
  110. elif answer == "2":
  111. player["hp"] = player["hp"] + player["heal"]
  112. stats()
  113.  
  114.  
  115. def roundstart():
  116. monster_gen()
  117. stats()
  118. time.sleep(5)
  119. while True:
  120. options()
  121. answer = input(f"{Fore.YELLOW}>>> ")
  122. if answer == "1":
  123. monster["hp"] = monster["hp"] - player["attack"]
  124. player["hp"] = player["hp"] - monster["attack"]
  125. stats()
  126. elif answer == "2":
  127. player["hp"] = player["hp"] + player["heal"]
  128. player["hp"] = player["hp"] - monster["attack"]
  129. stats()
  130. elif answer == "3":
  131. if player["superpower"] == "Smash":
  132. monster["hp"] = monster["hp"] - random.randint(20, 30)
  133. player["superpower"] = "None"
  134. stats()
  135. elif player["superpower"] == "Meditate":
  136. player["hp"] = player["hp"] + random.randint(20, 30)
  137. player["hp"] = player["hp"] - monster["attack"]
  138. player["superpower"] = "None"
  139. stats()
  140. elif player["superpower"] == "Flee":
  141. print(f"{Fore.GREEN}You flew.{Style.RESET_ALL}")
  142. player["superpower"] = "None"
  143. main()
  144. roundstart()
  145. elif player["superpower"] == "Freeze":
  146. print("You froze your enemy, you can choose 2 times.")
  147. player["superpower"] = "None"
  148. frozen()
  149. frozen()
  150.  
  151. if monster["hp"] <= 0:
  152. print(f"{Fore.GREEN}Congratulations! You won the round{Style.RESET_ALL}")
  153. playagain()
  154. elif player["hp"] <= 0:
  155. print(f"{Fore.RED}Sorry, you lost...{Style.RESET_ALL}")
  156. playagain()
  157.  
  158.  
  159. def main():
  160.  
  161. monster["hp"] = 0
  162. monster["attack"] = 0
  163. monster["name"] = ""
  164.  
  165. player["hp"] = 0
  166. player["attack"] = 0
  167. player["heal"] = 0
  168. player["superpower"] = "None"
  169.  
  170. print(f"{Fore.MAGENTA}******************************************{Style.RESET_ALL}")
  171. print(f"{Fore.YELLOW}* *{Style.RESET_ALL}")
  172. print(f"* {Fore.CYAN}Welcome to my game{Style.RESET_ALL} *")
  173. print(f"{Fore.RED}* MonsterDestruction *{Style.RESET_ALL}")
  174. print(f"{Fore.YELLOW}* *{Style.RESET_ALL}")
  175. print(f"{Fore.MAGENTA}******************************************{Style.RESET_ALL}")
  176. time.sleep(0)
  177. print("")
  178. print(f"{Fore.BLUE}Choose the gamestyle you want{Style.RESET_ALL} " + player[
  179. "name"] + f"{Fore.BLUE}:{Style.RESET_ALL}")
  180. print(
  181. f"{Fore.MAGENTA}{Style.BRIGHT}(1){Style.RESET_ALL} Get a random Superpower but start with 20hp less and lose 5 points of attack.")
  182. print(
  183. f"{Fore.MAGENTA}{Style.BRIGHT}(2){Style.RESET_ALL} Start with no random Superpower but start with 100hp and increase your heal to 10.")
  184. print(f"{Fore.MAGENTA}{Style.BRIGHT}(3){Style.RESET_ALL} Deal 6 points less damage but start with 200hp")
  185. answer = input(f"{Fore.YELLOW}{Style.BRIGHT}>>> {Style.RESET_ALL}")
  186. if answer == "1":
  187. superpower()
  188. player["hp"] = 80
  189. player["attack"] = 8
  190. player["heal"] = 5
  191. roundstart()
  192. elif answer == "2":
  193. player["hp"] = 100
  194. player["heal"] = 10
  195. player["attack"] = 7
  196. roundstart()
  197. elif answer == "3":
  198. player["attack"] = 6
  199. player["hp"] = 200
  200. player["heal"] = 2
  201. roundstart()
  202.  
  203.  
  204. define_name()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement