Fixed effect stacking

This commit is contained in:
WBHarry 2026-02-17 21:15:36 +01:00
parent 79057b0718
commit 617f1d64c1
7 changed files with 37 additions and 28 deletions

View file

@ -106,6 +106,20 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
update.img = 'icons/magic/life/heart-cross-blue.webp';
}
const existingEffect = this.actor.effects.find(x => x.origin === data.origin);
const stacks = data.system?.stacking?.enabled;
if (existingEffect && !stacks) return false;
if (existingEffect && stacks) {
const incrementedValue = existingEffect.system.stacking.value + 1;
await existingEffect.update({
'system.stacking.value': existingEffect.system.stacking.max
? Math.min(incrementedValue, existingEffect.system.stacking.max)
: incrementedValue
});
return false;
}
const statuses = Object.keys(data.statuses ?? {});
const immuneStatuses =
statuses.filter(