Fixed so that GroupRolls and TagTeams respect the HopeFear automation setting

This commit is contained in:
WBHarry 2026-06-19 11:44:46 +02:00
parent 0b7ae8a76c
commit 3115e96c17
4 changed files with 13 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import { ResourceUpdateMap } from '../../data/action/baseAction.mjs';
import { shouldUseHopeFearAutomation } from '../../helpers/utils.mjs';
import { emitGMUpdate, GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
import Party from '../sheets/actors/party.mjs';
@ -480,6 +481,8 @@ export default class GroupRollDialog extends HandlebarsApplicationMixin(Applicat
await cls.create(msgData);
if (!shouldUseHopeFearAutomation()) return this.cancelRoll({ confirm: false });
const resourceMap = new ResourceUpdateMap(actor);
if (totalRoll.isCritical) {
resourceMap.addResources([

View file

@ -1,5 +1,5 @@
import { MemberData } from '../../data/tagTeamData.mjs';
import { getCritDamageBonus } from '../../helpers/utils.mjs';
import { getCritDamageBonus, shouldUseHopeFearAutomation } from '../../helpers/utils.mjs';
import { emitGMUpdate, GMUpdateEvent, RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
import Party from '../sheets/actors/party.mjs';
@ -750,6 +750,8 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
await cls.create(msgData);
if (!shouldUseHopeFearAutomation()) return this.cancelRoll({ confirm: false });
/* Handle resource updates from the finished TagTeamRoll */
const tagTeamData = this.party.system.tagTeam;
const fearUpdate = { key: 'fear', value: null, total: null, enabled: true };

View file

@ -1,6 +1,6 @@
import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs';
import D20Roll from './d20Roll.mjs';
import { parseRallyDice, setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs';
import { parseRallyDice, setDiceSoNiceForDualityRoll, shouldUseHopeFearAutomation } from '../helpers/utils.mjs';
import { getDiceSoNicePresets } from '../config/generalConfig.mjs';
import { updateResourcesForDualityReroll } from './helpers.mjs';
@ -312,11 +312,9 @@ export default class DualityRoll extends D20Roll {
}
static async addDualityResourceUpdates(config) {
const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
const hopeFearAutomation = automationSettings.hopeFear;
if (
!config.source?.actor ||
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||
!shouldUseHopeFearAutomation() ||
config.actionType === 'reaction' ||
config.skips?.resources
)

View file

@ -885,3 +885,8 @@ export async function triggerChatRollFx(rolls, options = { whisper: false, blind
foundry.audio.AudioHelper.play({ src: CONFIG.sounds.dice });
}
}
export function shouldUseHopeFearAutomation() {
const { hopeFear } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
return game.user.isGM ? hopeFear.gm : hopeFear.players;
}