class BloodlustHealingEffector extends ApplyEffectToDismemberedEffector
{
	var m_poolSystem : StatPoolsSystem;
	var m_maxDistanceSquared : Float;
	var m_healAmount : Float;
	var m_usePercent : Bool;
	var m_lastActivationTime : Float;

	protected override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		m_usePercent = TweakDBInterface.GetBool( record + T".usePercent", false );
		m_healAmount = TweakDBInterface.GetFloat( record + T".healAmount", 0.0 );
		m_poolSystem = GameInstance.GetStatPoolsSystem( game );
		m_maxDistanceSquared = PowF( TweakDBInterface.GetFloat( record + T".maxDistance", 0.0 ), 2.0 );
		m_lastActivationTime = 0.0;
	}

	protected export override function ActionOn( owner : GameObject )
	{
		ProcessAction( owner );
	}

	protected export override function RepeatedAction( owner : GameObject )
	{
		ProcessAction( owner );
	}

	private function ProcessAction( owner : GameObject )
	{
		var dismembermentInfo : DismembermentInstigatedInfo;
		var targetPuppet : ScriptedPuppet;
		var currentTime : Float;
		currentTime = EngineTime.ToFloat( GameInstance.GetSimTime( owner.GetGame() ) );
		if( ( currentTime - m_lastActivationTime ) < 0.5 )
		{
			return;
		}
		dismembermentInfo = GetDismembermentInfo();
		if( dismembermentInfo.wasTargetAlreadyDead && ( dismembermentInfo.timeSinceDeath > 0.5 ) )
		{
			return;
		}
		if( dismembermentInfo.wasTargetAlreadyDefeated && ( dismembermentInfo.timeSinceDefeat > 0.5 ) )
		{
			return;
		}
		if( dismembermentInfo.attackIsExplosion )
		{
			if( !( dismembermentInfo.weaponRecord.TagsContains( WeaponObject.GetRangedWeaponTag() ) ) )
			{
				return;
			}
			if( Vector4.DistanceSquared( dismembermentInfo.targetPosition, dismembermentInfo.attackPosition ) > 1.0 )
			{
				return;
			}
		}
		targetPuppet = ( ( ScriptedPuppet )( dismembermentInfo.target ) );
		if( !( targetPuppet ) || targetPuppet.IsCrowd() )
		{
			return;
		}
		if( Vector4.DistanceSquared( owner.GetWorldPosition(), dismembermentInfo.targetPosition ) > m_maxDistanceSquared )
		{
			return;
		}
		if( m_poolSystem.GetStatPoolValue( owner.GetEntityID(), gamedataStatPoolType.Overshield, false ) <= 0.0 )
		{
			return;
		}
		GameInstance.GetStatPoolsSystem( owner.GetGame() ).RequestChangingStatPoolValue( owner.GetEntityID(), gamedataStatPoolType.Overshield, m_healAmount, owner, false, m_usePercent );
		m_lastActivationTime = currentTime;
	}

}

