package org.project.entity.enemies;


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

public class Skeleton extends Enemy{
    private boolean hasRevived;

    public Skeleton(String name, int hp, int mp, Weapon weapon, int xpReward) {
        super("Skeleton", 50, 20, new Sword(), 60);
        this.hasRevived = false;
    }

    @Override
    public void takeDamage(int damage){
        hp -= damage;
        if (hp < 0) hp = 0;
        System.out.println("\u001B[31m" + name + " Skeleton takes " +  damage + " damage!\u001B[0m");
        if (!hasRevived){
            hp = maxHP/2;
            hasRevived = true;
            System.out.println("\u001B[35m  Skeleton is revived whit " + hp + " HP!\u001B[0m");
        }
    }

    @Override
    public void specialAbility(Entity target){
        System.out.println("\u001B[31m  uses ability!\u001B[0m");
        attack(target);
        heal(10);
    }

    @Override
    public String geTKeyType() {
        return "SkeletonKey";
    }
}
