#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());
}

void Item::apply_stats(Stats &stats) const {
}

bool Item::has_capability(ItemCapability const &capability) const {
    return this->capabilities.has(capability);
}

gd::StringName const &Item::get_animation() const {
    return this->animation;
}

ItemID Item::get_id() const {
    return this->id;
}
