package org.project.entity;

/*public interface Entity {
    void attack(Entity target);

    void defend();

    void heal(int health);

    void fillMana(int mana);

    void takeDamage(int damage);

    int getMaxHP();

    int getMaxMP();

    /*
    TODO: ADD OTHER REQUIRED AND BONUS METHODS
    */
public abstract class Entity {

    protected String name;

    protected int hp;
    protected int mp;

    protected int maxHP;
    protected int maxMP;

    public Entity(String name, int hp, int mp) {

        this.name = name;

        this.hp = hp;
        this.mp = mp;

        this.maxHP = hp;
        this.maxMP = mp;
    }

    public abstract void attack(Entity target);

    public abstract void defend();

    public abstract void heal(int health);

    public void fillMana(int mana) {

        mp += mana;

        if (mp > maxMP) {
            mp = maxMP;
        }
    }

    public void takeDamage(int damage) {

        hp -= damage;

        if (hp < 0) {
            hp = 0;
        }
    }

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

    public int getMaxHP() {
        return maxHP;
    }

    public int getMaxMP() {
        return maxMP;
    }

    public int getHp() {
        return hp;
    }

    public int getMp() {
        return mp;
    }

    public String getName() {
        return name;
    }
}
