2020-12-29 00:33:43 +01:00
|
|
|
import { DS4Item } from "../item/item";
|
|
|
|
import { DS4ItemDataType } from "../item/item-data";
|
2020-12-29 22:44:56 +01:00
|
|
|
import { DS4ActorDataType, ModifiableData } from "./actor-data";
|
2020-12-23 18:23:26 +01:00
|
|
|
|
2020-12-29 00:33:43 +01:00
|
|
|
export class DS4Actor extends Actor<DS4ActorDataType, DS4ItemDataType, DS4Item> {
|
2020-12-23 16:52:20 +01:00
|
|
|
/** @override */
|
2020-12-23 18:23:26 +01:00
|
|
|
prepareDerivedData(): void {
|
2020-12-23 16:52:20 +01:00
|
|
|
const data = this.data;
|
2020-12-29 22:44:56 +01:00
|
|
|
const attributes = data.data.attributes;
|
|
|
|
Object.values(attributes).forEach(
|
|
|
|
(attribute: ModifiableData<number>) => (attribute.total = attribute.base + attribute.mod),
|
2020-12-23 16:52:20 +01:00
|
|
|
);
|
|
|
|
|
2020-12-29 22:44:56 +01:00
|
|
|
const traits = data.data.traits;
|
|
|
|
Object.values(traits).forEach((trait: ModifiableData<number>) => (trait.total = trait.base + trait.mod));
|
2020-12-23 16:52:20 +01:00
|
|
|
|
2020-12-29 22:44:56 +01:00
|
|
|
const combatValues = data.data.combatValues;
|
|
|
|
Object.values(combatValues).forEach(
|
|
|
|
(combatValue: ModifiableData<number>) => (combatValue.total = combatValue.base + combatValue.mod),
|
|
|
|
);
|
2021-01-07 12:47:38 +01:00
|
|
|
|
|
|
|
combatValues.hitPoints.max = combatValues.hitPoints.total;
|
2020-12-23 16:52:20 +01:00
|
|
|
}
|
|
|
|
}
|