weed-sim / src /shared /nameGenerator.ts
Yufok1
Checkpoint Devvit v0.0.24
1a343cd
Raw
History Blame Contribute Delete
1.22 kB
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)}`;
}