package org.project.entity;

import org.project.item.weapons.Weapon;

public abstract class Entity {

    private Weapon weapon;
    private int hp;
    private int maxHP;


    public Entity(Weapon weapon, int hp, int maxHP) {
        this.weapon = weapon;
        this.hp = hp;
        this.maxHP = maxHP;
    }

    public boolean isAlive() {
        if(hp>0)
            return true;

        return false;
    }

    public abstract void attack(Entity target);

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

    public void takeDamage(int damage) {hp -= weapon.getDamage();}

    public int getMaxHP() {return maxHP;}
    public int getHP() {return hp;}
    public Weapon getWeapon() {return weapon;}

    /*
    TODO: ADD OTHER REQUIRED AND BONUS METHODS
    */
}
