Added the ability for effects to have stacks

This commit is contained in:
WBHarry 2026-02-17 18:58:47 +01:00
parent 4aab5d315a
commit 79057b0718
11 changed files with 187 additions and 18 deletions

View file

@ -1,5 +1,5 @@
import { itemAbleRollParse } from '../helpers/utils.mjs';
import { RefreshType, socketEvent } from '../systemRegistration/socket.mjs';
import { RefreshType } from '../systemRegistration/socket.mjs';
export default class DhActiveEffect extends foundry.documents.ActiveEffect {
/* -------------------------------------------- */
@ -182,10 +182,17 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
} catch (_) {}
}
const evalValue = this.effectSafeEval(itemAbleRollParse(key, parseModel, effect.parent));
const evalValue = this.effectSafeEval(this.effectRollParse(key, parseModel, effect.parent, effect));
return evalValue ?? key;
}
static effectRollParse(value, actor, item, effect) {
const stackingParsedValue = effect.system.stacking?.enabled
? Roll.replaceFormulaData(value, { stacks: effect.system.stacking.value })
: value;
return itemAbleRollParse(stackingParsedValue, actor, item);
}
/**
* Altered Foundry safeEval to allow non-numeric return
* @param {string} expression