From a7d9235a497e56e10a5361e41bcfbb26bfd4bdee Mon Sep 17 00:00:00 2001 From: Aaron Lutomski Date: Sat, 13 Jun 2026 12:13:34 -0700 Subject: [PATCH 1/4] Ran prettier --- module/MODULES.md | 24 ++++++++++++------------ scss/dg-dialog/_dialogs.scss | 16 ++++++++++------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/module/MODULES.md b/module/MODULES.md index e111154..69c1e35 100644 --- a/module/MODULES.md +++ b/module/MODULES.md @@ -4,19 +4,19 @@ Entry point: [`deltagreen.js`](deltagreen.js) (registered in `system.json`). ## Folder responsibilities -| Path | Purpose | -| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`config/`](config/) | System constants (`DG`, skill list, template paths) | -| [`data/`](data/) | TypeDataModels (`actor/`, `item/`, `derived/`) | -| [`active-effect/`](active-effect/) | Active effect metadata, data model, document class, runtime sync | +| Path | Purpose | +| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`config/`](config/) | System constants (`DG`, skill list, template paths) | +| [`data/`](data/) | TypeDataModels (`actor/`, `item/`, `derived/`) | +| [`active-effect/`](active-effect/) | Active effect metadata, data model, document class, runtime sync | | [`profession/`](profession/) | Profession catalog, validation, character-creation math, deferred commit ([`commit-character-creation.js`](profession/commit-character-creation.js)), Damaged Veteran modifiers ([`damaged-veteran-modifiers.js`](profession/damaged-veteran-modifiers.js)), disorder IDs ([`disorders.js`](profession/disorders.js)) | -| [`roll/`](roll/) | Dice roll subclasses, roll pipeline, and roll UX. [`roll/roll.js`](roll/roll.js) is the public API. Internal Roll subclasses live in [`roll/classes/`](roll/classes/). | -| [`sheets/`](sheets/) | ApplicationV2 sheets and mixins | -| [`applications/`](applications/) | Standalone dialogs, chargen orchestrator ([`profession-setup-flow.js`](applications/profession-setup-flow.js)), shared dialog UI ([`character-creation-ui.js`](applications/character-creation-ui.js)), and dialog factory ([`dg-dialog.js`](applications/dg-dialog.js)) | -| [`actor/`](actor/), [`item/`](item/) | Document subclasses | -| [`chat/`](chat/) | Chat cards ([`dg-chat-card.js`](chat/dg-chat-card.js)) and inline actions | -| [`integrations/`](integrations/) | Optional module hooks (Dice So Nice) | -| [`utils/`](utils/) | Generic helpers only (Handlebars, migration, skill layout/tooltips) | +| [`roll/`](roll/) | Dice roll subclasses, roll pipeline, and roll UX. [`roll/roll.js`](roll/roll.js) is the public API. Internal Roll subclasses live in [`roll/classes/`](roll/classes/). | +| [`sheets/`](sheets/) | ApplicationV2 sheets and mixins | +| [`applications/`](applications/) | Standalone dialogs, chargen orchestrator ([`profession-setup-flow.js`](applications/profession-setup-flow.js)), shared dialog UI ([`character-creation-ui.js`](applications/character-creation-ui.js)), and dialog factory ([`dg-dialog.js`](applications/dg-dialog.js)) | +| [`actor/`](actor/), [`item/`](item/) | Document subclasses | +| [`chat/`](chat/) | Chat cards ([`dg-chat-card.js`](chat/dg-chat-card.js)) and inline actions | +| [`integrations/`](integrations/) | Optional module hooks (Dice So Nice) | +| [`utils/`](utils/) | Generic helpers only (Handlebars, migration, skill layout/tooltips) | Root-level modules: [`settings.js`](settings.js), [`templates.js`](templates.js). diff --git a/scss/dg-dialog/_dialogs.scss b/scss/dg-dialog/_dialogs.scss index 966829b..0847c38 100644 --- a/scss/dg-dialog/_dialogs.scss +++ b/scss/dg-dialog/_dialogs.scss @@ -814,9 +814,15 @@ line-height: 1.4; } -.dg-dialog--damaged-veterans label.checkbox.damaged-veterans-option > input[type="radio"], -.dg-dialog--things-disorder label.checkbox.things-disorder-option > input[type="radio"], -.dg-dialog--hard-experience label.checkbox.hard-experience-bond-option > input[type="radio"] { +.dg-dialog--damaged-veterans + label.checkbox.damaged-veterans-option + > input[type="radio"], +.dg-dialog--things-disorder + label.checkbox.things-disorder-option + > input[type="radio"], +.dg-dialog--hard-experience + label.checkbox.hard-experience-bond-option + > input[type="radio"] { margin-top: 0.15rem; } @@ -847,9 +853,7 @@ overflow: hidden; } -.dg-dialog-app.dg-dialog-app--hard-experience - .dialog-form - > .dialog-content { +.dg-dialog-app.dg-dialog-app--hard-experience .dialog-form > .dialog-content { display: flex; flex-direction: column; flex: 1 1 auto; From 219ad971d9b1f5d24fc19501e00b9d51db071fa1 Mon Sep 17 00:00:00 2001 From: Aaron Lutomski Date: Wed, 17 Jun 2026 17:30:18 -0700 Subject: [PATCH 2/4] Added catch for stats of 0 to prevent errors. --- lang/en.json | 1 + module/roll/classes/dg-percentile-roll.js | 16 +++++++++++++++- module/roll/roll.js | 5 +++++ module/sheets/mixins/roll-sheet-mixin.js | 8 +++++++- .../actor/partials/attributes-grid-partial.html | 4 ++-- templates/actor/parts/left-bar.html | 2 +- 6 files changed, 31 insertions(+), 5 deletions(-) diff --git a/lang/en.json b/lang/en.json index c62d621..7007ad5 100644 --- a/lang/en.json +++ b/lang/en.json @@ -168,6 +168,7 @@ "DG.Roll.For": "For", "DG.Roll.Damage": "Damage", "DG.Roll.Roll": "Roll", + "DG.Roll.CannotRollStat": "A statistic of 0 cannot be rolled.", "DG.Physical.Wounds": "Wounds", "DG.Physical.FirstAidLabel": "First Aid Has Already Been Attempted: ", "DG.Physical.ExhaustionPenalty": "Penalty:", diff --git a/module/roll/classes/dg-percentile-roll.js b/module/roll/classes/dg-percentile-roll.js index 57106a6..a247b81 100644 --- a/module/roll/classes/dg-percentile-roll.js +++ b/module/roll/classes/dg-percentile-roll.js @@ -255,6 +255,20 @@ export class DGPercentileRoll extends DGRoll { return { target, localizedKey, skillPath }; } + /** + * i18n key for a user-facing warning when this roll must not be made, or null if allowed. + * @returns {string|null} + */ + get blockedRollMessage() { + if (this.type !== "stat") return null; + + const x5 = Number(this.target); + if (!Number.isFinite(x5) || x5 < 1) { + return "DG.Roll.CannotRollStat"; + } + return null; + } + /** * Create label based on result of roll * @@ -392,7 +406,7 @@ export class DGPercentileRoll extends DGRoll { const { rollTargetModifier } = this; - if (!this.target || Number.isNaN(this.target)) { + if (this.target == null || Number.isNaN(this.target)) { return null; } diff --git a/module/roll/roll.js b/module/roll/roll.js index d622b66..e1ff5c5 100644 --- a/module/roll/roll.js +++ b/module/roll/roll.js @@ -100,6 +100,11 @@ export async function processDGRoll(event, roll) { const shiftKey = event?.shiftKey ?? false; const which = event?.which ?? 0; + if (roll instanceof DGPercentileRoll && roll.blockedRollMessage) { + ui.notifications.warn(roll.blockedRollMessage, { localize: true }); + return; + } + if (shiftKey || which === 3) { if (!(roll instanceof DGSanityDamageRoll)) { const dialogData = await roll.showDialog(); diff --git a/module/sheets/mixins/roll-sheet-mixin.js b/module/sheets/mixins/roll-sheet-mixin.js index 7367ac4..0f6edcb 100644 --- a/module/sheets/mixins/roll-sheet-mixin.js +++ b/module/sheets/mixins/roll-sheet-mixin.js @@ -36,8 +36,14 @@ export default function RollSheetMixin(Base) { * @private */ static async _onRoll(event, target) { - if (target.classList.contains("not-rollable") || event.which === 2) + if (event.which === 2) return; + + if (target.classList.contains("not-rollable")) { + if (target.dataset.rolltype === "stat") { + ui.notifications.warn("DG.Roll.CannotRollStat", { localize: true }); + } return; + } const item = this.actor.items.get(target.dataset.iid); const roll = createDGRollFromDataset(target.dataset, { diff --git a/templates/actor/partials/attributes-grid-partial.html b/templates/actor/partials/attributes-grid-partial.html index 6d9a53c..72802f4 100644 --- a/templates/actor/partials/attributes-grid-partial.html +++ b/templates/actor/partials/attributes-grid-partial.html @@ -7,7 +7,7 @@
-