mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Corrected BaseEffect scrollText armorUpdate logic
This commit is contained in:
parent
4319fbabb9
commit
394d1d338d
1 changed files with 4 additions and 5 deletions
|
|
@ -161,12 +161,11 @@ export default class BaseEffect extends foundry.data.ActiveEffectTypeDataModel {
|
||||||
this.parent.actor?.type === 'character' &&
|
this.parent.actor?.type === 'character' &&
|
||||||
this.parent.actor.system.resources.armor
|
this.parent.actor.system.resources.armor
|
||||||
) {
|
) {
|
||||||
const newArmorTotal = (changed.system?.changes ?? []).reduce((acc, change) => {
|
const armorEffect = changed.system?.changes?.find(x => x.type === 'armor');
|
||||||
if (change.type === 'armor') acc += change.value.current;
|
const newArmorTotal =
|
||||||
return acc;
|
armorEffect?.value?.current + (this.parent.actor.system.armor?.system?.armor?.current ?? 0);
|
||||||
}, this.parent.actor.system.armor?.system?.armor?.current ?? 0);
|
|
||||||
|
|
||||||
if (newArmorTotal !== this.parent.actor.system.armorScore.value) {
|
if (armorEffect && newArmorTotal !== this.parent.actor.system.armorScore.value) {
|
||||||
const armorData = getScrollTextData(this.parent.actor, { value: newArmorTotal }, 'armor');
|
const armorData = getScrollTextData(this.parent.actor, { value: newArmorTotal }, 'armor');
|
||||||
options.scrollingTextData = [armorData];
|
options.scrollingTextData = [armorData];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue