package org.project.item.consumables;

import org.project.entity.Entity;
import org.project.item.Item;

/**
 * Base class for one-shot items the player can carry and use in battle
 * (potions, flasks, ...). Each consumable knows its name, its shop price and how
 * potent its effect is; the actual effect is defined by each subclass in
 * {@link #use(Entity)}.
 */
public abstract class Consumable implements Item {

    private final String name;
    private final int price;
    protected final int potency;

    protected Consumable(String name, int potency, int price) {
        this.name = name;
        this.potency = potency;
        this.price = price;
    }

    /** Subclasses decide what the consumable actually does. */
    @Override
    public abstract void use(Entity target);

    @Override
    public String getName() {
        return name;
    }

    @Override
    public int getPrice() {
        return price;
    }
}
