package org.project.item.consumables;

import org.project.entity.Entity;
import org.project.entity.players.Player;

public class Flask extends Consumable {

    public Flask() {
        super("Flask", 20);
    }
    @Override
    public void use(Entity target) {
        int healAmount = target.getMaxHP() / 10;
        target.heal(healAmount);
        if (target instanceof Player) {
            System.out.println(((Player) target).getName() + " used Flask and restored " + healAmount + " HP.");
        }
        else {
            System.out.println(target.getClass().getSimpleName() + " used Flask and restored " + healAmount + " HP.");
        }
    }
}