execute as @e[type=husk,tag=!plussed] run data merge entity @s {DeathLootTable:"survivalplus:entities/husk"}

execute unless entity @e[tag=husk_king] if score time time matches 13000..23400 run execute as @e[type=husk,tag=!plussed,predicate=survivalplus:1chance,limit=1] run data merge entity @s {IsBaby:0b,CanBreakDoors:1b,CustomName:{"text":"Iron Clad"},Health:80,PersistenceRequired:1b,Tags:[plussed,husk_king,boss,rare,upgradeable,nopoly,lowregen,special],equipment:{mainhand:{id:iron_sword,components:{custom_data:{strengthsword:tag},item_name:{"text":"Iron Dune","italic":false},lore:[{"text":"Strength on kill","italic":false,"color":"light_purple"}],enchantments:{sweeping:1}}},offhand:{id:shield},feet:{id:iron_boots,components:{trim:{pattern:dune,material:gold},enchantments:{depth_strider:3,frost_walker:3}}},legs:{id:iron_leggings,components:{trim:{pattern:dune,material:gold},enchantments:{blast_protection:4,fire_protection:4}}},chest:{id:iron_chestplate,components:{trim:{pattern:shaper,material:gold},enchantments:{protection:3}}},head:{id:iron_helmet,components:{trim:{pattern:dune,material:quartz},enchantments:{projectile_protection:4}}}},drop_chances:{mainhand:1f,offhand:0f,feet:0f,legs:0f,chest:0f,head:0f},attributes:[{id:"movement_speed",base:0.26f},{id:"max_health",base:80f},{id:"attack_damage",base:3f},{id:"knockback_resistance",base:0.7f}]}
execute as @e[type=husk,tag=!plussed,predicate=survivalplus:2chance] run data merge entity @s {IsBaby:0b,CanBreakDoors:1b,Health:20,CanPickUpLoot:0b,Tags:[plussed,rare,upgradeable,iron_husk,armorable,dmggearme],equipment:{mainhand:{id:iron_axe},feet:{id:iron_boots},legs:{id:iron_leggings},chest:{id:iron_chestplate},head:{id:iron_helmet}},drop_chances:{mainhand:0.25f},attributes:[{id:"max_health",base:20f},{id:"knockback_resistance",base:0.5f},{id:"movement_speed",base:0.26f},{id:"attack_damage",base:1f},{id:"attack_knockback",base:2f}]}
execute as @e[tag=dmggearme] run function survivalplus:mobs/gear/iron_husk
execute if score hardmode hardmode matches 1 as @e[type=husk,tag=!plussed,predicate=survivalplus:10chance] at @s unless entity @a[distance=..15] run data merge entity @s {Health:50,Tags:[plussed,mineable,sand],CanPickUpLoot:0b,equipment:{chest:{id:leather_chestplate,components:{dyed_color:15789690}},head:{id:smooth_sandstone}},attributes:[{id:"attack_damage",base:6f},{id:"movement_speed",base:0.2f},{id:"knockback_resistance",base:0.8f},{id:"max_health",base:50f},{id:"armor_toughness",base:4f},{id:"armor",base:10f}],drop_chances:{chest:0f,head:0f},DeathLootTable:"survivalplus:entities/sand_mineable"}
execute if score hardmode hardmode matches 1 as @e[type=husk,tag=!plussed,predicate=survivalplus:1chance] run data merge entity @s {IsBaby:0b,Health:40,Tags:[plussed,spawner,rare,lowregen],CanPickUpLoot:0b,equipment:{legs:{id:stick,components:{enchantments:{"survivalplus:spawner":1},custom_data:{del:tag}}},head:{id:spawner}},attributes:[{id:"armor",base:10f},{id:"knockback_resistance",base:0.7f},{id:"attack_knockback",base:2f},{id:"max_health",base:40f},{id:"armor_toughness",base:4f},{id:"movement_speed",base:0.2f}],drop_chances:{legs:0f,head:0f},DeathLootTable:"survivalplus:entities/spawner_mob"}
execute as @e[type=husk,tag=!plussed,predicate=survivalplus:25chance,predicate=survivalplus:50chance] run data merge entity @s {Health:35,Tags:[plussed,item_snatcher,not_stole],CanBreakDoors:1b,CanPickUpLoot:1b,attributes:[{id:"attack_damage",base:3.5f},{id:"movement_speed",base:0.3f},{id:"knockback_resistance",base:0.5f},{id:"max_health",base:35f},{id:"armor_toughness",base:6f},{id:"attack_damage",base:3f}],drop_chances:{mainhand:2f,offhand:2f}}
execute as @e[tag=item_snatcher] run function survivalplus:tools/armor/delthorns
execute as @e[type=husk,tag=!plussed] run data merge entity @s {CanBreakDoors:1b,Health:35,attributes:[{id:"armor",base:8f},{id:"movement_speed",base:0.28f},{id:"max_health",base:35f},{id:"attack_damage",base:8f},{id:"knockback_resistance",base:0.5f}]}
execute as @e[type=husk,tag=!plussed] run tag @s add plussed
execute as @e[type=husk,nbt={IsBaby:1b}] run attribute @s attack_damage modifier add 3278053c-647e-46ad-bd07-6e787cb86722 -0.25 add_multiplied_base
execute as @e[type=husk,nbt={IsBaby:1b}] run attribute @s movement_speed modifier add e031c685-396b-415a-94c3-965d460ff3b6 -0.4 add_multiplied_base