class NPCRarityPrereqState extends PrereqState
{
}

class NPCRarityPrereq extends IScriptablePrereq
{
	var m_rarity : gamedataNPCRarity;
	var m_invert : Bool;

	protected export 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 );
	}

	protected export const override function IsOnRegisterSupported() : Bool
	{
		return false;
	}

	protected const override function OnApplied( state : PrereqState, game : GameInstance, context : IScriptable )
	{
		state.OnChanged( IsFulfilled( game, context ) );
	}

	public export const override function IsFulfilled( game : GameInstance, context : IScriptable ) : Bool
	{
		var owner : GameObject;
		var targetPuppet : ScriptedPuppet;
		var rarity : gamedataNPCRarity;
		owner = ( ( GameObject )( context ) );
		targetPuppet = ( ( ScriptedPuppet )( owner ) );
		rarity = targetPuppet.GetNPCRarity();
		if( rarity != m_rarity )
		{
			return ( ( m_invert ) ? ( true ) : ( false ) );
		}
		return ( ( m_invert ) ? ( false ) : ( true ) );
	}

}

