package org.project.entity.players;

import org.project.entity.Entity;
import org.project.item.armors.Armor;
import org.project.item.weapons.Weapon;
import org.project.ConsoleColors;

public class Wizard extends Player {
    public Wizard(String name) {
        super(name, 150, 80,
                new Weapon(8, 0, "Staff", 0) {
                    @Override
                    public void use(Entity target) {
                        target.takeDamage(getDamage());
                    }
                },
                new Armor(3, 15, "Wizard Robe", 0) {
                    @Override
                    public void use(Entity target) { }
                });
    }
    @Override
    public void lightAttack(Entity target) {
        int damage = getWeapon().getDamage();
        target.takeDamage(damage);
        System.out.println(getName() + " casts Light Bolt! Dealt " + damage + " damage.");
    }
    @Override
    public void heavyAttack(Entity target) {
        if (consumeMana(10)) {
            int damage = getWeapon().getDamage() * 2;
            target.takeDamage(damage);
            System.out.println(getName() + " casts Fireball! Dealt " + damage + " damage.");
        }
        else {
            System.out.println(ConsoleColors.YELLOW + "Not enough mana!" + ConsoleColors.RESET);
        }
    }
    @Override
    public void defend() {
        if (consumeMana(5)) {
            defending = true;
            System.out.println(getName() + " raises a magic barrier!");
        }
        else {
            System.out.println(ConsoleColors.YELLOW + "Not enough mana to defend!" + ConsoleColors.RESET);
        }
    }
    @Override
    public void heal(int health) {
        super.heal(health);
    }
    @Override
    public void specialAbility(Entity target) {
        if (consumeMana(20)) {
            int damage = getWeapon().getDamage() * 3;
            target.takeDamage(damage);
            heal(30);
            System.out.println(getName() + " unleashes Arcane Blast! Dealt " + damage + " damage and recovered 30 HP.");
        }
        else {
            System.out.println(ConsoleColors.YELLOW + "Not enough mana for Arcane Blast!" + ConsoleColors.RESET);
        }
    }
}