added talents overview and sheet
- added talents item type: - added scss - added to template.json (Item.types, Item.talent) - added to config.ts itemTypes - added type definition - added localizations - added talent overview tab to actor sheet - made total rank calculated upon data preparation by adding a prepareData method to DS4Item
This commit is contained in:
parent
2db60b1b76
commit
150a0ea487
11 changed files with 208 additions and 6 deletions
|
@ -48,6 +48,7 @@ export const DS4 = {
|
|||
shield: "DS4.ItemTypeShield",
|
||||
trinket: "DS4.ItemTypeTrinket",
|
||||
equipment: "DS4.ItemTypeEquipment",
|
||||
talent: "DS4.ItemTypeTalent",
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,7 @@ async function registerHandlebarsPartials() {
|
|||
"systems/ds4/templates/item/partials/effects.hbs",
|
||||
"systems/ds4/templates/item/partials/body.hbs",
|
||||
"systems/ds4/templates/actor/partials/items-overview.hbs",
|
||||
"systems/ds4/templates/actor/partials/talents-overview.hbs",
|
||||
"systems/ds4/templates/actor/partials/attributes-traits.hbs",
|
||||
"systems/ds4/templates/actor/partials/combat-values.hbs",
|
||||
];
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { ModifiableData } from "../actor/actor-data";
|
||||
|
||||
// TODO: Actually add a type for data
|
||||
export type DS4ItemDataType = DS4Weapon | DS4Armor | DS4Shield | DS4Trinket | DS4Equipment;
|
||||
export type DS4ItemDataType = DS4Weapon | DS4Armor | DS4Shield | DS4Trinket | DS4Equipment | DS4Talent;
|
||||
|
||||
// types
|
||||
|
||||
|
@ -14,6 +16,14 @@ interface DS4Armor extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4It
|
|||
armorType: "body" | "helmet" | "vambrace" | "greaves" | "vambraceGreaves";
|
||||
}
|
||||
|
||||
export interface DS4Talent extends DS4ItemBase {
|
||||
talentRank: DS4TalentRank;
|
||||
}
|
||||
|
||||
interface DS4TalentRank extends ModifiableData<number> {
|
||||
max: number;
|
||||
}
|
||||
|
||||
interface DS4Shield extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4ItemProtective {}
|
||||
interface DS4Trinket extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable {}
|
||||
interface DS4Equipment extends DS4ItemBase, DS4ItemPhysical {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { DS4Actor } from "../actor/actor";
|
||||
import { DS4ActorDataType } from "../actor/actor-data";
|
||||
import { DS4ItemDataType } from "./item-data";
|
||||
import { DS4ItemDataType, DS4Talent } from "./item-data";
|
||||
|
||||
/**
|
||||
* Extend the basic Item with some very simple modifications.
|
||||
|
@ -12,10 +12,18 @@ export class DS4Item extends Item<DS4ItemDataType, DS4ActorDataType, DS4Actor> {
|
|||
*/
|
||||
prepareData(): void {
|
||||
super.prepareData();
|
||||
this.prepareDerivedData();
|
||||
|
||||
// Get the Item's data
|
||||
// const itemData = this.data;
|
||||
// const actorData = this.actor ? this.actor.data : {};
|
||||
// const data = itemData.data;
|
||||
}
|
||||
|
||||
prepareDerivedData(): void {
|
||||
if (this.type === "talent") {
|
||||
const data: DS4Talent = this.data.data as DS4Talent;
|
||||
data.talentRank.total = data.talentRank.base + data.talentRank.mod;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue