From 5dfc6785610eadb04dfe3c6a40d37f9b1c7b7965 Mon Sep 17 00:00:00 2001 From: Carlos Fernandez Date: Tue, 24 Feb 2026 02:39:40 -0500 Subject: [PATCH] Refine elevation check to handle stacked tokens --- module/canvas/placeables/token.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/canvas/placeables/token.mjs b/module/canvas/placeables/token.mjs index 9d912b1c..f889d903 100644 --- a/module/canvas/placeables/token.mjs +++ b/module/canvas/placeables/token.mjs @@ -65,10 +65,10 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token { const thisElevation = [this.document.elevation, this.document.elevation + thisHeight]; const targetElevation = [target.document.elevation, target.document.elevation + targetHeight]; const isSameAltitude = - thisElevation[0] <= targetElevation[1] && // bottom of this must be at or below the top of target - thisElevation[1] >= targetElevation[0]; // top of this must be at or above the bottom of target + thisElevation[0] < targetElevation[1] && // bottom of this must be at or below the top of target + thisElevation[1] > targetElevation[0]; // top of this must be at or above the bottom of target const [lower, higher] = [targetElevation, thisElevation].sort((a, b) => a[1] - b[1]); - const elevation = isSameAltitude ? 0 : higher[0] - lower[1]; + const elevation = isSameAltitude ? 0 : higher[0] - lower[1] + 5; // Compute for gridless. This version returns circular edge to edge + grid distance, // so that tokens that are touching return 5.