execute unless entity @s[team=musor] run return 0
scoreboard players set @s scavenger.debuff 0
function ws:misc/stats/scavengerdebuff
execute unless score @s garbage.common matches 1.. at @s run return run function ws:work/misc/scavenger/fail

execute at @e[tag=big_bin,type=minecraft:interaction] run particle minecraft:smoke ^ ^ ^-1 0.6 0 0.3 0 100

scoreboard players operation @s garbage.pay = @s garbage.common
scoreboard players operation @s garbage.pay.total += @s garbage.pay
scoreboard players reset @s garbage.common

scoreboard players set @s garbage.pay 3
scoreboard players operation @s garbage.pay *= @s garbage.uncommon
scoreboard players operation @s garbage.pay.total += @s garbage.pay
scoreboard players reset @s garbage.uncommon

scoreboard players set @s garbage.pay 10
scoreboard players operation @s garbage.pay *= @s garbage.epic
scoreboard players operation @s garbage.pay.total += @s garbage.pay
scoreboard players reset @s garbage.epic

scoreboard players set @s garbage.pay 50
scoreboard players operation @s garbage.pay *= @s garbage.legendary
scoreboard players operation @s garbage.pay.total += @s garbage.pay
scoreboard players reset @s garbage.legendary

execute if score .eventor eventchoose matches 9 run function ws:work/misc/scavenger/x

execute as @s[scores={starterbonus.scavenger=1..}] run function ws:work/misc/scavenger/starterbonus

scoreboard players operation @s pay += @s garbage.pay.total
execute store result storage ws:temp temp int 1 run scoreboard players get @s garbage.pay.total
execute at @s run function ws:work/misc/scavenger/display with storage ws:temp
execute at @s run particle minecraft:happy_villager ~ ~2 ~ 0.1 0.1 0.1 1 30
execute at @s run playsound minecraft:entity.experience_orb.pickup player @p ~ ~ ~ 1
scoreboard players reset @s garbage.pay
scoreboard players reset @s garbage.pay.total
scoreboard players reset @s garbage.common
scoreboard players reset @s garbage.uncommon
scoreboard players reset @s garbage.epic
scoreboard players reset @s garbage.legendary