File size: 1,215 Bytes
1a343cd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | import { randomChoice, type RandomSource } from './rng';
import type { PlantType } from './types';
const PREFIXES: Record<PlantType, string[]> = {
Indica: ['Frost', 'Iron', 'Shadow', 'Glacier', 'Stone', 'Night', 'Crystal', 'Dark', 'Ash', 'Obsidian'],
Sativa: ['Solar', 'Flare', 'Blaze', 'Sky', 'Thunder', 'Fire', 'Sun', 'Lightning', 'Nova', 'Volt'],
Hybrid: [
'Velvet',
'Crimson',
'Ghost',
'Nebula',
'Silver',
'Phantom',
'Storm',
'Echo',
'Twilight',
'Lunar',
'Myco',
'Drift',
'Shade',
'Plasma',
'Oblivion',
'Mist',
'Hollow',
'Nova',
'Wisp',
'Onyx',
'Zephyr',
'Glow',
'Pulse',
'Eclipse',
'Spore',
'Dust',
'Sable',
'Prism',
'Wraith',
'Ashen',
'Flicker',
'Thorn',
'Rune',
'Haze',
'Tide',
'Shiver',
'Grime',
'Rift',
'Quartz',
'Solstice',
],
};
const MIDDLES = ['leaf', 'bloom', 'root', 'spark', 'shade', 'flare', 'dusk', 'shard', 'pulse', 'drift'];
export function generateName(type: PlantType = 'Hybrid', rng: RandomSource = Math.random): string {
return `${randomChoice(PREFIXES[type] ?? PREFIXES.Hybrid, rng)}${randomChoice(MIDDLES, rng)}`;
}
|