package org.project.entity.enemies;

import org.project.entity.Entity;

public abstract class Enemy implements Entity {
    protected String name;
    protected int hp;
    protected int maxHP;
    protected int baseDamage;
    protected boolean stunned;

    public Enemy(String name, int hp, int baseDamage) {
        this.name = name;
        this.hp = hp;
        this.maxHP = hp;
        this.baseDamage = baseDamage;
        this.stunned = false;
    }

    public abstract void attackAction(Entity target);

    @Override
    public void takeDamage(int damage) {
        hp -= damage;
        if (hp < 0) hp = 0;
        System.out.println("\u001B[31m" + name + " took " + damage + " damage!\u001B[0m");
    }

    @Override
    public void heal(int health) {
        hp += health;
        if (hp > maxHP) hp = maxHP;
    }

    @Override
    public void fillMana(int mana) {}

    @Override
    public int getHp() { return hp; }

    @Override
    public int getMaxHP() { return maxHP; }

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

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

    @Override
    public boolean isAlive() { return hp > 0; }

    @Override
    public String getName() { return name; }

    @Override
    public void setStunned(boolean stunned) { this.stunned = stunned; }

    @Override
    public boolean isStunned() { return stunned; }
}