package org.project.entity.enemies;

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

public class Goblin extends Enemy{

    public Goblin(String name, int hp, int mp, Weapon weapon, int xpReward) {
        super("Goblin", 40, 15, new Sword(), 50);
    }

    @Override
    public void attack(Entity target){
        int damage = weapon.getDamage();
        if (Math.random() < 0.3) {
            damage *= 2;
            System.out.println("\u001B[31m  Goblin landed a CRITICAL hit!\u001B[0m");
        }
        target.takeDamage(damage);
        System.out.println("\u001B[31m Goblin  attacked for " +  damage + " damage!\u001B[0m");
    }

    @Override
    public void specialAbility(Entity target) {
        System.out.println("\u001B[31m  Goblin use RAPID STRIKE \u001B[0m");
        attack(target);
        attack(target);
    }

    @Override
    public String geTKeyType() {
        return "GoblinKey";
    }
}
