ds4/src/module/actor/actor-data.ts

117 lines
3.2 KiB
TypeScript
Raw Normal View History

import { ModifiableData, ModifiableDataBase, ResourceData, UsableResource } from "../common/common-data";
2021-02-05 03:42:42 +01:00
import { DS4 } from "../config";
2021-01-26 03:55:18 +01:00
import { DS4ItemData } from "../item/item-data";
2021-02-05 03:42:42 +01:00
export type DS4ActorData = DS4CharacterData | DS4CreatureData;
2021-01-26 03:55:18 +01:00
2021-02-05 03:42:42 +01:00
type ActorType = keyof typeof DS4.i18n.actorTypes;
export interface DS4ActorDataHelper<T, U extends ActorType> extends Actor.Data<T, DS4ItemData> {
2021-02-05 03:42:42 +01:00
type: U;
2020-12-28 15:51:00 +01:00
}
2021-02-05 03:42:42 +01:00
type DS4CharacterData = DS4ActorDataHelper<DS4CharacterDataData, "character">;
type DS4CreatureData = DS4ActorDataHelper<DS4CreatureDataData, "creature">;
// templates
2021-02-05 03:42:42 +01:00
interface DS4ActorDataDataBase {
attributes: DS4ActorDataDataAttributes;
traits: DS4ActorDataDataTraits;
combatValues: DS4ActorDataDataCombatValues;
}
interface DS4ActorDataDataAttributes {
body: ModifiableDataBase<number>;
mobility: ModifiableDataBase<number>;
mind: ModifiableDataBase<number>;
2020-12-28 15:51:00 +01:00
}
2021-02-05 03:42:42 +01:00
interface DS4ActorDataDataTraits {
strength: ModifiableDataBase<number>;
constitution: ModifiableDataBase<number>;
agility: ModifiableDataBase<number>;
dexterity: ModifiableDataBase<number>;
intellect: ModifiableDataBase<number>;
aura: ModifiableDataBase<number>;
}
2021-02-05 03:42:42 +01:00
interface DS4ActorDataDataCombatValues {
2021-01-07 12:47:38 +01:00
hitPoints: ResourceData<number>;
defense: ModifiableData<number>;
initiative: ModifiableData<number>;
movement: ModifiableData<number>;
meleeAttack: ModifiableData<number>;
rangedAttack: ModifiableData<number>;
spellcasting: ModifiableData<number>;
targetedSpellcasting: ModifiableData<number>;
}
// types
2021-02-05 03:42:42 +01:00
interface DS4CharacterDataData extends DS4ActorDataDataBase {
baseInfo: DS4CharacterDataDataBaseInfo;
progression: DS4CharacterDataDataProgression;
language: DS4CharacterDataDataLanguage;
profile: DS4CharacterDataDataProfile;
currency: DS4CharacterDataDataCurrency;
2021-05-13 15:41:00 +02:00
slayerPoints: DS4CharacterDataDataSlayerPoints;
}
export interface DS4CharacterDataDataBaseInfo {
race: string;
class: string;
heroClass: string;
2021-01-03 20:37:30 +01:00
culture: string;
}
export interface DS4CharacterDataDataProgression {
level: number;
experiencePoints: number;
2020-12-30 21:34:12 +01:00
talentPoints: UsableResource<number>;
progressPoints: UsableResource<number>;
2020-12-28 15:51:00 +01:00
}
2021-01-03 20:37:30 +01:00
export interface DS4CharacterDataDataLanguage {
2021-01-03 20:37:30 +01:00
languages: string;
alphabets: string;
}
export interface DS4CharacterDataDataProfile {
2021-01-10 02:05:30 +01:00
biography: string;
2021-01-03 20:37:30 +01:00
gender: string;
birthday: string;
birthplace: string;
age: number;
height: number;
hairColor: string;
weight: number;
eyeColor: string;
specialCharacteristics: string;
}
2021-01-10 19:32:10 +01:00
export interface DS4CharacterDataDataCurrency {
2021-01-10 19:32:10 +01:00
gold: number;
silver: number;
copper: number;
}
2021-05-13 15:41:00 +02:00
export interface DS4CharacterDataDataSlayerPoints {
value: number;
}
2021-02-05 03:42:42 +01:00
interface DS4CreatureDataData extends DS4ActorDataDataBase {
baseInfo: DS4CreatureDataDataBaseInfo;
}
export interface DS4CreatureDataDataBaseInfo {
loot: string;
foeFactor: number;
creatureType: CreatureType;
sizeCategory: SizeCategory;
experiencePoints: number;
2021-01-10 02:05:30 +01:00
description: string;
}
type CreatureType = "animal" | "construct" | "humanoid" | "magicalEntity" | "plantBeing" | "undead";
type SizeCategory = "tiny" | "small" | "normal" | "large" | "huge" | "colossal";