package org.project.item.potions;

import org.project.entity.enemies.Enemy;
import org.project.entity.players.Player;
import org.project.item.Item;

// TODO: UPDATE IMPLEMENTATION
public abstract class Potion implements Item {
    /*
    TODO: ADD OTHER REQUIRED AND BONUS METHODS
    */

    private int number;
    private int cost;
    private int extraHP;
    private int extraMP;

    private boolean isBought;

    public Potion(int number, int cost, int extraHP, int extraMP) {
        this.number = number;
        this.cost = cost;
        this.extraHP = extraHP;
        this.extraMP = extraMP;
    }

    @Override
    public boolean buy(Player player) {
        boolean res;
        if (isBought) {
            number++;
            res = player.pay(cost);
        }
        else {
            isBought = true;
            res = player.addItem(this, cost);
        }
        return res;
    }

    public void consume(Enemy target, Player player) {}

    public void decreaseNum(int num){
        number -= num;
    }

    public int getNumber() { return number; }

    @Override
    public int getCost() { return cost; }

    public int getExtraHP() { return extraHP; }

    public int getExtraMP() { return extraMP; }
}
