Changes tooltips reference, update character sheet UI, getID now embed the ID_SIZE, new ability max option in feature effect.

This commit is contained in:
Clément Pons
2025-08-29 17:46:08 +02:00
parent 042d4479ee
commit 17bc232602
19 changed files with 522 additions and 242 deletions

57
types/character.d.ts vendored
View File

@@ -10,11 +10,9 @@ export type SpellElement = typeof SPELL_ELEMENTS[number];
export type Alignment = typeof ALIGNMENTS[number];
export type FeatureID = string;
export type TextID = string;
export type i18nID = string;
export type Resistance = string;
export type Dice = `${number}d${4 | 6 | 8 | 10 | 12 | 20}`;
export type Character = {
id: number;
@@ -41,7 +39,15 @@ export type CharacterVariables = {
sickness: Array<{ id: string, state: number | true }>;
spells: string[]; //Spell ID
equipment: string[]; //Equipment ID
items: ItemState[];
};
type ItemState = {
id: string,
amount: number;
enchantments?: [];
charges?: number;
equipped?: boolean;
state?: any;
};
export type CharacterConfig = {
peoples: Record<string, RaceConfig>;
@@ -51,35 +57,44 @@ export type CharacterConfig = {
spells: SpellConfig[];
aspects: AspectConfig[];
features: Record<FeatureID, Feature>;
enchantments: Record<string, { name: string, effect: FeatureEffect[] }>; //TODO
items: Record<string, ItemConfig & { enchantments: string[] }>;
enchantments: Record<string, { name: string, effect: FeatureEffect[], power: number }>; //TODO
items: Record<string, ItemConfig>;
lists: Record<string, { id: string, name: string, [key: string]: any }[]>;
texts: Record<TextID, Localized>;
texts: Record<i18nID, Localized>;
};
export type ItemConfig = { id: string, weight?: number, price?: number, power: number } & (ArmorConfig | WeaponConfig | WondrousConfig | MundaneConfig);
export type ItemConfig = CommonItemConfig & (ArmorConfig | WeaponConfig | WondrousConfig | MundaneConfig);
type CommonItemConfig = {
id: string;
rarity: 'common' | 'uncommon' | 'rare' | 'legendary';
weight?: number; //Optionnal but highly recommended
price?: number; //Optionnal but highly recommended
power?: number; //Optionnal as most mundane items should not receive enchantments (potions, herbal heals, etc...)
charge?: number //Max amount of charges
equippable: boolean;
}
type ArmorConfig = {
category: 'armor';
name: string; //TODO -> TextID
description: TextID;
life: number;
absorb: number;
description: i18nID;
health: number;
absorb: { static: number, percent: number };
};
type WeaponConfig = {
category: 'armor';
category: 'weapon';
name: string; //TODO -> TextID
description: TextID;
damage: Dice;
description: i18nID;
damage: string; //Dice formula
};
type WondrousConfig = {
category: 'armor';
category: 'wondrous';
name: string; //TODO -> TextID
description: TextID;
description: i18nID;
effect: FeatureEffect[];
};
type MundaneConfig = {
category: 'armor';
category: 'mundane';
name: string; //TODO -> TextID
description: TextID;
description: i18nID;
};
export type SpellConfig = {
id: string;
@@ -120,7 +135,7 @@ export type AspectConfig = {
export type FeatureEffect = {
id: FeatureID;
category: "value";
operation: "add" | "set";
operation: "add" | "set" | "min";
property: string;
value: number | `modifier/${MainStat}` | false;
} | {
@@ -140,10 +155,10 @@ export type FeatureItem = FeatureEffect | {
exclusive: boolean; //Disallow to pick the same option twice
};
options: Array<FeatureEffect & { text: string }>;
}
};
export type Feature = {
id: FeatureID;
description: string;
description: i18nID;
effect: FeatureItem[];
};