Added catch for stats of 0 to prevent errors.

This commit is contained in:
Aaron Lutomski
2026-06-21 13:44:55 -07:00
parent 78e46c66bc
commit efedccc205
6 changed files with 31 additions and 5 deletions
+15 -1
View File
@@ -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;
}