#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author : Keelan Bowmar # Created : 19/2/2025 # Copyright : Keelan 19/2/2025 #-------------------------------------------------------------------------- # Import libraries import random import time # Set starting variables ----------------------------------- #Starting Health (CONSTANT) START_HP_CAP = 50 START_HP_THANOS = 100 # Starting Health cap_health = 50 thanos_health = 100 # Damage presets thanos_sword = 0 cap_mjolnir = 0 # Deflect Preset Deflect = 0 # Player Descision Preset cap_choice = " " play_again = "y" #--------------------------------------------------------------- #Intro print("The sky grows darker as the army of Thanos moves closer and 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're in the ENDGAME now.") time.sleep(1) #Start of Play Again loop while play_again == "" : #Reset health levels for characters cap_health = START_HP_CAP thanos_health = START_HP_THANOS #Start of game loop while thanos_health > 0 : #Print current health levels time.sleep(1) print() print("Current Health") print("Cap has {} HP...".format(cap_health)) print("Thanks has {} HP...".format(thanos_health)) time.sleep(2) #Player Action Select print() print("What action do you choose?") print("[a]ttack with Mjolnir") print("or") print("[d]efend eith your shield") cap_choice = input("Your choice?...") print() #Player choice #Choice A if cap_choice == "a" : thanos_sword = random.randint(1, 20) print("Thanos attacks you with his double bladed sword and deals {} damage!".format(thanos_sword)) cap_health = cap_health - thanos_sword if cap_health < 1 : break time.sleep(1) cap_mjolnir = random.randint(1, 20) print("You attack back with Mjolnir in hand dealing {} damage in return!".format(cap_mjolnir)) thanos_health = thanos_health - cap_mjolnir time.sleep(1) #Choice D else: print("Thanos attacks you with his double bladed sword") print("You raise your shield and attempt to deflect the blow") time.sleep(1) deflect = random.randint(1, 2) if deflect == 1 : thanos_sword = random.randint(1, 20) print("You were too slow in raising your shield and Thanos strikes you with his sword for {} damage!".format(thanos_sword)) cap_health = cap_health - thanos_sword if cap_health < 1 : break time.sleep(1) else: thanos_sword = random.randit(1, 20) print("Thanos' sword rebounds off Caps vibranium shield and he deals {} damage to himself!".format(thanos_sword)) thanos_health = thanos_health - thanos_sword time.sleep(1) # End of game loop. Checks health values to determine winner if cap_health < 1 : print() print("Thanos is too strong. He has broken your sheld and cut you down.") #Option to play again play_again = input("Do you want to play again? [y]es [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 grayeful universe.") time.sleep(1) print("it is safe..") time.sleep(3) print(" ..For now..") #Option to play again play_again = input("Do you want to play again? [y]es [n]o...") #Game End time.sleep(2) print("Thanks for playng my game!") time.sleep(2)