From 55a040062a6e23fc0668391bbd53bb2fdf319004 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Fri, 1 May 2026 23:55:29 +0200 Subject: [PATCH] Fix ranged defense + HTH attacks --- module/documents/roll.mjs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/module/documents/roll.mjs b/module/documents/roll.mjs index 285a8a3..78096d3 100644 --- a/module/documents/roll.mjs +++ b/module/documents/roll.mjs @@ -289,7 +289,11 @@ export default class LethalFantasyRoll extends Roll { options.damageMedium = true dice = options.rollTarget.weapon.system.damage.damageM } - dice = dice.replace("E", "") + if (/NE$/i.test(dice)) { + hasMaxValue = false + hasExplode = false + } + dice = dice.replace(/NE$/i, "").replace("E", "") baseFormula = dice } else if (options.rollType.includes("monster-damage")) { @@ -302,7 +306,10 @@ export default class LethalFantasyRoll extends Roll { dice = options.rollTarget.damageDice dice = dice.replace("E", "") baseFormula = dice - if (options.rollTarget.noExplode) hasMaxValue = false + if (options.rollTarget.noExplode) { + hasMaxValue = false + hasExplode = false + } } @@ -498,7 +505,8 @@ export default class LethalFantasyRoll extends Roll { rollContext.favor = "none" } - maxValue = Number(baseFormula.match(/\d+$/)[0]) // Update the max value agains + const maxMatch = baseFormula ? baseFormula.match(/\d+$/) : null + maxValue = maxMatch ? Number(maxMatch[0]) : 0 const rollData = { type: options.rollType,