package org.project.item.consumables;

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

public class Flask extends Consumable{

    private static final int HEAL_AMOUNT = 20;
    private static final String YELLOW = "\033[33m";
    public static final String RESET = "\u001B[0m";

    public Flask(String name, int id)
    {
        super(name, id, HEAL_AMOUNT);
    }

    @Override
    public void use(Entity target) {
        if (target != null && target.isAlive()) {
            target.heal(HEAL_AMOUNT);
            Player player = (Player) target;
            System.out.println("🧪 " + player.getName() + " used Flask! Healed " + HEAL_AMOUNT + " HP.");
        }
        else
        {
            System.out.println(YELLOW+"❌ Cannot use Flask on a dead or null target."+RESET);
        }
    }
}
