tag @s[tag=!nl_SlotCheck] add nl_HandSlot
tag @s add nl_SlotCheck
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}}}]

    # Debuffs #
execute as @s[scores={nl.Rng=..50}] run loot spawn ~ ~ ~ loot next_level:quality/gear/roll_debuff
    
    # Buffs #
execute as @s[scores={nl.Rng=51..100}] run loot spawn ~ ~ ~ loot next_level:quality/gear/roll_buff
 
execute at @s run summon item ~ ~ ~ {Item:{id:"minecraft:barrier",Count:1b,CustomModelData:1412001},Tags:["nl_CopyArmor"]}
execute at @s[tag=nl_HandSlot] run data modify entity @e[type=item,limit=1,distance=..1,sort=nearest,tag=nl_CopyArmor] Item set from entity @s SelectedItem
execute at @s[tag=nl_HeadSlot] run data modify entity @e[type=item,limit=1,distance=..1,sort=nearest,tag=nl_CopyArmor] Item set from entity @s Inventory.[{Slot:103b}]
execute at @s[tag=nl_ChestSlot] run data modify entity @e[type=item,limit=1,distance=..1,sort=nearest,tag=nl_CopyArmor] Item set from entity @s Inventory.[{Slot:102b}]
execute at @s[tag=nl_LegsSlot] run data modify entity @e[type=item,limit=1,distance=..1,sort=nearest,tag=nl_CopyArmor] Item set from entity @s Inventory.[{Slot:101b}]
execute at @s[tag=nl_FeetSlot] run data modify entity @e[type=item,limit=1,distance=..1,sort=nearest,tag=nl_CopyArmor] Item set from entity @s Inventory.[{Slot:100b}]

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

