# Ensure present on days 1-2
execute if score cycle scav_cycle matches 1..2 unless entity @e[type=villager,tag=Scavenger] run scoreboard players set state scav_state 0
execute if score cycle scav_cycle matches 1..2 if score state scav_state matches 0 run function scavenger:spawn

# Keep Scavenger immortal
execute as @e[type=villager,tag=Scavenger] run data merge entity @s {Invulnerable:1b}
execute as @e[type=villager,tag=Scavenger] run attribute @s minecraft:generic.max_health base set 1024
execute as @e[type=villager,tag=Scavenger] run data modify entity @s Health set value 1024f
execute as @e[type=villager,tag=Scavenger] run effect give @s resistance 999999 255 true
execute as @e[type=villager,tag=Scavenger] run effect give @s regeneration 999999 255 true
execute as @e[type=villager,tag=Scavenger] run effect give @s fire_resistance 999999 1 true
execute as @e[type=villager,tag=Scavenger] run attribute @s minecraft:generic.knockback_resistance base set 1
