package org.project.entity.players;


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

public class Knight extends Player {

    public Knight(String name, int hp, int mp, Weapon weapon, Armor armor) {
        super(name, hp, mp, weapon, armor);
        setDefendRate(.9);
    }

    @Override
    public void lightAttack(Entity target) {
        attack(target, 1);
    }

    @Override
    public void heavyAttack(Entity target) {
        if (getMP() >= 8) {
            attack(target, 1.8);
            setMP(getMP() - 8);
        }
        else {
            System.out.println("Not enough MP");
        }
    }

    @Override
    public void defend() {
        if (getMP() >= 4) {
            super.defend();
            setMP(getMP() - 4);
        }
        else {
            System.out.println("Not enough MP");
        }
    }

    @Override
    public void specialAbility(Entity target) {
        if (getMP() >= 20) {
            setUsingSpecialAbility(true);
            attack(target, 2);
            setMP(getMP() - 20);
        }
        else {
            System.out.println("Not enough MP");
        }
    }

    @Override
    public void heal(int health) {
        if (getMP() >= 5) {
            super.heal(health);
            setMP(getMP() - 5);
        }
        else  {
            System.out.println("Not enough MP");
        }
    }

}

