From 2e43baa64026d8d469ed0045ff9966b26b423936 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Tue, 15 Jul 2025 02:48:48 +0200 Subject: [PATCH] Split HopeFear automation by GM and Players --- lang/en.json | 7 ++++--- module/data/settings/Automation.mjs | 4 ++-- module/dice/dhRoll.mjs | 3 ++- templates/settings/automation-settings.hbs | 7 ++++++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lang/en.json b/lang/en.json index 96f5a9dd..8a028086 100755 --- a/lang/en.json +++ b/lang/en.json @@ -1271,9 +1271,10 @@ "hint": "Automatically increase the GM's fear pool on a fear duality roll result." }, "FIELDS": { - "hope": { - "label": "Hope", - "hint": "Automatically increase a character's hope on a hope duality roll result." + "hopeFear": { + "label": "Hope & Fear", + "gm": { "label": "GM" }, + "players": { "label": "Players" } }, "actionPoints": { "label": "Action Points", diff --git a/module/data/settings/Automation.mjs b/module/data/settings/Automation.mjs index 11b50406..4291423b 100644 --- a/module/data/settings/Automation.mjs +++ b/module/data/settings/Automation.mjs @@ -8,12 +8,12 @@ export default class DhAutomation extends foundry.abstract.DataModel { gm: new fields.BooleanField({ required: true, initial: false, - label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hope.label' + label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hopeFear.gm.label' }), players: new fields.BooleanField({ required: true, initial: false, - label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hope.label' + label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hopeFear.players.label' }) }), actionPoints: new fields.BooleanField({ diff --git a/module/dice/dhRoll.mjs b/module/dice/dhRoll.mjs index c250444d..8badf038 100644 --- a/module/dice/dhRoll.mjs +++ b/module/dice/dhRoll.mjs @@ -138,9 +138,10 @@ export default class DHRoll extends Roll { export const registerRollDiceHooks = () => { Hooks.on(`${CONFIG.DH.id}.postRollDuality`, async (config, message) => { + const hopeFearAutomation = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).hopeFear; if ( !config.source?.actor || - !game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).hope || + (game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) || config.roll.type === 'reaction' ) return; diff --git a/templates/settings/automation-settings.hbs b/templates/settings/automation-settings.hbs index 7a637d08..87a48c06 100644 --- a/templates/settings/automation-settings.hbs +++ b/templates/settings/automation-settings.hbs @@ -1,5 +1,10 @@
- {{formGroup settingFields.schema.fields.hope value=settingFields._source.hope localize=true}} +
+ + {{formGroup settingFields.schema.fields.hopeFear.fields.gm value=settingFields._source.hopeFear.gm localize=true}} + {{formGroup settingFields.schema.fields.hopeFear.fields.players value=settingFields._source.hopeFear.players localize=true}} + +
{{formGroup settingFields.schema.fields.actionPoints value=settingFields._source.actionPoints localize=true}} {{formGroup settingFields.schema.fields.countdowns value=settingFields._source.countdowns localize=true}}