package org.project.item.consumables;

import org.project.entity.Entity;

public class Flask extends Consumable
{

    private static final int HEAL_AMOUNT = 30;

    public Flask()
    {
        super(
                "Health Flask",
                "A small flask that restores health.",
                HEAL_AMOUNT,
                false
        );
    }

    @Override
    public void use(Entity target)
    {

        int healValue;

        if (percentageBased)
        {
            healValue = target.getMaxHP() * restoreAmount / 100;
        } else
        {
            healValue = restoreAmount;
        }

        target.heal(healValue);

        System.out.println(
                target.getName() +
                        " used " +
                        name +
                        " and restored " +
                        healValue +
                        " HP!"
        );
    }
}
