##FORWARD
#forward
$execute if entity @s[predicate=main:movement/forward,predicate=!main:movement/backward,predicate=!main:movement/left,predicate=!main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"~ $(angle)"}
#forward + left + right
$execute if entity @s[predicate=main:movement/forward,predicate=main:movement/left,predicate=main:movement/right,predicate=!main:movement/backward] run function main:mechanics/knockback {"power":$(power),"angle":"~ $(angle)"}


##BACKWARD
#backward
$execute if entity @s[predicate=main:movement/backward,predicate=!main:movement/forward,predicate=!main:movement/left,predicate=!main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"~180 $(angle)"}
#backward + left + right
$execute if entity @s[predicate=main:movement/backward,predicate=!main:movement/forward,predicate=main:movement/left,predicate=main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"~180 $(angle)"}


##BOTH
#forward + backward
$execute if entity @s[predicate=main:movement/forward,predicate=main:movement/backward,predicate=!main:movement/left,predicate=!main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"$(vertical)"}


##RIGHT
#right
$execute if entity @s[predicate=main:movement/right,predicate=!main:movement/backward,predicate=!main:movement/left,predicate=!main:movement/forward] run function main:mechanics/knockback {"power":$(power),"angle":"~90 $(angle)"}
#forward + right
$execute if entity @s[predicate=main:movement/forward,predicate=main:movement/right,predicate=!main:movement/backward,predicate=!main:movement/left] run function main:mechanics/knockback {"power":$(power),"angle":"~45 $(angle)"}
#backward + right
$execute if entity @s[predicate=main:movement/backward,predicate=main:movement/right,predicate=!main:movement/forward,predicate=!main:movement/left] run function main:mechanics/knockback {"power":$(power),"angle":"~135 $(angle)"}
#forward + backward + right
$execute if entity @s[predicate=main:movement/forward,predicate=main:movement/backward,predicate=!main:movement/left,predicate=main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"~90 $(angle)"}

##LEFT
#left
$execute if entity @s[predicate=main:movement/left,predicate=!main:movement/backward,predicate=!main:movement/forward,predicate=!main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"~270 $(angle)"}
#forward + left
$execute if entity @s[predicate=main:movement/forward,predicate=main:movement/left,predicate=!main:movement/backward,predicate=!main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"~-45 $(angle)"}
#backward + left
$execute if entity @s[predicate=main:movement/backward,predicate=main:movement/left,predicate=!main:movement/forward,predicate=!main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"~225 $(angle)"}
#forward + backward + left
$execute if entity @s[predicate=main:movement/forward,predicate=main:movement/backward,predicate=main:movement/left,predicate=!main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"~270 $(angle)"}


#all
$execute if entity @s[predicate=main:movement/forward,predicate=main:movement/backward,predicate=main:movement/left,predicate=main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"$(vertical)"}

#none
$execute if entity @s[predicate=!main:movement/forward,predicate=!main:movement/backward,predicate=!main:movement/left,predicate=!main:movement/right] run function main:mechanics/knockback {"power":$(power),"angle":"$(vertical)"}