# Food
function rng:percentage

# 3
execute if score out rng matches ..2 run summon item ~ ~ ~ {Item:{id:"enchanted_golden_apple",Count:1b}}
# 5
execute if score out rng matches 3..7 run summon item ~ ~ ~ {Item:{id:"golden_apple",Count:1b}}
# 13
execute if score out rng matches 8..20 run summon item ~ ~ ~ {Item:{id:"golden_carrot",Count:1b}}
# 15
execute if score out rng matches 21..35 run summon item ~ ~ ~ {Item:{id:"cooked_beef",Count:1b}}
# 31
execute if score out rng matches 36..66 run summon item ~ ~ ~ {Item:{id:"apple",Count:4b}}
# 35
execute if score out rng matches 67..100 run summon item ~ ~ ~ {Item:{id:"bread",Count:3b}}

# Extra
# base = 15%  luck(100%) = 25%  -> max drop = 40
scoreboard players operation % rng = global luck
scoreboard players set #tmp rng 4
scoreboard players operation % rng /= #tmp rng
scoreboard players add % rng 15
execute if score % rng matches 101.. run scoreboard players set % rng 100
execute if predicate rng:percentage_check run function game:room/5_room_end/drops/extra

# base = 20%  luck(100%) = 40%  -> max drop = 50
scoreboard players operation % rng = global luck
scoreboard players set #tmp rng 10
scoreboard players operation % rng *= #tmp luck
scoreboard players set #tmp rng 25
scoreboard players operation % rng /= #tmp rng
scoreboard players add % rng 20
execute if score % rng matches 101.. run scoreboard players set % rng 100
execute if predicate rng:percentage_check run function items_py:rnd_shard_drop/drop
