#get the amount of artifacts in total (3)
$execute store result score @s mechanics_artifact_array_size run data get storage minecraft:mechanics artifact.list_$(quality)

#get the amount of artifacts in total to storage - 1 (2)
scoreboard players operation @s mechanics_artifact_array_size -= .1 number
execute store result storage minecraft:mechanics artifact.array int 1 run scoreboard players get @s mechanics_artifact_array_size

#quality
$data modify storage mechanics artifact.quality set value "$(quality)"
#artifacts random artifact
function main:mechanics/artifacts/random/choose_random with storage minecraft:mechanics artifact

#store randomized artifact into storage
execute store result storage minecraft:mechanics artifact.id int 1 run scoreboard players get @s mechanics_random

#remove the chosen artifact from array
function main:mechanics/artifacts/random/remove with storage minecraft:mechanics artifact

# #delete the list of artifacts
# data remove storage minecraft:mechanics artifact