From 5ac9c682d98c63c2aa3565c83274902b997d2246 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 13 Jan 2025 22:34:34 +0100 Subject: [PATCH] =?UTF-8?q?Support=20difficult=C3=A9=20num=C3=A9rique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/apps/textroll/text-roll-carac-competence.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/module/apps/textroll/text-roll-carac-competence.js b/module/apps/textroll/text-roll-carac-competence.js index 71349c63..7c2f5572 100644 --- a/module/apps/textroll/text-roll-carac-competence.js +++ b/module/apps/textroll/text-roll-carac-competence.js @@ -1,5 +1,4 @@ import "../xregexp-all.js"; -import { ACTOR_TYPES } from "../../item.js"; import { RdDCarac } from "../../rdd-carac.js"; import { RdDItemCompetence } from "../../item-competence.js"; import { RdDUtility } from "../../rdd-utility.js"; @@ -8,7 +7,6 @@ import { TextRollManager } from "./text-roll-formatter.js"; const REGECP_CARAC = "(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)" const REGEXP_COMP = "(\\/(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?" const REGEXP_DIFF = "(/(?[\\+\\-]?\\d+(d\\d+)?))?" -const REGEX_DICE_DIFF = /[\+\-]?\d+d\d+/; const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu') @@ -38,7 +36,7 @@ export class TextRollCaracCompetence { async calculDiff(node) { const diff = node.data('diff') ?? 0 - if (diff.match(REGEX_DICE_DIFF)) { + if (!Number.isInteger(diff)) { const roll = new Roll(diff) await roll.evaluate() await roll.toMessage({ flavor: `La difficulté de ${diff} a donné ${roll.total}` })