##ID 0

#summon dummy x and y are random values
summon husk ~ ~ ~ {attributes:[{id:"minecraft:step_height",base:1},{id:"minecraft:follow_range",base:50},{id:"minecraft:attack_damage",base:0},{base:1000,id:"max_health"},{base:10000,id:"armor"},{base:10000,id:"armor_toughness"},{id:"knockback_resistance",base:10000},{id:"minecraft:movement_speed",base:0.35}],NoAI:0b,ArmorItems:[{},{},{},{}],CanPickUpLoot:0b,CustomName:'{"text":"Dummy","color":"gold"}',Health:1000.0f,Tags:["dummy","enemy","newborn","melee"]}


execute as @e[type=husk,tag=newborn] run data modify entity @s CustomNameVisible set value 1b
#set id for stuff
scoreboard players set @e[type=husk,tag=dummy,tag=newborn,limit=1] id 0

##set level, health and id for newborn enemy
#set health
scoreboard players set @e[type=husk,tag=dummy,tag=newborn,limit=1] health_max 1000
scoreboard players add @e[type=husk,tag=dummy,tag=newborn,limit=1] health 1000

execute as @e[type=#main:enemies,tag=enemy,tag=dummy,tag=newborn] run function main:game/mobs/spawn/scores {"tag":dummy}

#enemy is not newborn now
tag @e[type=husk,tag=dummy,tag=newborn,limit=1] remove newborn