ds4/src/module/item/item.ts

28 lines
756 B
TypeScript
Raw Normal View History

2021-01-26 03:55:18 +01:00
import { DS4ItemData, DS4Talent } from "./item-data";
2020-12-23 18:23:26 +01:00
2020-12-23 16:52:20 +01:00
/**
* Extend the basic Item with some very simple modifications.
* @extends {Item}
*/
2021-01-26 03:55:18 +01:00
export class DS4Item extends Item<DS4ItemData> {
2020-12-23 16:52:20 +01:00
/**
* Augment the basic Item data model with additional dynamic data.
*/
2020-12-23 18:23:26 +01:00
prepareData(): void {
2020-12-23 16:52:20 +01:00
super.prepareData();
this.prepareDerivedData();
2020-12-23 16:52:20 +01:00
// Get the Item's data
2020-12-23 18:23:26 +01:00
// const itemData = this.data;
// const actorData = this.actor ? this.actor.data : {};
// const data = itemData.data;
2020-12-23 16:52:20 +01:00
}
prepareDerivedData(): void {
if (this.type === "talent") {
2021-01-06 11:36:06 +01:00
const data = this.data.data as DS4Talent;
data.rank.total = data.rank.base + data.rank.mod;
}
}
2020-12-23 16:52:20 +01:00
}