package org.project.entity.players;

import org.project.entity.Entity;
import org.project.entity.enemies.Enemy;
import org.project.item.armors.Armor;
import org.project.item.armors.AssassinMask;
import org.project.item.armors.WizardRobe;
import org.project.item.weapons.Sword;
import org.project.item.weapons.Wand;
import org.project.item.weapons.Weapon;
import org.project.location.NarrativeConsole;

public class Wizard extends Player implements Entity,ICombatActions  {
    public Wizard (String name) {
        super(name, 60, 45, new Wand(), new WizardRobe());
        setHp(getMaxHP());
        setMp(getMaxMP());
    }

    @Override
    public void specialAbility(Enemy target) {
        //Checking if the mana is enough of not
        if (getMp() < 15) {
            NarrativeConsole.printWarning("❌ Not enough mana for Devastating Spell!");
            return;
        }

        //Consuming mana
        setMp(getMp()-15);

        target.takeDamage(30);
        NarrativeConsole.printSpecial("🔮 " + getName() + "used DEVASTATING SPELL Dealt" + 30 + " damage!");

        int newHp = getHp() + 10;
        if (newHp > getMaxHP()) newHp = getMaxHP();
        setHp(newHp);

        NarrativeConsole.printSpecial("💚 " + getName() + " healed " + 10 + " HP! (Now: " +
                getHp() + "/" + getMaxHP() + ")");
        NarrativeConsole.printMana("💙 Mana left: " + getMp());
    }

    public void lightAttack(Enemy target) {
        int damage = 10;
        target.takeDamage(damage);
        NarrativeConsole.printCombat("⚔️ " + getName() + " used Light Attack! Dealt " + damage + " damage.");
    }

    @Override
    public void heavyAttack(Enemy target) {
        if (getMp() < 8) {
            NarrativeConsole.printWarning("❌ Not enough mana for Heavy Attack!");
            return;
        }
        setMp(getMp() - 8);
        int damage = 20;
        target.takeDamage(damage);
        NarrativeConsole.printDamage("💥 " + getName() + " used Heavy Attack! Dealt " + damage + " damage.");
    }

    @Override
    public void defend() {
        if (getMp() < 6) {
            NarrativeConsole.printWarning("❌ Not enough mana to defend!");
            return;
        }
        setMp(getMp() - 6);
        setDefending(true);
        NarrativeConsole.printCombat("🛡️ " + getName() + " is defending! Next attack will be halved.");
    }

    @Override
    public void heal() {
        if (getMp() < 12) {
            NarrativeConsole.printWarning("❌ Not enough mana to heal!");
            return;
        }
        setMp(getMp() - 12);
        int healAmount = 20;
        setHp(getHp() + healAmount);
        if (getHp() > getMaxHP()) setHp(getMaxHP());
        NarrativeConsole.printHeal("💚 " + getName() + " healed " + healAmount + " HP!");
    }

}