#-------------------------------------------------------------------------- # Name : Endgame_file # Purpose : 11DGT # Author: Phoenix, Ruddell # Created : 17/02/2025 # Copyright : © Phoenix, Ruddell 17/02/2025 #-------------------------------------------------------------------------- # Import libraries import random import time # Set starting variables # Starting health (constant) start_player_hp = 50 start_thanos_hp = 100 # Starting health player_health = 0 thanos_health = 0 # Damage presets thanos_sword = 0 cplayer_mjolnir = 0 # Deflect Preset deflect = 0 # User Decision Preset player_choise = " " play_again = "y" while True: player_name = input("What is your super hero name?") if player_name.isalpha() == True: break else: print("Please ener a sting input. J.A.R.V.I.S error ") while True: try: print() player_health = int(input("Select a health amount for {} between 50 and 80... ".format(player_name))) if player_health < 50 or player_health > 80 : print() print("Please select an amont between 50 and 80") else: break except: print() print("That is not a number.. you may need some additional tutoring from Mr Stark or Bannerd") # Game 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, Cap, to finish this. The fate of the universe is your weight to bare.") 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) #Start of Play Again loop while play_again == "y" : #reset entities health levels player_health - start_player_hp thanos_health = start_thanos_hp #Start of game loop while thanos_health > 0 : # Print current entities health levels time.sleep(1) print() print("Current Health") print("Cap has {} HP...".format(player_health)) print("Thanos has {} HP...".format(thanos_health)) time.sleep(2) #User selects their action print() print("What do you choose?..") print("[a]ttack with Mjolnir") print("or") print("[d]efend with your sheild") player_choice = input("Your choice?... ") print() #User choice #Choice A if player_choice == "a" : thanos_sword = random.randint(1, 20) print("Thanos attacks you with his double baded sword and deals {} damage".format(thanos_sword)) player_health = player_health - thanos_sword if player_health < 1: break time.sleep(1) player_mjolnir = random.randint(1, 20) print("You attack back with Mjolnir in the hand dealing {} damage in return".format(player_mjolnir)) thanos_health = thanos_health - player_mjolnir time.sleep(1) #Choice D else: print("Thanos attacks you with his double bladed sword...") print("You raise your sheild and deflect to deflect the blow...") time.sleep(1) deflect = random.randint(1, 2) if deflect == 1 : thanos_sword = random.randint(1, 20) print("You were to slow in raising yor shield and Thanos strikes you with his sword for {} damage".format(thanos_sword)) player_health = player_health - thanos_sword if player_health < 1: break time.sleep(1) else: thanos_sword = random.randint(1, 20) print("Thanos' sword rebounds off Caps vibranium shield and he deals himself {} damage".format(thanos_sword)) thanos_health = thanos_health - thanos_sword time.sleep(1) # End of game loop. Checking entities health values to determine a winner if player_health < 1: print() print("Thans is too strong. He has broken your sheild and cut you down. This is the end of all life in our universe...") #Option to play again 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("You stare out into a greatful universe.") time.sleep(1) print("It is safe...") time.sleep(3) print(" ..For now...") time.sleep(5) #OPtion to play again play_again = input("do you want to play again? [y]es or [n]o...") #Game end time.sleep(2) print("Thanks for playing my game") time.sleep(2) print (" Copyright : © Phoenix, Ruddell 17/02/2025")