47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#include "potion.h"
|
|
|
|
potion::potion(const potion_type type, const int duration, const position &pos):
|
|
type{type}, remaining_duration{duration}, pos{pos} {}
|
|
|
|
potion_type potion::get_type() const {
|
|
return type;
|
|
}
|
|
|
|
int potion::get_duration() const {
|
|
return remaining_duration;
|
|
}
|
|
|
|
position potion::get_pos() const {
|
|
return pos;
|
|
}
|
|
|
|
void potion::set_pos(const position &npos) {
|
|
pos = npos;
|
|
}
|
|
|
|
potion::potion(const potion &p):
|
|
type(p.type), remaining_duration(p.remaining_duration),
|
|
pos{p.pos} {}
|
|
|
|
potion::potion(potion &&p):
|
|
type(p.type), remaining_duration(p.remaining_duration),
|
|
pos{p.pos} {}
|
|
|
|
potion &potion::operator=(const potion &p) {
|
|
type = p.type;
|
|
remaining_duration = p.remaining_duration;
|
|
pos = p.pos;
|
|
return *this;
|
|
}
|
|
|
|
potion &potion::operator=(potion &&p) {
|
|
type = p.type;
|
|
remaining_duration = p.remaining_duration;
|
|
pos = p.pos;
|
|
return *this;
|
|
}
|
|
|
|
void potion::print(display *out) {
|
|
out->print_char(pos, 'P', COLOR_PAIR(COLOR_GREEN));
|
|
}
|