From fe0cb4468c4e99783eb8d58f6579cb1f36b80d68 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Mon, 30 Mar 2026 22:25:10 +0200 Subject: [PATCH] . --- module/dice/fateRoll.mjs | 16 ++++++++++++++++ module/documents/chatMessage.mjs | 4 ++-- templates/ui/chat/parts/roll-part.hbs | 14 +++++++------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/module/dice/fateRoll.mjs b/module/dice/fateRoll.mjs index 418c8465..5b52262a 100644 --- a/module/dice/fateRoll.mjs +++ b/module/dice/fateRoll.mjs @@ -43,6 +43,22 @@ export default class FateRoll extends D20Roll { return this.data.fateType; } + get withHope() { + if (!this._evaluatedl) return; + return this.dHope.total >= this.dFear.total; + } + + get withFear() { + if (!this._evaluated) return; + return this.dHope.total < this.dFear.total; + } + + get totalLabel() { + const label = this.withHope ? 'DAGGERHEART.GENERAL.hope' : 'DAGGERHEART.GENERAL.fear'; + + return game.i18n.localize(label); + } + static getHooks(hooks) { return [...(hooks ?? []), 'Fate']; } diff --git a/module/documents/chatMessage.mjs b/module/documents/chatMessage.mjs index 920b2875..884ba84f 100644 --- a/module/documents/chatMessage.mjs +++ b/module/documents/chatMessage.mjs @@ -84,10 +84,10 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage { } if (this.type === 'fateRoll') { html.classList.add('fate'); - if (this.system.roll?.fate.fateDie == 'Hope') { + if (this.system.roll?.fateDie == 'Hope') { html.classList.add('hope'); } - if (this.system.roll?.fate.fateDie == 'Fear') { + if (this.system.roll?.fateDie == 'Fear') { html.classList.add('fear'); } } diff --git a/templates/ui/chat/parts/roll-part.hbs b/templates/ui/chat/parts/roll-part.hbs index 6cab38df..850f0e92 100644 --- a/templates/ui/chat/parts/roll-part.hbs +++ b/templates/ui/chat/parts/roll-part.hbs @@ -29,20 +29,20 @@
- {{#if roll.fate}} - {{#if (eq roll.fate.fateDie "Hope")}} + {{#if roll.fateDie}} + {{#if (eq roll.fateDie "Hope")}}
-
- {{roll.fate.value}} +
+ {{roll.dHope.total}}
{{/if}} - {{#if (eq roll.fate.fateDie "Fear")}} + {{#if (eq roll.fateDie "Fear")}}
-
- {{roll.fate.value}} +
+ {{roll.dFear.total}}
{{/if}}