This commit is contained in:
WBHarry 2026-06-21 23:29:38 +02:00
parent 4d81509e79
commit 9618ad3d95
5 changed files with 11 additions and 10 deletions

View file

@ -202,11 +202,11 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns; const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
if (combatant.actor?.type === 'character') { if (combatant.actor?.type === 'character') {
await updateCountdowns( await updateCountdowns(
{ type: CONFIG.DH.GENERAL.countdownProgressionTypes.spotlight.id }, CONFIG.DH.GENERAL.countdownProgressionTypes.spotlight.id,
{ type: CONFIG.DH.GENERAL.countdownProgressionTypes.characterSpotlight.id } CONFIG.DH.GENERAL.countdownProgressionTypes.characterSpotlight.id
); );
} else { } else {
await updateCountdowns({ type: CONFIG.DH.GENERAL.countdownProgressionTypes.spotlight.id }); await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.spotlight.id);
} }
const autoPoints = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).actionPoints; const autoPoints = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).actionPoints;

View file

@ -342,9 +342,10 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
* Sends updates of the countdowns to the GM player. Since this is asynchronous, be sure to * Sends updates of the countdowns to the GM player. Since this is asynchronous, be sure to
* update all the countdowns at the same time. * update all the countdowns at the same time.
* *
* @param {...{ type: <key>, reverseDirection: boolean }} progressTypes Countdowns to be updated * @param {...{ type: <key>, undo: boolean }} progressTypes Countdowns to be updated
*/ */
static async updateCountdowns(...progressTypes) { static async updateCountdowns(...progressTypes) {
progressTypes = progressTypes.map(p => typeof p === 'string' ? { type: p } : p);
const { countdownAutomation } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation); const { countdownAutomation } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
if (!countdownAutomation) return; if (!countdownAutomation) return;
@ -353,7 +354,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
const countdown = countdownSetting.countdowns[key]; const countdown = countdownSetting.countdowns[key];
const progressData = progressTypes.find(x => x.type === countdown.progress.type); const progressData = progressTypes.find(x => x.type === countdown.progress.type);
if (progressData && countdown.progress.current > 0) { if (progressData && countdown.progress.current > 0) {
acc[key] = { value: progressData.reverseDirection ? 1 : -1 }; acc[key] = { value: progressData.undo ? 1 : -1 };
} }
return acc; return acc;

View file

@ -55,7 +55,7 @@ export default class DHAttackAction extends DHDamageAction {
if (result?.message?.system.action?.roll?.type === 'attack') { if (result?.message?.system.action?.roll?.type === 'attack') {
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns; const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
await updateCountdowns({ type: CONFIG.DH.GENERAL.countdownProgressionTypes.characterAttack.id }); await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.characterAttack.id);
} }
return result; return result;

View file

@ -362,11 +362,11 @@ export default class DualityRoll extends D20Roll {
if (config.roll.result.duality === -1) { if (config.roll.result.duality === -1) {
await updateCountdowns( await updateCountdowns(
{ type: CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id }, CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id,
{ type: CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id } CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id
); );
} else { } else {
await updateCountdowns({ type: CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id }); await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id);
} }
} }

View file

@ -24,7 +24,7 @@ export function updateResourcesForDualityReroll(oldDuality, newDuality, actor) {
if (fear !== 0) { if (fear !== 0) {
updates.push({ updates.push({
type: CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id, type: CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id,
reverseDirection: fear === 1 ? false : true undo: fear === 1 ? false : true
}); });
} }