#include "Mover.h"

#include "../../Neuz.h"

namespace flyff {
    uint64_t Mover::Buff::get_time_remaining() const {
        const auto &neuz = Neuz::instance();

        if (time_instantiated == 0)
            return 0;

        auto elapsed =
                (neuz.maybe_login_time +
                 ((neuz.current_time + time_instantiated * -1000) - neuz.start_time)) /
                1000;

        if (elapsed <= time_total) {
            return time_total - elapsed;
        }

        return 0;
    }

    bool Mover::is_in_combat(uint32_t millis) const {
        const auto &neuz = flyff::Neuz::instance();
        // 10 seconds
        return neuz.current_time - last_combat < (millis * 1000);
    }
};  // namespace flyff