ds4/src/module/item/item.ts

30 lines
909 B
TypeScript
Raw Normal View History

2020-12-29 00:33:43 +01:00
import { DS4Actor } from "../actor/actor";
import { DS4ActorDataType } from "../actor/actor-data";
import { DS4ItemDataType, 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}
*/
2020-12-29 00:33:43 +01:00
export class DS4Item extends Item<DS4ItemDataType, DS4ActorDataType, DS4Actor> {
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.talentRank.total = data.talentRank.base + data.talentRank.mod;
}
}
2020-12-23 16:52:20 +01:00
}