# Find if it will be cursed (luck based)
execute if score summon_cursed EB_generic matches -1 run function 0_enemy_boss:is_summon_cursed

# Summon if not cursed
execute if score summon_cursed EB_generic matches 0 run summon pufferfish ~ ~ ~ {CustomName:'{"translate":"pufferfish","color":"gold","italic":false}',CustomNameVisible:1,Health:12.00,Attributes:[{Name:"generic.max_health",Base:12.00},{Name:"generic.follow_range",Base:18.00},{Name:"generic.attack_damage",Base:0.00},{Name:"generic.movement_speed",Base:0.23}],HandItems:[{},{}],ArmorItems:[{},{},{},{id:"player_head",Count:1b,tag:{SkullOwner:{Id:[I;630075668,915163297,-2046968232,152236255],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTcxNTI4NzZiYzNhOTZkZDJhMjI5OTI0NWVkYjNiZWVmNjQ3YzhhNTZhYzg4NTNhNjg3YzNlN2I1ZDhiYiJ9fX0="}]}}}}],Tags:['enemy', 'pufferfish', 'EB', 'init'],DeathLootTable:"mdd:drop_marker",HandDropChances:[0.0F,0.0F],ArmorDropChances:[0.0F,0.0F,0.0F,0.0F]}

# Summon if cursed
execute if score summon_cursed EB_generic matches 1 run summon pufferfish ~ ~ ~ {CustomName:'{"translate":"pufferfish","color":"gold","italic":false}',CustomNameVisible:1,Health:15.60,Attributes:[{Name:"generic.max_health",Base:15.60},{Name:"generic.follow_range",Base:19.80},{Name:"generic.attack_damage",Base:0.00},{Name:"generic.movement_speed",Base:0.23}],HandItems:[{},{}],ArmorItems:[{},{},{},{id:"player_head",Count:1b,tag:{SkullOwner:{Id:[I;630075668,915163297,-2046968232,152236255],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTcxNTI4NzZiYzNhOTZkZDJhMjI5OTI0NWVkYjNiZWVmNjQ3YzhhNTZhYzg4NTNhNjg3YzNlN2I1ZDhiYiJ9fX0="}]}}}}],Tags:['enemy', 'pufferfish', 'EB', 'init', 'cursed'],DeathLootTable:"mdd:drop_marker",HandDropChances:[0.0F,0.0F],ArmorDropChances:[0.0F,0.0F,0.0F,0.0F]}

# Mark if it's a boss spawn
execute if score boss_spawn EB_generic matches 1 run tag @e[tag=pufferfish,tag=init,sort=nearest,limit=1] add boss_spawn

# Spawn count
execute if score spawn_count EB_generic matches 1 run scoreboard players add #enemies_spawned EB_generic 1

# Reset flags
scoreboard players set summon_cursed EB_generic -1
scoreboard players set boss_spawn EB_generic 0
scoreboard players set spawn_count EB_generic 1

# Custom commands
# Clear Init tag
tag @e[tag=pufferfish,tag=init,sort=nearest,limit=1] remove init