Feature Builder panel progress

This commit is contained in:
2025-08-11 09:39:41 +02:00
parent 86556ec604
commit 920ce2e1b6
23 changed files with 4924 additions and 4534 deletions

63
types/character.d.ts vendored
View File

@@ -40,10 +40,11 @@ export type CharacterValues = {
};
export type CharacterConfig = {
peoples: RaceConfig[],
training: Record<MainStat, Record<TrainingLevel, TrainingOption[]>>;
training: Record<MainStat, Record<TrainingLevel, string[]>>;
abilities: Record<Ability, AbilityConfig>;
spells: SpellConfig[];
aspects: AspectConfig[];
features: Record<string, Feature>;
};
export type SpellConfig = {
id: string;
@@ -64,7 +65,7 @@ export type AbilityConfig = {
export type RaceConfig = {
name: string;
description: string;
options: Record<Level, Feature[]>;
options: Record<Level, string[]>;
};
export type AspectConfig = {
name: string;
@@ -80,23 +81,22 @@ export type AspectConfig = {
};
export type FeatureEffect = {
id: string;
category: "value";
operation: "add" | "set";
property: string;
value: number | `modifier/${MainStat}`;
} | {
category: "feature";
kind: "action" | "reaction" | "freeaction" | "passive";
text: string;
value: number | `modifier/${MainStat}` | false;
} | {
id: string;
category: "list";
list: "spells";
list: "spells" | "action" | "reaction" | "freeaction" | "passive";
action: "add" | "remove";
item: string;
extra?: any;
};
export type FeatureItem = FeatureEffect | {
category: "choice";
id: string;
category: "choice";
settings?: { //If undefined, amount is 1 by default
amount: number;
exclusive: boolean; //Disallow to pick the same option twice
@@ -104,55 +104,26 @@ export type FeatureItem = FeatureEffect | {
options: Array<FeatureEffect & { text: string }>;
}
export type Feature = {
name?: string;
id: 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<keyof CompiledCharacter["defense"]>;
resistance?: Record<MainStat, number>;
bonus?: Record<string, number>;
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;
health: number; //Max
mana: number; //Max
race: number;
spellslots: number;
artslots: number;
spellslots: number; //Max
artslots: number; //Max
spellranks: Record<SpellType, 0 | 1 | 2 | 3>;
aspect: string;
aspect: string; //ID
speed: number | false;
capacity: number | false;
initiative: number;
spells: string[];
values: CharacterValues,
@@ -183,7 +154,7 @@ export type CompiledCharacter = {
modifier: Record<MainStat, number>;
abilities: Partial<Record<Ability, number>>;
level: number;
features: { [K in Extract<FeatureEffect, { category: "feature" }>["kind"]]?: string[] };
lists: { [K in Extract<FeatureEffect, { category: "list" }>["list"]]?: string[] };
notes: string;
};