- added isPhysical boolean to getData output of item-sheet.ts - added isPhysical checks for displays of physical-only information in templates
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { ModifiableData } from "../actor/actor-data";
|
|
|
|
export type DS4ItemDataType = DS4Weapon | DS4Armor | DS4Shield | DS4Trinket | DS4Equipment | DS4Talent;
|
|
|
|
// types
|
|
|
|
interface DS4Weapon extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable {
|
|
attackType: "melee" | "ranged" | "meleeRanged";
|
|
weaponBonus: number;
|
|
opponentDefense: number;
|
|
}
|
|
|
|
interface DS4Armor extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4ItemProtective {
|
|
armorMaterialType: "cloth" | "leather" | "chain" | "plate";
|
|
armorType: "body" | "helmet" | "vambrace" | "greaves" | "vambraceGreaves";
|
|
}
|
|
|
|
export interface DS4Talent extends DS4ItemBase {
|
|
rank: 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 {}
|
|
|
|
// templates
|
|
|
|
interface DS4ItemBase {
|
|
description: string;
|
|
}
|
|
interface DS4ItemPhysical {
|
|
quantity: number;
|
|
price: number;
|
|
availability: "hamlet" | "village" | "city" | "elves" | "dwarves" | "nowhere" | "unset";
|
|
storageLocation: string;
|
|
}
|
|
|
|
export function isDS4ItemDataTypePhysical(input: DS4ItemDataType): boolean {
|
|
return "quantity" in input && "price" in input && "availability" in input && "storageLocation" in input;
|
|
}
|
|
|
|
interface DS4ItemEquipable {
|
|
equipped: boolean;
|
|
}
|
|
|
|
interface DS4ItemProtective {
|
|
armorValue: number;
|
|
}
|