mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
.
This commit is contained in:
parent
94262ba6ec
commit
47b16392eb
7 changed files with 49 additions and 30 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { getScrollTextData } from '../../helpers/utils.mjs';
|
||||
|
||||
/**
|
||||
* ArmorEffects are ActiveEffects that have a static changes field of length 1. It includes current and maximum armor.
|
||||
* When applied to a character, it adds to their currently marked and maximum armor.
|
||||
|
|
@ -185,6 +187,19 @@ export default class ArmorEffect extends foundry.data.ActiveEffectTypeDataModel
|
|||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.cannotAlterArmorEffectType'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (changes.system.changes[0].value !== this.armorChange.value && this.parent.actor?.type === 'character') {
|
||||
const increased = changes.system.changes[0].value > this.armorChange.value;
|
||||
const value = -1 * (this.armorChange.value - changes.system.changes[0].value);
|
||||
options.scrollingTextData = [getScrollTextData(increased, value, 'armor')];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_onUpdate(changes, options, userId) {
|
||||
super._onUpdate(changes, options, userId);
|
||||
|
||||
if (options.scrollingTextData && this.parent.actor?.type === 'character')
|
||||
this.parent.actor.queueScrollText(options.scrollingTextData);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue