Index: source/simulation2/components/CCmpUnitMotion.cpp =================================================================== --- source/simulation2/components/CCmpUnitMotion.cpp +++ source/simulation2/components/CCmpUnitMotion.cpp @@ -985,7 +985,17 @@ out = cmpPosition->GetPosition2D() + offset; } else + { out = cmpPosition->GetPosition2D(); + // If the target is moving, we might never reach get in range if we just try to reach its current position, + // so we have to try and move to a position where we will be in-range, including their move. + // Since we request paths asynchronously a the end of our turn, we need to account for twice the movement speed. + // TODO: be cleverer about this. It fixes fleeing nicely currently, but orthogonal movement should be considered. + // and microing a unit to flee in a spiral pattern might break this. + CmpPtr cmpUnitMotion(GetSimContext(), m_MoveRequest.m_Entity); + if (cmpUnitMotion && cmpUnitMotion->IsMoving()) + out += (out - cmpPosition->GetPreviousPosition2D()) * 2; + } return true; }