summon drowned ~ ~ ~ {Tags:["vb.custom_mob.drowned_necromancer","vb.custom_mob","vb.loaded","vb.new_summon"],PersistenceRequired:1b,DeathLootTable:"vb:entities/drowned_necromancer",IsBaby:0,CanPickUpLoot:0b,LeftHanded:0b,drop_chances:{head:100f,mainhand:0f,legs:0f,chest:0f},equipment:{mainhand:{id:"minecraft:trident"},legs:{id:"minecraft:paper",components:{"minecraft:custom_model_data":{flags:[0b]},"minecraft:equippable":{"slot":"legs","asset_id":"vb:custom_mob/drowned_necromancer"}}},chest:{id:"minecraft:paper",components:{"minecraft:custom_model_data":{flags:[0b]},"minecraft:equippable":{"slot":"chest","asset_id":"vb:custom_mob/drowned_necromancer"}}}}}

## Equipment
loot replace entity @n[tag=vb.new_summon] armor.head loot vb:items/tidal_tiara

## Stats
attribute @n[tag=vb.new_summon] minecraft:scale modifier add vb.mob_attribute 0.3 add_value
effect give @n[tag=vb.new_summon] resistance infinite 200 true
effect give @n[tag=vb.new_summon] minecraft:instant_damage infinite 200 true
scoreboard players set @n[tag=vb.new_summon] vb.entity.boss_health 400
scoreboard players set @n[tag=vb.new_summon] vb.timer.boss_attack -40

## Rain
execute unless score #VB vb.settings.disable_boss_weather matches 1 run weather thunder

## Effects
particle minecraft:snowflake ~ ~ ~ 0 0 0 0.3 25

## ID the entities
scoreboard players add #VB vb.id.bossbar 1
scoreboard players operation @n[tag=vb.new_summon] vb.id.bossbar = #VB vb.id.bossbar

## Create bossbar based on my ID
execute store result storage vb dummy.id int 1 run scoreboard players get @n[tag=vb.new_summon] vb.id.bossbar
function vb:tick_entity/custom_mob/drowned_necromancer/bossbar_create with storage vb dummy

tag @n[tag=vb.new_summon] remove vb.new_summon