package org.project.entity;

public abstract class Entity {

    private int hp;
    private final int maxHP;


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

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

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

    public void takeDamage(int damage) {
        hp -= damage;
        if(hp<0) hp = 0;
    }

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

}
