package org.project.entity.enemies;

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

public class Goblin extends Enemy {
    private double criticalChance;
    public Goblin() {
        super(30, 0, new Weapon(5, 0, "Claw", 0) {
            @Override
            public void use(Entity target) {
                target.takeDamage(getDamage());
            }
        });
        this.criticalChance = 0.4;
    }
    @Override
    public void attack(Entity target) {
        int damage = getWeapon().getDamage();
        if (Math.random() < criticalChance) {
            damage *= 2;
            System.out.println("👹 Goblin used Critical Strike!");
        }
        target.takeDamage(damage);
        System.out.println(ConsoleColors.RED + "Goblin dealt " + damage + " damage." + ConsoleColors.RESET);
    }
}