namespace BP
{
	namespace Ailments
	{
		class Ailment
		{
			int type;
			float effectTime; //amount of time (in seconds) that the ailment will be active
			//------------------------------------------------------------------------------------------------------------------------
			Ailment() {}
			//------------------------------------------------------------------------------------------------------------------------
			bool opEquals(const Ailment &in other)
			{
				return type == other.type;
			}
			//------------------------------------------------------------------------------------------------------------------------
			Ailment@ opAssign(Ailment &in other)
			{
				type = other.type;
				effectTime = other.effectTime;
				return this;
			}
			//------------------------------------------------------------------------------------------------------------------------
			void Serialize(kDict dict, kStr& in key)
			{
				SERIALIZEKEY_INT(key, type);
				SERIALIZEKEY_FLOAT(key, effectTime);
			}
			//------------------------------------------------------------------------------------------------------------------------
			void Deserialize(kDict& in dict, kStr& in key)
			{
				DESERIALIZEKEY_FLOAT(key, effectTime);
			}
			//------------------------------------------------------------------------------------------------------------------------
			bool IsPositiveEffect() { return true; }
			//------------------------------------------------------------------------------------------------------------------------
			float EffectTime() { return 25.0f; }
			//------------------------------------------------------------------------------------------------------------------------
			float DamageBonus() { return 0.0f; }
			//------------------------------------------------------------------------------------------------------------------------
			float SpeedBonus() { return 0.0f; }
			//------------------------------------------------------------------------------------------------------------------------
			void OnEnable()
			{
				
				effectTime = EffectTime();
				if (IsPositiveEffect())
				{
					effectTime *= BP::LocalPlayer::Script.powerTime;
				}
				else
				{
					effectTime /= BP::LocalPlayer::Script.powerTime;
				}
			}
			//------------------------------------------------------------------------------------------------------------------------
			void OnDisable() {}
			//------------------------------------------------------------------------------------------------------------------------
			void OnActiveTick() {}
			//------------------------------------------------------------------------------------------------------------------------
			bool IsActive() final
			{
				return effectTime > 0.0f;
			}
			//------------------------------------------------------------------------------------------------------------------------
			void OnTick() final
			{
				if (effectTime > 0.0f)
				{
					OnActiveTick();
					effectTime -= GAME_DELTA_TIME;
					if (effectTime <= 0.0f)
					{
						OnDisable();
					}
				}
			}
			//------------------------------------------------------------------------------------------------------------------------
		};
	}
}
