
particle effect ~ ~1.75 ~ 0 0 0 .2 1 force @a[distance=..32]


tp @s ~ ~ ~ ~9 ~

execute as @e[sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @e[type=armor_stand,tag=ultris_book,sort=nearest,limit=1] ~ ~ ~


scoreboard players add @s ultris_count 1



execute if score @s ultris_count matches 1 run function 1_splatus:ultris/illusioner/book/init


execute if score @s ultris_count matches 1..15 as @e[distance=..2,sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @s ^ ^ ^.15
execute as @e[sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @e[type=armor_stand,tag=ultris_book,sort=nearest,limit=1] ~ ~ ~


execute if score @s ultris_count matches 16..20 as @e[distance=..2,sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @s ^ ^ ^.075
execute as @e[sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @e[type=armor_stand,tag=ultris_book,sort=nearest,limit=1] ~ ~ ~



execute if score @s ultris_count matches 20..34 as @e[distance=..2,sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @s ^ ^ ^.25 facing entity @p[distance=..64,gamemode=!creative,gamemode=!spectator] feet
execute if score @s ultris_count matches 35..64 as @e[distance=..2,sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @s ^ ^ ^.5
execute if score @s ultris_count matches 65..94 as @e[distance=..2,sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @s ^ ^ ^.75
execute if score @s ultris_count matches 95.. as @e[distance=..2,sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @s ^ ^ ^1
execute as @e[sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @e[type=armor_stand,tag=ultris_book,sort=nearest,limit=1] ~ ~ ~




#death

execute positioned ~ ~1 ~ if entity @p[distance=..1.25,gamemode=!spectator,gamemode=!creative] at @s run function 1_splatus:ultris/illusioner/book/break

execute if score @s ultris_count matches 5.. positioned ~ ~1 ~ unless block ~ ~ ~ #1_splatus:ultris/permeable run function 1_splatus:ultris/illusioner/book/break

execute positioned ~ ~1 ~ if score @s ultris_count matches 200.. run function 1_splatus:ultris/illusioner/book/break



execute as @e[sort=nearest,limit=1,type=marker,tag=ultris_book_follow] at @s run tp @e[type=armor_stand,tag=ultris_book,sort=nearest,limit=1] ~ ~ ~

