Untitled

 avatar
unknown
plain_text
a month ago
1.2 kB
5
Indexable
import random

player_hp = 20
enemy_hp = 15

print("Welcome to the Dark World!")
print("A wild Rudinn appears!\n")

while enemy_hp > 0 and player_hp > 0:

    print(f"Your HP: {player_hp}")
    print(f"Enemy HP: {enemy_hp}")
    print("\nChoose an action:")
    print("1. Fight")
    print("2. Act")
    print("3. Spare")

    choice = input("> ")

    if choice == "1":
        damage = random.randint(3, 6)
        enemy_hp -= damage
        print(f"\nYou attacked for {damage} damage!")

    elif choice == "2":
        print("\nYou complimented the enemy.")
        print("The enemy seems happier.")

    elif choice == "3":
        if enemy_hp <= 5:
            print("\nYou spared the enemy peacefully!")
            break
        else:
            print("\nThe enemy is not ready to be spared.")

    else:
        print("\nInvalid choice.")

    if enemy_hp > 0:
        enemy_damage = random.randint(2, 5)
        player_hp -= enemy_damage
        print(f"\nThe enemy attacks for {enemy_damage} damage!")

    print("\n-------------------\n")

if player_hp <= 0:
    print("You were defeated...")
elif enemy_hp <= 0:
    print("Enemy defeated!")
Editor is loading...
Leave a Comment