class StatPoolHitPrereqCondition extends BaseHitPrereqCondition
{
	var m_valueToCheck : Float;
	var m_objectToCheck : CName;
	var m_comparisonType : EComparisonType;
	var m_statPoolToCompare : gamedataStatPoolType;

	protected override function SetData( recordID : TweakDBID )
	{
		var str : String;
		m_objectToCheck = TweakDBInterface.GetCName( recordID + T".objectToCheck", '' );
		m_valueToCheck = TweakDBInterface.GetFloat( recordID + T".valueToCheck", 0.0 );
		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 obj : weak< GameObject >;
		var poolValue : Float;
		obj = GetObjectToCheck( m_objectToCheck, hitEvent );
		if( !( obj ) )
		{
			return false;
		}
		sps = GameInstance.GetStatPoolsSystem( obj.GetGame() );
		poolValue = sps.GetStatPoolValue( obj.GetEntityID(), m_statPoolToCompare );
		return ProcessCompare( m_comparisonType, poolValue, m_valueToCheck );
	}

}

