package org.project.entity.enemies;

import java.util.Random;

public class Goblin extends Enemy
{
    private static final Random random = new Random();

    public Goblin()
    {
        super("Goblin", 50, 20);
    }

    @Override
    public void attack(Entity target)
    {
        // Goblin has 25% chance for critical hit (1.5x damage)
        int baseDamage = 10;
        double critChance = 0.25;
        int damage = baseDamage;

        if (random.nextDouble() < critChance)
        {
            damage = (int) (baseDamage * 1.5);
            System.out.println(name + " lands a critical hit!");
        }
        System.out.println(name + " attacks for " + damage + " damage!");
        target.takeDamage(damage);
    }
}