package org.project.entity.enemies;

import org.project.entity.Entity;
import org.project.entity.players.Player;


public abstract class Enemy extends Entity {

    protected final EnemyStats stats;
    private boolean stunned;

    public Enemy(EnemyStats stats) {
        super(stats.maxHP);
        this.stats = stats;
        stunned = false;
    }

    @Override
    public void takeDamage(int damage) {
        super.takeDamage(damage);
        System.out.println("Your attack dealt " + damage + " damage to the enemy!");
    }

    public void attack(Player target) {
        if(!stunned) {
            System.out.println(getType() + " attacked you!");
            target.takeDamage(stats.damage);
        }

        else {
            System.out.println("The enemy was stunned and missed its turn!");
            stunned = false;
        }
    }

    public abstract String getType();

    public int getXpReward() {return stats.xpReward;}
    public boolean isStunned() { return stunned; }
    public void setStunned(boolean stunned) {this.stunned = stunned; }
}
