#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Alexander Rossiter # Created : 19/02/2024 # Copyright : © Alexander 19/02/24 #-------------------------------------------------------------------------- #Import libraries import random import time # Set starting variables ---------------------------- # Starting Health cap_health = 50 thanos_health = 100 # Damage presets thanos_sword = 0 cap_mjolnir = 0 # Delfect preset deflect = 0 # Player Decision Preset cap_choice = " " play_again = "y" #Intro print("The sky grows darker as the army of thanos moves closer.") time.sleep(2) print("Thor and Tony lie shattered and motionless after their previous encounter.") time.sleep(3) print("It's up to you cap, please finish this. The fate of this universe is in your hands.") time.sleep(3.5) print("You stand there motionless, but you still hold your sheild tight in one arm,") print("whilst weilding Mjolnir in the other.") time.sleep(4) print("Your are worthy, but will the power of Thor be enough...") time.sleep(2) print("You are in the ENDGAME now") time.sleep(1) #start of game loop while thanos_health > 0: print() time.sleep(1) print("current health") print("cap has {} HP".format(cap_health)) print("thanos has {} HP".format(thanos_health)) time.sleep(2) print() print("whats your first move?") print("[a]ttack with Mjolnir") print("or will you...") print("[d]efend with your sheild") cap_choice = input("your move:") print() if cap_choice == "a" : thanos_sword = random.randint(1, 20) print("thanos attacks with his double bladed word and deal {} damage".format(thanos_sword)) cap_health = cap_health - thanos_sword if cap_health <1 : break else: cap_mjolnir = random.randint(1,20) print("you attack next with Mjolnir dealing {} damage in return".format(cap_mjolnir)) thanos_health = thanos_health - cap_mjolnir time.sleep(1) while thanos_health > 0: if cap_choice == "d": print("Thanos attacks you with his double-bladed sword...") print("You raise your shield to deflect the blow...") time.sleep(1) deflect = random.randint(1, 2) if deflect == 1: thanos_sword = random.randint(1, 20) print("You were too 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 Cap's 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 was too strong. Your sheild is broken and have been slicked down. Our universe, now comes to an end.") #option to play again play_again = input("Luck wasnt on your side... But do you want to play again? [y] or [n]o?") else: print() print("thanos has fallen!") time.sleep(5) print("you drop to your knees, exhausted") time.sleep(5) print("you look out upon the universe.") print("it is safe...") time.sleep(4) print(" ..for now...") time.sleep(6) #option to play again play_again = input("Good job! Do you want to play again? [y]es or [n]o?") time.sleep(2) print("thank you for playing the game today!") time.sleep(2)