package org.project.entity.players;

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

public class Wizard extends Player {

    public Wizard(String name) {
        super(name, 100, 150, new Staff());
    }

    @Override
    public void heavyAttack(Entity target) {

        int manaCost = 20;

        if (getMana() < manaCost) {
            System.out.println("Not enough mana!");
            return;
        }

        useMana(manaCost);

        int damage = weapon.getDamage() * 2;

        if (target.isDefending()) {
            damage /= 2;
        }

        target.takeDamage(damage);


        System.out.println(name + " casts a powerful fire spell!");
        System.out.println(target.getName() + " takes " + damage + " damage.");
    }

    @Override
    public void heal() {

        int manaCost = 15;

        if (getMana() < manaCost) {
            System.out.println("Not enough mana!");
            return;
        }

        useMana(manaCost);

        int healAmount = 40;
        setHp(Math.min(getHp() + healAmount, getMaxHp()));


        System.out.println(name + " casts a healing spell and restores " + healAmount + " HP.");
    }

    @Override
    public void specialAbility(Entity target) {

        int manaCost = 40;

        if (getMana() < manaCost) {
            System.out.println("Not enough mana!");
            return;
        }

        useMana(manaCost);

        int damage = weapon.getDamage() * 3;

        if (target.isDefending()) {
            damage /= 2;
        }

        target.takeDamage(damage);


        System.out.println(name + " unleashes Lightning Storm!");
        System.out.println(target.getName() + " takes " + damage + " damage.");
    }
}
