execute if score @s EB_next_attack matches 0 run data merge entity @s {NoAI:1b}

execute if score @s EB_next_attack matches -20.. run tp @s ~ ~.07 ~ ~4 ~
execute if score @s EB_next_attack matches -40..-21 run tp @s ~ ~.07 ~ ~8 ~
execute if score @s EB_next_attack matches ..-41 run tp @s ~ ~ ~ ~12 ~

execute if score @s EB_next_attack matches ..0 run data modify entity @s Size set value 9
execute if score @s EB_next_attack matches ..-20 run data modify entity @s Size set value 8
execute if score @s EB_next_attack matches ..-40 run data modify entity @s Size set value 7
execute if score @s EB_next_attack matches ..-60 run data modify entity @s Size set value 6
execute if score @s EB_next_attack matches ..-80 run data modify entity @s Size set value 5
execute if score @s EB_next_attack matches ..-100 run data modify entity @s Size set value 4
execute if score @s EB_next_attack matches ..-120 run data modify entity @s Size set value 3

execute if score @s EB_next_attack matches 0 run function bosses:mega_slime/split/throw
execute if score @s EB_next_attack matches -20 run function bosses:mega_slime/split/throw
execute if score @s EB_next_attack matches -40 run function bosses:mega_slime/split/throw
execute if score @s EB_next_attack matches -60 run function bosses:mega_slime/split/throw
execute if score @s EB_next_attack matches -80 run function bosses:mega_slime/split/throw
execute if score @s EB_next_attack matches -100 run function bosses:mega_slime/split/throw
execute if score @s EB_next_attack matches -120 run function bosses:mega_slime/split/throw

execute if score @s EB_next_attack matches -120 run tag @s remove attacking
execute if score @s EB_next_attack matches -120 run tag @s remove split
execute if score @s EB_next_attack matches -120 run data merge entity @s {NoAI:0b}
