import random import time while True: player_name = input( "What is your superhero name?: ") if player_name.isalpha() == True: break else: print( "Please enter a string input. J.A.R.V.I.S Error") START_HP_PLAYER = 50 START_HP_THANOS = 100 player_health = 0 thanos_health = 0 thanos_sword = 0 player_mjolnir = 0 deflect = 0 player_choice = " " play_again = "y" print("The sky grows darker as the army of Thanos moves closer.") time.sleep(2) print( " " ) print("Thor and Tony lie battered and motionless on the ground from the previous encounter.") time.sleep(3) print( " " ) print("It is up to you, {}, to finish this. The fate of the universe is your weight to bare.".format(player_name)) time.sleep(3.5) print( " " ) print("You stand, hurt. But you have your shield in arm hand and wield Mjolnir in the other.") time.sleep(4) print( " " ) print("You are worthy, but will the power of Thor be enough....") time.sleep(3) print( " " ) print("You are in the ENDGAME now") time.sleep(1) while play_again == "y": 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 additional tutoring from Mr stark or Banner") thanos_health = START_HP_THANOS player_health = player_health while thanos_health >0: time.sleep(1) print( " " ) print( "Health Levels:" ) print( " {} Health {}".format(player_name, player_health)) print( " Thanos Health {}".format(thanos_health)) time.sleep(2) print( " " ) print( "Possible actions:" ) print( " [a]ttack with Mjolnir" ) print( " [d]efend with your shield" ) print( " " ) player_choice = input( "Your choice: " ) print( " " ) if player_choice == "a": thanos_sword = random.randint(1,20) print( "Thanos attacks with his sword..." ) time.sleep(1) print( " " ) print( "He deals {} damage with his sword...".format(thanos_sword)) player_health = player_health - thanos_sword if player_health >0: player_mjolnir = random.randint(1,20) print( "You swing Mjolnir... " ) time.sleep(1) print( " " ) print( "You deal {} damage to thanos".format(player_mjolnir)) thanos_health = thanos_health - player_mjolnir else: break else: deflect = random.randint(1,2) thanos_sword = random.randint(1,20) player_mjolnir = random.randint(1,20) print( "Thanos attacks with his sword..." ) time.sleep(1) if deflect == 1: print( "You raise your shield and deflect the blow" ) print( " " ) print( "The rebounding blow deals {} damage to thanos".format(thanos_sword)) thanos_health = thanos_health - thanos_sword else: print( " " ) print( "You were slow raising your shield and Thanos swings his sword for {} damage".format(thanos_sword)) player_health = player_health - thanos_sword if player_health <1: break time.sleep(1) print( " " ) time.sleep(3) if player_health >0: print() print("Thanos has fallen!") time.sleep(1) print("You drop to your knees, exhausted.") time.sleep(1) print("You stare out into a grateful universe.") time.sleep(1) print("It is safe...") time.sleep(3) print("..For now...") time.sleep(5) else: print("Thanos is too strong. He has broken your shield and cut you down. This is the end of all life in our universe...") time.sleep(3) play_again = input( "Would you like to play again? y/n: " ) time.sleep(2) print( " " ) print( "Thanks {} for playing my game!".format(player_name) ) time.sleep(2)