167 lines
4.7 KiB
TypeScript
167 lines
4.7 KiB
TypeScript
export type MainStat = "strength" | "dexterity" | "constitution" | "intelligence" | "curiosity" | "charisma" | "psyche";
|
|
export type Ability = "athletics" | "acrobatics" | "intimidation" | "sleightofhand" | "stealth" | "survival" | "investigation" | "history" | "religion" | "arcana" | "understanding" | "perception" | "performance" | "medecine" | "persuasion" | "animalhandling" | "deception";
|
|
export type Level = | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
export type TrainingLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
|
|
export type SpellType = "precision" | "knowledge" | "instinct" | "arts";
|
|
export type Category = "action" | "reaction" | "freeaction" | "misc";
|
|
export type Resistance = keyof CompiledCharacter["resistance"];
|
|
|
|
export type DoubleIndex<T extends number | string> = [T, number];
|
|
|
|
export type Progression = {
|
|
training: Record<MainStat, DoubleIndex<TrainingLevel>[]>;
|
|
race: {
|
|
index?: number;
|
|
progress?: DoubleIndex<Level>[];
|
|
};
|
|
level: number;
|
|
abilities: Partial<Record<Ability, [number, number]>>; //First is the ability, second is the max increment
|
|
spells?: string[]; //Spell ID
|
|
modifiers: Partial<Record<MainStat, number>>;
|
|
aspect?: string;
|
|
notes: string;
|
|
};
|
|
export type Character = {
|
|
id: number;
|
|
name: string;
|
|
progress: Progression;
|
|
owner?: number;
|
|
};
|
|
export type CharacterConfig = {
|
|
peoples: Race[],
|
|
training: Record<MainStat, Record<TrainingLevel, TrainingOption[]>>;
|
|
abilities: Record<Ability, AbilityConfig>;
|
|
resistances: Record<Resistance, ResistanceConfig>;
|
|
};
|
|
export type AbilityConfig = {
|
|
max: [MainStat, MainStat];
|
|
name: string;
|
|
description: string;
|
|
};
|
|
export type ResistanceConfig = {
|
|
name: string;
|
|
statistic: MainStat;
|
|
};
|
|
export type Race = {
|
|
name: string;
|
|
description: string;
|
|
utils: {
|
|
maxOption: number;
|
|
};
|
|
options: Record<Level, RaceOption[]>;
|
|
};
|
|
export type RaceOption = {
|
|
training?: number;
|
|
health?: number;
|
|
mana?: number;
|
|
shaping?: number;
|
|
modifier?: number;
|
|
abilities?: number;
|
|
};
|
|
export type Feature = {
|
|
text?: string;
|
|
} & (ActionFeature | ReactionFeature | FreeActionFeature | BonusFeature | MiscFeature);
|
|
type ActionFeature = {
|
|
type: "action";
|
|
cost: 1 | 2 | 3;
|
|
text: string;
|
|
};
|
|
type ReactionFeature = {
|
|
type: "reaction";
|
|
text: string;
|
|
};
|
|
type FreeActionFeature = {
|
|
type: "freeaction";
|
|
text: string;
|
|
};
|
|
type BonusFeature = {
|
|
type: "bonus";
|
|
action: "add" | "remove" | "set" | "cap";
|
|
value: number;
|
|
property: string;
|
|
};
|
|
type MiscFeature = {
|
|
type: "misc";
|
|
text: string;
|
|
};
|
|
export type TrainingOption = {
|
|
description: Array<{
|
|
text: string;
|
|
disposable?: boolean;
|
|
replaced?: boolean;
|
|
category?: Category;
|
|
}>;
|
|
|
|
//Automatically calculated by compiler
|
|
mana?: number;
|
|
health?: number;
|
|
speed?: false | number;
|
|
initiative?: number;
|
|
mastery?: keyof CompiledCharacter["mastery"];
|
|
spellrank?: SpellType;
|
|
defense?: Array<keyof CompiledCharacter["defense"]>;
|
|
resistance?: [Resistance, "attack" | "defense"][];
|
|
|
|
//Used during character creation, not used by compiler
|
|
modifier?: number;
|
|
ability?: number;
|
|
spec?: number;
|
|
spellslot?: number | MainStat;
|
|
arts?: number | MainStat;
|
|
|
|
features?: Feature[]; //TODO
|
|
};
|
|
export type CompiledCharacter = {
|
|
id: number;
|
|
owner?: number;
|
|
username?: string;
|
|
name: string;
|
|
health: number;
|
|
mana: number;
|
|
race: number;
|
|
spellslots: number;
|
|
artslots: number;
|
|
spellranks: Record<SpellType, 0 | 1 | 2 | 3>;
|
|
aspect: string;
|
|
speed: number | false;
|
|
initiative: number;
|
|
|
|
defense: {
|
|
static: number;
|
|
activeparry: number;
|
|
activedodge: number;
|
|
passiveparry: number;
|
|
passivedodge: number;
|
|
};
|
|
|
|
mastery: {
|
|
strength: number;
|
|
dexterity: number;
|
|
shield: number;
|
|
armor: number;
|
|
multiattack: number;
|
|
magicpower: number;
|
|
magicspeed: number;
|
|
magicelement: number;
|
|
};
|
|
|
|
resistance: { //First is attack, second is defense
|
|
stun: [number, number];
|
|
bleed: [number, number];
|
|
poison: [number, number];
|
|
fear: [number, number];
|
|
influence: [number, number];
|
|
charm: [number, number];
|
|
possesion: [number, number];
|
|
precision: [number, number];
|
|
knowledge: [number, number];
|
|
instinct: [number, number];
|
|
};
|
|
|
|
modifier: Record<MainStat, number>;
|
|
abilities: Partial<Record<Ability, number>>;
|
|
level: number;
|
|
features: Record<Category, string[]>; //Currently: List of training option as text. TODO: Update to a more complex structure later
|
|
|
|
notes: string;
|
|
}; |