namespace BP
{
	namespace Ailments
	{
		class Stun : Ailment
		{
			//------------------------------------------------------------------------------------------------------------------------
			Stun()
			{
				super();
				type = TYPE_STUN;
			}
			//------------------------------------------------------------------------------------------------------------------------
			bool IsPositiveEffect() { return false; }
			//------------------------------------------------------------------------------------------------------------------------
			float EffectTime() { return 2.5f; }
			//------------------------------------------------------------------------------------------------------------------------
			float SpeedBonus() { return -0.3f; }
			//------------------------------------------------------------------------------------------------------------------------
			void OnEnable() override
			{
				Ailment::OnEnable();
				// Hud.AddMessage("Stunned!", 200);
				BP::LocalPlayer::LockControls(LocalPlayer.WeaponActor(), CLF_AILMENT, true);
				// BP::LocalPlayer::LockMovement(MLF_AILMENT, true);
				// SpawnShake(kVec3(0, 0, 300.0f), BP::LocalPlayer::Actor.Origin(), 10000, true); //delete
			}
			//------------------------------------------------------------------------------------------------------------------------
			void OnDisable() override
			{
				Ailment::OnDisable();
				BP::LocalPlayer::LockControls(LocalPlayer.WeaponActor(), CLF_AILMENT, false);
				// BP::LocalPlayer::LockMovement(MLF_AILMENT, false);
			}
			//------------------------------------------------------------------------------------------------------------------------
			void OnActiveTick() override
			{
				//random look direction
				BP::LocalPlayer::Actor.Yaw() += Math::RandRange(-0.034907f, 0.034907f); //-2, 2 degrees
				BP::LocalPlayer::Actor.Pitch() += Math::RandRange(-0.017453f, 0.017453f); //-1, 1 degrees
				
				//shock the mesh (even though can't see in Singleplayer)
				BP::LocalPlayer::Actor.RenderMeshComponent().Flags() |= RMCF_SHOCKED;
				
				//little random movement
				BP::LocalPlayer::Actor.MovementComponent().Velocity() += kVec3(Math::RandRange(-1.0f, 1.0f), Math::RandRange(-1.0f, 1.0f), 0);
				
				//Play random zap sound every 4 frames
				if (BP::LocalPlayer::Actor.GameTicks() % 4 == 0)
				{
					BP::LocalPlayer::Actor.PlaySound(kSfx_Zap);
				}
			}
			//------------------------------------------------------------------------------------------------------------------------
		};
	}
}
