#include "potion.h"

#include "constants.h"

potion::potion(const potion_type type, const int duration, const position &pos):
        item{pos}, type{type}, remaining_duration{duration} {}

potion_type potion::get_type() const {
        return type;
}

int potion::get_duration() const {
        return remaining_duration;
}

void potion::print(output *out) const {
        out->print_char(this->get_pos(), 'P', COLOR_PAIR(COLOR_GREEN));
}

size_t get_potion_at(const position &pos, const potion_list &plist) {
        for (size_t i = 0; i < plist.size(); ++i)
                if (plist[i]->get_pos() == pos)
                        return i;

        return plist.size();
}
