scoreboard players add @s mob_first_skill_counter 1
scoreboard players add @s mob_second_skill_counter 1
scoreboard players add @s mob_third_skill_counter 1

execute if entity @s[nbt={HurtTime:10s}] if predicate kiwi2:chance_random_50 run function kiwi2:custom_mobs_fx/subterranean_silverfish/subterranean_silverfish_thorns
execute if entity @s[nbt={HurtTime:10s}] run playsound minecraft:item.shield.block master @a ~ ~ ~ 1 2
execute if entity @s[nbt={HurtTime:10s}] run playsound minecraft:entity.silverfish.hurt master @a ~ ~ ~ 1 0.3

execute if score @s mob_first_skill_counter matches 400 run summon armor_stand ~ ~ ~ {Marker:1b,Invisible:1b,Tags:["subterranean_silverfish_marker"]}
execute if score @s mob_first_skill_counter matches 400..450 if predicate kiwi2:chance_random_20 run function kiwi2:custom_mobs_fx/subterranean_silverfish/subterranean_silverfish_spawn
execute if score @s mob_first_skill_counter matches 450.. run kill @e[type=armor_stand,tag=subterranean_silverfish_marker]
execute if score @s mob_first_skill_counter matches 450.. store result score @s mob_first_skill_counter run random value 1..25

execute if score @s mob_second_skill_counter matches 560 run playsound minecraft:entity.warden.tendril_clicks master @a[distance=..32] ~ ~ ~ 1 1.8
execute if score @s mob_second_skill_counter matches 560 run particle dust_pillar{block_state:dirt} ~ ~ ~ 2.5 1 2.5 1 100
execute if score @s mob_second_skill_counter matches 560 run particle shriek{delay:0} ~ ~1.5 ~ 0 0 0 1 0 normal
execute if score @s mob_second_skill_counter matches 565 run particle shriek{delay:0} ~ ~1.5 ~ 0 0 0 1 0 normal
execute if score @s mob_second_skill_counter matches 570 run particle shriek{delay:0} ~ ~1.5 ~ 0 0 0 1 0 normal
execute if score @s mob_second_skill_counter matches 575 run particle shriek{delay:0} ~ ~1.5 ~ 0 0 0 1 0 normal
execute if score @s mob_second_skill_counter matches 580 run particle shriek{delay:0} ~ ~1.5 ~ 0 0 0 1 0 normal
execute if score @s mob_second_skill_counter matches 600 run function kiwi2:custom_mobs_fx/subterranean_silverfish/subterranean_silverfish_dripstone
execute if score @s mob_second_skill_counter matches 600.. store result score @s mob_second_skill_counter run random value 1..25