A frightened creature has disadvantage on ability checks and attack rolls while the source of its fear is within line of sight.
The creature can't willingly move closer to the source of its fear.
The creature can't willingly make melee attacks against the source of its fear, unless it has no other choice (eg. cornered, defending itself from attack, etc.). Doing so would constitute moving closer to the source of its fear.
The creature can make ranged attacks against the source of its fear, all made at disadvantage, as long as making the ranged attack does not require the creature to move closer to the source of its fear.