execute as @n[tag=upgradekit] on origin run advancement grant @s only survivalplus:adventure/merchant/upgradekit
execute as @n[tag=upgradekit] if entity @e[distance=..1,tag=upgrade] run kill @s
execute at @s[tag=upgrade] run function survivalplus:tools/upgrade_effect

execute as @s[tag=upgrade,tag=husk_king] run function survivalplus:mobs/upgrade/weapon/husk_king
execute as @s[tag=upgrade,tag=ice_king] run function survivalplus:mobs/upgrade/weapon/ice_king
execute as @s[tag=upgrade,tag=undead_king] run function survivalplus:mobs/upgrade/weapon/undead_king
execute as @s[tag=upgrade,tag=gravedigger] run function survivalplus:mobs/upgrade/weapon/gravedigger
execute as @s[tag=upgrade,tag=tim] run data merge entity @s {drop_chances:{mainhand:2f,feet:0f,legs:0f,chest:0f,head:0f},Health:20,Tags:[plussed,tim,upgradeable,rare,special]}
execute as @s[tag=upgrade,type=piglin_brute] run function survivalplus:mobs/upgrade/weapon/piglin_brute
execute as @s[tag=upgrade,tag=diamond] run function survivalplus:mobs/upgrade/weapon/diamond_stray
execute as @s[tag=upgrade,tag=iron_husk] run function survivalplus:mobs/upgrade/weapon/iron_husk
execute as @s[tag=upgrade,tag=gold_skel] run function survivalplus:mobs/upgrade/weapon/gold_skel
execute as @s[tag=upgrade,tag=mineable,tag=merchant_face] run data modify entity @s equipment.mainhand set value {id:golden_axe,components:{unbreakable:{},item_name:{"text":"Swift Saw","italic":false},enchantments:{efficiency:10}}}
execute as @s[tag=upgrade,tag=elite] run function survivalplus:mobs/upgrade/weapon/elite_guard
execute as @s[tag=upgrade,tag=undead_miner] run function survivalplus:mobs/upgrade/weapon/undead_miner
execute as @s[tag=upgrade,tag=poly_mage] run data merge entity @s {drop_chances:{mainhand:0.28f},Health:28}
execute as @s[tag=upgrade,tag=commander] run data merge entity @s {drop_chances:{mainhand:1f},Health:25}
tag @s[tag=upgrade] add upgraded
tag @s[tag=upgraded] remove upgradeable
tag @s[tag=upgraded] remove upgrade
tag @s[tag=upgraded] remove RanEn