import type { MAIN_STATS, ABILITIES, LEVELS, TRAINING_LEVELS, SPELL_TYPES, CATEGORIES, SPELL_ELEMENTS } from "~/shared/character"; 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 DoubleIndex = [T, number]; export type Character = { id: number; name: string; people?: number; level: number; aspect?: number; notes?: string | null; health: number; mana: number; training: Record[]>; leveling: DoubleIndex[]; 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 CharacterValues = { health: number; mana: number; }; export type CharacterConfig = { peoples: Race[], training: Record>; abilities: Record; spells: SpellConfig[]; }; 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 Race = { name: string; description: string; options: Record; }; export type FeatureEffect = { category: "value"; operation: "add" | "set"; property: string; value: number | `modifier/${MainStat}`; } | { category: "feature"; kind: "action" | "reaction" | "freeaction" | "passive"; text: string; } | { category: "list"; list: "spells"; action: "add" | "remove"; item: string; }; export type FeatureItem = FeatureEffect | { category: "choice"; id: string; settings?: { //If undefined, amount is 1 by default amount: number; exclusive: boolean; //Disallow to pick the same option twice }; options: FeatureEffect[]; } export type Feature = { name?: string; description: string; effect: FeatureItem[]; }; 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; resistance?: Record; bonus?: Record; spell?: string; //Used during character creation, not used by compiler modifier?: number; ability?: number; spec?: number; spellslot?: number | MainStat; arts?: number | MainStat; features?: FeatureItem[]; //TODO }; export type CompiledCharacter = { id: number; owner?: number; username?: string; name: string; health: number; mana: number; race: number; spellslots: number; artslots: number; spellranks: Record; aspect: string; speed: number | false; initiative: number; spells: string[]; values: CharacterValues, 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; features: { [K in Extract["kind"]]: string[] }; notes: string; };