Melee combat AI should approach the target when entering the attack range

!5357 (merged)

Split from #7776.