From e2fe1848330d82dafb490e4251f8730ce4c9fe9e Mon Sep 17 00:00:00 2001 From: Chris Ryan Date: Fri, 9 Jan 2026 07:41:36 +1000 Subject: [PATCH] Auto remove all marked stress and HP for Risk It All, if Hope value rolled covers it. --- module/applications/dialogs/deathMove.mjs | 36 ++++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/module/applications/dialogs/deathMove.mjs b/module/applications/dialogs/deathMove.mjs index b20f0151..01f70413 100644 --- a/module/applications/dialogs/deathMove.mjs +++ b/module/applications/dialogs/deathMove.mjs @@ -64,6 +64,23 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV } } + async clearAllStressAndHitpoints() { + await this.actor.update( + { + system: { + resources: { + hitPoints: { + value: 0 + }, + stress: { + value: 0 + } + } + } + } + ); + } + async handleRiskItAll() { const config = await enrichedDualityRoll({ reaction: true, @@ -78,20 +95,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV if (config.roll.isCritical) { console.log("Clear all stress and HP"); - await this.actor.update( - { - system: { - resources: { - hitPoints: { - value: 0 - }, - stress: { - value: 0 - } - } - } - } - ); + this.clearAllStressAndHitpoints(); return; } @@ -99,6 +103,10 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV if (config.roll.result.duality == 1) { console.log("Need to clear up Stress and HP up to hope value"); console.log("Hope rolled", config.roll.hope.value); + if (config.roll.hope.value >= (this.actor.system.resources.hitPoints.value + this.actor.system.resources.stress.value)) { + console.log("Hope roll value is more than the HP + Stress, auto- remove"); + this.clearAllStressAndHitpoints(); + } return; }