Simplify active effect application slightly

This commit is contained in:
Johannes Loher 2021-02-18 13:42:59 +01:00
parent b2490a2e2f
commit d5af9c90c4

View file

@ -39,15 +39,13 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
this.overrides = {};
this.applyActiveEffectsFiltered(
(change) =>
!this.derivedDataProperties.includes(change.key) && !this.finalDerivedProperties.includes(change.key),
!this.derivedDataProperties.includes(change.key) &&
!this.finalDerivedDataProperties.includes(change.key),
);
}
applyActiveEffectsToDerivedData(): void {
this.applyActiveEffectsFiltered(
(change) =>
this.derivedDataProperties.includes(change.key) && !this.finalDerivedProperties.includes(change.key),
);
this.applyActiveEffectsFiltered((change) => this.derivedDataProperties.includes(change.key));
}
/**
@ -108,9 +106,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
* The list of properties that are derived from others, given in dot notation.
*/
get derivedDataProperties(): Array<string> {
return Object.keys(DS4.i18n.combatValues)
.map((combatValue) => `data.combatValues.${combatValue}.total`)
.concat("data.combatValues.hitPoints.max");
return Object.keys(DS4.i18n.combatValues).map((combatValue) => `data.combatValues.${combatValue}.total`);
}
/**
@ -124,7 +120,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
* The list of properties that are completely derived (i.e. {@link ActiveEffect}s cannot be applied to them),
* given in dot notation.
*/
get finalDerivedProperties(): string[] {
get finalDerivedDataProperties(): string[] {
return ["data.combatValues.hitPoints.max"];
}