class StatPoolComparisonHitPrereqCondition extends BaseHitPrereqCondition
{
	var m_comparisonSource : CName;
	var m_comparisonTarget : CName;
	var m_comparisonType : EComparisonType;
	var m_statPoolToCompare : gamedataStatPoolType;

	protected override function SetData( recordID : TweakDBID )
	{
		var str : String;
		m_comparisonSource = TweakDBInterface.GetCName( recordID + T".comparisonSource", '' );
		m_comparisonTarget = TweakDBInterface.GetCName( 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 ) ) ) ) );
		super.SetData( recordID );
	}

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var result : Bool;
		result = ComparePoolValues( hitEvent );
		if( result )
		{
			result = CheckOnlyOncePerShot( hitEvent );
		}
		return ( ( m_invert ) ? ( !( result ) ) : ( result ) );
	}

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

}

