Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- onward = "\n..."
- dragon_hp = 40
- player_hp = 20
- heal_lmt = 4
- print("You are a fearsome warrior facing off against a terrible dragon.")
- print("You can choose to fight the dragon or run away.")
- Turn = True
- while Turn:
- dodge_chance = random.randint(1, 8)
- action_play = input("\nChoose an action:\nAttack\nHeal\nMagic\nRun\n")
- if action_play == "a":
- # "a" stands for attack
- print("\nYou swing at the dragon with your sword.")
- player_atk = random.randint(3, 5)
- damage = player_atk
- dragon_hp = dragon_hp - damage
- print("\nYou did %d damage!\nDragon HP is now %d!" % (damage, dragon_hp))
- if damage == 5:
- print(' CRITICAL!')
- if action_play == "m":
- # "m" stands for magic
- print("\nYou try hitting the dragon with a fireball...")
- player_magic = random.randint(10, 12)
- magic_miss = random.randint(1, 6)
- if magic_miss == 1:
- print("BLAM! You hit the dragon with a fire ball! You deal a massive %d damage!!" % player_magic)
- dragon_hp = dragon_hp - player_magic
- print("Dragon HP is now %d!" % dragon_hp)
- else:
- print("The dragon dodges your fireball. You deal 0 damage.")
- if action_play == "h":
- # "h" stands for heal
- heal_plus = 8
- if heal_lmt < 5:
- player_hp = player_hp + heal_plus
- if player_hp > 20:
- player_hp = 20
- print("\nYou drink a healing potion. You regain %d HP. You know have %d HP." % (heal_plus, player_hp))
- heal_lmt = heal_lmt + 1
- print("You have", 5 - heal_lmt, "healing potions left.")
- if heal_lmt == 5:
- print("WARNING!! YOU ARE OUT OF HEALING POTIONS!! USING HEAL AGAIN WOULD WASTE A TURN!")
- else:
- print("You ran out of healing potions. You can't heal anymore.")
- if action_play == "r":
- # "r" stands for run
- print("You ran away...")
- break
- if dragon_hp <= 0:
- print("The dragon is Dead!\nYou Win!!")
- break
- print("\nDragon Attacks!")
- dragon_atk = random.randint(1, 3)
- if dragon_atk == 1:
- print("The dragon attacks with blazing fire.")
- fire_dmg = random.randint(15, 18)
- if dodge_chance == 1:
- print("Ouch! The flames burn you! you take %d damage!" % fire_dmg)
- player_hp = player_hp - fire_dmg
- else:
- print("You dodged the fire. Close call.")
- if dragon_atk == 2:
- print("The dragon attacks with his savage claws.")
- claw_dmg = random.randint(3, 5)
- if dodge_chance > 3:
- print("Ouch! You get slashed! you take %d damage!" % claw_dmg)
- player_hp = player_hp - claw_dmg
- else:
- print("You dodged the claws. Close call.")
- if dragon_atk == 3:
- print("The dragon bites down on you with his massive fangs")
- bite_dmg = random.randint(6, 8)
- if dodge_chance > 5:
- print("Ouch! You're caught in the dragon's fangs! you take %d damage!" % bite_dmg)
- player_hp = player_hp - bite_dmg
- else:
- print("You dodged the bite. Close call.")
- print("You now have %d HP" % player_hp)
- if player_hp <= 0:
- print("YOU DIED!")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement