ds4/src/module/item/item-data.ts
2021-01-06 11:52:11 +01:00

48 lines
1.3 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;
}
interface DS4ItemEquipable {
equipped: boolean;
}
interface DS4ItemProtective {
armorValue: number;
}