diff options
Diffstat (limited to 'web/src/lib/game/line/tokens.ts')
| -rw-r--r-- | web/src/lib/game/line/tokens.ts | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/web/src/lib/game/line/tokens.ts b/web/src/lib/game/line/tokens.ts new file mode 100644 index 0000000..ed070ba --- /dev/null +++ b/web/src/lib/game/line/tokens.ts @@ -0,0 +1,95 @@ +/** + * The ability-line token table and element check (the reference `LineBuilder`'s + * `tokens` map + `isElement`, PORTING.md ยง8b). Token keys are the `%token%` + * names used in card lines; values are the display labels (translated by the + * in-game `t()` at render time, so the English label is the key's translation). + */ + +export const TOKENS: Record<string, string> = { + attack: 'Attack', + move: 'Move', + teleport: 'Teleport', + range: 'Range', + heal: 'Heal', + target: 'Target', + shield: 'Shield', + loot: 'Loot', + retaliate: 'Retaliate', + jump: 'Jump', + stun: 'STUN', + wound: 'WOUND', + disarm: 'DISARM', + immobilize: 'IMMOBILIZE', + poison: 'POISON', + invisible: 'INVISIBLE', + strengthen: 'STRENGTHEN', + muddle: 'MUDDLE', + regenerate: 'REGENERATE', + ward: 'WARD', + impair: 'IMPAIR', + bane: 'BANE', + brittle: 'BRITTLE', + chill: 'CHILL', + infect: 'INFECT', + rupture: 'RUPTURE', + push: 'PUSH', + pull: 'PULL', + pierce: 'PIERCE', + curse: 'CURSE', + enfeeble: 'ENFEEBLE', + empower: 'EMPOWER', + bless: 'BLESS', + safeguard: 'SAFEGUARD', + flip: 'ROLLING', + damage: 'damage', + and: 'and' +}; + +/** True when [name] is one of the five elements (or "any"). */ +export function isElement(name: string): boolean { + return ( + name.includes('air') || + name.includes('earth') || + name.includes('fire') || + name.includes('ice') || + name.includes('dark') || + name.includes('light') || + name === 'any' + ); +} + +/** + * Tokens whose graphic has both a Gloomhaven and a Frosthaven variant + * (the reference `hasGHVersion` / `_ghVersionSet`). Only these get the `_fh` + * image suffix when the card renders in Frosthaven style; the rest reuse the + * single graphic. + */ +const GH_VERSION_SET = new Set([ + 'attack', + 'damage', + 'disarm', + 'flying', + 'heal', + 'immobilize', + 'invisible', + 'jump', + 'loot', + 'move', + 'pierce', + 'poison', + 'push', + 'pull', + 'stun', + 'target', + 'range', + 'retaliate', + 'shield', + 'strengthen', + 'teleport', + 'use', + 'wound' +]); + +export function hasGHVersion(name: string): boolean { + return GH_VERSION_SET.has(name); +} |
