Originally Posted by
Styrmir
Cheers Moon Wizard, that would indeed be the cause if larger than medium sized tokens were in play.
While I was typing out my reply this morning I forgot to mention, that currently the flanking and checking for disadvantage as enemy in melee range only considers medium sized targets with a 5' reach currently. This is mentioned in the patch notes and would be relevant to both moguls77 and Mazzar's posts above.
This is something I am wanting to address in a future update, but it will require a sizeable slot of time available to do as there are a number of things to consider for that in the three dimensional plane. Having worked out how to make it work for medium sized actors with a 5' reach, lays the basis for that extension of functionality.
On a separate note, ranged attacks distance calculations will work for all the different size categories and uses separate logic from the flanking and disadvantage checking.
Ranged attack calculations use the Pythagoras theorem in the three dimensional plane to calculate the distances between the actor tokens grid edge to the target tokens grid edge, this considers different sizes of targets. This means the range will be accurate, but not using the simplified grid or variant rules for use from the DM guide. Thus taking advantage of playing on a VTT over simplifications necessary to give rough estimates for in-person play.
Furthermore in my humble opinion there are some improvements to my solution here over the in-built logic, at least when it comes to playing 5E on a square grid map. This may not be a factor for other gaming systems.
The default in-built targeting arrow and line drawing range logic, as far as my testing has showed, have some drawbacks that my approach overcomes. When tokens were side by side and not at least diagonal there would be no range returned, related to that what I'm assuming that the arrow line could not be drawn in those cases. This in turn would break range calculations in those cases so a different solution was needed.
The range would also not consider the difference in distance to the target tokens grid edge (5E) from different angles. Imagine drawing a circle with a radius, with its center in the center of an actors grid square. This circle would only touch the grid squares edges at the absolute middle of the horizontal and vertical. Leaving an unspecified distance from the circumference of that circle to the horizontal or vertical edge of the square grid in any case where the two tokens circles circumferences did not touch, that is if tokens are not absolutely horizontally or vertically placed towards each other. This problem would be exasperated as it would occur for both the actors and targets side.
My calculations considers this and also consider this for different sized targets. Finding the interception line location of both attackers and targets tokens last occupied square on the map (as per the 5e rules), and considering that difference to derive the actual range in game terms.
TLDR;
Long story short, it's all rather complicated and all these range functionalities use my own custom solution for 5E. Ranged attack ranges return precise ranges while considering the 5E rules for grid occupation of targets of various sizes, thus returning precise actual ranges in game terms.
Flanking and checking for disadvantage as active enemy in range works by finding the tokens square grid location and comparing placements to each other, also considering a 5' reach in three dimensions. This works very differently due to the nature of the problem. Currently only for medium or smaller sized tokens (tokens that fit within 1 square).
@moguls77 and Mazzar
Both your cases will only work if the actor and target are Medium or smaller sized, that is they only occupy one grid square space. This is something that may get addressed in future updates.