Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- from colorama import Fore
- from colorama import Style
- monster = {
- "hp": 0, "attack": 0, "name": "None"
- }
- player = {
- "hp": 100, "name": "", "attack": 13, "heal": 7, "superpower": "None",
- }
- names = ["Danial", "Osvaldo", "Alan", "Hollis", "Emory", "Antony", "Donovan", "Hilario", "Kelley", "Chadwick", "Shirley", "Marcel", "Florentino", "Guadalupe", "Andy", "Claudio", "Kris"]
- def define_name():
- print(f"{Fore.CYAN}Hello, What's should your ingame name be?{Style.RESET_ALL}")
- name = input(f"{Fore.YELLOW}{Style.BRIGHT}>>> {Style.RESET_ALL}")
- player["name"] = name
- main()
- def superpower():
- print("")
- print("")
- print(
- f"{Fore.CYAN}SMASH! is a Superpower that deals massive damage. The damage is random, from 20 to 30!.{Style.RESET_ALL}")
- print(
- f"{Fore.CYAN}Freeze is a Superpower that freezes your enemy for 1 round. You can heal yourself or attack.{Style.RESET_ALL}")
- print(
- 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}")
- print(
- f"{Fore.CYAN}Escape is a Superpower that allows you to flee from a monster. Use it wisely.{Style.RESET_ALL}")
- print(
- f"{Fore.RED}REMEMBER! This are one time Superpowers, you will be able to get more throughout the game tho.{Style.RESET_ALL}")
- time.sleep(1)
- randomsp = random.randint(1, 4)
- if randomsp == 1:
- print(f"{Fore.GREEN}You got: SMASH!{Style.RESET_ALL}")
- print(f"{Fore.RED}You got super lucky! You got the best Superpower in the game. Use it well.{Style.RESET_ALL}")
- player["superpower"] = "Smash"
- elif randomsp == 2:
- print(f"{Fore.GREEN}You got: Freeze{Style.RESET_ALL}")
- player["superpower"] = "Freeze"
- elif randomsp == 3:
- print(f"{Fore.GREEN}You got: Meditate{Style.RESET_ALL}")
- player["superpower"] = "Meditate"
- elif randomsp == 4:
- print(f"{Fore.GREEN}You got: Flee{Style.RESET_ALL}")
- player["superpower"] = "Flee"
- def spstat():
- if player["superpower"] == "None":
- pass
- else:
- print(" Superpower: ", player["superpower"])
- def stats():
- print(f"{Fore.CYAN}Your stats: ", "HP: ", player["hp"])
- print(" Attack: ", player["attack"])
- print(" Heal: ", player["heal"])
- spstat()
- print(f"{Fore.RED}Your enemies stats: ", "HP: ", monster["hp"])
- print(" Attack: ", monster["attack"])
- def options():
- print(f"{Fore.YELLOW}What do you want to do?{Style.RESET_ALL}")
- print(f"{Fore.MAGENTA}{Style.BRIGHT}(1){Style.RESET_ALL}{Fore.YELLOW}Attack{Style.RESET_ALL}")
- print(f"{Fore.MAGENTA}{Style.BRIGHT}(2){Style.RESET_ALL}{Fore.YELLOW}Heal{Style.RESET_ALL}")
- if player["superpower"] == "None":
- pass
- else:
- print(f"{Fore.MAGENTA}{Style.BRIGHT}(3){Style.RESET_ALL}{Fore.YELLOW}Superpower: {Style.RESET_ALL}", player["superpower"])
- def monster_gen():
- name = random.choice(names)
- monster["name"] = name
- hp = random.randint(60, 180)
- monster["hp"] = hp
- attack = random.randint(6, 15)
- monster["attack"] = attack
- def playagain():
- print(f"{Fore.MAGENTA}Want to play again? (y/n){Style.RESET_ALL}")
- answer = input(f"{Fore.YELLOW}>>> {Style.RESET_ALL}")
- if answer == "y":
- main()
- elif answer == "n":
- print(f"{Fore.GREEN}Thanks for playing{Style.RESET_ALL}")
- exit()
- else:
- print(f"{Fore.GREEN}Sorry, I did not understand you.{Style.RESET_ALL}")
- playagain()
- def frozen():
- options()
- answer = input(f"{Fore.YELLOW}>>> ")
- if answer == "1":
- monster["hp"] = monster["hp"] - player["attack"]
- stats()
- elif answer == "2":
- player["hp"] = player["hp"] + player["heal"]
- stats()
- def roundstart():
- monster_gen()
- stats()
- time.sleep(5)
- while True:
- options()
- answer = input(f"{Fore.YELLOW}>>> ")
- if answer == "1":
- monster["hp"] = monster["hp"] - player["attack"]
- player["hp"] = player["hp"] - monster["attack"]
- stats()
- elif answer == "2":
- player["hp"] = player["hp"] + player["heal"]
- player["hp"] = player["hp"] - monster["attack"]
- stats()
- elif answer == "3":
- if player["superpower"] == "Smash":
- monster["hp"] = monster["hp"] - random.randint(20, 30)
- player["superpower"] = "None"
- stats()
- elif player["superpower"] == "Meditate":
- player["hp"] = player["hp"] + random.randint(20, 30)
- player["hp"] = player["hp"] - monster["attack"]
- player["superpower"] = "None"
- stats()
- elif player["superpower"] == "Flee":
- print(f"{Fore.GREEN}You flew.{Style.RESET_ALL}")
- player["superpower"] = "None"
- main()
- roundstart()
- elif player["superpower"] == "Freeze":
- print("You froze your enemy, you can choose 2 times.")
- player["superpower"] = "None"
- frozen()
- frozen()
- if monster["hp"] <= 0:
- print(f"{Fore.GREEN}Congratulations! You won the round{Style.RESET_ALL}")
- playagain()
- elif player["hp"] <= 0:
- print(f"{Fore.RED}Sorry, you lost...{Style.RESET_ALL}")
- playagain()
- def main():
- monster["hp"] = 0
- monster["attack"] = 0
- monster["name"] = ""
- player["hp"] = 0
- player["attack"] = 0
- player["heal"] = 0
- player["superpower"] = "None"
- print(f"{Fore.MAGENTA}******************************************{Style.RESET_ALL}")
- print(f"{Fore.YELLOW}* *{Style.RESET_ALL}")
- print(f"* {Fore.CYAN}Welcome to my game{Style.RESET_ALL} *")
- print(f"{Fore.RED}* MonsterDestruction *{Style.RESET_ALL}")
- print(f"{Fore.YELLOW}* *{Style.RESET_ALL}")
- print(f"{Fore.MAGENTA}******************************************{Style.RESET_ALL}")
- time.sleep(0)
- print("")
- print(f"{Fore.BLUE}Choose the gamestyle you want{Style.RESET_ALL} " + player[
- "name"] + f"{Fore.BLUE}:{Style.RESET_ALL}")
- print(
- f"{Fore.MAGENTA}{Style.BRIGHT}(1){Style.RESET_ALL} Get a random Superpower but start with 20hp less and lose 5 points of attack.")
- print(
- f"{Fore.MAGENTA}{Style.BRIGHT}(2){Style.RESET_ALL} Start with no random Superpower but start with 100hp and increase your heal to 10.")
- print(f"{Fore.MAGENTA}{Style.BRIGHT}(3){Style.RESET_ALL} Deal 6 points less damage but start with 200hp")
- answer = input(f"{Fore.YELLOW}{Style.BRIGHT}>>> {Style.RESET_ALL}")
- if answer == "1":
- superpower()
- player["hp"] = 80
- player["attack"] = 8
- player["heal"] = 5
- roundstart()
- elif answer == "2":
- player["hp"] = 100
- player["heal"] = 10
- player["attack"] = 7
- roundstart()
- elif answer == "3":
- player["attack"] = 6
- player["hp"] = 200
- player["heal"] = 2
- roundstart()
- define_name()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement