package org.project.entity.players;

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

public class Assassin extends Player {
    private boolean invisible;
    private boolean criticalAttack;

    public Assassin(String name, Weapon weapon) {
        super(name, 90, 120, 16, weapon);
        this.invisible = false;
        this.criticalAttack = false;
    }

    @Override
    public void specialAbility(Entity target) {
        if (mp < 22) {
            System.out.println("Not enough Mana!");
            return;
        }
        mp -= 22;
        invisible = true;
        criticalAttack = true;
        System.out.println("🗡 Assassin vanished into the shadows.");
    }

    @Override
    public void lightAttack(Entity target) {
        int totalDamage = damage;
        if (weapon != null) {
            totalDamage += weapon.getDamage();
        }
        if (criticalAttack) {
            totalDamage *= 2;
            System.out.println("💥 Critical Strike!");
            criticalAttack = false;
        }
        target.receiveAttack(totalDamage, false);
    }

    @Override
    public void receiveAttack(int damage, boolean ignoreDefense) {
        if (invisible) {
            System.out.println("Attack dodged!");
            invisible = false;
            return;
        }
        super.receiveAttack(damage, ignoreDefense);
    }

    // This method doesn't override anything from Entity interface
    // It's just a convenience method that calls receiveAttack
    public void takeDamage(int damage) {
        receiveAttack(damage, false);
    }
}