package org.project.entity.enemies;

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

public class Goblin extends Enemy
{

    public Goblin()
    {
        super("Goblin", 30, 20, null);
    }

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

    @Override
    public int getXpReward() {
        return 50;
    }

    @Override
    public String getEnemyType() {
        return "GOBLIN";
    }

    @Override
    public void attack(Entity target)
    {
        boolean isCritical = Math.random() < 0.3;
        int damage = isCritical ? 25 : 12;
        System.out.print(getName() + " attacks");
        if (isCritical) {
            System.out.print(" with CRITICAL hit!");
        }
        System.out.println(" for " + damage + " damage!");

        target.takeDamage(damage);
    }

    @Override
    public int getMaxMP() {
        return 0;
    }
}
