36 lines
881 B
C++
36 lines
881 B
C++
#include "item.hpp"
|
|
#include "unit.hpp"
|
|
#include "utils/godot_macros.hpp"
|
|
|
|
Item::~Item() {}
|
|
|
|
bool Item::can_use_on(Unit *used_by, gd::Object *used_on) const {
|
|
return used_on != nullptr;
|
|
}
|
|
|
|
bool Item::try_use_on(Unit *used_by, gd::Object *used_on) const {
|
|
if(this->can_use_on(used_by, used_on)) {
|
|
this->use_on(used_by, used_on);
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
void Item::use_on(Unit *used_by, gd::Object *used_on) const {
|
|
if(used_on != nullptr)
|
|
gd::UtilityFunctions::push_warning(used_by->get_path(), " tried to use default Item::use_on implementation on object of type ", used_on->get_class());
|
|
}
|
|
|
|
Stats Item::get_stats() const {
|
|
return {};
|
|
}
|
|
|
|
bool Item::has_capability(ItemCapability const &capability) const {
|
|
return this->capabilities.has(capability);
|
|
}
|
|
|
|
ItemID Item::get_id() const {
|
|
return this->id;
|
|
}
|