package org.project.entity.enemies;

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

public class Vampire extends Enemy {
    public Vampire(Weapon weapon) {
        int maxHP = 50;
        int maxMP = 50;
        super(maxHP, maxMP, weapon, 8);
    }

    @Override
    public void getKilled() {
        isAlive = false;
    }

    @Override
    public void attack(Entity target) {
        target.takeDamage((weapon.getDamage() + getBaseDamage()));
        System.out.println("\u001B[35mVampire stole your HP\u001B[0m");
        System.out.printf("\u001B[32mVampire: +%d hp\u001B[0m\n", (int) ((weapon.getDamage() + getBaseDamage()) * 0.5));
        this.heal((int) ((weapon.getDamage() + getBaseDamage()) * 0.5));
        System.out.printf("\u001B[31mYou took %d damage.\u001B[0m\n", (int) (weapon.getDamage() + getBaseDamage()));
    }

    @Override
    public void heal(int health) {
        if (getHP() + health > getMaxHP())
            setHP(getMaxHP());
        else
            setHP(getHP() + health);
    }

    @Override
    public void fillMana(int mana) {
        if (getMP() + mana > getMaxMP())
            setMP(getMaxMP());
        else
            setMP(getMP() + mana);
    }

    @Override
    public int getMaxHP() {
        return 50;
    }

    @Override
    public int getMaxMP() {
        return 50;
    }
}