Fix the sliders to do the correct maximums

This commit is contained in:
Chris Ryan 2026-01-17 12:11:21 +10:00
parent a071626e43
commit 2c93defd9c
3 changed files with 4 additions and 3 deletions

View file

@ -41,6 +41,8 @@ export default class RiskItAllDialog extends HandlebarsApplicationMixin(Applicat
async _prepareContext(_options) { async _prepareContext(_options) {
const context = await super._prepareContext(_options); const context = await super._prepareContext(_options);
context.resourceValue = this.resourceValue; context.resourceValue = this.resourceValue;
context.maxHitPointsValue = Math.min(this.resourceValue, this.actor.system.resources.hitPoints.max);
context.maxStressValue = Math.min(this.resourceValue, this.actor.system.resources.stress.max);
context.remainingResource = this.resourceValue - this.choices.hitPoints - this.choices.stress; context.remainingResource = this.resourceValue - this.choices.hitPoints - this.choices.stress;
context.unfinished = context.remainingResource !== 0; context.unfinished = context.remainingResource !== 0;

View file

@ -45,7 +45,6 @@ function getFateMessage(roll, flavor) {
export const renderFateButton = async event => { export const renderFateButton = async event => {
const button = event.currentTarget, const button = event.currentTarget,
target = getCommandTarget({ allowNull: true }); target = getCommandTarget({ allowNull: true });
console.log('button', button);
const fateTypeData = getFateTypeData(button.dataset?.fatetype); const fateTypeData = getFateTypeData(button.dataset?.fatetype);

View file

@ -10,11 +10,11 @@
<div class="resource-section"> <div class="resource-section">
<div class="resource-container"> <div class="resource-container">
<label>{{localize "DAGGERHEART.APPLICATIONS.RiskItAllDialog.clearResource" resource=(localize "DAGGERHEART.GENERAL.HitPoints.short")}}: {{this.choices.hitPoints}}</label> <label>{{localize "DAGGERHEART.APPLICATIONS.RiskItAllDialog.clearResource" resource=(localize "DAGGERHEART.GENERAL.HitPoints.short")}}: {{this.choices.hitPoints}}</label>
<input type="range" step="1" min="0" max="{{this.resourceValue}}" value="{{this.choices.hitPoints}}" name="choices.hitPoints" data-choice="hitPoints" /> <input type="range" step="1" min="0" max="{{this.maxHitPointsValue}}" value="{{this.choices.hitPoints}}" name="choices.hitPoints" data-choice="hitPoints" />
</div> </div>
<div class="resource-container"> <div class="resource-container">
<label>{{localize "DAGGERHEART.APPLICATIONS.RiskItAllDialog.clearResource" resource=(localize "DAGGERHEART.GENERAL.stress")}}: {{this.choices.stress}}</label> <label>{{localize "DAGGERHEART.APPLICATIONS.RiskItAllDialog.clearResource" resource=(localize "DAGGERHEART.GENERAL.stress")}}: {{this.choices.stress}}</label>
<input type="range" step="1" min="0" max="{{this.resourceValue}}" value="{{this.choices.stress}}" name="choices.stress" data-choice="stress" /> <input type="range" step="1" min="0" max="{{this.maxStressValue}}" value="{{this.choices.stress}}" name="choices.stress" data-choice="stress" />
</div> </div>
</div> </div>