| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import { Castor } from './Castor';
- import type { Character, CharacterStats } from './Character';
- import { Chat } from './Chat';
- import { Gege } from './Gege';
- import { Leon } from './Leon';
- import { Generic } from './Generic';
- import { Magicien } from './Magicien';
- import { Mamie } from './Mamie';
- import { Pompier } from './Pompier';
- import { Prout } from './Prout';
- import { Pyromanchot } from './Pyromanchot';
- import { Tatie } from './Tatie';
- // Menu order (readme §4 table), then the test character.
- const registry: Record<string, new (stats: CharacterStats) => Character> = {
- castor: Castor,
- mamie: Mamie,
- pyromanchot: Pyromanchot,
- gege: Gege,
- pompier: Pompier,
- prout: Prout,
- chat: Chat,
- magicien: Magicien,
- tatie: Tatie,
- leon: Leon,
- generic: Generic,
- };
- /** Characters offered to players (the test character is for development only). */
- export const PLAYABLE_CHARACTER_IDS = Object.keys(registry).filter((id) => id !== 'generic');
- /** Ids of playable characters, in menu order. */
- export const CHARACTER_IDS = Object.keys(registry);
- export function isCharacterId(id: string): boolean {
- return Object.hasOwn(registry, id);
- }
- export function createCharacter(stats: CharacterStats): Character {
- const ctor = registry[stats.id];
- if (!ctor) throw new Error(`Unknown character "${stats.id}"`);
- return new ctor(stats);
- }
- export { Anim, Character, parseCharacterStats } from './Character';
- export type { Blast, CharacterContext, CharacterCue, CharacterStats, ProjectileSpec, Spell, TurretSpec } from './Character';
|