package org.project.entity.enemies;

import org.project.entity.Entity;
import org.project.util.ConsoleColors;

/**
 * Vampire 🦇 — heals itself for a portion of the damage it deals (lifesteal),
 * making it a war of attrition. Drops the Vampire Key.
 */
public class Vampire extends Enemy {

    private static final double LIFESTEAL = 0.5; // heals for 50% of damage dealt

    public Vampire() {
        super("Vampire", 48, 11, 30, 16, KeyType.VAMPIRE, 25);
    }

    @Override
    public void attack(Entity target) {
        System.out.println(ConsoleColors.red("🦇 Vampire sinks its fangs in!"));
        target.takeDamage(damage);

        int stolen = (int) (damage * LIFESTEAL);
        heal(stolen);
        System.out.println(ConsoleColors.green(
                "🩸 Vampire drains " + stolen + " HP and now has " + getHp() + "/" + getMaxHP() + " HP."));
    }
}
