# Name : Endgame # Purpose : 11DGT # Author: Rhys Peter David Mason # Created : 19/02/2024 # Copyright : © Shay McDonald 19/02/2024 import random import time cap_health = 50 thanos_health = 100 thanos_sword = 0 cap_mjolnir = 0 deflect = 0 cap_choice = " " print("The sky grows darker as the army of Thanos moves closer.") print(" ") time.sleep(2) print("Thor and Tony lie battered and motionless on the ground from the previous encounter.") print(" ") time.sleep(3) print("It is up to you, Cap, to finish this. The fate of the universe is your weight to bare.") print(" ") time.sleep(3.5) print("You stand there, hurt. But you have your shield in arm hand and wield Mjolnir in the other.") print(" ") time.sleep(4) print("You are worthy, but will the power of Thor be enough....") print(" ") time.sleep(3) print("You are in the ENDGAME now") print(" ") time.sleep(1) print("Current Health") print("Caps Health = {}" .format(cap_health)) print("Thanos Health = {}" .format(thanos_health)) print(" ") time.sleep(2) while thanos_health > 0: cap_choice = input("You are Cap do you want to: Attack or Defend? (a/d): ") if cap_choice == "a" : time.sleep(1) print(" ") print("Attack!") time.sleep(1) print(" ") print("Thanos is attacking...") thanos_sword = random.randint(1, 20) cap_health = cap_health - thanos_sword time.sleep(1) print(" ") print("Thanos has attacked!") time.sleep(1) print(" ") print("Cap took", thanos_sword, "damage") time.sleep(1) print(" ") print("Current Health") print("Caps Health = {}" .format(cap_health)) print("Thanos Health = {}" .format(thanos_health)) print(" ") time.sleep(2) if cap_health < 0 : print(" ") print(" Game Over") print(" ") print(" Cap Health = 0") print(" ") print("THANOS WINS!") break if thanos_health < 0 : print(" ") print(" Game Over") print(" ") print(" Thanos Health = 0") print(" ") print("CAP WINS!") break time.sleep(1) print("Cap is attacking...") cap_mjolnir = random.randint(1, 20) thanos_health = thanos_health - cap_mjolnir time.sleep(1) print(" ") print("Cap has attacked!") time.sleep(1) print(" ") print("Thanos took", cap_mjolnir, "damage") time.sleep(1) print(" ") print("Current Health") print("Caps Health = {}" .format(cap_health)) print("Thanos Health = {}" .format(thanos_health)) print(" ") time.sleep(2) if cap_choice == "d" : time.sleep(1) print(" ") print("Defend!") time.sleep(1) print(" ") print("Cap is defending...") time.sleep(1) deflect = random.randint(1, 2) if deflect == 1: print(" ") print("Attack Deflected!") time.sleep(1) cap_mjolnir = random.randint(1, 20) thanos_health = thanos_health - cap_mjolnir print(" ") print("Thanos took", cap_mjolnir, "damage!") time.sleep(1) print(" ") print("Current Health") print("Caps Health = {}" .format(cap_health)) print("Thanos Health = {}" .format(thanos_health)) print(" ") if thanos_health < 0 : print(" ") print(" Game Over") print(" ") print(" Thanos Health = 0") print(" ") print("CAP WINS!") break if deflect == 2: print(" ") print("Attack was not deflected!") time.sleep(1) thanos_sword = random.randint(1, 20) cap_health = cap_health - thanos_sword print(" ") print("Cap took", thanos_sword, "damage!") time.sleep(1) print(" ") print("Current Health") print("Caps Health = {}" .format(cap_health)) print("Thanos Health = {}" .format(thanos_health)) print(" ") if cap_health < 0 : print(" ") print(" Game Over") print(" ") print(" Cap Health = 0") print(" ") print("THANOS WINS!") break