package org.project.entity.enemies;

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

public class Vampire extends Enemy{

    private static final double lifeStealPercent = 0.3;

    public Vampire(Weapon weapon)
    {
        super(60, 0, weapon);
    }

    @Override
    public void attack(Entity target) {
        if (!this.isAlive()) return;

        int damage = 0;
        if (super.getWeapon() != null) {
            damage = super.getWeapon().getDamage();
        }
        else
        {
            damage = 12;
        }

        target.takeDamage(damage);

        int healAmount = (int) (damage * lifeStealPercent);
        if (healAmount > 0)
        {
            super.heal(healAmount);
            System.out.println("🦇 Vampire used Life Drain and drained " + healAmount + " HP!");
        }
        else
        {
            System.out.println("🦇 Vampire used Bite!");
        }
    }
}
