#stun
execute as @s[scores={stun=1..}] run function main:game/mobs/ai/scores/stun
# function main:characters/effects {"character":enemy}

#overheal
execute if score @s health > @s health_max run scoreboard players operation @s health = @s health_max

#in air
execute at @s if block ~ ~-0.5 ~ #air run scoreboard players add @s in_air 1
execute at @s unless block ~ ~-0.5 ~ #air run scoreboard players set @s in_air 0

#cooldowns
execute as @s[scores={enemy_ability_cooldown_1=1..,stun=..0}] run scoreboard players remove @s enemy_ability_cooldown_1 1
execute as @s[scores={enemy_ability_cooldown_2=1..,stun=..0}] run scoreboard players remove @s enemy_ability_cooldown_2 1
execute as @s[scores={enemy_ability_cooldown_3=1..,stun=..0}] run scoreboard players remove @s enemy_ability_cooldown_3 1
execute as @s[scores={enemy_attack_1=1..,stun=..0}] run scoreboard players remove @s enemy_attack_1 1
execute as @s[scores={enemy_attack_2=1..,stun=..0}] run scoreboard players remove @s enemy_attack_2 1

execute if score @s entity_animation_attack matches 1.. run scoreboard players remove @s entity_animation_attack 1
execute if score @s entity_animation_idle matches 1.. run scoreboard players remove @s entity_animation_idle 1
execute if score @s entity_animation_walk matches 1.. run scoreboard players remove @s entity_animation_walk 1
execute if score @s entity_animation_ability_1 matches 1.. run scoreboard players remove @s entity_animation_ability_1 1
execute if score @s entity_animation_ability_2 matches 1.. run scoreboard players remove @s entity_animation_ability_2 1
execute if score @s entity_animation_ability_3 matches 1.. run scoreboard players remove @s entity_animation_ability_3 1
execute if score @s entity_animation matches 1.. run scoreboard players remove @s entity_animation 1

execute unless score @s entity_animation_attack matches ..0 unless score @s entity_animation_idle matches ..0 unless score @s entity_animation_walk matches ..0 unless score @s entity_animation_ability_1 matches ..0 unless score @s entity_animation_ability_2 matches ..0 unless score @s entity_animation_ability_3 matches ..0 run scoreboard players set @s entity_animation 1

execute unless score @s entity_animation_ability_1 matches ..0 unless score @s entity_animation_ability_2 matches ..0 unless score @s entity_animation_ability_3 matches ..0 run scoreboard players set @s entity_animation_ability 1

execute as @s[scores={enemy_cooldown=1..,stun=..0}] run scoreboard players remove @s enemy_cooldown 1