#include "stats.hpp"
#include <godot_cpp/core/math.hpp>

namespace gd = godot;

Stats operator &(Stats const &lhs, Stats const &rhs) {
    Stats rval{};
    rval.damage_absorb = gd::Math::min(lhs.damage_absorb + rhs.damage_absorb, 1.f);
    rval.hazmat_level = gd::Math::max(lhs.hazmat_level, rhs.hazmat_level);
    return rval;
}

Stats &operator <<(Stats &lhs, Stats const &rhs) {
    return (lhs = lhs & rhs);
}
