class GameplayTagsPrereq extends IScriptablePrereq
{
	var m_allowedTags : array< CName >;
	var m_invert : Bool;

	protected override function Initialize( recordID : TweakDBID )
	{
		var prereqRecord : GameplayTagsPrereq_Record;
		prereqRecord = TweakDBInterface.GetGameplayTagsPrereqRecord( recordID );
		m_allowedTags = prereqRecord.AllowedTags();
		m_invert = prereqRecord.Invert();
	}

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

	public const override function IsFulfilled( game : GameInstance, context : IScriptable ) : Bool
	{
		var owner : ScriptedPuppet;
		owner = ( ( ScriptedPuppet )( context ) );
		if( !( owner ) )
		{
			return ( ( m_invert ) ? ( true ) : ( false ) );
		}
		if( !( NPCManager.HasAllTags( owner.GetRecordID(), m_allowedTags ) ) )
		{
			return ( ( m_invert ) ? ( true ) : ( false ) );
		}
		return ( ( m_invert ) ? ( false ) : ( true ) );
	}

}

