Generate scenario on DOM load, not page load.
[heroik.git] / names.js
1 /* The person who associated a work with this deed has dedicated the
2 work to the public domain by waiving all of his or her rights to
3 the work worldwide under copyright law, including all related and
4 neighboring rights, to the extent allowed by law.
5
6 You can copy, modify, distribute and perform the work, even for
7 commercial purposes, all without asking permission.
8
9 See https://creativecommons.org/publicdomain/zero/1.0/ for details.
10 */
11
12 "use strict";
13
14 var ADJECTIVE = [
15 "Abandoned",
16 "Abysmal",
17 "Abyssal",
18 "Adamantine",
19 "Ancient",
20 "Angry",
21 "Arcane",
22 "ArCHing",
23 "Arctic",
24 "Arid",
25 "Bare",
26 "Bellowing",
27 "Betrayed",
28 "Bleak",
29 "Blooded",
30 "Boiling",
31 "Bottomless",
32 "Brilliant",
33 "BronZe",
34 "Brutal",
35 "Buried",
36 "Burning",
37 "Burnt",
38 "Chaotic",
39 "CHarnel",
40 "Cobalt",
41 "Cold",
42 "Collapsing",
43 "Conquered",
44 "Coral",
45 "Crescent",
46 "Cruel",
47 "Crying",
48 "Crystal",
49 "Cunning",
50 "Cursed",
51 "Damned",
52 "Dancing",
53 "Dark",
54 "Dead",
55 "Deadly",
56 "Decayed",
57 "Decaying",
58 "Deep",
59 "Deepest",
60 "Demonic",
61 "Depraved",
62 "Desert",
63 "Deserted",
64 "Desolate",
65 "Desolated",
66 "Destroyed",
67 "Diamond",
68 "Dire",
69 "Dishonored",
70 "Distant",
71 "Doomed",
72 "Dread",
73 "Dreaded",
74 "Dreadful",
75 "Dreamy",
76 "Dreary",
77 "Dry",
78 "Dying",
79 "Eastern",
80 "Ebon",
81 "Eclipsed",
82 "Elemental",
83 "Emerald",
84 "Empty",
85 "EnCHanted",
86 "Endless",
87 "Enigmatic",
88 "Erased",
89 "Eternal",
90 "Ethereal",
91 "Fabled",
92 "Fallen",
93 "False",
94 "FarTHest",
95 "Feared",
96 "Fearsome",
97 "Fire",
98 "Flowing",
99 "Foaming",
100 "Forbidden",
101 "Forgotten",
102 "Forsaken",
103 "Fractured",
104 "FroZen",
105 "Full Moon",
106 "Furious",
107 "Gentle",
108 "Ghostly",
109 "Glistening",
110 "Gloomy",
111 "Glowing",
112 "Goblin",
113 "Golden",
114 "Granite",
115 "Grey",
116 "Grim",
117 "GriZzly",
118 "Haunted",
119 "Hidden",
120 "Hollow",
121 "Hopeless",
122 "Howling",
123 "Hungry",
124 "InFernal",
125 "Infinite",
126 "Invisible",
127 "Iron",
128 "Jade",
129 "Jagged",
130 "Laughing",
131 "Lifeless",
132 "Liminal",
133 "Living",
134 "Lonely",
135 "Lost",
136 "Lower",
137 "Lucent",
138 "Lunar",
139 "Mad",
140 "Mighty",
141 "Mirrored",
142 "Misty",
143 "Moaning",
144 "Molten",
145 "Mourning",
146 "Murky",
147 "Mysterious",
148 "Mystic",
149 "MyTHic",
150 "Nameless",
151 "Narrow",
152 "Neglected",
153 "NeTHer",
154 "NeverEnding",
155 "Nightmare",
156 "Northern",
157 "Obliterated",
158 "Oblivion",
159 "Obsidian",
160 "Orc",
161 "Pale",
162 "PHantom",
163 "Poisoned",
164 "Prismic",
165 "Quick",
166 "Quiet",
167 "Raging",
168 "RainBow",
169 "Red",
170 "Restless",
171 "Roaring",
172 "Rocky",
173 "Rugged",
174 "Ruthless",
175 "Sad",
176 "Sanguine",
177 "Savage",
178 "Scarlet",
179 "Scorched",
180 "Screaming",
181 "Secret",
182 "Serene",
183 "Shadow",
184 "Shadowed",
185 "Shadowy",
186 "Shimmering",
187 "Shrieking",
188 "Shrouded",
189 "Shunned",
190 "Silent",
191 "Silver",
192 "Sleeping",
193 "Smoky",
194 "Smoldering",
195 "Southern",
196 "Specter",
197 "Spirit",
198 "Steel",
199 "Storm",
200 "Sunken",
201 "Swamp",
202 "Terraced",
203 "THundering",
204 "Tormented",
205 "Tranquil",
206 "Turbulent",
207 "Twilight",
208 "Twisted",
209 "Twisting",
210 "Uncanny",
211 "Unholy",
212 "UnLucky",
213 "Unknown",
214 "Unmourned",
215 "Unseen",
216 "Unspoken",
217 "Unstable",
218 "Vanished",
219 "Vanishing",
220 "Vanquished",
221 "Veiled",
222 "Vicious",
223 "Violent",
224 "Voiceless",
225 "Wailing",
226 "Wasted",
227 "WatCHing",
228 "Western",
229 "Whispering",
230 "Wicked",
231 "Wild",
232 "Windy",
233 "Winter",
234 "WiTHered",
235 "Yawning",
236 "Zealous",
237 ];
238
239 var LOCATION = [
240 "Abbey",
241 "Abyss",
242 "Alley",
243 "Barracks",
244 "Burrows",
245 "Castle",
246 "Catacomb",
247 "Cave",
248 "Caverns",
249 "CHambers",
250 "Chasm",
251 "Crypt",
252 "Delve",
253 "Demesne",
254 "Den",
255 "Desert",
256 "Domain",
257 "Drop",
258 "Dungeon",
259 "Egress",
260 "Fissure",
261 "Forest",
262 "Forge",
263 "Gate",
264 "Grave",
265 "Grotto",
266 "Hall",
267 "Halls",
268 "Haunt",
269 "Hole",
270 "Hollow",
271 "Ingress",
272 "Jail",
273 "Jungle",
274 "Keep",
275 "Labyrinth",
276 "Lair",
277 "Lake",
278 "Lowlands",
279 "Manse",
280 "Mansion",
281 "Marsh",
282 "Mausoleum",
283 "MaZe",
284 "Mine",
285 "Mound",
286 "Mountain",
287 "Necropolis",
288 "NightMare",
289 "Ossuary",
290 "Oubliette",
291 "Pale",
292 "Pass",
293 "Passage",
294 "Pit",
295 "Pool",
296 "Prison",
297 "Pyramid",
298 "Quarters",
299 "Refuge",
300 "Rest",
301 "Rift",
302 "Sepulchre",
303 "Shrine",
304 "Spring",
305 "Stockade",
306 "Swamp",
307 "THrone",
308 "Tomb",
309 "Tor",
310 "Tower",
311 "Tunnels",
312 "Vale",
313 "Valley",
314 "Vault",
315 "Waste",
316 ];
317
318 var STATE = [
319 "Abomination",
320 "Bloodlust",
321 "Bloodshed",
322 "CHange",
323 "Chaos",
324 "Courage",
325 "Cunning",
326 "DeJection",
327 "Death",
328 "Delusion",
329 "Destruction",
330 "Dread",
331 "Earth",
332 "Ennui",
333 "Fortune",
334 "Grief",
335 "Hate",
336 "Illness",
337 "InJury",
338 "Loneliness",
339 "Loss",
340 "Murder",
341 "Night",
342 "Oblivion",
343 "Pain",
344 "Quiet",
345 "Regret",
346 "Remorse",
347 "Ruin",
348 "Slumber",
349 "Sorrow",
350 "Torment",
351 "THreat",
352 "Valor",
353 "Vexation",
354 "Woe",
355 "Zealotry",
356 ];
357
358 var DENIZEN = [
359 "Alicorn",
360 "Army",
361 "Baku",
362 "Banshee",
363 "Bat",
364 "Bear",
365 "BogGart",
366 "Bunyip",
367 "CHangling",
368 "Cult",
369 "Demon",
370 "DraGon",
371 "Drake",
372 "Draugr",
373 "Dwarf",
374 "Eagle",
375 "Elf",
376 "Emperor",
377 "Erinyes",
378 "Ettin",
379 "Fae",
380 "Fairy",
381 "Full Moon",
382 "Furies",
383 "Ghoul",
384 "Giant",
385 "Goblin",
386 "Guardian",
387 "Harpy",
388 "Heart",
389 "Hellhound",
390 "Hob",
391 "Horsemen",
392 "Hound",
393 "Huldra",
394 "Huma",
395 "Hunter",
396 "Hydra",
397 "Ifrit",
398 "Imp",
399 "Incubus",
400 "Irrlicht",
401 "Jiangshi",
402 "Jinn",
403 "KaPpa",
404 "Kelpie",
405 "King",
406 "Kirin",
407 "Kobold",
408 "Lamia",
409 "Legion",
410 "Leopard",
411 "Lich",
412 "Lion",
413 "Lynx",
414 "Mage",
415 "Mandrake",
416 "Mara",
417 "Mermaid",
418 "Monk",
419 "Moon",
420 "Naga",
421 "Naiad",
422 "Nekomata",
423 "Nue",
424 "Nymph",
425 "Ogre",
426 "Oni",
427 "Oracle",
428 "Orc",
429 "Panther",
430 "Pegasus",
431 "PHantasm",
432 "PHantom",
433 "PHoenix",
434 "Pixie",
435 "Priest",
436 "Python",
437 "Queen",
438 "QuinoTaur",
439 "RainBow",
440 "Raven",
441 "Roc",
442 "Salamander",
443 "Satyr",
444 "Scorpion",
445 "Selkie",
446 "SerPent",
447 "Slyph",
448 "Soldier",
449 "Sphinx",
450 "Spider",
451 "Strigoi",
452 "Tanuki",
453 "Taotie",
454 "Tarasque",
455 "Tengu",
456 "THief",
457 "THunderbird",
458 "Titan",
459 "Troll",
460 "Undead",
461 "Undine",
462 "Unicorn",
463 "Valkyrie",
464 "Vampire",
465 "WarLord",
466 "Warrior",
467 "Wendigo",
468 "Werewolf",
469 "WiZard",
470 "Witch",
471 "Wolf",
472 "Wraith",
473 "Wyrm",
474 "Wyvern",
475 "Yama-Uba",
476 "Yeti",
477 "Youkai",
478 "Zombie",
479 "dJinn",
480 "kNight",
481 ];
482
483 function capitalize (s) {
484 return s.split(" ").map(function (s) {
485 return s[0].toUpperCase() + s.slice(1).toLowerCase();
486 }).join(" ");
487 }
488
489 function consonant (b) {
490 var a = this.replace(/C/g, 'K')
491 .replace(/PH/g, 'F')
492 .replace(/[^A-Z]+/g, ' ')
493 .trimRight().split(/ +/g);
494 var b = b.replace(/C/g, 'K')
495 .replace(/PH/g, 'F')
496 .replace(/[^A-Z]+/g, ' ')
497 .trimRight().split(/ +/g);
498 return intersects(a, b);
499 }
500
501 function generateName () {
502 var location = choice(LOCATION);
503 var denizen = capitalize(choice(
504 DENIZEN.filter(consonant, location)));
505 var adjective = capitalize(choice(
506 ADJECTIVE.filter(consonant, location)));
507 var state = capitalize(choice(
508 STATE.filter(consonant, location)));
509 location = capitalize(location);
510 return choice([
511 ["The", denizen + "'s", location],
512 ["The", adjective, location],
513 ["The", location, "of", state],
514 [state + "'s", location],
515 ["The", location, "of", "the", denizen],
516 choice([
517 [capitalize(choice(ADJECTIVE)), denizen, location],
518 [adjective, denizen, capitalize(choice(LOCATION))],
519 ]),
520 ]).join(" ");
521 }