Auto-translated
Everything is calculated correctly. You can see that the first time, the cost of the path to the castle was 290, after spending 150 movement points, it became 270, and after spending another 150 movement points, it was back to 290. In all three cases, the correct value was displayed: that is, exactly how many movement points were needed in that situation to reach the city, and this number depends on the number of movement points the hero currently has. This is a feature of the last movement points and the fact that sometimes the cost of a diagonal movement is reduced to the cost of a straight movement, and sometimes it isn't (see physics and all that), but the HotA pathfinding algorithm takes this feature into account and shows what the cost of the path is right now, with the current number of movement points the hero has (that's why it showed 290 in two cases and 270 in one).