ds4/src/documents/actor/actor-data-properties-base.ts

47 lines
1.4 KiB
TypeScript
Raw Normal View History

// SPDX-FileCopyrightText: 2021 Johannes Loher
// SPDX-FileCopyrightText: 2021 Oliver Rümpelein
// SPDX-FileCopyrightText: 2021 Gesina Schwalbe
// SPDX-FileCopyrightText: 2021 Siegfried Krug
//
// SPDX-License-Identifier: MIT
2022-11-04 21:47:18 +01:00
import { DS4 } from "../../config";
import type { ModifiableDataBaseTotal, ResourceDataBaseTotalMax } from "../common/common-data";
export interface DS4ActorDataPropertiesDataBase {
2023-07-10 22:23:13 +02:00
attributes: DS4ActorDataPropertiesDataAttributes;
traits: DS4ActorDataPropertiesDataTraits;
combatValues: DS4ActorDataPropertiesDataCombatValues;
rolling: DS4ActorDataPropertiesDataRolling;
checks: DS4ActorDataPropertiesDataChecks;
armorValueSpellMalus: number;
}
type DS4ActorDataPropertiesDataAttributes = {
2023-07-10 22:23:13 +02:00
[Key in keyof typeof DS4.i18n.attributes]: ModifiableDataBaseTotal<number>;
};
type DS4ActorDataPropertiesDataTraits = { [Key in keyof typeof DS4.i18n.traits]: ModifiableDataBaseTotal<number> };
type DS4ActorDataPropertiesDataCombatValues = {
2023-07-10 22:23:13 +02:00
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints"
? ResourceDataBaseTotalMax<number>
: ModifiableDataBaseTotal<number>;
};
interface DS4ActorDataPropertiesDataRolling {
2023-07-10 22:23:13 +02:00
maximumCoupResult: number;
minimumFumbleResult: number;
}
type DS4ActorDataPropertiesDataChecks = {
2023-07-10 22:23:13 +02:00
[key in Check]: number;
};
export type Check = keyof typeof DS4.i18n.checks;
export function isCheck(value: string): value is Check {
2023-07-10 22:23:13 +02:00
return Object.keys(DS4.i18n.checks).includes(value);
}