package org.project.entity.enemies;

import org.project.entity.Entity;
import org.project.item.weapons.Weapon;
import org.project.ConsoleColors;

public class Skeleton extends Enemy {
    private boolean hasResurrected;
    public Skeleton() {
        super(40, 0, new Weapon(8, 0, "Bone Sword", 0) {
            @Override
            public void use(Entity target) {
                target.takeDamage(getDamage());
            }
        });
        this.hasResurrected = false;
    }
    @Override
    public void takeDamage(int damage) {
        super.takeDamage(damage);
        if (!isAlive() && !hasResurrected) {
            hp = maxHP / 2;
            hasResurrected = true;
            System.out.println("☠️ Skeleton resurrected with " + hp + " HP!");
        }
    }
    @Override
    public void attack(Entity target) {
        int damage = getWeapon().getDamage();
        target.takeDamage(damage);
        System.out.println(ConsoleColors.RED + "Skeleton dealt " + damage + " damage." + ConsoleColors.RESET);
    }
}