package org.project.entity.players;

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

public class Knight extends Player{

    public Knight(String name, Weapon weapon, Armor armor) {
        super(name, 40, 40, weapon, armor, 40, 40);
    }
    @Override
    public void attack(Entity target) {
        target.takeDamage(10);
    }

    @Override
    public boolean heavyAttack(Entity target) {
        if (getMP() >= 8) {
            spendMP(8);
            target.takeDamage(weapon.getDamage() + 5);
            return true;
        }
        return false;
    }

    //attacks the enemy and stuns it
    @Override
    public boolean specialAbility(Player player, Enemy target) {
        //checks if player has enough mana
        if (getMP() >= 15) {
            spendMP(15);
            target.toBeStunned(true);
            target.takeDamage(player.getWeapon().getDamage() + 5);
            return true;
        }
        return false;
    }
}
