namespace BP
{
	namespace Ailments
	{
		const float REGEN_HEALTH_GAIN = 5.0f;
		const float REGEN_HEALTH_GAIN_TIME = 1.0f;
		
		class Regen : Ailment
		{
			float healthTime; //amount of time (in seconds) until hp is given
			//------------------------------------------------------------------------------------------------------------------------
			Regen()
			{
				super();
				type = TYPE_REGEN;
			}
			//------------------------------------------------------------------------------------------------------------------------
			Regen@ opAssign(Regen &in other)
			{
				Ailment::opAssign(other);
				healthTime = other.healthTime;
				return this;
			}
			//------------------------------------------------------------------------------------------------------------------------
			void Serialize(kDict dict, kStr& in key) override
			{
				Ailment::Serialize(dict, key);
				SERIALIZEKEY_FLOAT(key, healthTime);
			}
			//------------------------------------------------------------------------------------------------------------------------
			void Deserialize(kDict& in dict, kStr& in key) override
			{
				Ailment::Deserialize(dict, key);
				DESERIALIZEKEY_FLOAT(key, healthTime);
			}
			//------------------------------------------------------------------------------------------------------------------------
			void OnEnable() override
			{
				Ailment::OnEnable();
				healthTime = 0.0f;
			}
			//------------------------------------------------------------------------------------------------------------------------
			void OnActiveTick() override
			{
				BP::LocalPlayer::ScreenFlash(blue: 255.0f, alpha: 128.0f, sustainTime: 15.0f, decayTime: 15.0f);

				healthTime += GAME_DELTA_TIME;
				if (healthTime >= REGEN_HEALTH_GAIN_TIME && BP::LocalPlayer::Actor.Health() > 0)
				{
					healthTime -= REGEN_HEALTH_GAIN_TIME;
					BP::LocalPlayer::Actor.Health() = MIN(BP::LocalPlayer::Actor.Health() + REGEN_HEALTH_GAIN, BP::Game::playerMaxHealth);
				}
			}
			//------------------------------------------------------------------------------------------------------------------------
		};
	}
}
