class HitIsTheSameTargetPrereqState extends GenericHitPrereqState
{
	var m_previousTarget : weak< GameObject >;
	var m_previousSource : weak< GameObject >;
	var m_previousWeapon : weak< WeaponObject >;

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var checkPassed : Bool;
		const var prereq : HitIsTheSameTargetPrereq;
		prereq = ( ( HitIsTheSameTargetPrereq )( GetPrereq() ) );
		if( !( hitEvent.target.IsActive() ) )
		{
			return true;
		}
		if( ( !( m_previousTarget ) || !( m_previousSource ) ) || !( m_previousWeapon ) )
		{
			m_previousTarget = hitEvent.target;
			m_previousSource = hitEvent.attackData.GetSource();
			m_previousWeapon = hitEvent.attackData.GetWeapon();
			return false;
		}
		checkPassed = ( ( m_previousTarget == hitEvent.target ) && ( m_previousSource == hitEvent.attackData.GetSource() ) ) && ( m_previousWeapon == hitEvent.attackData.GetWeapon() );
		if( !( checkPassed ) )
		{
			m_previousTarget = hitEvent.target;
			m_previousSource = hitEvent.attackData.GetSource();
			m_previousWeapon = hitEvent.attackData.GetWeapon();
		}
		if( prereq.m_invert )
		{
			checkPassed = !( checkPassed );
		}
		return checkPassed;
	}

}

class HitIsTheSameTargetPrereq extends GenericHitPrereq
{
	default m_isSync = true;
	default m_callbackType = gameDamageCallbackType.HitTriggered;
	default m_pipelineStage = gameDamagePipelineStage.Process;
	var m_isMoving : Bool;
	var m_object : String;
	var m_invert : Bool;

	protected override function Initialize( recordID : TweakDBID )
	{
		m_invert = TweakDBInterface.GetBool( recordID + T".invert", false );
	}

}

