# Counter effect
scoreboard players remove @s mage_armor 1

# Particles
execute unless predicate effects:is_baby run particle falling_dust gray_concrete_powder ~ ~.7 ~ .3 .6 .3 0 7 normal
execute if predicate effects:is_baby run particle falling_dust gray_concrete_powder ~ ~.3 ~ .3 .6 .3 0 7 normal

# Effect
effect give @s glowing 1 0 true
effect give @s resistance 1 5 true

execute if predicate effects:hurt run playsound custom.effect.mage_armor hostile @a ~ ~ ~ 1 .5
execute if predicate effects:hurt run particle block_marker barrier ~ ~1 ~ 0 0 0 0 1 force

# Clear
execute if score @s mage_armor matches 0 run function effects:mage_armor/clear