#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Caleb Litolff # Created : 19/02/2024 # Copyright : © Caleb Litolff 2024 #-------------------------------------------------------------------------- # import libraies import random import time # Set starting variables ----------------------------------- while True: player_name = input("What is your suprehero name? ") if player_name.isalpha() == True: break else: print("please enter a string input J.A.R.V.I.S error ") #starting health constant START_HP_THANOS = 100 # Starting Health player_health = 0 thanos_health = 0 # Damage presets thanos_sword = 0 player_mjolnir = 0 #deflet present deflect = 0 # player decision preset player_choice = " " play_again = "y" #charctor healths thanos_health = START_HP_THANOS 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 amount between 50 and 80") else: break except: print() print("that is not a number.. you may need some addtional tutoring from Mr stark or Banner") # 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,", player_name, ", 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": while thanos_health > 0: time.sleep(1) print("Helath Levels:") print(player_name, player_health) print(" Thanos", thanos_health) #player actions print() print("Possible actions:") print("[a]ttack with mjolnir") print("[d]efend with your shield") player_choice = str(input("Your choice? ")) if player_choice == "a": thanos_sword = random.randint(1,20) print("Thanos attacks with his sword and deals", thanos_sword,"damage") player_health = player_health - thanos_sword if player_health <0 : break time.sleep(1) player_mjolnir = random.randint(1,20) print("you attack back woth Mjolnir in hand dealing", player_mjolnir,"damage in return") thanos_health = thanos_health - player_mjolnir time.sleep(1) else: print("thanos attacks you with his sword...") print("you raise your shield and deflect to deflect the hit...") time.sleep(1) deflect = random.randint(1,2) if deflect == 1: thanos_sword = random.randint(1,20) print("You were slow to raise your shield and thanos strikes you with his sword for", thanos_sword,"damage") 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", player_name, "vibreanium sheild and he deals himself", thanos_sword, "damage") thanos_health = thanos_health - thanos_sword if player_health < 1: 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? 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 grateful universe.") time.sleep(1) print("It is safe...") time.sleep(3) print(" ..For now...") time.sleep(5) 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)