package de.miaurizius.jgame2d.entity.item;

import de.miaurizius.jgame2d.core.GamePanel;
import de.miaurizius.jgame2d.core.enums.EntityType;
import de.miaurizius.jgame2d.core.enums.GameState;
import de.miaurizius.jgame2d.entity.Entity;

public class PotionObj extends Entity {

    GamePanel panel;
    int value = 2;

    public PotionObj(GamePanel panel) {
        super(panel);
        this.panel = panel;

        type = EntityType.ITEM;
        consumable = true;
        name = "Red Potion";
        down1 = initEntitySprites("objects/potion_red");
        description = "[" + name + "]\nHeals your life by " + value + ".";

        price = 50;
        stackable = true;

        setDialogue();
    }

    public void setDialogue() {
        dialogue[0][0] = "You drank a " + name + "!\nYour life has been recovered by " + value + ".";
    }

    public boolean use(Entity entity) {
        startDialogue(this,0);
        entity.life += value;
        if(panel.player.life > panel.player.maxLife) panel.player.life = panel.player.maxLife;
        panel.playSE(2);
        return true;
    }

}
