# Holder
execute at @e[tag=boss_holder_marker,limit=1] run summon armor_stand ~ ~ ~ {Invulnerable:1b,ShowArms:1b,Pose:{RightArm:[-20f,0f,5f]},ArmorItems:[{id:"diamond_boots",Count:1b},{id:"diamond_leggings",Count:1b},{id:"diamond_chestplate",Count:1b},{id:"player_head",tag:{SkullOwner:"Jarofdirt"},Count:1b}],Tags:["boss_holder","holder","unspellable"],Rotation:[-90.0f,0.0f]}

# Tutorial
execute if score floor dungeon matches 0 run data merge entity @e[tag=boss_holder,limit=1] {DisabledSlots:4144703,CustomName:'{"bold":true,"color":"gold","translate":"tutorial.gold_bar"}',HandItems:[{id:"gold_ingot",Count:1b,tag:{Armory:1b,display:{Name:'{"bold":true,"color":"gold","translate":"tutorial.gold_bar"}',Lore:['{"translate":"tutorial.gold_bar.lore","color":"gray"}']}}},{}],Tags:["boss_holder","tuto","holder","unspellable","tutorial_obj"]}

# Floors
execute if score floor dungeon matches 1 as @e[tag=boss_holder,limit=1] run function items_py:holder/passive/s/boss_medallion_i
execute if score floor dungeon matches 2 as @e[tag=boss_holder,limit=1] run function items_py:holder/passive/s/boss_medallion_ii
execute if score floor dungeon matches 3 as @e[tag=boss_holder,limit=1] run function items_py:holder/passive/s/boss_medallion_iii

# Rotation - 1 block higer to update rendering seems to work
execute as @e[tag=boss_holder,type=armor_stand,limit=1] at @s run tp @s ~ ~0.1 ~ facing entity @e[limit=1,tag=center,tag=boss]

# Sound
playsound ui.toast.challenge_complete ambient @a[distance=..30] ~ ~ ~ 1 0.5
tellraw @a[distance=..30] ["",{"text":"[!] ","color":"dark_purple","bold":true},{"translate":"msg.boss_medallion_spawn","color":"gray","bold":false}]

# statistic
scoreboard players add #boss_medallions stats_calc 1
