package org.project.entity.players;

import org.project.entity.Entity;
import org.project.item.armors.AssassinArmor;
import org.project.item.weapons.Dagger;

public class Assassin extends Player {

    public Assassin(String name) {
        super(name, 120, 80, new Dagger());
    }

    @Override
    public void heavyAttack(Entity target) {

        int manaCost = 15;

        if (getMana() < manaCost) {
            System.out.println("Not enough mana!");
            return;
        }

        useMana(manaCost);

        int damage = weapon.getDamage() * 2;

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

        target.takeDamage(damage);


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

    @Override
    public void heal() {

        int healAmount = 20;
        int manaGain = 20;

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

        setMana(Math.min(getMana() + manaGain, getMaxMana()));


        System.out.println(name + " regains " + healAmount + " HP and " + manaGain + " mana.");
    }

    @Override
    public void specialAbility(Entity target) {

        int manaCost = 30;

        if (getMana() < manaCost) {
            System.out.println("Not enough mana!");
            return;
        }

        useMana(manaCost);

        int damage = weapon.getDamage() * 3;

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

        target.takeDamage(damage);


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