mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 06:26:13 +01:00
Fixed so that Rally dice works as a single active effect for bard (#1708)
This commit is contained in:
parent
92d8c2ca18
commit
83c3da0130
6 changed files with 12 additions and 107 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import DamageDialog from '../applications/dialogs/damageDialog.mjs';
|
import DamageDialog from '../applications/dialogs/damageDialog.mjs';
|
||||||
|
import { parseRallyDice } from '../helpers/utils.mjs';
|
||||||
import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs';
|
import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs';
|
||||||
import DHRoll from './dhRoll.mjs';
|
import DHRoll from './dhRoll.mjs';
|
||||||
|
|
||||||
|
|
@ -197,7 +198,7 @@ export default class DamageRoll extends DHRoll {
|
||||||
// Bardic Rally
|
// Bardic Rally
|
||||||
const rallyChoices = config.data?.parent?.appliedEffects.reduce((a, c) => {
|
const rallyChoices = config.data?.parent?.appliedEffects.reduce((a, c) => {
|
||||||
const change = c.changes.find(ch => ch.key === 'system.bonuses.rally');
|
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;
|
return a;
|
||||||
}, []);
|
}, []);
|
||||||
if (rallyChoices.length) {
|
if (rallyChoices.length) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs';
|
import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs';
|
||||||
import D20Roll from './d20Roll.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 { getDiceSoNicePresets } from '../config/generalConfig.mjs';
|
||||||
import { ResourceUpdateMap } from '../data/action/baseAction.mjs';
|
import { ResourceUpdateMap } from '../data/action/baseAction.mjs';
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ export default class DualityRoll extends D20Roll {
|
||||||
setRallyChoices() {
|
setRallyChoices() {
|
||||||
return this.data?.parent?.appliedEffects.reduce((a, c) => {
|
return this.data?.parent?.appliedEffects.reduce((a, c) => {
|
||||||
const change = c.changes.find(ch => ch.key === 'system.bonuses.rally');
|
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;
|
return a;
|
||||||
}, []);
|
}, []);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -558,6 +558,13 @@ export function calculateExpectedValue(formulaOrTerms) {
|
||||||
return terms.reduce((r, t) => r + (t.bonus ?? 0) + (t.diceQuantity ? (t.diceQuantity * (t.faces + 1)) / 2 : 0), 0);
|
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)}`;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Refreshes character and/or adversary resources.
|
* Refreshes character and/or adversary resources.
|
||||||
* @param { string[] } refreshTypes Which type of features to refresh using IDs from CONFIG.DH.GENERAL.refreshTypes
|
* @param { string[] } refreshTypes Which type of features to refresh using IDs from CONFIG.DH.GENERAL.refreshTypes
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,6 @@
|
||||||
{
|
{
|
||||||
"type": "class",
|
"type": "class",
|
||||||
"item": "Compendium.daggerheart.classes.Item.PydiMnNCKpd44SGS"
|
"item": "Compendium.daggerheart.classes.Item.PydiMnNCKpd44SGS"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "class",
|
|
||||||
"item": "Compendium.daggerheart.classes.Item.TVeEyqmPPiRa2r3i"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"subclasses": [
|
"subclasses": [
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
{
|
{
|
||||||
"key": "system.bonuses.rally",
|
"key": "system.bonuses.rally",
|
||||||
"mode": 2,
|
"mode": 2,
|
||||||
"value": "d6",
|
"value": "6 + min((floor(@system.levelData.level.current / 5)*2), 2)",
|
||||||
"priority": null
|
"priority": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
{
|
|
||||||
"folder": "C9y59fIkq50d3SyD",
|
|
||||||
"name": "Rally (Level 5)",
|
|
||||||
"type": "feature",
|
|
||||||
"img": "icons/tools/instruments/drum-hand-tan.webp",
|
|
||||||
"system": {
|
|
||||||
"description": "<p>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.</p>",
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue