private Point GetTileNextToBuilding(int tileX, int tileY)
        {
            AStarNode tileNode = this.GetNode(tileX, tileY);

            if (tileNode is not null)
            {
                tileNode.FakeTileClear = true;

                AStarPath path = this.FindPath(this.FarmerNodeOffset, tileNode);

                if (path is not null && path.Count > 0)
                {
                    return(new Point(tileX, tileY));
                }

                tileNode.FakeTileClear = false;
            }

            return(Point.Zero);
        }
        public AStarPath FindPathToNeighbourDiagonalWithBubbleCheck(AStarNode startNode, AStarNode endNode)
        {
            AStarPath pathWithBubbleCheck = this.FindPathWithBubbleCheck(startNode, endNode);

            if (pathWithBubbleCheck is not null)
            {
                return(pathWithBubbleCheck);
            }

            if (endNode.FakeTileClear)
            {
                int       minDistance = int.MaxValue;
                AStarNode nearestNode = null;
                foreach (WalkDirection walkDirection in WalkDirection.DiagonalDirections)
                {
                    AStarNode node = this.GetNode(endNode.X + walkDirection.X, endNode.Y + walkDirection.Y);

                    if (node is not null && node.TileClear)
                    {
                        int distance = ClickToMoveHelper.SquaredEuclideanDistance(
                            startNode.X,
                            startNode.Y,
                            node.X,
                            node.Y);

                        if (distance < minDistance)
                        {
                            nearestNode = node;
                            minDistance = distance;
                        }
                    }
                }

                if (nearestNode is not null)
                {
                    return(this.FindPathWithBubbleCheck(startNode, nearestNode));
                }
            }

            return(null);
        }