From cfc3bbdabb85ed8bbd8b0e0f541cbc377fa407f3 Mon Sep 17 00:00:00 2001 From: Chris Ryan Date: Fri, 16 Jan 2026 20:29:33 +1000 Subject: [PATCH] Start on risk it dialog --- lang/en.json | 3 ++- .../applications/dialogs/riskItAllDialog.mjs | 26 ++++++++++++++++++- templates/dialogs/riskItAllDialog.hbs | 11 +++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/lang/en.json b/lang/en.json index 6b055be0..bdd91cd5 100755 --- a/lang/en.json +++ b/lang/en.json @@ -615,7 +615,8 @@ "rerollDice": "Reroll Dice" }, "RiskItAllDialog": { - "title": "Risk It All - Clear Stress and Hope", + "title": "{name} - Risk It All - Clear Stress and/or Hit Points", + "subtitle": "Clear {hope} Stress and/or Hit Points", "submit": "Submit" }, "TagTeamSelect": { diff --git a/module/applications/dialogs/riskItAllDialog.mjs b/module/applications/dialogs/riskItAllDialog.mjs index 5a114d3a..bbde1279 100644 --- a/module/applications/dialogs/riskItAllDialog.mjs +++ b/module/applications/dialogs/riskItAllDialog.mjs @@ -31,12 +31,36 @@ export default class RiskItAllDialog extends HandlebarsApplicationMixin(Applicat async _prepareContext(_options) { const context = await super._prepareContext(_options); context.RiskItAllDialog = this.RiskItAllDialog; - context.title = game.i18n.localize('DAGGERHEART.APPLICATIONS.RiskItAllDialog.submit'); + context.title = game.i18n.format('DAGGERHEART.APPLICATIONS.RiskItAllDialog.subtitle', { hope: this.config.hope }); + context.currentHitPointsLabel = "Current Marked Hit Points: " + this.actor.system.resources.hitPoints.value; + context.currentStressLabel = "Current Marked Stress: " + this.actor.system.resources.stress.value; return context; } + static checkForValidChoice() { + /* + TODO: + + return (this.config.hope == (this.actor.system.resources.hitPoints.value - newHitPointValue) + (this.actor.system.resources.stress.value - newStressValue)); + */ + return true; + } + static async submit() { this.close(); + // TODO: Update actor with changes. + await this.actor.update({ + system: { + resources: { + hitPoints: { + value: 0 // TODO put editted value here + }, + stress: { + value: 0 // TODO put editted value here + } + } + } + }); } } diff --git a/templates/dialogs/riskItAllDialog.hbs b/templates/dialogs/riskItAllDialog.hbs index 0bf78e6b..09bf2f0d 100644 --- a/templates/dialogs/riskItAllDialog.hbs +++ b/templates/dialogs/riskItAllDialog.hbs @@ -2,8 +2,17 @@

{{title}}

+
+ Remaining points to use here. +
- TODO magic here + +
+ {{currentHitPointsLabel}} + New HP field editor, initial value is current hit points + {{currentStressLabel}} + New Stress field editor, initial value is current hit points +