package org.project.entity.enemies;

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

public abstract class Enemy implements Entity {
    Weapon weapon;
    private int hp;
    private int mp;
    private boolean isStunned = false;
    private int stunTurns = 0;

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

        this.weapon = weapon;
    }

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

    public void setStunned(boolean stunned) {
        this.isStunned = stunned;
        if (stunned) {
            this.stunTurns = 1;  //Stunned in one turn
        }
    }

    //Decreasing the stunned turns
    public void decrementStun() {
        if (isStunned) {
            stunTurns--;
            if (stunTurns <= 0) {
                isStunned = false;
            }
        }
    }

    public boolean isStunned() {
        return isStunned;
    }

    public int getHp() {
        return hp;
    }

    public int getMp() {
        return mp;
    }

    public Weapon getWeapon() {
        return weapon;
    }
}
