This commit is contained in:
WBHarry 2026-03-30 22:25:10 +02:00
parent bf5a6d2a4d
commit fe0cb4468c
3 changed files with 25 additions and 9 deletions

View file

@ -43,6 +43,22 @@ export default class FateRoll extends D20Roll {
return this.data.fateType; 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) { static getHooks(hooks) {
return [...(hooks ?? []), 'Fate']; return [...(hooks ?? []), 'Fate'];
} }

View file

@ -84,10 +84,10 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
} }
if (this.type === 'fateRoll') { if (this.type === 'fateRoll') {
html.classList.add('fate'); html.classList.add('fate');
if (this.system.roll?.fate.fateDie == 'Hope') { if (this.system.roll?.fateDie == 'Hope') {
html.classList.add('hope'); html.classList.add('hope');
} }
if (this.system.roll?.fate.fateDie == 'Fear') { if (this.system.roll?.fateDie == 'Fear') {
html.classList.add('fear'); html.classList.add('fear');
} }
} }

View file

@ -29,20 +29,20 @@
<div class="dice-tooltip"> <div class="dice-tooltip">
<div class="wrapper"> <div class="wrapper">
<div class="roll-dice"> <div class="roll-dice">
{{#if roll.fate}} {{#if roll.fateDie}}
{{#if (eq roll.fate.fateDie "Hope")}} {{#if (eq roll.fateDie "Hope")}}
<div class="roll-die"> <div class="roll-die">
<label>{{localize "DAGGERHEART.GENERAL.hope"}}</label> <label>{{localize "DAGGERHEART.GENERAL.hope"}}</label>
<div class="dice {{roll.fate.dice}} color-hope" data-die-index="0" data-type="hope"> <div class="dice {{roll.dHope.denomination}} color-hope" data-die-index="0" data-type="hope">
{{roll.fate.value}} {{roll.dHope.total}}
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{#if (eq roll.fate.fateDie "Fear")}} {{#if (eq roll.fateDie "Fear")}}
<div class="roll-die"> <div class="roll-die">
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label> <label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
<div class="dice {{roll.fate.dice}} color-fear" data-die-index="0" data-type="fear"> <div class="dice {{roll.dFear.denomination}} color-fear" data-die-index="0" data-type="fear">
{{roll.fate.value}} {{roll.dFear.total}}
</div> </div>
</div> </div>
{{/if}} {{/if}}