package org.project.entity.enemies;

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

public class Vampire extends Enemy {

    public Vampire() {
        super("Vampire", 65, 40, 15, null, 70);
    }

    public Vampire(String name, int maxHP, int maxMP, int damage, Weapon weapon, int xpReward) {
        super(name, maxHP, maxMP, damage, weapon, xpReward);
    }

    // Additional constructor for easier creation without weapon
    public Vampire(String name, int maxHP, int maxMP, int damage, int xpReward) {
        this(name, maxHP, maxMP, damage, null, xpReward);
    }

    @Override
    public void attack(Entity target) {
        if (stunned) {
            System.out.println(ConsoleColors.YELLOW + name + " is stunned and cannot attack!" + ConsoleColors.RESET);
            return;
        }

        int totalDamage = damage;
        if (weapon != null) {
            totalDamage += weapon.getDamage();
        }

        // Vampire has lifesteal - heals for 30% of damage dealt
        System.out.println(ConsoleColors.RED + name + " strikes with vampiric claws!" + ConsoleColors.RESET);
        target.receiveAttack(totalDamage, false);

        int healAmount = (int)(totalDamage * 0.3);
        heal(healAmount);
        System.out.println(ConsoleColors.GREEN + name + " drains " + healAmount + " HP!" + ConsoleColors.RESET);
    }
}