class HitStatPoolComparisonPrereqState extends GenericHitPrereqState
{

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var checkPassed : Bool;
		const var prereq : HitStatPoolComparisonPrereq;
		prereq = ( ( HitStatPoolComparisonPrereq )( GetPrereq() ) );
		checkPassed = ComparePoolValues( hitEvent, prereq );
		return checkPassed;
	}

	private function ComparePoolValues( hitEvent : gameHitEvent, const prereq : HitStatPoolComparisonPrereq ) : Bool
	{
		var sps : StatPoolsSystem;
		var source : weak< GameObject >;
		var target : weak< GameObject >;
		var sourcePoolValue : Float;
		var targetPoolValue : Float;
		source = GetObjectToCheck( prereq.m_comparisonSource, hitEvent );
		target = GetObjectToCheck( prereq.m_comparisonTarget, hitEvent );
		if( !( source ) || !( target ) )
		{
			return false;
		}
		sps = GameInstance.GetStatPoolsSystem( source.GetGame() );
		sourcePoolValue = sps.GetStatPoolValue( source.GetEntityID(), prereq.m_statPoolToCompare );
		targetPoolValue = sps.GetStatPoolValue( target.GetEntityID(), prereq.m_statPoolToCompare );
		return ProcessCompare( prereq.m_comparisonType, sourcePoolValue, targetPoolValue );
	}

}

class HitStatPoolComparisonPrereq extends GenericHitPrereq
{
	default m_isSync = true;
	default m_callbackType = gameDamageCallbackType.HitTriggered;
	default m_pipelineStage = gameDamagePipelineStage.Process;
	var m_comparisonSource : String;
	var m_comparisonTarget : String;
	var m_comparisonType : EComparisonType;
	var m_statPoolToCompare : gamedataStatPoolType;

	protected override function Initialize( recordID : TweakDBID )
	{
		var str : String;
		m_comparisonSource = TweakDBInterface.GetString( recordID + T".comparisonSource", "" );
		m_comparisonTarget = TweakDBInterface.GetString( recordID + T".comparisonTarget", "" );
		str = TweakDBInterface.GetString( recordID + T".statPoolToCompare", "" );
		m_statPoolToCompare = ( ( gamedataStatPoolType )( ( ( Int32 )( EnumValueFromString( "gamedataStatPoolType", str ) ) ) ) );
		str = TweakDBInterface.GetString( recordID + T".comparisonType", "" );
		m_comparisonType = ( ( EComparisonType )( ( ( Int32 )( EnumValueFromString( "EComparisonType", str ) ) ) ) );
	}

}

