execute unless entity @n[distance=..3,tag=zombie,type=zombie] run title @s actionbar {"color":"red", "text": "No valid summons nearby!"}
execute unless entity @n[distance=..3,tag=zombie,type=zombie] run playsound entity.arrow.hit_player master @s ~ ~ ~ 1 0.5
execute unless entity @n[distance=..3,tag=zombie,type=zombie] run give @s minecraft:bone[minecraft:custom_name='{"italic":false,"text":"[ Soul of Hunger ]"}',minecraft:lore=['{"color":"gray","italic":false,"text":"[","extra":[{"color":"dark_green","bold":false,"italic":false,"keybind":"key.use"},{"color":"gray","italic":false,"text":"] on a Zombie summon to evolve it into a Husk."}]}','{"text":""}','{"color":"gray","italic":false,"text":"Upgrades:"}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"red","bold":false,"italic":false,"text":"+15 Health"}]}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"blue","bold":false,"italic":false,"text":"+0.05 Movement Speed"}]}','{"color":"#2070b6","italic":false,"text":"[ ON-HIT ] ","extra":[{"color":"gray","bold":false,"italic":false,"text":"Apply the "},{"color":"dark_green","bold":false,"italic":false,"text":"Hunger I"},{"color":"gray","bold":false,"italic":false,"text":" debuff on enemies."}]}','{"text":""}','{"color":"gray","italic":false,"text":"Existing weapons and armors will be carried over."}'],minecraft:rarity=uncommon,minecraft:enchantment_glint_override=true,minecraft:custom_data={necromancer_soul_of_hunger:1b,necromancer_soul_upgrade:1b},minecraft:consumable={consume_seconds:0,animation:none,sound:"minecraft:entity.hoglin.converted_to_zombified",has_consume_particles:false},minecraft:item_model="minecraft:ender_eye"] 1

execute if entity @n[distance=..3,tag=zombie_evolved] run title @s actionbar {"color":"red", "text": "This summon has already evolved!"}
execute if entity @n[distance=..3,tag=zombie_evolved] run playsound entity.arrow.hit_player master @s ~ ~ ~ 1 0.5
execute if entity @n[distance=..3,tag=zombie_evolved] run give @s minecraft:bone[minecraft:custom_name='{"italic":false,"text":"[ Soul of Hunger ]"}',minecraft:lore=['{"color":"gray","italic":false,"text":"[","extra":[{"color":"dark_green","bold":false,"italic":false,"keybind":"key.use"},{"color":"gray","italic":false,"text":"] on a Zombie summon to evolve it into a Husk."}]}','{"text":""}','{"color":"gray","italic":false,"text":"Upgrades:"}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"red","bold":false,"italic":false,"text":"+15 Health"}]}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"blue","bold":false,"italic":false,"text":"+0.05 Movement Speed"}]}','{"color":"#2070b6","italic":false,"text":"[ ON-HIT ] ","extra":[{"color":"gray","bold":false,"italic":false,"text":"Apply the "},{"color":"dark_green","bold":false,"italic":false,"text":"Hunger I"},{"color":"gray","bold":false,"italic":false,"text":" debuff on enemies."}]}','{"text":""}','{"color":"gray","italic":false,"text":"Existing weapons and armors will be carried over."}'],minecraft:rarity=uncommon,minecraft:enchantment_glint_override=true,minecraft:custom_data={necromancer_soul_of_hunger:1b,necromancer_soul_upgrade:1b},minecraft:consumable={consume_seconds:0,animation:none,sound:"minecraft:entity.hoglin.converted_to_zombified",has_consume_particles:false},minecraft:item_model="minecraft:ender_eye"] 1

tag @n[distance=..3,limit=1,tag=necromancer_summon,type=zombie,tag=!zombie_evolved] add remove_summon
tag @n[limit=1,tag=zombie_check,type=slime,sort=nearest,predicate=kiwi2:necromancer_remove_entity] add remove_summon_check
effect give @n[distance=..3,limit=1,tag=remove_summon,type=zombie] invisibility infinite 0 true
execute as @n[distance=..3,limit=1,tag=remove_summon,type=zombie] at @s run summon husk ~ ~ ~ {Tags:["husk_convertion","necromancer_summon","zombie","zombie_evolved"],Health:60,CustomNameVisible:1b,Team:"Player_Glow",PersistenceRequired:1b,CustomName:'"[ Husk ]"', attributes:[{id:"minecraft:burning_time",base:0},{id:"minecraft:follow_range",base:512},{id:"max_health",base:40,modifiers:[{id:"soul_of_hunger_max_health",amount:20,operation:"add_value"}]},{id:"movement_speed",modifiers:[{id:"soul_of_hunger_movement_speed",amount:0.05,operation:"add_value"}]}]}
ride @n[limit=1,tag=remove_summon_check,type=slime,sort=nearest] dismount
ride @n[limit=1,tag=remove_summon_check,type=slime,sort=nearest] mount @n[type=husk,tag=husk_convertion,limit=1,sort=nearest]
execute as @n[distance=..3,limit=1,tag=remove_summon,type=zombie] run data modify entity @e[type=husk,tag=husk_convertion,limit=1,sort=nearest] attributes set from entity @s attributes
execute as @n[distance=..3,limit=1,tag=remove_summon,type=zombie] run data modify entity @e[type=husk,tag=husk_convertion,limit=1,sort=nearest] HandItems set from entity @s HandItems
execute as @n[distance=..3,limit=1,tag=remove_summon,type=zombie] run data modify entity @e[type=husk,tag=husk_convertion,limit=1,sort=nearest] ArmorItems set from entity @s ArmorItems
execute as @n[distance=..3,limit=1,tag=remove_summon,type=zombie] run scoreboard players operation @e[type=husk,tag=husk_convertion,limit=1,sort=nearest] zombie_identifier = @s zombie_identifier
execute as @n[distance=..3,limit=1,tag=remove_summon,type=zombie] at @s run particle minecraft:flame ~ ~1 ~ 0.5 0.8 0.5 0.1 30
execute as @n[distance=..3,limit=1,tag=remove_summon,type=zombie] at @s run particle minecraft:sculk_soul ~ ~1 ~ 0.5 0.8 0.5 0.2 25

tag @e[type=husk,tag=husk_convertion,limit=1,sort=nearest] remove husk_convertion
tag @n[distance=..3,limit=1,tag=remove_summon,type=zombie] remove zombie
tag @n[distance=..3,limit=1,tag=remove_summon,type=zombie] remove necromancer_summon
tag @n[limit=1,tag=remove_summon_check,type=slime,sort=nearest] remove remove_summon_check
tp @n[limit=1,tag=remove_summon,type=zombie] ~ -65 ~
kill @n[limit=1,tag=remove_summon,type=zombie]