#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Luke Whitney # Created : 20/02/2024 # Copyright : ©LukeWhitney2024 #-------------------------------------------------------------------------- #Libraries import random import time #-------------------------------------------------------------------------- #Variables #Health cap_health = 1000000000 thanos_health = 100 #Damage thanos_sword = 0 cap_mjolnir = 0 #Deflect deflect = 0 #Decision cap_decision = " " #------------------------------------------------------------------------- #Opening print("Welcome to the Endgame!") time.sleep (1.5) print("You are Captain America, and hopefully you are prepared to defeat Thanos.") time.sleep (2.5) print("Every turn you will have 2 choices, [d]eflect or [a]ttack. When you deflect, you have a 50% to deflect the damage back on Thanos. When you attack you randomly deal 1 - 20 damage to Thanos. Thanos will attack every turn with the same roll for damage.") time.sleep (7) print ("Ready") time.sleep (.8) print ("Set") time.sleep (.8) print ("Fight!") #Print current health levels time.sleep(1) print("Current Health") print("Cap has {} HP...".format(cap_health)) print("Thanos has {} HP...".format(thanos_health)) time.sleep(2) while thanos_health > 0: #Player selects their action print("What do you choose?..") print("[a]ttack with Mjolnir") print("or") print("[d]efend with your shield") cap_choice = input("Your choice?... ") if cap_choice == "a" : thanos_sword = random.randint(1, 20) print("Thanos attacks you with his 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 with Mjolnir dealing {} damage".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 deflect to deflect the blow...") time.sleep(1) deflect = random.randint(1, 2) if deflect == 1 : thanos_sword = random.randint(1, 20) print("You were to 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.randint(1, 20) print("Thanos' sword rebounds off Caps vibranium shield and he deals himself {} damage".format(thanos_sword)) thanos_health = thanos_health - thanos_sword time.sleep(1) # End of game loop. Checking health values to determine a winner if cap_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...") 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)