## Store ID
scoreboard players operation #VB vb.dummy1 = @s vb.id.oceanic_orb

## Damage
execute if entity @s[nbt={HurtTime:10s}] unless score @s vb.entity.oceanic_orb_data matches 3.. run scoreboard players set @s vb.entity.oceanic_orb_data 3
execute if score @s vb.entity.oceanic_orb_data matches 3.. run scoreboard players add @s vb.entity.oceanic_orb_data 1
execute if score @s vb.entity.oceanic_orb_data matches 13.. run function vb:tick_entity/custom_mob/oceanic_orb_core/die

## Scale up
# This is not done when summoning the mob because it has 2 frames where it's visible
# Doing it this way keeps it unseen, inside the item display, until its made bigger & stops rendering
execute unless score @s vb.entity.oceanic_orb_data matches 2.. run scoreboard players add @s vb.entity.oceanic_orb_data 1
execute if score @s vb.entity.oceanic_orb_data matches 2 run attribute @s minecraft:scale modifier add vb.mob_attribute 1.3 add_value

## Position the orb
execute unless score @s vb.entity.oceanic_orb_data matches 3.. as @e[tag=vb.custom_mob.oceanic_orb,predicate=vb:matching_id/oceanic_orb] at @s run function vb:tick_entity/custom_mob/oceanic_orb_core/position {hurt:0,turn:3}
execute if score @s vb.entity.oceanic_orb_data matches 3.. as @e[tag=vb.custom_mob.oceanic_orb,predicate=vb:matching_id/oceanic_orb] at @s run function vb:tick_entity/custom_mob/oceanic_orb_core/position {hurt:1,turn:-30}

## Particles
tp @s ~ ~ ~ facing entity @n[tag=vb.custom_mob.drowned_necromancer,distance=..40]
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^1 0.2 0.2 0.2 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^2 0.2 0.2 0.2 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^3 0.2 0.2 0.2 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^4 0.2 0.2 0.2 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^5 0.2 0.2 0.2 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^6 0.2 0.2 0.2 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^7 0.1 0.1 0.1 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^8 0.1 0.1 0.1 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^9 0.05 0.05 0.05 0 1 force
execute if score @s vb.entity.oceanic_orb_data matches 2 run particle minecraft:enchanted_hit ^ ^0.6 ^10 0 0 0 0 1 force