35 lines
864 B
TypeScript
35 lines
864 B
TypeScript
import { DS4ItemData } from "./item-data";
|
|
|
|
/**
|
|
* The Item class for DS4
|
|
*/
|
|
export class DS4Item extends Item<DS4ItemData> {
|
|
/**
|
|
* @override
|
|
*/
|
|
prepareData(): void {
|
|
super.prepareData();
|
|
this.prepareDerivedData();
|
|
}
|
|
|
|
prepareDerivedData(): void {
|
|
if (this.data.type === "talent") {
|
|
const data = this.data.data;
|
|
data.rank.total = data.rank.base + data.rank.mod;
|
|
}
|
|
}
|
|
|
|
isNonEquippedEuipable(): boolean {
|
|
return "equipped" in this.data.data && !this.data.data.equipped;
|
|
}
|
|
|
|
/**
|
|
* The number of times that active effect changes originating from this item should be applied.
|
|
*/
|
|
get activeEffectFactor(): number | undefined {
|
|
if (this.data.type === "talent") {
|
|
return this.data.data.rank.total;
|
|
}
|
|
return 1;
|
|
}
|
|
}
|