package org.project.entity.players;

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

public class Assassin extends Player
{
    private boolean isInvisible = false;
    private boolean nextAttackCritical = false;

    public Assassin(String name) {
        super(name, 70, 100, null, null, "Assassin", 0, 70, 100);
    }

    @Override
    public void lightAttack(Entity target)
    {
        int damage = 15;
        if (nextAttackCritical)
        {
            damage *= 2;
            System.out.println("CRITICAL HIT! ");
            nextAttackCritical = false;
        }
        System.out.println(name + " (Assassin) used Light Attack! (0 MP)");
        target.takeDamage(damage);
        System.out.println(name + " MP: " + getMP() + "/" + getMaxMP());
    }

    @Override
    public void specialAbility(Entity target)
    {
        if (getMP() >= 15)
        {
            fillMana(-15);
            isInvisible = true;
            nextAttackCritical = true;
            System.out.println(name + " turns INVISIBLE! (-15 MP)");
            System.out.println("Next attack will be a guaranteed CRITICAL HIT!");
            System.out.println("Will dodge the next incoming attack completely!");
        }
        else
            System.out.println("Not enough MP for Special Ability!");

        System.out.println("MP: " + getMP() + "/" + getMaxMP());

    }

    @Override
    public void heavyAttack(Entity target)
    {
        if (getMP() >= 10)
        {
            fillMana(-10);
            int damage = 28;
            if (nextAttackCritical)
            {
                damage *= 2;
                System.out.println("CRITICAL HIT! ");
                nextAttackCritical = false;
            }
            System.out.println(name + " used Heavy Attack! (-10 MP)");
            target.takeDamage(damage);
        }
        else
            System.out.println("Not enough MP!");

        System.out.println("MP: " + getMP() + "/" + getMaxMP());
    }

    @Override
    public void defend() {
        if (getMP() >= 6) {
            fillMana(-6);
            super.defend();
            System.out.println("Defensive stance! (-6 MP)");
        } else {
            System.out.println("Not enough MP!");
        }
        System.out.println("MP: " + getMP() + "/" + getMaxMP());
    }

    @Override
    public void heal(int health) {
        if (getMP() >= 12) {
            fillMana(-12);
            super.heal(health);
            System.out.println("Healed! (-12 MP)");
        } else {
            System.out.println("Not enough MP!");
        }
        System.out.println("MP: " + getMP() + "/" + getMaxMP());
    }
}
