From 3fbcdebd3b5d36929c5c0613df1601d2757f0bbc Mon Sep 17 00:00:00 2001 From: WBHarry Date: Fri, 6 Mar 2026 16:38:00 +0100 Subject: [PATCH] Fixed so that Rally dice works as a single active effect for bard --- module/dice/damageRoll.mjs | 3 +- module/dice/dualityRoll.mjs | 4 +- module/helpers/utils.mjs | 8 ++ .../classes/class_Bard_vegl3bFOq3pcFTWT.json | 4 - .../feature_Rally_PydiMnNCKpd44SGS.json | 2 +- ...ture_Rally__Level_5__TVeEyqmPPiRa2r3i.json | 99 ------------------- 6 files changed, 13 insertions(+), 107 deletions(-) delete mode 100644 src/packs/classes/feature_Rally__Level_5__TVeEyqmPPiRa2r3i.json diff --git a/module/dice/damageRoll.mjs b/module/dice/damageRoll.mjs index 0c9d5e41..ef5f9434 100644 --- a/module/dice/damageRoll.mjs +++ b/module/dice/damageRoll.mjs @@ -1,4 +1,5 @@ import DamageDialog from '../applications/dialogs/damageDialog.mjs'; +import { parseRallyDice } from '../helpers/utils.mjs'; import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs'; import DHRoll from './dhRoll.mjs'; @@ -197,7 +198,7 @@ export default class DamageRoll extends DHRoll { // Bardic Rally const rallyChoices = config.data?.parent?.appliedEffects.reduce((a, c) => { const change = c.changes.find(ch => ch.key === 'system.bonuses.rally'); - if (change) a.push({ value: c.id, label: change.value }); + if (change) a.push({ value: c.id, label: parseRallyDice(change.value, c) }); return a; }, []); if (rallyChoices.length) { diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index cafe0cff..9037250a 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -1,6 +1,6 @@ import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs'; import D20Roll from './d20Roll.mjs'; -import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs'; +import { parseRallyDice, setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs'; import { getDiceSoNicePresets } from '../config/generalConfig.mjs'; import { ResourceUpdateMap } from '../data/action/baseAction.mjs'; @@ -68,7 +68,7 @@ export default class DualityRoll extends D20Roll { setRallyChoices() { return this.data?.parent?.appliedEffects.reduce((a, c) => { const change = c.changes.find(ch => ch.key === 'system.bonuses.rally'); - if (change) a.push({ value: c.id, label: change.value }); + if (change) a.push({ value: c.id, label: parseRallyDice(change.value, c) }); return a; }, []); } diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index 57badd89..643cde6d 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -557,3 +557,11 @@ export function calculateExpectedValue(formulaOrTerms) { : [formulaOrTerms]; return terms.reduce((r, t) => r + (t.bonus ?? 0) + (t.diceQuantity ? (t.diceQuantity * (t.faces + 1)) / 2 : 0), 0); } + +export function parseRallyDice(value, effect) { + const legacyStartsWithPrefix = value.toLowerCase().startsWith('d'); + const workingValue = legacyStartsWithPrefix ? value.slice(1) : value; + const dataParsedValue = itemAbleRollParse(workingValue, effect.parent); + + return `d${game.system.api.documents.DhActiveEffect.effectSafeEval(dataParsedValue)}`; +} diff --git a/src/packs/classes/class_Bard_vegl3bFOq3pcFTWT.json b/src/packs/classes/class_Bard_vegl3bFOq3pcFTWT.json index b7830722..c4dd83a7 100644 --- a/src/packs/classes/class_Bard_vegl3bFOq3pcFTWT.json +++ b/src/packs/classes/class_Bard_vegl3bFOq3pcFTWT.json @@ -20,10 +20,6 @@ { "type": "class", "item": "Compendium.daggerheart.classes.Item.PydiMnNCKpd44SGS" - }, - { - "type": "class", - "item": "Compendium.daggerheart.classes.Item.TVeEyqmPPiRa2r3i" } ], "subclasses": [ diff --git a/src/packs/classes/feature_Rally_PydiMnNCKpd44SGS.json b/src/packs/classes/feature_Rally_PydiMnNCKpd44SGS.json index e8d4c3c9..e2a0b5bb 100644 --- a/src/packs/classes/feature_Rally_PydiMnNCKpd44SGS.json +++ b/src/packs/classes/feature_Rally_PydiMnNCKpd44SGS.json @@ -63,7 +63,7 @@ { "key": "system.bonuses.rally", "mode": 2, - "value": "d6", + "value": "6 + min((floor(@system.levelData.level.current / 5)*2), 2)", "priority": null } ], diff --git a/src/packs/classes/feature_Rally__Level_5__TVeEyqmPPiRa2r3i.json b/src/packs/classes/feature_Rally__Level_5__TVeEyqmPPiRa2r3i.json deleted file mode 100644 index 46717fcb..00000000 --- a/src/packs/classes/feature_Rally__Level_5__TVeEyqmPPiRa2r3i.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "folder": "C9y59fIkq50d3SyD", - "name": "Rally (Level 5)", - "type": "feature", - "img": "icons/tools/instruments/drum-hand-tan.webp", - "system": { - "description": "

Once per session, describe how you rally the party and give yourself and each of your allies a Rally Die. At level 1, your Rally Die is a d6. A PC can spend their Rally Die to roll it, adding the result to their action roll, reaction roll, damage roll, or to clear a number of Stress equal to the result. At the end of each session, clear all unspent Rally Dice. At level 5, your Rally Die increases to a d8.

", - "resource": null, - "actions": { - "Z1KWFrpXOqZWuZD1": { - "type": "effect", - "_id": "Z1KWFrpXOqZWuZD1", - "systemPath": "actions", - "description": "", - "chatDisplay": true, - "actionType": "action", - "cost": [], - "uses": { - "value": null, - "max": "1", - "recovery": "session" - }, - "effects": [ - { - "_id": "8CFxYJV8zE6Wabwj", - "onSave": false - } - ], - "target": { - "type": "any", - "amount": null - }, - "name": "Rally your Allies", - "img": "icons/tools/instruments/drum-hand-tan.webp", - "range": "" - } - }, - "originItemType": null, - "originId": null, - "attribution": { - "source": "Daggerheart SRD", - "page": 9, - "artist": "" - } - }, - "effects": [ - { - "name": "Rally (Level 5)", - "img": "icons/tools/instruments/drum-hand-tan.webp", - "origin": "Compendium.daggerheart.classes.Item.oxv0m8AFUQVFKtZ4", - "transfer": false, - "_id": "8CFxYJV8zE6Wabwj", - "type": "base", - "system": { - "rangeDependence": { - "enabled": false, - "type": "withinRange", - "target": "hostile", - "range": "melee" - } - }, - "changes": [ - { - "key": "system.bonuses.rally", - "mode": 2, - "value": "d8", - "priority": null - } - ], - "disabled": false, - "duration": { - "startTime": null, - "combat": null, - "seconds": null, - "rounds": null, - "turns": null, - "startRound": null, - "startTurn": null - }, - "description": "", - "tint": "#ffffff", - "statuses": [], - "sort": 0, - "flags": {}, - "_stats": { - "compendiumSource": null - }, - "_key": "!items.effects!TVeEyqmPPiRa2r3i.8CFxYJV8zE6Wabwj" - } - ], - "flags": {}, - "ownership": { - "default": 0, - "LgnbNMLaxandgMQq": 3 - }, - "_id": "TVeEyqmPPiRa2r3i", - "sort": 300000, - "_key": "!items!TVeEyqmPPiRa2r3i" -}