Added automation for ActionRolls on countdowns

This commit is contained in:
WBHarry 2025-11-20 01:54:06 +01:00
parent 0c6b022e49
commit 498e6b9aa2
16 changed files with 134 additions and 44 deletions

View file

@ -232,7 +232,8 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
hasRoll: true,
skips: {
createMessage: true,
resources: !isLeader
resources: !isLeader,
updateCountdowns: !isLeader
}
};
const result = await actor.diceRoll({
@ -291,7 +292,8 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
},
hasRoll: true,
skips: {
createMessage: true
createMessage: true,
updateCountdowns: true
}
};
const result = await actor.diceRoll({

View file

@ -612,6 +612,10 @@ export const abilityCosts = {
};
export const countdownProgressionTypes = {
actionRoll: {
id: 'actionRoll',
label: 'DAGGERHEART.CONFIG.CountdownType.actionRoll'
},
spotlight: {
id: 'spotlight',
label: 'DAGGERHEART.CONFIG.CountdownType.spotlight'

View file

@ -32,7 +32,7 @@ export default class DHRoll extends Roll {
const actorIdSplit = config.source?.actor?.split('.');
if (actorIdSplit) {
const tagTeamSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll);
config.tagTeamSelected = tagTeamSettings.members[actorIdSplit[actorIdSplit.length - 1]];
config.tagTeamSelected = Boolean(tagTeamSettings.members[actorIdSplit[actorIdSplit.length - 1]]);
}
for (const hook of config.hooks) {
@ -239,7 +239,18 @@ 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;
const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
if (
automationSettings.countdownAutomation &&
config.actionType !== CONFIG.DH.ITEM.actionTypes.reaction.id &&
!config.tagTeamSelected &&
!config.skips?.updateCountdowns
) {
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id);
}
const hopeFearAutomation = automationSettings.hopeFear;
if (
!config.source?.actor ||
(game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) ||