From e25cf0c4cd6fc3e98f6f95ad19fd845fdbeb3b6b Mon Sep 17 00:00:00 2001 From: WBHarry Date: Mon, 6 Jul 2026 16:00:49 +0200 Subject: [PATCH] Fixed so that dice css uses specific results.denomation if available --- module/dice/die/baseDie.mjs | 19 +++++++++++++++++++ templates/ui/chat/parts/damage-part.hbs | 2 +- templates/ui/chat/parts/roll-part.hbs | 7 ++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/module/dice/die/baseDie.mjs b/module/dice/die/baseDie.mjs index ed44cb39..fa6086c3 100644 --- a/module/dice/die/baseDie.mjs +++ b/module/dice/die/baseDie.mjs @@ -30,4 +30,23 @@ export default class BaseDie extends foundry.dice.terms.Die { return this.continueCombo(); } + + /** @override */ + getResultCSS(result) { + const hasSuccess = result.success !== undefined; + const hasFailure = result.failure !== undefined; + const isMax = result.result === this.faces; + const isMin = result.result === 1; + return [ + this.constructor.name.toLowerCase(), + result.denomination ?? this.denomination, // Accomodating ComboDie as a result can have a different denomination than the die as a whole + result.success ? 'success' : null, + result.failure ? 'failure' : null, + result.rerolled ? 'rerolled' : null, + result.exploded ? 'exploded' : null, + result.discarded ? 'discarded' : null, + !(hasSuccess || hasFailure) && isMin ? 'min' : null, + !(hasSuccess || hasFailure) && isMax ? 'max' : null + ]; + } } \ No newline at end of file diff --git a/templates/ui/chat/parts/damage-part.hbs b/templates/ui/chat/parts/damage-part.hbs index 45b09b72..9636e066 100644 --- a/templates/ui/chat/parts/damage-part.hbs +++ b/templates/ui/chat/parts/damage-part.hbs @@ -39,7 +39,7 @@ {{#unless discarded}}
{{#if hasRerolls}}{{/if}} diff --git a/templates/ui/chat/parts/roll-part.hbs b/templates/ui/chat/parts/roll-part.hbs index cfee735f..2c5c150a 100644 --- a/templates/ui/chat/parts/roll-part.hbs +++ b/templates/ui/chat/parts/roll-part.hbs @@ -84,8 +84,13 @@ {{else}} {{#each roll.dice}} {{#each results}} + {{debug this}}
-
+
{{result}}