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 @@