tag @s add raidhorn
execute unless score @s horn matches 1.. run scoreboard players set @s horn 0
effect give @s[scores={horn=0},nbt={active_effects:[{id:"minecraft:bad_omen",amplifier:4b}]}] bad_omen 30 4
effect give @s[scores={horn=0},nbt={active_effects:[{id:"minecraft:bad_omen",amplifier:3b}]}] bad_omen 30 4
effect give @s[scores={horn=0},nbt={active_effects:[{id:"minecraft:bad_omen",amplifier:2b}]}] bad_omen 30 3
effect give @s[scores={horn=0},nbt={active_effects:[{id:"minecraft:bad_omen",amplifier:1b}]}] bad_omen 30 2
effect give @s[scores={horn=0},nbt={active_effects:[{id:"minecraft:bad_omen"}]}] bad_omen 30 1
effect give @s[scores={horn=0},nbt=!{active_effects:[{id:"minecraft:bad_omen"}]}] bad_omen 30 0
scoreboard players set @s[scores={horn=0}] horn 140
advancement revoke @s only survivalplus:tools/raidhorn
tag @s remove raidhorn

