#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Jasper Harvey # Created : Date # Copyright : © Jasper Harvey 17/02/25 #-------------------------------------------------------------------------- # Import libraries import random import time #set starting variable values-------------------------------------------------------------------- #starting health (constant) start_hp_plaer = 50 start_hp_thanos = 100 #player health levels player_health=0 thanos_health=0 #damage presets thanos_sword=0 player_mjolnir=0 #deflect presets deflect=0 #player decision preset player_choice=" " play_again = "y" #------------------------------------------------------------------------------------------------------ #intro print("The sky grows darker as the army of Thanos moves closer.") time.sleep(3) print("Thor and Tony lie battered and motionless on the ground from the previous encounter.") time.sleep(4) print("It is up to you, Cap, to finish this. The fate of the universe is your weight to bare.") time.sleep(4.5) print("You stand there, hurt. But you have your shield in arm hand and wield Mjolnir in the other.") time.sleep(5) print("You are worthy, but will the power of Thor be enough....") time.sleep(4) print("You are in the ENDGAME now") time.sleep(2) while play_again == "y": #player name while True: player_name = input("whats your super hero name? ") if player_name.isalpha() == True: break else: print("Please enter a string input. J.A.R.V.I.S error ") #health pesets thanos_health=start_hp_thanos while True: try: print( ) player_health = int(input("Select a health amont for {} between 50 and 80... ".format(player_name))) if player_health < 50 or player_health > 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 extra tutoring from Mr stark or banner") #attack script while thanos_health > 0: #Print current health levels time.sleep(1) print() print("Current Health") print(player_name, "has {} HP...".format(player_health)) print("Thanos has {} HP...".format(thanos_health)) time.sleep(2) #Player selects their action print() print("What do you choose?..") print("[a]ttack with Mjolnir") print("or") print("[d]efend with your shield") player_choice = input("Your choice?... ") if player_choice == "a" : thanos_sword = random.randint(1, 20) print("Thanos attacks you with his double bladed 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 hand dealing {} damage in return".format(player_mjolnir)) thanos_health = thanos_health - player_mjolnir time.sleep(1) else: print("Thanos attacks you with his double bladed sword...") print("You raise your shield 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 your 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 text if player_health > 1: print("Thanos has fallen!") time.sleep(1) print("the world is safe!") #play again play_again=input("do you wish to play again? y/n: ") else: print("thanos won and destroyed half of the world!!") #play again play_again=input("do you wish to play again? y/n: ") #game ends time.sleep(2) print("thanks for playing") time.sleep(2)