/** * The `Condition` enum (server `lib/core/enums.dart`). The state serializes * conditions as their index; the wire commands `addCondition` / * `removeCondition` take the enum *name*. */ export const CONDITIONS = [ { name: 'stun', label: 'Stunned' }, { name: 'immobilize', label: 'Immobilized' }, { name: 'disarm', label: 'Disarmed' }, { name: 'wound', label: 'Wounded' }, { name: 'wound2', label: 'Wounded x2' }, { name: 'muddle', label: 'Muddled' }, { name: 'poison', label: 'Poisoned' }, { name: 'poison2', label: 'Poisoned x2' }, { name: 'poison3', label: 'Poisoned x3' }, { name: 'poison4', label: 'Poisoned x4' }, { name: 'bane', label: 'Bane' }, { name: 'brittle', label: 'Brittle' }, { name: 'chill', label: 'Chilled' }, { name: 'infect', label: 'Infected' }, { name: 'impair', label: 'Impaired' }, { name: 'rupture', label: 'Ruptured' }, { name: 'plague', label: 'Plagued' }, { name: 'strengthen', label: 'Strengthened' }, { name: 'invisible', label: 'Invisible' }, { name: 'regenerate', label: 'Regenerating' }, { name: 'ward', label: 'Warded' }, { name: 'dodge', label: 'Dodging' }, { name: 'safeguard', label: 'Safeguard' }, { name: 'shield', label: 'Shielded' }, { name: 'retaliate', label: 'Retaliating' }, // character1..4 are custom per-character slots; they are managed by the // game data, not the condition menu, so they are excluded here. ] as const; export type ConditionName = (typeof CONDITIONS)[number]['name']; /** Human label for a condition index (falling back to the index). */ export function conditionLabel(index: number): string { const c = CONDITIONS[index]; return c ? c.label : `condition ${index}`; } /** Wire name for a condition index (falling back to the index). */ export function conditionName(index: number): string { const c = CONDITIONS[index]; return c ? c.name : `condition${index}`; } /** True when [index] is chill or plague (rendered with a coloured chip). */ export function conditionChipClass(index: number): string { const name = CONDITIONS[index]?.name; if (name === 'chill') return 'cond cond--chill'; if (name === 'plague') return 'cond cond--plague'; return 'cond'; }