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.ConsoleColors;

public class Knight extends Player {
    public Knight(String name) {
        super(name, 120, 50, new Sword(), new KnightArmor());
    }
    @Override
    public void lightAttack(Entity target) {
        int damage = getWeapon().getDamage();
        target.takeDamage(damage);
        System.out.println(getName() + " used Light Attack! Dealt " + damage + " damage.");
    }
    @Override
    public void heavyAttack(Entity target) {
        if (consumeMana(10)) {
            int damage = getWeapon().getDamage() * 2;
            target.takeDamage(damage);
            System.out.println(getName() + " used Heavy Attack! 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() + " is defending!");
        }
        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);
            if (target instanceof Enemy) {
                ((Enemy) target).setStunned(true);
            }
            System.out.println(getName() + " used Shield Bash! Dealt " + damage + " damage and stunned the enemy.");
        }
        else {
            System.out.println(ConsoleColors.YELLOW + "Not enough mana for Shield Bash!" + ConsoleColors.RESET);
        }
    }
}