package org.project.entity.enemies;

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

// TODO: UPDATE IMPLEMENTATION

public abstract class Enemy implements Entity {
    private Weapon weapon;
    private int hp;
    private int mp;
    private int maxHp ;
    private int maxMp ;

    public Enemy(int hp, int mp, Weapon weapon) {
        this.hp = hp;
        this.maxHp = hp ;
        this.mp = mp;
        this.maxMp =mp ;

        this.weapon = weapon;
    }

    @Override
    public void takeDamage(int damage) {
        hp -= damage;
    }

    public int getHp() {
        return hp;
    }

    public void setNewHp(int newhp) {
        hp = newhp;
    }

    public int getMp() {
        return mp;
    }

    public Weapon getWeapon() {
        return weapon;
    }

    @Override
    public  abstract void attack(Entity target)  ;


    // TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR
    public abstract void check_hp();

    public abstract void defend();
    public abstract String getName() ;

    public void heal(int health)
    {
        hp = hp + health ;
        if (hp > maxHp)
        {
            hp = maxHp;
        }

    }
    public void fillMana( int mana)
    {
        mp += mana ;
        if (mp > maxMp)
        {
            mp = maxMp ;
        }
    }
    public boolean IsLive ( )
    {
        if (getHp() <= 0 )
            return false ;
        else
        {
            return true ;
        }
    }
    @Override
    public void LightAttack( Entity target , int base_damage)
    {
        target.takeDamage(base_damage);
    }
    public int getMaxHP() {
        return maxHp;
    }
    public int getMaxMp(){return maxMp ; }
    public void freshFactors()
    {
        mp = maxMp ;
        hp = maxHp ;
    }

}


