
loot spawn ~ ~ ~ loot next_level:custom_blocks/enchant_roll
execute store result score @s nl.Rng at @s run data get entity @e[type=minecraft:item,distance=..1,limit=1,nbt={Item:{tag:{nl_roll100:1b}}}] Item.tag.AttributeModifiers.[0].Amount
kill @e[limit=1,nbt={Item:{tag:{nl_roll100:1b}}}]

# Roll if Debuff #
execute as @s[scores={nl.Rng=..50}] run loot spawn ~ ~ ~ loot next_level:quality/tools/roll_debuff
    
# Roll if Buff #
execute as @s[scores={nl.Rng=51..100}] run loot spawn ~ ~ ~ loot next_level:quality/tools/roll_buff

execute at @s run summon item ~ ~ ~ {Item:{id:"minecraft:barrier",Count:1b,CustomModelData:1412001},Tags:["nl_CopyTool"]}
execute at @s run data modify entity @e[type=item,limit=1,distance=..1,sort=nearest,tag=nl_CopyTool] Item set from entity @s SelectedItem

execute as @s[scores={nl.Rng=..50}] at @s run function next_level:quality/debuff_tool
execute as @s[scores={nl.Rng=51..}] at @s run function next_level:quality/buff_tool
