anchor.diff:        end;
       end;
     end;
  +
  +  // Determine first line (divided by count of allies - it is rought because allies can have different size of defensive line but better than nothing)
  +  aFirstLine := Round(aFirstLine / AllianceCnt);
  +
     SetLength(DefPosArr, Cnt);
     Result := True;
   end;
  
positive.code:   SQR_MIN_DEF_POINT_DISTANCE = 3*3;
  var
    Check: Boolean;
    Idx, NearbyIdx, Cnt: Word;
    I, K: Integer;
    Direction: TKMDirection;
    PolyArr: TPolygonArray;
  begin
    Result := False;
    // Check and determine counts
    if (BestDefLines.Count = 0) then
      Exit
    else if aMinDefeces then
      aBaseCnt := Max(4,BestDefLines.Count)
    else
      aBaseCnt := Max(aBaseCnt,BestDefLines.Count);
  
    PolyArr := gAIFields.NavMesh.Polygons;
    // Prepare defensive FF - add all polygon is BestDefLines to queue
    NewQueue(fVisitedIdx + 1);
    aFirstLine := BestDefLines.Count;
    for I := 0 to BestDefLines.Count - 1 do
    begin
      Idx := BestDefLines.Lines[I].Polygon;
  
negative.code:         Polygon := Idx;
          Direction := KMGetDirection( fQueueArray[Idx].DistPoint, fDefInfo[Idx].PointInDir );
          DirPoint := KMPointDir( fQueueArray[Idx].DistPoint, Direction );
          Weight := Max( 0, (High(Word) shr 1) // Init value
                             + (fDefInfo[Idx].Influence shl 1) // Increase weight of owner's city
                             - ((ScannedCnt div aFirstLine) * 100) // Penalize back lines
                             - fDefInfo[Idx].AllyInfluence // Penalize allied influence
                             + fDefInfo[Idx].EnemyInfluence // Add more soldiers closer to enemy influence
                       );
        end;
        if (Direction <> dir_NA) then
          Cnt := Cnt + 1;
  