package org.project.entity.enemies;

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

public abstract class Enemy implements Entity {
    Weapon weapon;
    boolean isAlive;
    private int hp;
    private int mp;
    private int baseDamage;

    public Enemy(int hp, int mp, Weapon weapon, int baseDamage) {
        this.baseDamage = baseDamage;
        isAlive = true;
        this.hp = hp;
        this.mp = mp;
        this.weapon = weapon;
    }

    public void setHP(int hp) {
        this.hp = hp;
    }

    public void setMP(int mp) {
        this.mp = mp;
    }

    @Override
    public void takeDamage(int damage) {
        if (0 >= (hp - damage)) {
            isAlive = false;
            hp = 0;
            System.out.println("\u001B[32myou killed your enemy\u001B[0m");
            return;
        }
        hp -= damage;
        System.out.printf("\u001B[31mEnemy took %d damage.\u001B[0m\n", damage);
    }

    public abstract void getKilled();

    public int getHP() {
        return hp;
    }

    public int getMP() {
        return mp;
    }

    public int getBaseDamage() {
        return baseDamage;
    }

    public Weapon getWeapon() {
        return weapon;
    }
}