Small cleanup
This commit is contained in:
parent
624059ef02
commit
38a3437267
1 changed files with 7 additions and 7 deletions
|
@ -15,7 +15,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
|
|||
if (!this.data.name) this.data.name = "New " + this.entity;
|
||||
this.prepareBaseData();
|
||||
this.prepareEmbeddedEntities();
|
||||
this.applyActiveEffectsToNonDerivedData();
|
||||
this.applyActiveEffectsToBaseData();
|
||||
this.prepareDerivedData();
|
||||
this.applyActiveEffectsToDerivedData();
|
||||
this.prepareFinalDerivedData();
|
||||
|
@ -24,6 +24,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
|
|||
/** @override */
|
||||
prepareBaseData(): void {
|
||||
const data = this.data;
|
||||
|
||||
const attributes = data.data.attributes;
|
||||
Object.values(attributes).forEach(
|
||||
(attribute: ModifiableData<number>) => (attribute.total = attribute.base + attribute.mod),
|
||||
|
@ -33,7 +34,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
|
|||
Object.values(traits).forEach((trait: ModifiableData<number>) => (trait.total = trait.base + trait.mod));
|
||||
}
|
||||
|
||||
applyActiveEffectsToNonDerivedData(): void {
|
||||
applyActiveEffectsToBaseData(): void {
|
||||
this.applyActiveEffectsFiltered(
|
||||
(change) =>
|
||||
!this.derivedDataProperties.includes(change.key) && !this.finalDerivedProperties.includes(change.key),
|
||||
|
@ -90,8 +91,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
|
|||
}
|
||||
|
||||
protected _getOriginatingItemOfActiveEffect(effect: ActiveEffect<DS4Actor>): DS4Item | undefined {
|
||||
const item = this.items.find((item) => item.uuid === effect.data.origin);
|
||||
return item ?? undefined;
|
||||
return this.items.find((item) => item.uuid === effect.data.origin) ?? undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,8 +119,8 @@ 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.
|
||||
* 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[] {
|
||||
return ["data.combatValues.hitPoints.max"];
|
||||
|
@ -165,9 +165,9 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
|
|||
protected _prepareCombatValues(): void {
|
||||
const data = this.data.data;
|
||||
const armorValueOfEquippedItems = this._calculateArmorValueOfEquippedItems();
|
||||
|
||||
data.combatValues.hitPoints.base =
|
||||
(data.attributes.body.total ?? 0) + (data.traits.constitution.total ?? 0) + 10;
|
||||
|
||||
data.combatValues.defense.base =
|
||||
(data.attributes.body.total ?? 0) + (data.traits.constitution.total ?? 0) + armorValueOfEquippedItems;
|
||||
data.combatValues.initiative.base = (data.attributes.mobility.total ?? 0) + (data.traits.agility.total ?? 0);
|
||||
|
|
Loading…
Reference in a new issue