Changed so all default rolls become BaseRolls to access convenience functions and getters

This commit is contained in:
WBHarry 2026-07-17 16:28:37 +02:00
parent c68b3045f2
commit d7f0747e5c
4 changed files with 8 additions and 3 deletions

View file

@ -24,7 +24,7 @@ import TokenManager from './module/documents/tokenManager.mjs';
CONFIG.DH = SYSTEM;
CONFIG.TextEditor.enrichers.push(...enricherConfig);
CONFIG.Dice.rolls = [BaseRoll, DHRoll, DualityRoll, D20Roll, DamageRoll, FateRoll];
CONFIG.Dice.rolls = [Roll = BaseRoll, DHRoll, DualityRoll, D20Roll, DamageRoll, FateRoll];
CONFIG.Dice.daggerheart = {
DHRoll: DHRoll,
DualityRoll: DualityRoll,

View file

@ -4,4 +4,8 @@ export default class BaseRoll extends Roll {
/** @inheritdoc */
static TOOLTIP_TEMPLATE = 'systems/daggerheart/templates/ui/chat/foundryRollTooltip.hbs';
get modifierTotal() {
return this.total - this.dice.reduce((acc, dice) => acc + dice.total, 0);
}
}

View file

@ -2,7 +2,7 @@
<div class="roll-data {{#if isCritical}}critical{{/if}}">
<div class="duality-label">
<span>{{localize (concat "DAGGERHEART.CONFIG.HealingType." key ".name")}}:</span>
<span>{{damage.roll.total}}</span>
<span>{{roll.total}}</span>
</div>
<div class="roll-dice-container">

View file

@ -39,7 +39,7 @@
{{#if active}}
<div class="roll-die{{#unless @../first}} has-plus{{/unless}}">
<div
class="dice reroll-button {{../dice}}"
class="dice reroll-button {{../denomination}}"
data-die-index="0" data-type="damage" data-damage-type="{{@../../key}}" data-dice="{{@../key}}" data-result="{{@key}}"
>
{{#if hasRerolls}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerolled"}}"></i>{{/if}}
@ -49,6 +49,7 @@
{{/if}}
{{/each}}
{{/each}}
{{#if roll.modifierTotal}}
<div class="roll-die{{#if (gt roll.modifierTotal 0)}} has-plus{{/if}}">
<div class="font-20">{{roll.modifierTotal}}</div>