I have done temporarily in the following way (fragment responsible only for direction):
But this solution has the disadvantage that if several allies (player is a subclass of ally) are on the different sides from the enemy, it will reflect from the first overlapping ally and start to push the second one. @Auran131, do you know how to fix it?
EDIT: it seems that after a reflection from the first ally, the enemy will push the second one for at most several meters and reflect again. Even if allies encircle the enemy, it will push them at random directions but not far. So I think this works in most cases.
