Skip to content

Commit

Permalink
Fix Emanate Wrath which has "+" as prefix to the formula
Browse files Browse the repository at this point in the history
Parsing a formula with tooltips where parts are split in different nodes
was not working for Emanate Wrath because the span had "+" prefix

Fixes #1170
  • Loading branch information
kakaroto committed Nov 16, 2024
1 parent 3d22ff2 commit 1437e02
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dndbeyond/base/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,12 @@ function recursiveDiceReplace(node, cb) {
const parentText = parent.text();
// The parent has another portion of the same dice formula, so we need to replace the whole parent
// with the replaced dice
if (parentText !== node.textContent && replaceRolls(parentText, () => "-") === "-") {
const parentReplaced = replaceRolls(parentText, () => "-");
if (parentText !== node.textContent &&
(parentReplaced === "-" ||
parentReplaced === "--" ||
parentReplaced === "+-" // Emanate Wrath has "+2d6" which gets "2d6" parsed and leaves "+-"
)) {
const text = replaceRolls(parentText, (...args) => cb(node, ...args));
parent.html($.parseHTML(text));
} else {
Expand Down

0 comments on commit 1437e02

Please sign in to comment.