package org.project.entity.enemies;

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

public class Goblin extends Enemy{

    public Goblin(Weapon weapon)
    {
        super(30, 0, weapon);
    }

    @Override
    public void attack(Entity target)
    {
        if (!this.isAlive()) return;
        int baseDamage = 0;
        if (super.getWeapon() != null)
        {
            baseDamage += super.getWeapon().getDamage();
        }
        else
        {
            baseDamage = 8;
        }
        if (Math.random() < 0.4)
        {
            int criticalDamage = baseDamage*2;
            target.takeDamage(criticalDamage);
            System.out.println("👹 Goblin used Critical Strike!");
        }
        else
        {
            target.takeDamage(baseDamage);
            System.out.println("👹 Goblin used Slash!");
        }
    }
}
