Skip to content

Commit

Permalink
Include item roll options in cloned statistic used for inline `agains…
Browse files Browse the repository at this point in the history
…t` expressions (#18335)
  • Loading branch information
stwlam authored Feb 23, 2025
1 parent 1a35a83 commit 6357670
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/module/system/text-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,7 @@ class TextEditorPF2e extends TextEditor {
// Let the inline roll function handle level base DCs
// Don't save the result if we are matching a statistic
const checkDC = params.dc === "@self.level" ? params.dc : getCheckDC({ name, params, item, actor });
if (!params.against) {
anchor.dataset.pf2Dc = checkDC;
}
if (!params.against) anchor.dataset.pf2Dc = checkDC;

// When using fixed DCs/adjustments, parse and add them to render the real DC
if (checkDC !== "@self.level") {
Expand Down Expand Up @@ -848,9 +846,9 @@ function getCheckDC({
// We assume that we can actually display the dc if against is provided.
// This function shouldn't be called otherwise.
if (!params.dc && params.against && actor) {
const rollOptions = [item?.isOfType("action", "feat") ? `origin:action:slug:${item.slug}` : null].filter(
R.isTruthy,
);
const rollOptions = item?.isOfType("action", "feat")
? [`origin:action:slug:${item.slug}`, ...item.getRollOptions("item")]
: [];
const statistic = actor.getStatistic(params.against)?.clone({ rollOptions });
return String(statistic?.dc.value ?? 0);
}
Expand Down

0 comments on commit 6357670

Please sign in to comment.