daggerheart/templates/ui/chat/parts/roll-part.hbs
WBHarry f156b12d79
[V14] Message Rolls Rework (#1757)
* Basic rework to the roll data in messages

* .

* Fixed advantage/disadvantage

* .

* .

* Fixed TagTeamDialog

* Reuse getter in faces setter

* Simplify fate roll type css class

* Add more caution to the dualityRoll fromData function

* Apply suggestion from @CarlosFdez

* Compute modifiers using deterministic terms (#1758)

---------

Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com>
2026-03-31 17:20:22 +02:00

110 lines
6.8 KiB
Handlebars

<div class="roll-part roll-section">
<div class="roll-part-content">
<div class="roll-result-container">
<span class="roll-result-value">{{roll.total}}</span>
<span class="roll-result-desc">
{{#if roll.isCritical}}
<span>{{localize "DAGGERHEART.GENERAL.criticalShort"}}</span>
{{else}}
{{#if (and roll.result (not (eq roll.type "reaction")))}}
<span>{{localize "DAGGERHEART.GENERAL.withThing" thing=roll.totalLabel}}</span>
{{/if}}
{{/if}}
</span>
</div>
{{#if roll.difficulty}}
<span class="roll-difficulty{{#unless roll.success}} is-miss{{/unless}}">
{{!-- {{#if canViewSecret}} --}}
difficulty {{roll.difficulty}}
{{!-- {{else}}
{{localize (ifThen roll.success "DAGGERHEART.GENERAL.success" "DAGGERHEART.GENERAL.failure")}}
{{/if}} --}}
</span>
{{/if}}
</div>
{{#unless isPrivate}}
<div class="dice-roll" data-action="expandRoll">
<div class="roll-part-header"><div><span>{{localize "DAGGERHEART.GENERAL.formula"}}</span></div></div>
<div class="roll-part-content dice-result">
<div class="dice-tooltip">
<div class="wrapper">
<div class="roll-dice">
{{#if roll.fateDie}}
{{#if (eq roll.fateDie "Hope")}}
<div class="roll-die">
<label>{{localize "DAGGERHEART.GENERAL.hope"}}</label>
<div class="dice {{roll.dHope.denomination}} color-hope" data-die-index="0" data-type="hope">
{{roll.dHope.total}}
</div>
</div>
{{/if}}
{{#if (eq roll.fateDie "Fear")}}
<div class="roll-die">
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
<div class="dice {{roll.dFear.denomination}} color-fear" data-die-index="0" data-type="fear">
{{roll.dFear.total}}
</div>
</div>
{{/if}}
{{else}}
{{#if roll.dHope}}
<div class="roll-die">
<label>{{localize "DAGGERHEART.GENERAL.hope"}}</label>
<div class="dice {{roll.dHope.denomination}} color-hope reroll-button" data-die-index="0" data-type="hope" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}">
{{#if roll.dHopehope.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.dHope.rerolled.rerolls.length}}"></i>{{/if}}
{{roll.dHope.total}}
</div>
</div>
<div class="roll-die has-plus">
<label>{{localize "DAGGERHEART.GENERAL.fear"}}</label>
<div class="dice {{roll.dFear.denomination}} color-fear reroll-button" data-die-index="1" data-type="fear" style="--svg-folder: 'fear';" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerollThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}">
{{#if roll.dFear.rerolled.any}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.UI.Tooltip.diceIsRerolled" times=roll.dFear.rerolled.rerolls.length}}"></i>{{/if}}
{{roll.dFear.total}}
</div>
</div>
{{#if roll.dAdvantage}}
<div class="roll-die has-plus">
<label>{{localize "DAGGERHEART.GENERAL.Advantage.short"}}</label>
<div class="dice {{roll.dAdvantage.denomination}} color-adv">{{roll.dAdvantage.total}}</div>
</div>
{{else if roll.dDisadvantage}}
<div class="roll-die has-minus">
<label>{{localize "DAGGERHEART.GENERAL.Disadvantage.short"}}</label>
<div class="dice {{roll.dDisadvantage.denomination}} color-dis">{{roll.dDisadvantage.total}}</div>
</div>
{{/if}}
{{#if roll.rally.dice}}
<div class="roll-die has-plus">
<label>{{localize "DAGGERHEART.CLASS.Feature.short"}}</label>
<div class="dice {{roll.rally.dice}}">{{roll.rally.value}}</div>
</div>
{{/if}}
{{#each roll.extraDice}}
<div class="roll-die has-plus">
<label></label>
<div class="dice {{this.denomination}}">{{this.total}}</div>
</div>
{{/each}}
{{else}}
{{#each roll.dice}}
{{#each results}}
<div class="roll-die {{#unless (or @../first discarded)}} has-plus{{/unless}}">
<div class="dice {{../dice}}{{#if discarded}} discarded{{else}}{{#if (and @../first ../../roll.advantage.type)}}{{#if (eq ../../roll.advantage.type 1)}} color-adv{{else}} color-dis{{/if}}{{/if}}{{#if success}} color-adv{{/if}}{{/if}}">
{{result}}
</div>
</div>
{{/each}}
{{/each}}
{{/if}}
{{/if}}
</div>
</div>
{{#if roll.fate}}
{{else}}
<div class="roll-formula">{{roll.formula}}</div>
{{/if}}
</div>
</div>
</div>
{{/unless}}
</div>