#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Mac Gillingham # Created : 17/02/25 # Copyright : © Mac Gillingham 2025 #-------------------------------------------------------------------------- import random import time # Starting Health (CONSTANT) thanos_start_hp = 100 # Starting Health thanos_hp = 100 player_hp = 50 # Damage Presets thanos_attack = 0 player_attack = 0 # Deflect Preset deflect = 0 # Player Decision Preset choice = " " play_again = "y" while True: player_name = input("What is your superhero name? ") if player_name.isalpha() == True: print() print() break else: print("Please enter a string inpot. J.A.R.V.I.S error ") # Intro print("The sky grows darker as the army of Thanos moves closer.") time.sleep(2) print("Thor and Tony lie battered and motionless on the ground from the previous encounter.") time.sleep(3) print("It is up to you, {}, to finish this. The fate of the universe is your weight to bare.".format(player_name)) time.sleep(3.5) print("You stand there, hurt. But you have your shield in arm hand and wield Mjolnir in the other.") time.sleep(4) print("You are worthy, but will the power of Thor be enough....") time.sleep(3) print("You are in the ENDGAME now") time.sleep(1) while play_again == "y": while True: try: print() player_hp = int(input("Select a health amount for {} between 50 and 80... ".format(player_name))) if player_hp < 50 or player_hp > 80: print() print("Please select an amount between 50 and 80") else: break except: print() print("That is not a number... you may need some additional tutoring from Mr Stark or Banner") thanos_hp = thanos_start_hp while thanos_hp > 0 and player_hp > 0: print() print("Health Levels:") print("Thanos HP: ", (thanos_hp)) print("Your HP: ", (player_hp)) time.sleep(2) print() print("Possible actions:") print(" [a]ttack with Mjolnir") print(" or") print(" [d]efend with your shield") print() choice = input("Your choice? ") print() # Player Attacks if choice == "a": thanos_attack = random.randint(1, 20) print("Thanos attacks you with his double bladed sword and deals ", thanos_attack, " damage") player_hp = player_hp - thanos_attack if player_hp < 1: break time.sleep(1) player_attack = random.randint(1, 20) print("You attack back with Mjolnir in hand dealing {} damage in return".format(player_attack)) thanos_hp = thanos_hp - player_attack time.sleep(1) # Player Defends else: print("Thanos attacks you with his double bladed sword...") print("You raise your shield to deflect the blow...") time.sleep(1) deflect = random.randint(1, 2) if deflect == 1: thanos_attack = random.randint(1, 20) print("You were too slow in raising your shield and Thanos strikes you with his sword for {} damage".format(thanos_attack)) player_hp = player_hp - thanos_attack if player_hp < 0: break time.sleep(1) else: thanos_attack = random.randint(1, 20) print("Thanos' sword rebounds off of your vibranium shield and he deals himself {} damage".format(thanos_attack)) thanos_hp = thanos_hp - thanos_attack time.sleep(1) # Win/Loss Conditions if player_hp < 1: print() print("you suck lol") play_again = input("Do you want to play again? [y]es or [n]o... ") else: print() print("Thanos has fallen!") time.sleep(.5) print("You drop to your knees, exhausted.") time.sleep(.5) print("It is safe...") time.sleep(3) print(" ...For now...") time.sleep(3) play_again = input("Do you want to play again? [y]es or [n]o... ") time.sleep(2) print() print("ay thanks for playing bro") time.sleep(2)