execute if entity @s[tag=!electric_charge] run scoreboard players add @s n_effects 1

execute at @s run playsound custom.effect.electrocute ambient @a ~ ~ ~

execute if entity @s[tag=!electric_charge] run scoreboard players operation @s electric_charge = duration n_effects
execute if entity @s[tag=electric_charge] if score @s electric_charge < duration n_effects run scoreboard players operation @s electric_charge = duration n_effects

tag @s add electric_charge

scoreboard players set ignore_armor damage_custom 1
scoreboard players add amount damage_custom 300
function damage:apply_factors
