#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: James Halliday # Created : 2024 # Copyright : © Gregarious Simulation Systems 2024 #-------------------------------------------------------------------------- import time import random thanosStartHealth = 100 capHealth = 0 capAttack = 0 thanosHealth = 0 thanosAttack = 0 deflect = 0 capChoice = "" play_again = "y" print("\033c") print ("J.A.R.V.I.S: 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 (f" It is up to you to finish this. The fate of the universe is your weight to bear.") 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") print () time.sleep(3) while play_again == "y" : playerName = input(" What is your name, soldier? ") if playerName.isalpha() == True: print(f"J.A.R.V.I.S: You show a lot of bravery, {playerName}. Now go and defeat Thanos!") else: print(" Please enter a string input. J.A.R.V.I.S ERROR ") capStartHealth = int(input(f" Select a health ammount for {playerName} between 50 and 80... ")) if capHealth < 50 or capHealth > 80 : print() print("Please select an ammount between 50 and 80") break else: print() capHealth = capStartHealth thanosHealth = thanosStartHealth while thanosHealth > 0 and capHealth > 0: print("Health Levels:") print(f"{playerName}: {capHealth}") print(f"Thanos: {thanosHealth}") time.sleep(2) print() print("Possible Moves:") print("[a]ttack with Mjolnir") print("[d]efend with your shield") print() capChoice = input("Your choice?.. ") if capChoice == 'a': thanosAttack = random.randint(1, 20) print("Thanos attacks you with his sword..") time.sleep(1) print(f"He deals you {thanosAttack} damage") time.sleep(1) print("You swing Mjolnir...") capAttack = random.randint(1, 20) time.sleep(1) print(f"You deal Thanos {capAttack} damage") capHealth = capHealth - thanosAttack thanosHealth = thanosHealth - capAttack print() else: print("Thanos attacks you with his sword..") print("You raise your shield to deflect the blow..") time.sleep(1) deflect = random.randint(1, 2) if deflect == 1: thanosAttack = random.randint(1, 20) print(f"You were too slow in raising your shield and Thanos strikes you with his sword for {thanosAttack} damage.") capHealth = capHealth - thanosAttack if capHealth < 1: break time.sleep(1) else: thanosAttack = random.randint(1, 20) print(f"Thanos' sword rebounds off {playerName}'s vibranium shield and he deals himself {thanosAttack} damage") thanosHealth = thanosHealth - thanosAttack time.sleep(1) if capHealth <= 0: print() print("Thanos is too strong. He has broken your shield and cut you down. This is the end of all life in our universe...") 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 the grateful universe. ") time.sleep(1) print(f"It is safe, thanks to you {playerName}..") print("..For now..") time.sleep(5) play_again = input("Do you want to play again? [y]es or [n]o..") time.sleep(2) print ("Thanks for playing Endgame by GSS!") time.sleep(2)