Skip to content

Commit

Permalink
Zombie Beholder macro fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed May 18, 2024
1 parent ef6ce53 commit e7dec32
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Next Up

- Fix for Beholder Zombie Eye Ray macro

# 5.1.25

- Monster Effects: Beholder Legendary Eye Ray action will now roll Eye Rays macro.
Expand Down
24 changes: 24 additions & 0 deletions src/effects/DDBEffectHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,30 @@ export default class DDBEffectHelper {
});
});
}
if (results.length > 0) return results;
return DDBEffectHelper.extractParagraphItems(text, { titleType });
}

static extractParagraphItems(text, { type = "p", titleType = "em" } = {}) {
const results = [];
const parsedDoc = utils.htmlToDoc(text);

const listItems = parsedDoc.querySelectorAll(type);
let i = 1;
for (const item of listItems) {
const title = item.querySelector(titleType);
// eslint-disable-next-line no-continue
if (!title) continue;
const content = title.nextSibling;
results.push({
number: i,
title: title.textContent.replace(/\.$/, "").trim(),
content: content.innerHTML?.trim() ?? content.wholeText?.trim() ?? content.textContent?.trim(),
full: item.innerHTML,
});
i++;
}

return results;
}

Expand Down

0 comments on commit e7dec32

Please sign in to comment.