Add back Loading Indicator, rework children caching, small visual improvement on character sheet and config management.

This commit is contained in:
Clément Pons
2026-01-12 17:48:28 +01:00
parent 0eaffcaa04
commit f761e44569
16 changed files with 333 additions and 238 deletions

View File

@@ -1,4 +1,4 @@
import type { MAIN_STATS, ABILITIES, LEVELS, TRAINING_LEVELS, SPELL_TYPES, CATEGORIES, SPELL_ELEMENTS, ALIGNMENTS, RESISTANCES, DAMAGE_TYPES, WEAPON_TYPES } from "#shared/character.util";
import type { MAIN_STATS, ABILITIES, LEVELS, TRAINING_LEVELS, SPELL_TYPES, CATEGORIES, SPELL_ELEMENTS, ALIGNMENTS, RESISTANCES, DAMAGE_TYPES, WEAPON_TYPES, PropertySum, ITEM_BUFFER_KEYS } from "#shared/character.util";
import type { Localized } from "../types/general";
export type MainStat = typeof MAIN_STATS[number];
@@ -57,11 +57,16 @@ export type CharacterVariables = {
money: number;
};
export type TreeStructure = {
name: string;
};
type CommonState = {
capacity?: number;
powercost?: number;
};
type ArmorState = { health?: number };
type StateBufferKeys = typeof ITEM_BUFFER_KEYS[number];
type ArmorState = { loss: number, health?: number, absorb?: { flat?: number, percent?: number } };
type WeaponState = { attack?: number | string, hit?: number };
type WondrousState = { };
type MundaneState = { };
@@ -72,11 +77,12 @@ type ItemState = {
charges?: number;
equipped?: boolean;
state?: (ArmorState | WeaponState | WondrousState | MundaneState) & CommonState;
buffer?: Partial<Record<StateBufferKeys, PropertySum>>;
};
export type CharacterConfig = {
peoples: Record<string, RaceConfig>;
training: Record<MainStat, Record<TrainingLevel, FeatureID[]>>;
spells: Record<string, SpellConfig | ArtConfig>;
spells: Record<string, SpellConfig>;
aspects: Record<string, AspectConfig>;
features: Record<FeatureID, Feature>;
enchantments: Record<string, EnchantementConfig>;
@@ -86,11 +92,12 @@ export type CharacterConfig = {
freeaction: Record<string, { id: string, name: string, description: string }>;
passive: Record<string, { id: string, name: string, description: string }>;
texts: Record<i18nID, Localized>;
trees: Record<string, TreeStructure>;
//Each of these groups extend an existing feature as they all use the same properties
sickness: Record<FeatureID, { stage: number }>; //TODO
poisons: Record<FeatureID, { difficulty: number, efficienty: number, solubility: number }>; //TODO
dedications: Record<FeatureID, { id: string, name: string, description: i18nID, effect: FeatureID[], requirement: Array<{ stat: MainStat, amount: number }> }>; //TODO
sickness: Record<FeatureID, { name: string, stage: number }>; //TODO
poisons: Record<FeatureID, { name: string, difficulty: number, efficienty: number, solubility: number }>; //TODO
dedications: Record<FeatureID, { name: string, requirement: Array<{ stat: MainStat, amount: number }> }>; //TODO
};
export type EnchantementConfig = {
id: string;
@@ -142,7 +149,7 @@ export type SpellConfig = {
id: string;
name: string; //TODO -> TextID
rank: 1 | 2 | 3 | 4;
type: Exclude<SpellType, "arts">;
type: SpellType;
cost: number;
speed: "action" | "reaction" | number;
elements: Array<SpellElement>;
@@ -191,7 +198,7 @@ export type FeatureEquipment = {
id: FeatureID;
category: "value";
operation: "add" | "set" | "min";
property: 'weapon/damage/value' | 'armor/health' | 'armor/absorb/flat' | 'armor/absorb/percent';
property: StateBufferKeys;
value: number | `modifier/${MainStat}` | false;
}
export type FeatureList = {
@@ -228,13 +235,15 @@ export type CompiledCharacter = {
race: string;
spellslots: number; //Max
artslots: number; //Max
spellranks: Record<SpellType, 0 | 1 | 2 | 3>;
spellranks: Record<SpellType | 'arts', 0 | 1 | 2 | 3>;
aspect: {
id: string,
amount: number;
duration: number;
bonus: number;
shift_bonus: number;
tier: 0 | 1 | 2;
bonus?: Partial<CompiledCharacter['bonus']>;
};
speed: number | false;
capacity: number | false;
@@ -269,13 +278,13 @@ export type CompiledCharacter = {
defense: Partial<Record<MainStat, number>>; //Defense aux jets de resistance
abilities: Partial<Record<Ability, number>>;
spells: {
type: Partial<Record<SpellType, number>>;
type: Partial<Record<SpellType | 'arts', number>>;
rank: Partial<Record<1 | 2 | 3 | 4, number>>;
elements: Partial<Record<SpellElement, number>>;
};
weapon: Partial<Record<WeaponType, number>>;
resistance: Partial<Record<Resistance, number>>; //Bonus à l'attaque
}; //Any special bonus goes here
resistance: Partial<Record<Resistance, number>>; //Bonus à l'attaque
craft: { level: number, bonus: number };