#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Joseph # Created : 2025 # Copyright : © Joseph - 2025 #-------------------------------------------------------------------------- # Import Libraries import time import random import sys # Starting Health cap_health_player_baaa1 = 50 thanos_health_bot_baaa1 = 100 # Damage cap_damage_player_baaa1 = 0 thanos_damage_bot_baaa1 = 0 # Deflect deflect_player_baaa1 = 0 # Player Decision cap_choice_player_baaa1 = " " # Text System txt_delay_log_text = 0 aaaaa_count_log_text = 0 aaaaa_detect_log_text = 0 # Dialogue aaaa1_log_text = "The sky grows darker as the army of Thanos grows on the horizon." aaaa2_log_text = "Thor and Tony lie battered and motionless on the ground, unable to fight after Thanos cooked them." aaaa3_log_text = "It is up to you, Cap, to finish this. The fate of the universe is your weight to bare." aaaa4_log_text = "You stand there, hurt. But you valiantly wield your shield in one hand and Mjolnir in the other." aaaa5_log_text = "You are worthy, but will the power of Odin be enough...." aaaa6_log_text = "Its capping' time." for char in aaaa1_log_text: # Went through a lot of trials. Credit: Grigorji Schleifer, teamtreehouse.com : Public Fourm sys.stdout.write(char) sys.stdout.flush() time.sleep(0.02) print("\n") for char in aaaa2_log_text: sys.stdout.write(char) sys.stdout.flush() time.sleep(0.02) print("\n") for char in aaaa3_log_text: sys.stdout.write(char) sys.stdout.flush() time.sleep(0.02) print("\n") for char in aaaa4_log_text: sys.stdout.write(char) sys.stdout.flush() time.sleep(0.02) print("\n") for char in aaaa5_log_text: sys.stdout.write(char) sys.stdout.flush() time.sleep(0.02) print("\n") for char in aaaa6_log_text: sys.stdout.write(char) sys.stdout.flush() time.sleep(0.02) # Print current health levels time.sleep(1) print() print(" Current Health") print(" Cap has {} HP...".format(cap_health_player_baaa1)) print(" Thanos has {} HP...".format(thanos_health_bot_baaa1)) time.sleep(2) # Player selects their action print() print(" What do you choose?..") print(" [a]ttack with Mjolnir") print(" or") print(" [d]efend with your shield") cap_choice = input(" Your choice?... ") print() # Player choice # Choice A if cap_choice == "a" : thanos_sword = random.randint(1, 20) print("Thanos attacks you with his double bladed sword and deals {} damage".format(thanos_sword)) cap_health = cap_health_player_baaa1 - thanos_sword if cap_health < 1: exit time.sleep(1) cap_mjolnir = random.randint(1, 20) print("You attack back with Mjolnir in hand dealing {} damage in return".format(cap_mjolnir)) thanos_health = thanos_health_bot_baaa1 - 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_player_baaa1 = cap_health_player_baaa1 - thanos_sword if cap_health_player_baaa1 < 1: exit 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_bot_baaa1 = thanos_health_bot_baaa1 - thanos_sword time.sleep(1) # End of game loop. Checking health values to determine a winner if cap_health_player_baaa1 < 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) # | | | | | | | | | | | | | | | | | | | | | | | | | | |