Some improvements to ally avoidance system. [Finishes #67528000]