# Spawns boss rig
execute positioned ~ ~ ~ rotated ~ 0 run function animated_java:necromancer/summon/default
# Animates boss
execute as @e[tag=ssz_boss_rig,limit=1,distance=..10,type=item_display] run function animated_java:necromancer/animations/idle/play

# Summons an AI entity
summon zombie ~ ~ ~ {Silent:1b,PersistenceRequired:1b,active_effects:[{id:"minecraft:invisibility",amplifier:1b,duration:1000000000,show_particles:0b}],Tags:["ssz_boss_ai","ai_necromancer"],Motion:[0.0d,0.3d,0.0d],ArmorItems:[{},{},{},{id:"minecraft:stick",count:1b,components:{"minecraft:custom_model_data":1000}}],Health:1024f,attributes:[{id:"minecraft:generic.max_health",base:1024},{id:"minecraft:generic.knockback_resistance",base:1.0},{id:"minecraft:generic.movement_speed",base:0.23},{id:"minecraft:generic.attack_damage",base:12.0},{id:"minecraft:generic.scale",base:1.5}],ArmorDropChances:[0.000F,0.000F,0.000F,0.000F],DeathLootTable:"ss:entities/empty"}
team join ssz_enemy @e[type=zombie,limit=1,tag=ssz_boss_ai]

execute as @e[type=minecraft:item_display,tag=aj.necromancer.bone] run data modify entity @s Glowing set value 1b
execute as @e[type=minecraft:item_display,tag=aj.necromancer.bone] run team join ssz_enemy @s

# Sets zombie boss health
scoreboard players set boss_health zombData 1500
execute if score round zombData matches 21.. run scoreboard players set boss_health zombData 4000
scoreboard players set boss_attack_timer zombData 120

# Sets up boss bar
bossbar set zomb_boss name {"text":"Necromancer","color":"#f0f048"}
bossbar set zomb_boss visible true
bossbar set zomb_boss color purple
bossbar set zomb_boss value 1500
execute if score round zombData matches 21.. run bossbar set zomb_boss value 4000
bossbar set zomb_boss max 1500
execute if score round zombData matches 21.. run bossbar set zomb_boss max 4000

tellraw @a[scores={location=3}] [{"text":"\n The","color":"gray"},{"text":" Necromancer","color":"#f0f048"},{"text":" has arrived!\n"}]

# Mansion kick
execute in ss:zombies run function ss:zomb/boss/mansion_kick