Fixed effects not being creatable when not on an actor

This commit is contained in:
WBHarry 2026-03-27 22:11:01 +01:00
parent d7ce388cad
commit d79c236cfe

View file

@ -108,6 +108,7 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
update.img = 'icons/magic/life/heart-cross-blue.webp'; update.img = 'icons/magic/life/heart-cross-blue.webp';
} }
if (this.actor) {
const existingEffect = this.actor.effects.find(x => x.origin === data.origin); const existingEffect = this.actor.effects.find(x => x.origin === data.origin);
const stacks = Boolean(data.system?.stacking); const stacks = Boolean(data.system?.stacking);
if (existingEffect && !stacks) return false; if (existingEffect && !stacks) return false;
@ -119,7 +120,9 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
}); });
return false; return false;
} }
}
if (this.parent) {
const statuses = Object.keys(data.statuses ?? {}); const statuses = Object.keys(data.statuses ?? {});
const immuneStatuses = const immuneStatuses =
statuses.filter( statuses.filter(
@ -141,6 +144,7 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
this.parent.queueScrollText(scrollingTexts); this.parent.queueScrollText(scrollingTexts);
} }
} }
}
if (Object.keys(update).length > 0) { if (Object.keys(update).length > 0) {
await this.updateSource(update); await this.updateSource(update);