package org.project.entity.players;

import org.project.entity.Entity;
import org.project.entity.enemies.Enemy;
import org.project.item.armors.KnightArmor;
import org.project.item.weapons.Sword;
import org.project.util.ConsoleColors;

/**
 * The Knight ⚔️ — the front-line bruiser. Highest base damage of the three
 * classes and sturdy plate armor, but an average health and mana pool.
 *
 * Special: Shield Bash — deals heavy damage and stuns the enemy so it skips its
 * next turn.
 */
public class Knight extends Player {

    public Knight(String name) {
        // Highest base damage (8); average HP/Mana.
        super(name, 50, 40, 8, new Sword(), new KnightArmor());
    }

    @Override
    public String getClassName() {
        return "Knight";
    }

    @Override
    public String getSpecialName() {
        return "Shield Bash";
    }

    @Override
    public void specialAbility(Entity target) {
        spendMana(SPECIAL_COST);
        System.out.println(ConsoleColors.purple("🛡️💥 " + name + " performs a mighty SHIELD BASH! "
                + ConsoleColors.blue("(-" + SPECIAL_COST + " Mana)")));
        dealDamage(target, (int) (getAttackPower() * 2.2));

        // Stun only makes sense against an actual enemy.
        if (target instanceof Enemy enemy) {
            enemy.stun();
            System.out.println(ConsoleColors.yellow("😵 " + enemy.getName() + " is stunned and will skip its next turn!"));
        }
    }
}
