class HitIsRarityPrereqState extends GenericHitPrereqState
{

	public override function Evaluate( hitEvent : gameHitEvent ) : Bool
	{
		var result : Bool;
		var objectToCheck : weak< ScriptedPuppet >;
		const var prereq : HitIsRarityPrereq;
		prereq = ( ( HitIsRarityPrereq )( GetPrereq() ) );
		objectToCheck = ( ( ScriptedPuppet )( hitEvent.target ) );
		result = objectToCheck.GetNPCRarity() == prereq.m_rarity;
		if( prereq.m_invert )
		{
			return !( result );
		}
		return result;
	}

}

class HitIsRarityPrereq extends GenericHitPrereq
{
	default m_isSync = true;
	default m_callbackType = gameDamageCallbackType.HitTriggered;
	default m_pipelineStage = gameDamagePipelineStage.PreProcess;
	var m_invert : Bool;
	var m_rarity : gamedataNPCRarity;

	protected override function Initialize( recordID : TweakDBID )
	{
		var str : String;
		str = TweakDBInterface.GetString( recordID + T".rarity", "" );
		m_rarity = ( ( gamedataNPCRarity )( ( ( Int32 )( EnumValueFromString( "gamedataNPCRarity", str ) ) ) ) );
		m_invert = TweakDBInterface.GetBool( recordID + T".invert", false );
	}

}

