Skip to content

Commit

Permalink
Merge branch 'not-assume-a-dc-for-inline-skill-checks' into 'master'
Browse files Browse the repository at this point in the history
Remove setting a default DC when no DC is supplied in an inline roll

See merge request hooking/foundry-vtt---pathfinder-2e!6091
  • Loading branch information
stwlam committed Nov 27, 2021
2 parents 5013e11 + 5dc5756 commit 4ea7e5c
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/scripts/ui/inline-roll-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const InlineRollsLinks = {
const dc = Number(link.dataset.pf2Dc?.trim() ?? "");
const role = link.dataset.pf2ShowDc?.trim() ?? "";
const userCanView = ["all", "owner"].includes(role) || (role === "gm" && game.user.isGM);
if (!Number.isNaN(dc) && userCanView) {
if (userCanView && dc > 0) {
const text = link.innerHTML;
link.innerHTML = game.i18n.format("PF2E.DCWithValue", { dc, text });
}
Expand Down Expand Up @@ -175,16 +175,17 @@ export const InlineRollsLinks = {
for (const actor of skillActors) {
const skillCheck = actor.data.data.skills[skill ?? ""];
if (skill && skillCheck) {
const dc = { label: pf2Label, value: 20 } as CheckDC;
if (pf2Dc === "@self.level") {
const proficiencyWithoutLevel: boolean =
game.settings.get("pf2e", "proficiencyVariant") === "ProficiencyWithoutLevel";
const level = actor.data.data.details.level.value;
const adjustment = Number.isInteger(Number(pf2Adjustment)) ? Number(pf2Adjustment) : 0;
dc.value = calculateDC(level, { proficiencyWithoutLevel }) + adjustment;
} else {
dc.value = Number.isInteger(Number(pf2Dc)) ? Number(pf2Dc) : 20;
}
const dcValue =
pf2Dc === "@self.level"
? ((): number => {
const pwlSetting = game.settings.get("pf2e", "proficiencyVariant");
const proficiencyWithoutLevel = pwlSetting === "ProficiencyWithoutLevel";
const level = actor.level;
const adjustment = Number(pf2Adjustment) || 0;
return calculateDC(level, { proficiencyWithoutLevel }) + adjustment;
})()
: Number(pf2Dc);
const dc = dcValue > 0 ? { label: pf2Label, value: dcValue } : null;
const options = actor.getRollOptions(["all", "skill-check", skill]);
if (pf2Traits) {
const traits = pf2Traits
Expand Down

0 comments on commit 4ea7e5c

Please sign in to comment.