package org.project.entity.enemies;

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

// TODO: UPDATE IMPLEMENTATION
public class Skeleton extends Enemy {
    // TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR
    private boolean hasRevived = false;

    public Skeleton() {
        super("Skeleton", 40, 15, null);
    }

    public Skeleton(Weapon weapon) {
        super("Skeleton", 40, 15, weapon);
    }

    @Override
    public void attack(Entity target) {
        int damage = 15;
        System.out.println(getName() + " shoots an arrow for " + damage + " damage!");
        target.takeDamage(damage);
    }

    @Override
    public void takeDamage(int damage) {
        super.takeDamage(damage);

        if (!isAlive() && !hasRevived) {
            hasRevived = true;
            int revivedHp = getMaxHP() / 2;
            setHp(revivedHp);
            System.out.println(getName() + " rises again with " + revivedHp + " HP");
        }
    }

    @Override
    public int getMaxMP() {
        return 0;
    }

    @Override
    public int getXpReward() {
        return 70;
    }

    @Override
    public String getEnemyType() {
        return "SKELETON";
    }
}
