#include "component_stun.h"

/* Sets stun component info. */
void
component_stun_init(ComponentStun* self, u32 value)
{
	self->max = value;
	self->value = self->max;
}

/* Ticks stun component. If depleted, no longer invincible.. */
void
component_stun_tick(ComponentStun* self, ECS* ecs)
{
	if (self->isStun)
	{
		self->value--;

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