Fixed BaseEffect emiting a scroll text of 0 armor change on every update

This commit is contained in:
WBHarry 2026-03-25 14:30:42 +01:00
parent aa1d117c43
commit 931217577a
2 changed files with 5 additions and 4 deletions

View file

@ -166,8 +166,10 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
return acc; return acc;
}, this.parent.actor.system.armor?.system?.armor?.current ?? 0); }, this.parent.actor.system.armor?.system?.armor?.current ?? 0);
const armorData = getScrollTextData(this.parent.actor, { value: newArmorTotal }, 'armor'); if (newArmorTotal !== this.parent.actor.system.armorScore.value) {
options.scrollingTextData = [armorData]; const armorData = getScrollTextData(this.parent.actor, { value: newArmorTotal }, 'armor');
options.scrollingTextData = [armorData];
}
} }
} }

View file

@ -752,8 +752,7 @@ export function getArmorSources(actor) {
const data = rawArmorSources.map(doc => { const data = rawArmorSources.map(doc => {
// Get the origin item. Since the actor is already loaded, it should already be cached // Get the origin item. Since the actor is already loaded, it should already be cached
// Consider the relative function versions if this causes an issue // Consider the relative function versions if this causes an issue
const isItem = doc instanceof Item; const origin = doc.origin ? foundry.utils.fromUuidSync(doc.origin) : doc;
const origin = isItem ? doc : doc.origin ? foundry.utils.fromUuidSync(doc.origin) : doc.parent;
return { return {
origin, origin,
name: origin.name, name: origin.name,