execute as @e[type=illusioner,scores={illusionbosstime=2}] at @s run data merge entity @s {NoAI:0b,Invulnerable:0b}
execute as @e[type=illusioner,scores={illusionbosstime=22..55}] at @s run data merge entity @s {NoAI:1b}
execute as @e[type=illusioner,scores={illusionbosstime=97}] at @s run data merge entity @s {Invulnerable:0b}
execute as @e[type=illusioner,scores={illusionbosstime=1}] at @s run particle minecraft:poof ~ ~1.2 ~ .4 .7 .4 .08 27 force @a[distance=..64]

execute as @e[type=illusioner,scores={illusionbosstime=3..96}] at @s as @e[type=illusioner,tag=illusioner_boss2,sort=nearest,limit=1] at @s run particle minecraft:poof ~ ~1.2 ~ .4 .7 .4 .08 27 force @a[distance=..64]
execute as @e[type=illusioner,scores={illusionbosstime=3..96}] at @s as @e[type=illusioner,tag=illusioner_boss4,sort=nearest,limit=1] at @s run particle minecraft:poof ~ ~1.2 ~ .4 .7 .4 .08 27 force @a[distance=..64]

execute as @e[type=illusioner,scores={illusionbosstime=3..96}] at @s run tp @e[type=skeleton,tag=illusioner_boss3,sort=nearest,limit=1] ~ -100 ~
execute as @e[type=illusioner,scores={illusionbosstime=3..96}] at @s run tp @e[type=skeleton,tag=illusioner_boss5,sort=nearest,limit=1] ~ -100 ~
execute as @e[type=illusioner,scores={illusionbosstime=3..96}] at @s run kill @e[type=skeleton,tag=illusioner_boss_main,sort=nearest,limit=1]

execute as @e[type=illusioner,scores={illusionbosstime=3..96}] at @s run tp @e[type=illusioner,tag=illusioner_boss2,sort=nearest,limit=1] ~ -100 ~
execute as @e[type=illusioner,scores={illusionbosstime=3..96}] at @s run tp @e[type=illusioner,tag=illusioner_boss4,sort=nearest,limit=1] ~ -100 ~

execute as @e[type=illusioner,scores={illusionbosstime=1..5}] at @s run playsound minecraft:entity.illusioner.cast_spell ambient @a[distance=..20] ~ ~ ~ 1 .5
execute as @e[type=illusioner,scores={illusionbosstime=40}] at @s run function 1_splatus:ultris/other/boss_attacks/potion2
execute as @e[type=illusioner,scores={illusionbosstime=40}] at @s run playsound entity.splash_potion.throw ambient @a[distance=..20] ~ ~ ~ 1 .5
execute as @e[type=illusioner,scores={illusionbosstime=60}] at @s run function 1_splatus:ultris/other/boss_attacks/potion3
execute as @e[type=illusioner,scores={illusionbosstime=60}] at @s run playsound entity.splash_potion.throw ambient @a[distance=..20] ~ ~ ~ 1 .5
execute as @e[tag=illusioner_boss_pig,nbt={HurtTime:10s}] at @s run advancement grant @a[distance=..20] only 1_splatus:ultris/illusioner2