Finalize CharacterBuilder

This commit is contained in:
Clément Pons
2025-07-22 17:46:16 +02:00
parent 3ef98df5d2
commit 7d6f9162ed
13 changed files with 1830 additions and 145 deletions

26
types/character.d.ts vendored
View File

@@ -9,6 +9,7 @@ export type Category = typeof CATEGORIES[number];
export type SpellElement = typeof SPELL_ELEMENTS[number];
export type DoubleIndex<T extends number | string> = [T, number];
export type Alignment = { loyalty: 'loyal' | 'neutral' | 'chaotic', kindness: 'good' | 'neutral' | 'evil' };
export type Character = {
id: number;
@@ -21,9 +22,9 @@ export type Character = {
health: number;
mana: number;
training: Record<MainStat, DoubleIndex<TrainingLevel>[]>;
leveling: DoubleIndex<Level>[];
abilities: Partial<Record<Ability, [number, number]>>; //First is the ability, second is the max increment
training: Record<MainStat, Partial<Record<TrainingLevel, number>>>;
leveling: Partial<Record<Level, number>>;
abilities: Partial<Record<Ability, number>>; //First is the ability, second is the max increment
spells: string[]; //Spell ID
modifiers: Partial<Record<MainStat, number>>;
@@ -38,10 +39,11 @@ export type CharacterValues = {
mana: number;
};
export type CharacterConfig = {
peoples: Race[],
peoples: RaceConfig[],
training: Record<MainStat, Record<TrainingLevel, TrainingOption[]>>;
abilities: Record<Ability, AbilityConfig>;
spells: SpellConfig[];
aspects: AspectConfig[];
};
export type SpellConfig = {
id: string;
@@ -59,11 +61,23 @@ export type AbilityConfig = {
name: string;
description: string;
};
export type Race = {
export type RaceConfig = {
name: string;
description: string;
options: Record<Level, Feature[]>;
};
export type AspectConfig = {
name: string;
description: string;
stat: MainStat | 'special';
alignment: Alignment;
magic: boolean;
difficulty: number;
physic: { min: number, max: number };
mental: { min: number, max: number };
personality: { min: number, max: number };
options: FeatureEffect[];
};
export type FeatureEffect = {
category: "value";
@@ -169,7 +183,7 @@ export type CompiledCharacter = {
modifier: Record<MainStat, number>;
abilities: Partial<Record<Ability, number>>;
level: number;
features: { [K in Extract<FeatureEffect, { category: "feature" }>["kind"]]: string[] };
features: { [K in Extract<FeatureEffect, { category: "feature" }>["kind"]]?: string[] };
notes: string;
};