-
-
- Remaining points to use here.
-
-
-
{{currentHitPointsLabel}}
-
- New Hit Points Value
-
-
+
{{localize "DAGGERHEART.APPLICATIONS.RiskItAllDialog.subtitle"}}
-
{{currentStressLabel}}
-
-
New Stress Value
-
+
+
{{localize "DAGGERHEART.APPLICATIONS.RiskItAllDialog.remainingTitle"}}
+
{{this.remainingResource}}
+
+
+
+
+
+
{{localize "DAGGERHEART.APPLICATIONS.RiskItAllDialog.finalTitle"}}
+
+
+ {{localize "DAGGERHEART.GENERAL.HitPoints.plural"}}
+ {{this.final.hitPoints.value}}/{{this.final.hitPoints.max}}
+
+
+ {{localize "DAGGERHEART.GENERAL.stress"}}
+ {{this.final.stress.value}}/{{this.final.stress.max}}
+
+
+
+
+
+ {{localize "Submit"}}
+
-
-
- {{localize "Cancel"}}
-
-
-
- {{localize "DAGGERHEART.APPLICATIONS.RiskItAllDialog.submit"}}
-
-
-
\ No newline at end of file
diff --git a/templates/ui/chat/deathMove.hbs b/templates/ui/chat/deathMove.hbs
index b36ee590..02691c7c 100644
--- a/templates/ui/chat/deathMove.hbs
+++ b/templates/ui/chat/deathMove.hbs
@@ -19,7 +19,7 @@
{{#if this.showRiskItAllButton}}
-
+
{{this.riskItAllButtonLabel}}
From 16d839a8817d0106d60e0d20f1bf5dd73ac24eca Mon Sep 17 00:00:00 2001
From: WBHarry
Date: Fri, 16 Jan 2026 16:04:54 +0100
Subject: [PATCH 3/3] .
---
daggerheart.mjs | 19 +++---
lang/en.json | 2 +-
module/applications/dialogs/d20RollDialog.mjs | 2 +-
module/applications/dialogs/deathMove.mjs | 2 +-
module/enrichers/FateRollEnricher.mjs | 66 +++++++------------
.../action-settings/trigger.hbs | 2 +-
6 files changed, 34 insertions(+), 59 deletions(-)
diff --git a/daggerheart.mjs b/daggerheart.mjs
index ae1502b0..ae93253c 100644
--- a/daggerheart.mjs
+++ b/daggerheart.mjs
@@ -10,7 +10,7 @@ import { enricherConfig, enricherRenderSetup } from './module/enrichers/_module.
import { getCommandTarget, rollCommandToJSON } from './module/helpers/utils.mjs';
import { BaseRoll, DHRoll, DualityRoll, D20Roll, DamageRoll, FateRoll } from './module/dice/_module.mjs';
import { enrichedDualityRoll } from './module/enrichers/DualityRollEnricher.mjs';
-import { enrichedFateRoll, getFateType } from './module/enrichers/FateRollEnricher.mjs';
+import { enrichedFateRoll, getFateTypeData } from './module/enrichers/FateRollEnricher.mjs';
import {
handlebarsRegistration,
runMigrations,
@@ -322,29 +322,26 @@ Hooks.on('chatMessage', (_, message) => {
if (message.startsWith('/fr')) {
const result =
message.trim().toLowerCase() === '/fr' ? { result: {} } : rollCommandToJSON(message.replace(/\/fr\s?/, ''));
+
if (!result) {
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.fateParsing'));
return false;
}
const { result: rollCommand, flavor } = result;
+ const fateTypeData = getFateTypeData(rollCommand?.type);
- const fateTypeFromRollCommand = getFateType(rollCommand?.type);
-
- if (fateTypeFromRollCommand == 'BAD') {
- ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.fateTypeParsing'));
- return false;
- }
-
- const fateType = fateTypeFromRollCommand;
+ if (!fateTypeData)
+ return ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.fateTypeParsing'));
+ const { value: fateType, label: fateTypeLabel } = fateTypeData;
const target = getCommandTarget({ allowNull: true });
- const title = fateType + ' Fate Roll';
+ const title = flavor ?? game.i18n.localize('DAGGERHEART.GENERAL.fateRoll');
enrichedFateRoll({
target,
title,
- label: 'test',
+ label: fateTypeLabel,
fateType
});
return false;
diff --git a/lang/en.json b/lang/en.json
index e74b2128..69965b9e 100755
--- a/lang/en.json
+++ b/lang/en.json
@@ -2679,7 +2679,7 @@
"riskItAllFailure": "The fear die rolled higher. You have crossed through the veil of death.",
"blazeOfGlory": "Blaze of Glory Effect Added!",
"riskItAllDialogButton": "Clear Stress And Hit Points.",
- "riskItAllSuccessWithEnoughHope": "Hope roll value is more than the marked Stress and Hit Points. Both are cleared fully.",
+ "riskItAllSuccessWithEnoughHope": "The Hope value is more than the marked Stress and Hit Points. Both are cleared fully.",
"riskItAllSuccess": "The hope die rolled higher, clear up to {hope} Stress And Hit Points."
},
"dicePool": {
diff --git a/module/applications/dialogs/d20RollDialog.mjs b/module/applications/dialogs/d20RollDialog.mjs
index 441842dc..6f320152 100644
--- a/module/applications/dialogs/d20RollDialog.mjs
+++ b/module/applications/dialogs/d20RollDialog.mjs
@@ -123,7 +123,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
context.formula = this.roll.constructFormula(this.config);
if (this.actor?.system?.traits) context.abilities = this.getTraitModifiers();
- context.showReaction = !this.config.roll?.type || context.rollType === 'DualityRoll';
+ context.showReaction = !this.config.skips?.reaction && context.rollType === 'DualityRoll';
context.reactionOverride = this.reactionOverride;
}
diff --git a/module/applications/dialogs/deathMove.mjs b/module/applications/dialogs/deathMove.mjs
index 5cc78b5f..18ebf104 100644
--- a/module/applications/dialogs/deathMove.mjs
+++ b/module/applications/dialogs/deathMove.mjs
@@ -84,7 +84,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
label: game.i18n.localize('DAGGERHEART.GENERAL.dualityDice'),
actionType: null,
advantage: null,
- customConfig: { skips: { resources: true } }
+ customConfig: { skips: { resources: true, reaction: true } }
});
if (!config.roll.result) return;
diff --git a/module/enrichers/FateRollEnricher.mjs b/module/enrichers/FateRollEnricher.mjs
index c1b73bae..c50a563b 100644
--- a/module/enrichers/FateRollEnricher.mjs
+++ b/module/enrichers/FateRollEnricher.mjs
@@ -4,56 +4,35 @@ export default function DhFateRollEnricher(match, _options) {
const roll = rollCommandToJSON(match[1], match[0]);
if (!roll) return match[0];
- const fateTypeFromRoll = getFateType(roll?.type);
-
- if (fateTypeFromRoll == 'BAD') {
- ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.fateTypeParsing'));
- return;
- }
-
return getFateMessage(roll.result, roll?.flavor);
}
-export function getFateType(fateTypeValue) {
- const fateTypeFromValue = fateTypeValue
- ? fateTypeValue.toLowerCase() == 'fear'
- ? 'Fear'
- : fateTypeValue.toLowerCase() == 'hope'
- ? 'Hope'
- : 'BAD'
- : 'Hope';
-
- return fateTypeFromValue;
+export function getFateTypeData(fateTypeValue) {
+ const value = fateTypeValue ? fateTypeValue.capitalize() : 'Hope';
+ const lowercased = fateTypeValue?.toLowerCase?.() ?? 'hope';
+ switch (lowercased) {
+ case 'hope':
+ case 'fear':
+ return { value, label: game.i18n.localize(`DAGGERHEART.GENERAL.${lowercased}`) };
+ default:
+ return null;
+ }
}
function getFateMessage(roll, flavor) {
- const fateType = getFateType(roll?.type);
+ const fateTypeData = getFateTypeData(roll?.type);
- if (fateType == 'BAD') {
- ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.fateTypeParsing'));
- return '';
- }
+ if (!fateTypeData)
+ return ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.fateTypeParsing'));
- const fateTypeLocalized =
- fateType === 'Hope'
- ? game.i18n.localize('DAGGERHEART.GENERAL.hope')
- : game.i18n.localize('DAGGERHEART.GENERAL.fear');
-
- const title =
- flavor ??
- fateTypeLocalized +
- ' ' +
- game.i18n.localize('DAGGERHEART.GENERAL.fate') +
- ' ' +
- game.i18n.localize('DAGGERHEART.GENERAL.roll');
-
- const dataLabel = game.i18n.localize('DAGGERHEART.GENERAL.fate');
+ const { value: fateType, label: fateTypeLabel } = fateTypeData;
+ const title = flavor ?? game.i18n.localize('DAGGERHEART.GENERAL.fateRoll');
const fateElement = document.createElement('span');
fateElement.innerHTML = `
${title}
@@ -68,19 +47,17 @@ export const renderFateButton = async event => {
target = getCommandTarget({ allowNull: true });
console.log('button', button);
- const fateTypeFromButton = getFateType(button.dataset?.fatetype);
+ const fateTypeData = getFateTypeData(button.dataset?.fatetype);
- if (fateTypeFromButton == 'BAD') {
- ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.fateTypeParsing'));
- return;
- }
+ if (!fateTypeData) ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.fateTypeParsing'));
+ const { value: fateType, label: fateTypeLabel } = fateTypeData;
await enrichedFateRoll(
{
target,
title: button.dataset.title,
label: button.dataset.label,
- fateType: fateTypeFromButton
+ fateType: fateType
},
event
);
@@ -93,7 +70,8 @@ export const enrichedFateRoll = async ({ target, title, label, fateType }, event
headerTitle: label,
roll: {},
hasRoll: true,
- fateType: fateType
+ fateType: fateType,
+ skips: { reaction: true }
};
config.data = { experiences: {}, traits: {}, fateType: fateType };
diff --git a/templates/sheets-settings/action-settings/trigger.hbs b/templates/sheets-settings/action-settings/trigger.hbs
index b048461e..9ef97733 100644
--- a/templates/sheets-settings/action-settings/trigger.hbs
+++ b/templates/sheets-settings/action-settings/trigger.hbs
@@ -30,7 +30,7 @@
- {{formInput @root.fields.triggers.element.fields.command value=trigger.command elementType="code-mirror" name=(concat "triggers." index ".command") aria=(object label=(localize "Test")) }}
+ {{formInput @root.fields.triggers.element.fields.command value=trigger.command elementType="code-mirror" name=(concat "triggers." index ".command") }}
{{/each}}