package org.project.entity.players;

import org.project.entity.Entity;
import org.project.item.armors.KnightArmor;
import org.project.item.weapons.Sword;

public class Knight extends Player {

    public Knight(String name) {
        super(name, 150, 50, new Sword());
    }

    @Override
    public void heavyAttack(Entity target) {

        int damage = weapon.getDamage() * 2;

        if (target.isDefending()) {
            damage /= 2;
        }

        target.takeDamage(damage);


        System.out.println(name + " performs a heavy sword strike!");
        System.out.println(target.getName() + " takes " + damage + " damage.");
    }

    @Override
    public void heal() {

        int healAmount = 30;
        setHp(Math.min(getHp() + healAmount, getMaxHp()));


        System.out.println(name + " recovers " + healAmount + " HP.");
    }

    @Override
    public void specialAbility(Entity target) {

        int damage = weapon.getDamage() + 20;

        if (target.isDefending()) {
            damage /= 2;
        }

        target.takeDamage(damage);


        System.out.println(name + " uses Shield Bash!");
        System.out.println(target.getName() + " takes " + damage + " damage.");
    }
}
