#-------------------------------------------------------------------------- # Name : Endgame # Purpose : 11DGT # Author: Hayden De Rohan # Created : 19/02/2024 # Finished : 21/02/2024 # Copyright : © Hayden De Rohan 21/02/2024 #-------------------------------------------------------------------------- import random import time CaptHp = 999999999 ThanosHp = 100 blocks = 0 stacks = 0 print(" ") print("!! Use lowercase as inputs !!") print(" ") while True : print(" ") player_Name = input("What is your superhero's name? - ") if player_Name.isalpha() == True : break else : print(" ") print("Enter your name as a string") print(" ") while True : try : print() AskHp = int(input("Select the amount of health you want {} to have that is between 50-80 - this effects the difficulty the greater the easier - ".format(player_Name))) if AskHp < 50 or AskHp > 80 : print() print("Input a value between 50 and 80!") else : CaptHp = int(AskHp) print("{} now has ".format(player_Name), CaptHp, " Hp") break except : print() print("Enter a number") time.sleep(1) print(" ") print("Ironman and Thor have fallen") time.sleep(0.7) print("The rest of the team are gone") time.sleep(0.7) print("You", player_Name ,"wield both Captain America's shield and Mjolnir and are face-to-face with Thanos...") time.sleep(1) def StackExplode(amount) : print(amount, " stacks exploded doing ") #StackDamage = def Hit() : Damage = random.randint(1,20) crit = random.randint(1,5) #print("original damage = ", Damage) time.sleep(0.5) if crit == 5 : print("{}".format(player_Name), "was able to crit doing 4x damage!") Damage = int(Damage)*4 print(" ") #print("Crit value = ", int(crit)) print("You swing at Thanos doing ", "[" ,Damage, "] "," damage") return Damage def ThanosAttack() : ThanosDamage = random.randint(1,20) time.sleep(0.5) print(" ") print("Thanos Attacks with his blade doing ", "[" ,ThanosDamage, "] "," damage") return ThanosDamage def Stacks(num) : StacksGiven = random.randint(1,3) print(" ") print("You stacked up ", StacksGiven) return StacksGiven def Actions() : print(" ") print(" ") print("[A] Attack Thanos with Mjolnir to do damage") print("[B] Use your sheild to mitigate on coming damage") print("[C] Empowering 'stacks' that have a 25% chance to go off") time.sleep(0.5) print(" ") print("What to do?") time.sleep(0.2) Choice = input(" -- ") return Choice def HpLevels(CaptHp, ThanosHp) : print(" ") print(" ") time.sleep(0.5) print("{}'s Hp : ".format(player_Name), " [" ,int(CaptHp), "] ") print("Thano's Hp : ", " [" ,int(ThanosHp), "] ") def MainScript(CaptHp, ThanosHp, blocks, stacks) : while CaptHp >= 0 : while ThanosHp >= 0 : HpLevels(CaptHp, ThanosHp) time.sleep(0.5) Answer = Actions() print("You choose [", Answer, "]") if Answer == "A".casefold() : no = Hit() ThanosTake = int(no) print(" ") print("You attacked") ThanosHp -= ThanosTake elif Answer == "B".casefold() : blocks += 1 print(" ") print("You blocked") elif Answer == "C".casefold() : Explode = random.randint(1,4) Amount_Stacks = Stacks(stacks) stacks += int(Amount_Stacks) if Explode == 4 : print() print("stacks exploded") StackExplode(stacks) print() print("Remaing total stacks : ", stacks) else : print("Different Input detected") if blocks > 0 : number = ThanosAttack() CaptTake = int(number) print(" ") print("You blocked and it was used to mitigate ", int(CaptTake/3), " damage from Thanos's orginal ", CaptTake) Relfect = random.randint(1,2) if Relfect == 2 : print(" ") print("You reflected the attack and did ", CaptTake, " damage to Thanos") ThanosHp -= (CaptTake) else : print(" ") print("You couldn't reflect the attack") CaptHp -= (CaptTake/3) blocks -= 1 else : number = ThanosAttack() CaptTake = int(number) CaptHp -= (CaptTake) if blocks > 0 : blocks = 0 print(" ") if CaptHp < 1 : print(" ") time.sleep(1) print(" -- {} has fallen -- ".format(player_Name)) print("Thanos had ", "[",ThanosHp,"]", "hp remaining") Restart = input("Wish to play again? y/n - ") if Restart == "y".casefold() : CaptHp = AskHp ThanosHp = 100 blocks = 0 MainScript(CaptHp, ThanosHp, blocks, stacks) break elif Restart == "n".casefold() : print(" ") print("Thank you for playing") break break else : print(" ") time.sleep(1) print("{} killed Thanos".format(player_Name), " with ", CaptHp, " health remaining") print(" ") print(" -- Universe Saved -- ") Restart = input("Wish to play again? y/n - ") if Restart == "y".casefold() : CaptHp = AskHp ThanosHp = 100 blocks = 0 MainScript(CaptHp, ThanosHp, blocks, stacks) break elif Restart == "n".casefold() : print(" ") print("Thank you for playing") break break if __name__ == "__main__" : print(" ") print(" ") print(" -- Game Worked -- ") MainScript(CaptHp, ThanosHp, blocks, stacks) else : print("Didn't work LMAOOOOO")