execute store result score @s apothecary_random run random value 1..100
tag @s add apothecary_rolling

execute if score @s apothecary_random <= @s apothecary_common_chance run function kiwi2:upgrades/classes/apothecary/apothecary_common_roll
execute if score @s apothecary_random > @s apothecary_common_chance if score @s apothecary_random <= @s apothecary_rare_chance run function kiwi2:upgrades/classes/apothecary/apothecary_rare_roll
execute if score @s apothecary_random > @s apothecary_rare_chance if score @s apothecary_random <= @s apothecary_epic_chance run function kiwi2:upgrades/classes/apothecary/apothecary_epic_roll
execute if score @s apothecary_random > @s apothecary_epic_chance if score @s apothecary_random <= @s apothecary_legendary_chance run function kiwi2:upgrades/classes/apothecary/apothecary_legendary_roll
execute if score @s apothecary_random > @s apothecary_legendary_chance if score @s apothecary_random <= @s apothecary_mythical_chance run function kiwi2:upgrades/classes/apothecary/apothecary_mythical_roll