refactor: use subclasses for different item types

This commit is contained in:
Johannes Loher 2022-02-17 00:17:59 +01:00
parent be616e3be8
commit 8d2cff77d7
47 changed files with 766 additions and 456 deletions

View file

@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: 2022 Johannes Loher
//
// SPDX-License-Identifier: MIT
import { DS4ItemDataPropertiesDataRollable } from "../item-data-properties-base";
import { DS4ArmorDataSourceData } from "./armor-data-source";
export interface DS4ArmorDataProperties {
type: "armor";
data: DS4ArmorDataPropertiesData;
}
interface DS4ArmorDataPropertiesData extends DS4ArmorDataSourceData, DS4ItemDataPropertiesDataRollable {}

View file

@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: 2022 Johannes Loher
//
// SPDX-License-Identifier: MIT
import { DS4 } from "../../config";
import {
DS4ItemDataSourceDataBase,
DS4ItemDataSourceDataEquipable,
DS4ItemDataSourceDataPhysical,
DS4ItemDataSourceDataProtective,
} from "../item-data-source-base";
export interface DS4ArmorDataSource {
type: "armor";
data: DS4ArmorDataSourceData;
}
export interface DS4ArmorDataSourceData
extends DS4ItemDataSourceDataBase,
DS4ItemDataSourceDataPhysical,
DS4ItemDataSourceDataEquipable,
DS4ItemDataSourceDataProtective {
armorMaterialType: keyof typeof DS4.i18n.armorMaterialTypes;
armorType: keyof typeof DS4.i18n.armorTypes;
}

11
src/item/armor/armor.ts Normal file
View file

@ -0,0 +1,11 @@
// SPDX-FileCopyrightText: 2022 Johannes Loher
//
// SPDX-License-Identifier: MIT
import { DS4Item } from "../item";
export class DS4Armor extends DS4Item {}
export interface DS4Armor {
data: foundry.data.ItemData & { type: "armor"; _source: { type: "armor" } };
}