#include "component_invincibility.h"

/* Sets invincibility component info. */
void
component_invincibility_init(ComponentInvincibility* self, u32 value)
{
	self->max = value;
	self->value = self->max;
}

/* Ticks invincibility component. If depleted, no longer invincible.. */
void
component_invincibility_tick(ComponentInvincibility* self, ECS* ecs)
{
	if (self->isInvincible)
	{
		self->value--;

		if (self->value <= 0)
		{
			self->value = 0;
			self->isInvincible = false;
		}
	}
}
