package org.project.entity.players;

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

public class Wizard extends Player
{

    private static final int LIGHT_COST = 5;
    private static final int HEAVY_COST = 15;
    private static final int SPECIAL_COST = 30;

    private static final String RESET = "\u001B[0m";
    private static final String RED = "\u001B[31m";
    private static final String GREEN = "\u001B[32m";
    private static final String YELLOW = "\u001B[33m";
    private static final String BLUE = "\u001B[34m";
    private static final String PURPLE = "\u001B[35m";

    public Wizard(String name) {
        super(name, 100, 120, new BasicWeapon("Magic Staff", 20));
    }

    @Override
    public void lightAttack(Entity target)
    {
        if (mp < LIGHT_COST)
        {
            System.out.println(RED + "❌ Not enough MP!" + RESET);
            return;
        }

        mp -= LIGHT_COST;
        int dmg = weapon.getDamage() + 10;
        target.takeDamage(dmg);

        System.out.println(YELLOW + "✨ " + name + " casts Magic Bolt for " + dmg + " damage!" + RESET);
    }

    @Override
    public void heavyAttack(Entity target)
    {
        if (mp < HEAVY_COST)
        {
            System.out.println(RED + "❌ Not enough MP!" + RESET);
            return;
        }

        mp -= HEAVY_COST;
        int dmg = weapon.getDamage() + 35;
        target.takeDamage(dmg);

        System.out.println(PURPLE + "🔥 " + name +
                " casts FIREBALL for " + dmg + " damage!" + RESET);
    }

    @Override
    public void defendAction()
    {
        defend();
        System.out.println(BLUE + "🔮 Magical barrier activated!" + RESET);
    }

    @Override
    public void healAction()
    {
        if (mp < 20)
        {
            System.out.println(RED + "❌ Not enough MP to heal!" + RESET);
            return;
        }

        mp -= 20;
        heal(40);
        System.out.println(GREEN + "💖 " + name +
                " casts HEAL restoring 40 HP!" + RESET);
    }

    @Override
    public void specialAbility(Entity target)
    {
        if (mp < SPECIAL_COST)
        {
            System.out.println(RED + "❌ Not enough MP!" + RESET);
            return;
        }

        mp -= SPECIAL_COST;

        int dmg = weapon.getDamage() + 60;
        target.takeDamage(dmg);

        System.out.println(BLUE + "🌪️ ARCANE BURST hits for " +
                dmg + " damage!" + RESET);
    }
}