From d142b35522787cc71e716860ca7ad9e341efe43b Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Sat, 3 May 2025 17:06:38 -0400 Subject: [PATCH] fix -number check to identify +-1 and collapse the +-1 into "+" and "-1" instead of "+" "-" and "1" --- src/artigen/math/mathTokenizer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/artigen/math/mathTokenizer.ts b/src/artigen/math/mathTokenizer.ts index acd04de..d9e03a0 100644 --- a/src/artigen/math/mathTokenizer.ts +++ b/src/artigen/math/mathTokenizer.ts @@ -125,7 +125,7 @@ export const tokenizeMath = (cmd: string, modifiers: RollModifiers): [ReturnData } // Identify if we are in a state where the current number is a negative number - if (mathConf[i - 1] === '-' && ((!mathConf[i - 2] && mathConf[i - 2] !== 0) || mathConf[i - 2] === '(')) { + if (mathConf[i - 1] === '-' && ((!mathConf[i - 2] && mathConf[i - 2] !== 0) || operators.includes( mathConf[i - 2]))) { if (typeof mathConf[i] === 'string') { // Current item is a mathOp, need to insert a "-1 *" before it mathConf.splice(i - 1, 1, ...[parseFloat('-1'), '*']);