package org.project.entity.enemies;

import org.project.entity.Entity;
import org.project.item.weapons.BasicWeapon;

public class Skeleton extends Enemy
{

    private boolean revived = false;

    private static final String RESET = "\u001B[0m";
    private static final String RED = "\u001B[31m";
    private static final String YELLOW = "\u001B[33m";

    public Skeleton()
    {
        super("Skeleton", 70, 10, new BasicWeapon("Bone Sword", 15));
    }

    @Override
    public void attack(Entity target)
    {

        int damage = weapon.getDamage();

        target.takeDamage(damage);

        System.out.println(RED + "☠ Skeleton slashes for " + damage + " damage!" + RESET);
    }

    @Override
    public void takeDamage(int damage)
    {

        super.takeDamage(damage);

        if (!isAlive() && !revived)
        {

            revived = true;
            this.hp = 40;

            System.out.println(YELLOW + "⚠ Skeleton reassembles itself!" + RESET);
        }
    }
}