87 lines
2.6 KiB
TypeScript
87 lines
2.6 KiB
TypeScript
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { ModifiableDataBaseTotal, ResourceDataBaseTotalMax } from "../common/common-data";
|
|
import { DS4 } from "../config";
|
|
import {
|
|
DS4CharacterDataSourceDataBaseInfo,
|
|
DS4CharacterDataSourceDataCurrency,
|
|
DS4CharacterDataSourceDataProfile,
|
|
DS4CharacterDataSourceDataProgression,
|
|
DS4CharacterDataSourceDataSlayerPoints,
|
|
DS4CreatureDataSourceDataBaseInfo,
|
|
} from "./actor-data-source";
|
|
|
|
declare global {
|
|
interface DataConfig {
|
|
Actor: DS4ActorDataProperties;
|
|
}
|
|
}
|
|
|
|
export type DS4ActorDataProperties = DS4CharacterDataProperties | DS4CreatureDataProperties;
|
|
|
|
interface DS4CharacterDataProperties {
|
|
type: "character";
|
|
data: DS4CharacterDataPropertiesData;
|
|
}
|
|
|
|
interface DS4CreatureDataProperties {
|
|
type: "creature";
|
|
data: DS4CreatureDataPropertiesData;
|
|
}
|
|
|
|
// templates
|
|
|
|
interface DS4ActorDataPropertiesDataBase {
|
|
attributes: DS4ActorDataPropertiesDataAttributes;
|
|
traits: DS4ActorDataPropertiesDataTraits;
|
|
combatValues: DS4ActorDataPropertiesDataCombatValues;
|
|
rolling: DS4ActorDataPropertiesDataRolling;
|
|
checks: DS4ActorDataPropertiesDataChecks;
|
|
}
|
|
|
|
type DS4ActorDataPropertiesDataAttributes = {
|
|
[Key in keyof typeof DS4.i18n.attributes]: ModifiableDataBaseTotal<number>;
|
|
};
|
|
|
|
type DS4ActorDataPropertiesDataTraits = { [Key in keyof typeof DS4.i18n.traits]: ModifiableDataBaseTotal<number> };
|
|
|
|
type DS4ActorDataPropertiesDataCombatValues = {
|
|
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints"
|
|
? ResourceDataBaseTotalMax<number>
|
|
: ModifiableDataBaseTotal<number>;
|
|
};
|
|
|
|
interface DS4ActorDataPropertiesDataRolling {
|
|
maximumCoupResult: number;
|
|
minimumFumbleResult: number;
|
|
}
|
|
|
|
type DS4ActorDataPropertiesDataChecks = {
|
|
[key in Check]: number;
|
|
};
|
|
|
|
export type Check = keyof typeof DS4.i18n.checks;
|
|
|
|
export function isCheck(value: string): value is Check {
|
|
return Object.keys(DS4.i18n.checks).includes(value);
|
|
}
|
|
|
|
// types
|
|
|
|
interface DS4CreatureDataPropertiesData extends DS4ActorDataPropertiesDataBase {
|
|
baseInfo: DS4CreatureDataSourceDataBaseInfo;
|
|
}
|
|
|
|
interface DS4CharacterDataPropertiesData extends DS4ActorDataPropertiesDataBase {
|
|
baseInfo: DS4CharacterDataSourceDataBaseInfo;
|
|
progression: DS4CharacterDataSourceDataProgression;
|
|
profile: DS4CharacterDataSourceDataProfile;
|
|
currency: DS4CharacterDataSourceDataCurrency;
|
|
slayerPoints: DS4CharacterDataPropertiesDataSlayerPoints;
|
|
}
|
|
|
|
export interface DS4CharacterDataPropertiesDataSlayerPoints extends DS4CharacterDataSourceDataSlayerPoints {
|
|
max: number;
|
|
}
|