Split HopeFear automation by GM and Players

This commit is contained in:
WBHarry 2025-07-15 02:48:48 +02:00
parent eac38ae205
commit 2e43baa640
4 changed files with 14 additions and 7 deletions

View file

@ -1271,9 +1271,10 @@
"hint": "Automatically increase the GM's fear pool on a fear duality roll result." "hint": "Automatically increase the GM's fear pool on a fear duality roll result."
}, },
"FIELDS": { "FIELDS": {
"hope": { "hopeFear": {
"label": "Hope", "label": "Hope & Fear",
"hint": "Automatically increase a character's hope on a hope duality roll result." "gm": { "label": "GM" },
"players": { "label": "Players" }
}, },
"actionPoints": { "actionPoints": {
"label": "Action Points", "label": "Action Points",

View file

@ -8,12 +8,12 @@ export default class DhAutomation extends foundry.abstract.DataModel {
gm: new fields.BooleanField({ gm: new fields.BooleanField({
required: true, required: true,
initial: false, initial: false,
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hope.label' label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hopeFear.gm.label'
}), }),
players: new fields.BooleanField({ players: new fields.BooleanField({
required: true, required: true,
initial: false, initial: false,
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hope.label' label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hopeFear.players.label'
}) })
}), }),
actionPoints: new fields.BooleanField({ actionPoints: new fields.BooleanField({

View file

@ -138,9 +138,10 @@ export default class DHRoll extends Roll {
export const registerRollDiceHooks = () => { export const registerRollDiceHooks = () => {
Hooks.on(`${CONFIG.DH.id}.postRollDuality`, async (config, message) => { Hooks.on(`${CONFIG.DH.id}.postRollDuality`, async (config, message) => {
const hopeFearAutomation = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).hopeFear;
if ( if (
!config.source?.actor || !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' config.roll.type === 'reaction'
) )
return; return;

View file

@ -1,5 +1,10 @@
<div> <div>
{{formGroup settingFields.schema.fields.hope value=settingFields._source.hope localize=true}} <div class="form-group">
<label>{{localize "DAGGERHEART.SETTINGS.Automation.FIELDS.hopeFear.label"}}</label>
{{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}}
</div>
{{formGroup settingFields.schema.fields.actionPoints value=settingFields._source.actionPoints localize=true}} {{formGroup settingFields.schema.fields.actionPoints value=settingFields._source.actionPoints localize=true}}
{{formGroup settingFields.schema.fields.countdowns value=settingFields._source.countdowns localize=true}} {{formGroup settingFields.schema.fields.countdowns value=settingFields._source.countdowns localize=true}}