package org.project.entity.enemies;

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

import java.util.Random;

public class Goblin extends Enemy
{

    private Random random = new Random();

    private static final String RESET = "\u001B[0m";
    private static final String RED = "\u001B[31m";
    private static final String PURPLE = "\u001B[35m";

    public Goblin() {
        super("Goblin", 60, 20, new BasicWeapon("Rusty Dagger", 12));
    }

    @Override
    public void attack(Entity target)
    {

        int damage = weapon.getDamage();

        if (random.nextInt(100) < 25)
        {
            damage *= 2;
            System.out.println(PURPLE + "💀 Goblin CRITICAL strike!" + RESET);
        }

        target.takeDamage(damage);

        System.out.println(RED + "👹 Goblin attacks for " + damage + " damage!" + RESET);
    }
}