#reset
scoreboard players set .artifact_random arena 0
scoreboard players set .artifact_random_quality arena 0
scoreboard players set .artifact_rarity arena 0

#1% chance to get an item in the first place, and each time it doesnt work +1%
execute store result score .artifact_random arena run random value 1..100

#85% chance of it being green, 15% chance of it being blue
$execute if score .artifact_random arena matches 1$(roll) store result score .artifact_random_quality arena run random value 1..100
$execute if score .artifact_random arena matches 1$(roll) run scoreboard players set .artifact_random_roll arena 1
$execute if score .artifact_random arena matches 1$(roll) store result storage artifact_random value int 1 run scoreboard players get .artifact_random_roll arena

execute if score .artifact_random_quality arena matches 1..100 run scoreboard players set .artifact_rarity arena 1

execute if score .artifact_rarity arena matches 1 run function main:mechanics/artifacts/id/give/random_green

$execute if score .artifact_random arena matches 1$(roll) run return fail

scoreboard players operation .artifact_random_roll arena += .1 number
execute store result storage artifact_random value int 1 run scoreboard players get .artifact_random_roll arena
# $execute if score .artifact_random arena matches $(roll).. run scoreboard players add .artifact_random_roll arena 1
$execute if score .artifact_random arena matches $(roll).. store result storage artifact_random value int 1 run scoreboard players get .artifact_random_roll arena