# Name: Endgame # Purpose : 11DGT # Author : Suvin Bandara # Created : 17/02/2025 # Copyright : © Suvin Bandara 17/02/2025 # Import libraries import random import time # Starting health vik_health = 50 dragon_health = 100 # Damage presets dragon_fire = 0 vik_sword = 0 # Deflect presets deflect = 0 # Player Decision Preset vike_choice = "" # Intro print("The sky grows darker as the dragon destroys everything in its path.") time.sleep(2) print("The viking men lie battered and motionless on the ground from the dragon's previous encounter.") time.sleep(3) print("It is up to you, viking, to finish off this battle. The fate of our village is on you.") time.sleep(3.5) print("You stand there hurt. But you have your shield in one hand and the mighty sword in the other.") time.sleep(4) print("You wield that powerful sword crafted by the high elves, but will the power of that sword be enough?") time.sleep(3) print("You are in the endgame now.") time.sleep(1) while dragon_health > 0: # Print current health levels time.sleep(1) print() print("Current health:") print("Vik has {} HP".format(vik_health)) print("Dragon has {} HP".format(dragon_health)) time.sleep(2) # Player selects their action print() print("What do you choose?") print("[a]ttack with sword") print("or") print("[d]efend with your shield") cap_choice = input("Your choice? ") print() # Player choice # Choice A (Attack) if cap_choice == "a": dragon_sword = random.randint(1, 20) print("Dragon attacks you with his breeding fire deals {} damage.".format(dragon_sword)) vik_health = vik_health - dragon_sword if vik_health < 1: break time.sleep(1) vik_sword = random.randint(1, 20) print("You attack back with your sword in hand, dealing {} damage in return.".format(vik_sword)) dragon_health = dragon_health - vik_sword time.sleep(1) # Choice D (Defend) else: print("Dragon attacks you with his giant wings...") print("You raise your shield to deflect the blow...") time.sleep(1) deflect = random.randint(1, 2) if deflect == 1: dragon_sword = random.randint(1, 20) print("You were too slow in raising your shield, and the dragon strikes you with his claws, dealing {} damage.".format(dragon_sword)) vik_health = vik_health - dragon_sword if vik_health < 1: break else: dragon_sword = random.randint(1, 20) print("Dragon's fiery breath rebounds off your shield, and he takes {} damage.".format(dragon_sword)) dragon_health = dragon_health - dragon_sword time.sleep(1) # End of game loop. Checking health values to determine a winner if vik_health < 1: print() print("The dragon is too strong. He has broken your shield and cut you down. This is the end of all life in our village...") break elif dragon_health < 1: print() print("The dragon has fallen!") time.sleep(0.5) print("You drop to your knees, exhausted.") time.sleep(0.5) print("You stare out into a grateful village.") time.sleep(1) print("It is safe...") time.sleep(3) print(" ..For now...") time.sleep(5) START_HP_CAP = 50 START_HP_THANOS = 100 vik_health = 0 dragon_health = 0 dragon_sword = 0 vik_sword = 0 deflect = 0 cap_choice = " " play_again = "y" while play_again == "y" : while thanos_health > 0 : if cap_health < 1: print() print("The dragon is to strong. He has broken your shield") else: print() print("The dragon has fallen") time.slee-(.5) print (" You drop to the ground and look at your bloddy hand") time.slee-(.5) print (" You stare into your village as you were now named a hero") time.sleep(1) print("Everyone comes out of there hding in the village and your here them clap nd cheer from a far") time sleep(2) print("ths")