package org.project.entity.enemies;

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

public class Vampire extends Enemy{

    public Vampire(int hp, int mp, Weapon weapon) {
        super(hp,mp,weapon);
        setDefendRate(.7);
    }

    @Override
    public void attack(Entity target, double multiplier) {
        if (getMP() > 5) {
            super.attack(target,1.5);
            setMP(getMP() - 5);
        }
        else {
            System.out.println("Not enough MP");
        }

        double damage = weapon.getDamage() * multiplier;
        if (target.isDefending()) {
            heal( (int) (.3 * (damage * (1 - target.getDefendRate()))));
        }
        else {
            heal( (int) (.3 * damage));
        }
    }

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

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