import type { MAIN_STATS, ABILITIES, LEVELS, TRAINING_LEVELS, SPELL_TYPES, CATEGORIES, SPELL_ELEMENTS } from "#shared/character.util"; export type MainStat = typeof MAIN_STATS[number]; export type Ability = typeof ABILITIES[number]; export type Level = typeof LEVELS[number]; export type TrainingLevel = typeof TRAINING_LEVELS[number]; export type SpellType = typeof SPELL_TYPES[number]; export type Category = typeof CATEGORIES[number]; export type SpellElement = typeof SPELL_ELEMENTS[number]; export type FeatureID = string; export type Alignment = { loyalty: 'loyal' | 'neutral' | 'chaotic', kindness: 'good' | 'neutral' | 'evil' }; export type Character = { id: number; name: string; people?: number; level: number; aspect?: number; notes?: string | null; health: number; mana: number; training: Record>>; leveling: Partial>; abilities: Partial>; //First is the ability, second is the max increment spells: string[]; //Spell ID modifiers: Partial>; choices: Record; owner: number; username?: string; visibility: "private" | "public"; }; export type CharacterVariables = { health: number; mana: number; sickness: Array<{ id: string, progress: number | true }>; equipment: Array; }; export type CharacterConfig = { peoples: RaceConfig[], training: Record>; abilities: Record; spells: SpellConfig[]; aspects: AspectConfig[]; features: Record; lists: Record; }; export type SpellConfig = { id: string; name: string; rank: 1 | 2 | 3 | 4; type: SpellType; cost: number; speed: "action" | "reaction" | number; elements: Array; effect: string; tags?: string[]; }; export type AbilityConfig = { max: [MainStat, MainStat]; name: string; description: string; }; export type RaceConfig = { name: string; description: string; options: Record; }; 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 = { id: FeatureID; category: "value"; operation: "add" | "set"; property: string; value: number | `modifier/${MainStat}` | false; } | { id: FeatureID; category: "list"; list: "spells" | "sickness" | "action" | "reaction" | "freeaction" | "passive"; action: "add" | "remove"; item: string; extra?: any; }; export type FeatureItem = FeatureEffect | { id: FeatureID; category: "choice"; text: string; settings?: { //If undefined, amount is 1 by default amount: number; exclusive: boolean; //Disallow to pick the same option twice }; options: Array; } export type Feature = { id: FeatureID; description: string; effect: FeatureItem[]; }; export type CompiledCharacter = { id: number; owner?: number; username?: string; name: string; health: number; //Max mana: number; //Max race: number; spellslots: number; //Max artslots: number; //Max spellranks: Record; aspect: string; //ID speed: number | false; capacity: number | false; initiative: number; variables: CharacterVariables, defense: { hardcap: number; 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; magicinstinct: number; }; bonus: Record; //Any special bonus goes here resistance: Record; modifier: Record; abilities: Partial>; level: number; lists: { [K in Extract["list"]]?: string[] }; notes: string; };