From 498e6b9aa276b768c6b22146f56c395cd37a26e3 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Thu, 20 Nov 2025 01:54:06 +0100 Subject: [PATCH] Added automation for ActionRolls on countdowns --- lang/en.json | 1 + module/applications/ui/chatLog.mjs | 6 ++- module/config/generalConfig.mjs | 4 ++ module/dice/dhRoll.mjs | 15 ++++++- ...ary_Adult_Flickerfly_G7jiltRjgvVhZewm.json | 6 +-- ...ary_Arch_Necromancer_WPEOIGfclNJxWb87.json | 6 +-- ...sary_Fallen_Sorcerer_PELRry1vqjBzSAlr.json | 6 +-- ...rlord__Realm_Breaker_hxZ0sgoFJubh5aj6.json | 6 +-- ..._Undefeated_Champion_RXkZTwBRi4dJ3JE5.json | 10 ++--- ..._Juvenile_Flickerfly_MYXmTx2FHcIjdfYZ.json | 6 +-- ...ersary_Mortal_Hunter_mVV7a7KQAORoPMgZ.json | 6 +-- ...dversary_Stonewraith_3aAS2Qm3R6cgaYfE.json | 44 +++++++++++++++++-- ...inCard_Mass_Disguise_dT95m0Jam8sWbeuC.json | 44 +++++++++++++++++-- ...g_Heart_of_the_Woods_oY69NN4rYxoRE4hl.json | 6 +-- ...ironment_Chaos_Realm_2Z1mKc65LxNk2PqR.json | 6 +-- ...onment_Mountain_Pass_acMu9wJrMZZzLSTJ.json | 6 +-- 16 files changed, 134 insertions(+), 44 deletions(-) diff --git a/lang/en.json b/lang/en.json index 520fa20b..684f9fa2 100755 --- a/lang/en.json +++ b/lang/en.json @@ -931,6 +931,7 @@ } }, "CountdownType": { + "actionRoll": "Action Roll", "characterSpotlight": "Character Spotlight", "spotlight": "Spotlight", "custom": "Custom", diff --git a/module/applications/ui/chatLog.mjs b/module/applications/ui/chatLog.mjs index e2e3b6d4..871ff173 100644 --- a/module/applications/ui/chatLog.mjs +++ b/module/applications/ui/chatLog.mjs @@ -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({ diff --git a/module/config/generalConfig.mjs b/module/config/generalConfig.mjs index 58081db9..33de1956 100644 --- a/module/config/generalConfig.mjs +++ b/module/config/generalConfig.mjs @@ -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' diff --git a/module/dice/dhRoll.mjs b/module/dice/dhRoll.mjs index 46446df3..d01077c2 100644 --- a/module/dice/dhRoll.mjs +++ b/module/dice/dhRoll.mjs @@ -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) || diff --git a/src/packs/adversaries/adversary_Adult_Flickerfly_G7jiltRjgvVhZewm.json b/src/packs/adversaries/adversary_Adult_Flickerfly_G7jiltRjgvVhZewm.json index 0c969a5b..8abd4129 100644 --- a/src/packs/adversaries/adversary_Adult_Flickerfly_G7jiltRjgvVhZewm.json +++ b/src/packs/adversaries/adversary_Adult_Flickerfly_G7jiltRjgvVhZewm.json @@ -737,7 +737,7 @@ "img": "icons/magic/air/fog-gas-smoke-purple.webp", "progress": { "looping": "looping", - "type": "custom", + "type": "actionRoll", "max": "1d6", "current": 1 }, @@ -768,9 +768,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754122030308, - "modifiedTime": 1763488778150, + "modifiedTime": 1763599149242, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!G7jiltRjgvVhZewm.49cIxZRFiAM6jDva" diff --git a/src/packs/adversaries/adversary_Arch_Necromancer_WPEOIGfclNJxWb87.json b/src/packs/adversaries/adversary_Arch_Necromancer_WPEOIGfclNJxWb87.json index aff64172..031786a9 100644 --- a/src/packs/adversaries/adversary_Arch_Necromancer_WPEOIGfclNJxWb87.json +++ b/src/packs/adversaries/adversary_Arch_Necromancer_WPEOIGfclNJxWb87.json @@ -793,7 +793,7 @@ "img": "icons/magic/unholy/hand-claw-fire-green.webp", "progress": { "looping": "looping", - "type": "custom", + "type": "actionRoll", "max": "2d6", "current": 1 }, @@ -824,9 +824,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754132668836, - "modifiedTime": 1763489422778, + "modifiedTime": 1763599179169, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!WPEOIGfclNJxWb87.FKcuCo0v2U7fVkqq" diff --git a/src/packs/adversaries/adversary_Fallen_Sorcerer_PELRry1vqjBzSAlr.json b/src/packs/adversaries/adversary_Fallen_Sorcerer_PELRry1vqjBzSAlr.json index 8999db3f..ad396a8f 100644 --- a/src/packs/adversaries/adversary_Fallen_Sorcerer_PELRry1vqjBzSAlr.json +++ b/src/packs/adversaries/adversary_Fallen_Sorcerer_PELRry1vqjBzSAlr.json @@ -578,7 +578,7 @@ "img": "icons/magic/unholy/strike-hand-glow-pink.webp", "progress": { "looping": "looping", - "type": "custom", + "type": "actionRoll", "max": "2d6", "current": 1 }, @@ -656,9 +656,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754133847132, - "modifiedTime": 1763489509026, + "modifiedTime": 1763599235251, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!PELRry1vqjBzSAlr.gwSgBhkcekCGvXxz" diff --git a/src/packs/adversaries/adversary_Fallen_Warlord__Realm_Breaker_hxZ0sgoFJubh5aj6.json b/src/packs/adversaries/adversary_Fallen_Warlord__Realm_Breaker_hxZ0sgoFJubh5aj6.json index 9c8dfb4a..423c40d2 100644 --- a/src/packs/adversaries/adversary_Fallen_Warlord__Realm_Breaker_hxZ0sgoFJubh5aj6.json +++ b/src/packs/adversaries/adversary_Fallen_Warlord__Realm_Breaker_hxZ0sgoFJubh5aj6.json @@ -622,7 +622,7 @@ "img": "icons/magic/control/fear-fright-monster-grin-red-orange.webp", "progress": { "looping": "decreasing", - "type": "custom", + "type": "actionRoll", "max": "8", "current": 1 }, @@ -653,9 +653,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754134694918, - "modifiedTime": 1763489601633, + "modifiedTime": 1763599267846, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!hxZ0sgoFJubh5aj6.48tIwFQr64IQ5LaY" diff --git a/src/packs/adversaries/adversary_Fallen_Warlord__Undefeated_Champion_RXkZTwBRi4dJ3JE5.json b/src/packs/adversaries/adversary_Fallen_Warlord__Undefeated_Champion_RXkZTwBRi4dJ3JE5.json index 31b8826d..1666ee1c 100644 --- a/src/packs/adversaries/adversary_Fallen_Warlord__Undefeated_Champion_RXkZTwBRi4dJ3JE5.json +++ b/src/packs/adversaries/adversary_Fallen_Warlord__Undefeated_Champion_RXkZTwBRi4dJ3JE5.json @@ -578,7 +578,7 @@ "name": "Circle of Defilement", "type": "feature", "system": { - "description": "

Countdown (1d8). When the Undefeated Champion is in the spotlight for the fi rst time, activate the countdown. When it triggers, activate a magical circle covering an area within Far range of the Champion. A target within that area is Vulnerable until they leave the circle. The circle can be removed by dealing Severe damage to the Undefeated Champion.

", + "description": "

Countdown (1d8). When the Undefeated Champion is in the spotlight for the first time, activate the countdown. When it triggers, activate a magical circle covering an area within Far range of the Champion. A target within that area is Vulnerable until they leave the circle. The circle can be removed by dealing Severe damage to the Undefeated Champion.

", "resource": null, "actions": { "mHeYZ8e8MbkGz22d": { @@ -612,7 +612,7 @@ "type": "countdown", "_id": "4x13WyksHU0u0j20", "systemPath": "actions", - "description": "

Countdown (1d8). When the Undefeated Champion is in the spotlight for the fi rst time, activate the countdown.

", + "description": "

Countdown (1d8). When the Undefeated Champion is in the spotlight for the first time, activate the countdown.

", "chatDisplay": true, "originItem": { "type": "itemCollection" @@ -633,7 +633,7 @@ "img": "icons/magic/unholy/barrier-fire-pink.webp", "progress": { "looping": "noLooping", - "type": "custom", + "type": "actionRoll", "max": "1d8", "current": 1 }, @@ -711,9 +711,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754135646248, - "modifiedTime": 1763489679922, + "modifiedTime": 1763599314892, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!RXkZTwBRi4dJ3JE5.55P7ZijSbQeVHCw4" diff --git a/src/packs/adversaries/adversary_Juvenile_Flickerfly_MYXmTx2FHcIjdfYZ.json b/src/packs/adversaries/adversary_Juvenile_Flickerfly_MYXmTx2FHcIjdfYZ.json index e70fd357..3084864e 100644 --- a/src/packs/adversaries/adversary_Juvenile_Flickerfly_MYXmTx2FHcIjdfYZ.json +++ b/src/packs/adversaries/adversary_Juvenile_Flickerfly_MYXmTx2FHcIjdfYZ.json @@ -639,7 +639,7 @@ "img": "icons/magic/air/fog-gas-smoke-purple.webp", "progress": { "looping": "looping", - "type": "custom", + "type": "actionRoll", "max": "1d6", "current": 1 }, @@ -670,9 +670,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754080402680, - "modifiedTime": 1763488392319, + "modifiedTime": 1763599059605, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!MYXmTx2FHcIjdfYZ.EjfM83eVCdcVGC3c" diff --git a/src/packs/adversaries/adversary_Mortal_Hunter_mVV7a7KQAORoPMgZ.json b/src/packs/adversaries/adversary_Mortal_Hunter_mVV7a7KQAORoPMgZ.json index bfa6bc38..1bbe078b 100644 --- a/src/packs/adversaries/adversary_Mortal_Hunter_mVV7a7KQAORoPMgZ.json +++ b/src/packs/adversaries/adversary_Mortal_Hunter_mVV7a7KQAORoPMgZ.json @@ -624,7 +624,7 @@ "img": "icons/magic/movement/trail-streak-zigzag-yellow.webp", "progress": { "looping": "looping", - "type": "custom", + "type": "actionRoll", "max": "1d6", "current": 1 }, @@ -655,9 +655,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754082669471, - "modifiedTime": 1763488527913, + "modifiedTime": 1763599508803, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!mVV7a7KQAORoPMgZ.IOCG3J20wUHvyvvh" diff --git a/src/packs/adversaries/adversary_Stonewraith_3aAS2Qm3R6cgaYfE.json b/src/packs/adversaries/adversary_Stonewraith_3aAS2Qm3R6cgaYfE.json index 45e01348..19865d9f 100644 --- a/src/packs/adversaries/adversary_Stonewraith_3aAS2Qm3R6cgaYfE.json +++ b/src/packs/adversaries/adversary_Stonewraith_3aAS2Qm3R6cgaYfE.json @@ -516,6 +516,42 @@ "name": "Roll Save", "img": "icons/magic/sonic/projectile-sound-rings-wave.webp", "range": "close" + }, + "UurIzyyMRAJc2DUX": { + "type": "countdown", + "_id": "UurIzyyMRAJc2DUX", + "systemPath": "actions", + "description": "

The rubble can be cleared with a Progress Countdown (8).

", + "chatDisplay": false, + "originItem": { + "type": "itemCollection" + }, + "actionType": "action", + "cost": [], + "uses": { + "value": null, + "max": "", + "recovery": null, + "consumeOnSuccess": false + }, + "countdown": [ + { + "name": "Avalanche Roar", + "type": "encounter", + "defaultOwnership": -1, + "img": "icons/magic/sonic/projectile-sound-rings-wave.webp", + "progress": { + "looping": "noLooping", + "type": "custom", + "max": "8", + "current": 1 + }, + "ownership": {} + } + ], + "name": "Start Countdown", + "img": "icons/magic/sonic/projectile-sound-rings-wave.webp", + "range": "" } }, "originItemType": null, @@ -535,12 +571,12 @@ "compendiumSource": null, "duplicateSource": null, "exportSource": null, - "coreVersion": "13.350", + "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "0.0.1", + "systemVersion": "1.2.4", "createdTime": 1754085059319, - "modifiedTime": 1761503879335, - "lastModifiedBy": "fBcTgyTzoARBvohY" + "modifiedTime": 1763599582935, + "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!3aAS2Qm3R6cgaYfE.9Z0i0uURfBMVIapJ" }, diff --git a/src/packs/domains/domainCard_Mass_Disguise_dT95m0Jam8sWbeuC.json b/src/packs/domains/domainCard_Mass_Disguise_dT95m0Jam8sWbeuC.json index b715c94a..704feaa5 100644 --- a/src/packs/domains/domainCard_Mass_Disguise_dT95m0Jam8sWbeuC.json +++ b/src/packs/domains/domainCard_Mass_Disguise_dT95m0Jam8sWbeuC.json @@ -36,6 +36,42 @@ "name": "Cast", "img": "icons/skills/social/diplomacy-unity-alliance.webp", "range": "close" + }, + "ZM96wFu3YuAeUXel": { + "type": "countdown", + "_id": "ZM96wFu3YuAeUXel", + "systemPath": "actions", + "description": "

Activate a Countdown (8). It ticks down as a consequence the GM chooses. When it triggers, the disguise drops.

", + "chatDisplay": false, + "originItem": { + "type": "itemCollection" + }, + "actionType": "action", + "cost": [], + "uses": { + "value": null, + "max": "", + "recovery": null, + "consumeOnSuccess": false + }, + "countdown": [ + { + "name": "Mass Disguise", + "type": "encounter", + "defaultOwnership": -1, + "img": "icons/magic/time/hourglass-brown-orange.webp", + "progress": { + "looping": "noLooping", + "type": "custom", + "max": "8", + "current": 1 + }, + "ownership": {} + } + ], + "name": "Start Countdown", + "img": "icons/magic/time/hourglass-brown-orange.webp", + "range": "" } }, "attribution": { @@ -49,12 +85,12 @@ "compendiumSource": null, "duplicateSource": null, "exportSource": null, - "coreVersion": "13.347", + "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.0.5", + "systemVersion": "1.2.4", "createdTime": 1753922784480, - "modifiedTime": 1755429370519, - "lastModifiedBy": "VZIeX2YDvX338Zvr" + "modifiedTime": 1763599737574, + "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_id": "dT95m0Jam8sWbeuC", "sort": 3400000, diff --git a/src/packs/environments/environment_Burning_Heart_of_the_Woods_oY69NN4rYxoRE4hl.json b/src/packs/environments/environment_Burning_Heart_of_the_Woods_oY69NN4rYxoRE4hl.json index 7c819e9d..0abe95cf 100644 --- a/src/packs/environments/environment_Burning_Heart_of_the_Woods_oY69NN4rYxoRE4hl.json +++ b/src/packs/environments/environment_Burning_Heart_of_the_Woods_oY69NN4rYxoRE4hl.json @@ -544,7 +544,7 @@ "img": "icons/magic/air/fog-gas-smoke-brown.webp", "progress": { "looping": "looping", - "type": "custom", + "type": "actionRoll", "max": "6", "current": 1 }, @@ -575,9 +575,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754217910442, - "modifiedTime": 1763493849742, + "modifiedTime": 1763599784561, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!oY69NN4rYxoRE4hl.kYxuTZjH7HDUGeWh" diff --git a/src/packs/environments/environment_Chaos_Realm_2Z1mKc65LxNk2PqR.json b/src/packs/environments/environment_Chaos_Realm_2Z1mKc65LxNk2PqR.json index c1ca3559..ff130b70 100644 --- a/src/packs/environments/environment_Chaos_Realm_2Z1mKc65LxNk2PqR.json +++ b/src/packs/environments/environment_Chaos_Realm_2Z1mKc65LxNk2PqR.json @@ -340,7 +340,7 @@ "img": "icons/magic/control/sihouette-hold-beam-green.webp", "progress": { "looping": "looping", - "type": "custom", + "type": "actionRoll", "max": "4", "current": 1 }, @@ -371,9 +371,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754219142956, - "modifiedTime": 1763494178457, + "modifiedTime": 1763599839181, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!2Z1mKc65LxNk2PqR.0OYHJZqT0DlVz5be" diff --git a/src/packs/environments/environment_Mountain_Pass_acMu9wJrMZZzLSTJ.json b/src/packs/environments/environment_Mountain_Pass_acMu9wJrMZZzLSTJ.json index d3e66fbe..8f6a2bf3 100644 --- a/src/packs/environments/environment_Mountain_Pass_acMu9wJrMZZzLSTJ.json +++ b/src/packs/environments/environment_Mountain_Pass_acMu9wJrMZZzLSTJ.json @@ -403,7 +403,7 @@ "img": "icons/magic/water/snowflake-ice-blue-white.webp", "progress": { "looping": "looping", - "type": "custom", + "type": "actionRoll", "max": "4", "current": 1 }, @@ -434,9 +434,9 @@ "exportSource": null, "coreVersion": "13.351", "systemId": "daggerheart", - "systemVersion": "1.2.3", + "systemVersion": "1.2.4", "createdTime": 1754217155443, - "modifiedTime": 1763493758044, + "modifiedTime": 1763599993797, "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items!acMu9wJrMZZzLSTJ.K8ld4m5yTA6WZwUs"