#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Gareth Willats # Created : 20/02/2025 # Copyright : © #-------------------------------------------------------------------------- #Imports: #-------------------------------------------------------------------- import random import time #Variable lists: #-------------------------------------------------------------------- chshp = " " healthC = " " healthT = 100 damageC = 0 damageT = 0 deflect_chance = random.randint(1,2) inputC = " " damagewrd = random.randint(1,3) if damagewrd == 1: damagewrd = "casts" if damagewrd == 2: damagewrd = "deals" if damagewrd == 3: damagewrd = "does" playagain = " " #Strings: #-------------------------------------------------------------------- print("Ironman and Thor have fallen") time.sleep(2) print("The rest of the team gone") time.sleep(2) print("You wield both your shield and Mjolnir and are face-to-face with Thanos...") time.sleep(3) #MainStrCode: #-------------------------------------------------------------------- chshp = input("Choose hp. 50/80: ") if chshp == "50": healthC = 50 if chshp == "80": healthC = 80 else: print("Let's just go with 50..") healthC = 50 while healthT > 0 : print("-----------------------------------------------") print("Caps Current Health =", healthC) print("Thanos' Current Health =", healthT) time.sleep(2) print("Cap may swing or defend.") time.sleep(2) inputC = input("What is your decision? ") if inputC == "swing" or inputC == "Swing": print("------------------------------------------------") damageT = random.randint(1,30) time.sleep(2) print("Thanos' attack", damagewrd, damageT, "Damage") time.sleep(2) print("Cap Swipes") time.sleep(2) damageC = random.randint(5,35) print("Cap", damagewrd, damageC, "Damage") time.sleep(1) print("--------------------------------------------") healthT -= damageC healthC -= damageT print("Thanos' health is now", healthT,",") time.sleep(1) print("Your health is now", healthC,".") time.sleep(1) if healthC < 1: time.sleep(3) print(healthC) print("You have fallen!") if healthT < 1: print("Thanos has fallen!") if inputC == "defend" or inputC == "Defend": print("------------------------------------------------") time.sleep(1) deflect = random.randint(1,2) if deflect == 1: damageT = random.randint(1,30) print("You attempted to raise your shield but was too slow.") time.sleep(2) print("Thanos", damagewrd, damageT, "damage.") healthC -= damageT time.sleep(1) print("Thanos' health is now", healthT,",") time.sleep(1) print("Your health is now", healthC,".") time.sleep(1) else: damageT = random.randint(1,30) print("Thanos' sword rebounds and", damagewrd, damageT, "damage.") healthT = healthT - damageT time.sleep(1) print("Thanos' health is now", healthT,",") time.sleep(1) print("Your health is now", healthC,".") time.sleep(1) if healthT < 1: time.sleep(3) print(healthT) print("Thanos has fallen!") playagain = input("Play again? [y]/[n]") if playagain == "n": break if playagain == "y": healthT = 100 if healthC < 1: time.sleep(3) print(healthC) print("You have fallen!") print("-----------------------------------------------") playagain = input("Play again? [y]/[n]") if playagain == "n": break if playagain == "y": chshp = input("Choose hp. 50/80 ") if chshp == "50": healthC = 50 if chshp == "80": healthC = 80 else: print("Let's just go with 50..") healthC = 50 healthT = 100 #End of Strings: #--------------------------------------------------------------------#