package org.project.entity.players;

import org.project.entity.Entity;
import org.project.item.armors.Robe;
import org.project.item.weapons.Wand;

public class Wizard extends Player{

    public Wizard(String name)
    {
        super(name, 200, 100, new Wand(), new Robe());
        //Wizard: Highest Max Health (HP).
    }

    @Override
    public int getBaseDamage()
    {
        return 8;
    }

    @Override
    public void specialAbility(Entity target)
    {
        if (this.getMp() < costSpecial)
        {
            System.out.println(YELLOW+"Not enough Mana for Soul Siphon!"+RESET);
            return;
        }
        this.setMp(this.getMp() - costSpecial);
        int damage = getBaseDamage() + (weapon != null ? weapon.getDamage() : 0) + 25;
        target.takeDamage(damage);
        int selfHeal = 15;

        System.out.println("🪄 " +PURPLE+ name + " (Wizard) used soul siphon!"+RESET + " (" + BLUE+costSpecial+RESET + " Mana)");
        System.out.println("💥 " + target.getClass().getSimpleName() + " took " + RED+damage+RESET + " damage!");
        heal(selfHeal);
    }

    @Override
    public void heavyAttack(Entity target)
    {
        int baseDmg = getBaseDamage() * 2;
        int weaponDmg = (weapon != null) ? weapon.getDamage() : 0;
        int totalDmg = baseDmg + weaponDmg;

        if (this.getMp() < costHeavy)
        {
            System.out.println(YELLOW+"Not enough Mana for Heavy Attack!"+RESET);
            return;
        }
        this.setMp(this.getMp() - costHeavy);

        target.takeDamage(totalDmg);
        System.out.println("💥 " + name + " (Wizard) used Heavy Attack! " + "( " + BLUE+costHeavy+RESET + " Mana)");
        System.out.println("💥 " + target.getClass().getSimpleName() + " took " + RED+totalDmg+RESET + " fire damage!");
    }

    @Override
    public void lightAttack(Entity target)
    {
        int baseDmg = getBaseDamage();
        int weaponDmg = (weapon != null) ? weapon.getDamage() : 0;
        int totalDmg = baseDmg + weaponDmg;
        target.takeDamage(totalDmg);
        System.out.println("️🧙 " + name + " (Wizard) used Light Attack! " + "( " + BLUE+costLight+RESET + " Mana)");
        System.out.println("💥 " + target.getClass().getSimpleName() + " took " + RED+totalDmg+RESET + " magical damage!");
    }

    @Override
    public void heal(int health)
    {
        setHp(getHp() + health);
        if (this.getHp() > getMaxHP()) {
            setHp(getMaxHP());
        }
        System.out.println("💚" + name + " (Wizard) healed " + health + " HP!" );
    }
    @Override
    public void defend()
    {
        if (this.getMp() >= costDefend)
        {
            this.setMp(getMp() - costDefend);
            this.setDefending(true);
            System.out.println("🛡️" + name + " (Wizard) is defending!" + "( " + BLUE+costDefend+RESET + " Mana)");
        }
        else
        {
            System.out.println(YELLOW+"Not enough Mana!"+RESET);
        }
    }
}
