Start on risk it dialog

This commit is contained in:
Chris Ryan 2026-01-16 20:29:33 +10:00
parent 3447afc213
commit cfc3bbdabb
3 changed files with 37 additions and 3 deletions

View file

@ -615,7 +615,8 @@
"rerollDice": "Reroll Dice" "rerollDice": "Reroll Dice"
}, },
"RiskItAllDialog": { "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" "submit": "Submit"
}, },
"TagTeamSelect": { "TagTeamSelect": {

View file

@ -31,12 +31,36 @@ 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.RiskItAllDialog = this.RiskItAllDialog; 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; 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() { static async submit() {
this.close(); 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
}
}
}
});
} }
} }

View file

@ -2,8 +2,17 @@
<header class="dialog-header"> <header class="dialog-header">
<h1>{{title}}</h1> <h1>{{title}}</h1>
</header> </header>
<div>
<span>Remaining points to use here.</span>
</div>
<div class="risk-it-all-container"> <div class="risk-it-all-container">
<span>TODO magic here</span>
<div class="two-columns even">
<span>{{currentHitPointsLabel}}</span>
<span>New HP field editor, initial value is current hit points</span>
<span>{{currentStressLabel}}</span>
<span>New Stress field editor, initial value is current hit points</span>
</div>
</div> </div>
<footer class="flexrow"> <footer class="flexrow">
<button data-action="close"> <button data-action="close">