#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Lincoln # Created : 19/02/2024 # Copyright : © Lincoln 19/02/2024 #-------------------------------------------------------------------------- import random import time START_HP_CAP = 50 START_HP_THANOS = 100 caphp = 0 capstuff = caphp capatck = 0 deflect = 0 choice = "" play_again = "y" thanoshp = 0 thanostuff = thanoshp thanosatck = 0 print ("") print ("Everyone had been defeated.") print ("") time.sleep(1.5) print ("Everyone but you.") print ("") time.sleep(1.5) print("You pick up Mjolnir and prepare for Thanos's wrath.") print ("") time.sleep(2.5) print ("You are in the ENDGAME now") time.sleep(1.5) while play_again == "y" : caphp = START_HP_CAP capstuff = START_HP_CAP thanoshp = START_HP_THANOS thanostuff = START_HP_THANOS while thanoshp > 0 : print ("") print ("Health Levels:") print ("Cap = {}" .format(caphp)) print ("thanos = {}" .format(thanoshp)) time.sleep(1) print ("") print ("Do you (a)ttack with mjolnir or (d)efend with your shield ") choice = input(": ") if choice == "a" : print ("") thanosatck = random.randint(1,20) capatck = random.randint(10,20) caphp = capstuff - thanosatck capstuff = caphp thanoshp = thanostuff - capatck thanostuff = thanoshp print ("Thanos swings his sword") print ("Thanos deals {} damage" .format(thanosatck)) time.sleep(1.5) if caphp <= 0 : print ("You have failed to defeat Thanos") time.sleep(1.5) print ("") print ("The universe is doomed") print ("") break print ("") print ("You swing Mjolnir") print ("You deal {} damage to Thanos" .format(capatck)) time.sleep(1.5) if thanoshp <= 0 : print ("") print ("Thanos has fallen and the universe has been saved") print ("") break if choice == "d" : deflect = random.randint(1,2) thanosatck = random.randint(1,20) if deflect == 2 : thanoshp = thanostuff - thanosatck thanostuff = thanoshp print ("") print ("You deflected thanos's attack dealing {} damage to Thanos" .format(thanosatck)) time.sleep(2) if thanoshp <= 0 : print ("") print ("Thanos has fallen and the universe has been saved") break elif deflect == 1 : caphp = capstuff - (thanosatck / 2) capstuff = caphp print ("You defended against Thanos's attack") time.sleep(1) print ("") print ("You took {} damage" .format(thanosatck / 2)) print ("") time.sleep(1) if caphp <= 0 : print ("") print ("You have failed to defeat Thanos") time.sleep(1.5) print ("") print ("The universe is doomed") print ("") break if caphp <= 0 or thanoshp <= 0 : print ("Thank you for playing my game") time.sleep (1) print ("") play_again = input("Would you like to play again? (y/n) ") if play_again == "y" : print ("") print ("Ok goodluck") elif play_again == "n" : print ("") print (" Ok then goodbye")