package org.project.entity.enemies;

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

public class Goblin extends Enemy {

    public Goblin() {
        this("Goblin", 40, 15, 8, null, 35);
    }

    public Goblin(String name, int maxHP, int maxMP, int damage, Weapon weapon, int xpReward) {
        super(name, maxHP, maxMP, damage, weapon, xpReward);
    }

    // Additional constructor for easier creation without weapon
    public Goblin(String name, int maxHP, int maxMP, int damage, int xpReward) {
        this(name, maxHP, maxMP, damage, null, xpReward);
    }

    @Override
    public void attack(Entity target) {
        if (stunned) {
            System.out.println(ConsoleColors.YELLOW + name + " is stunned and cannot attack!" + ConsoleColors.RESET);
            return;
        }

        int totalDamage = damage;
        if (weapon != null) {
            totalDamage += weapon.getDamage();
        }

        System.out.println(ConsoleColors.RED + name + " swings a crude club!" + ConsoleColors.RESET);
        target.receiveAttack(totalDamage, false);
    }
}