Skip to content

Instantly share code, notes, and snippets.

@justin-carver
Created January 31, 2023 02:40
Show Gist options
  • Save justin-carver/525b3c5de3ab14a55bab0a5e1fe0fd0d to your computer and use it in GitHub Desktop.
Save justin-carver/525b3c5de3ab14a55bab0a5e1fe0fd0d to your computer and use it in GitHub Desktop.
Bleak Lands Chapter Generator
const rumors = [
'Lost Artifact',
'Ravenous Beast',
'Forbidden Knowledge',
'Dire Prophecy',
'Splintered Chains',
'Cursed Flame',
'Hidden Truths',
'Dark Odyssey',
'Phantom Sword',
'Rising Evil',
'Deadly Plots',
'Enduring Agony',
'Secret Treaty',
'Fading Heroes',
'Sorcerous Storms',
'Stygian Grail',
'Charnel Choir',
'Unholy Pact',
'Spellbound Horror',
'Fabled Oaths',
'Demon\'s Boon',
'Fallen Empire'
];
const quests = [
'Undead Reagent',
'Broken Throne',
'Frozen Steel',
'Blighted Path',
'Forgotten Gods',
'Shattered Dreams',
'Endless Night',
'Witch Hunt',
'Foul Ritual',
'Shadow March',
'Iron Reign',
'Burning Effigy',
'Scarlet Conquest',
'Corrupt Bargain',
'Spectral Host',
'Morbid Omen',
'Vile Descent',
'Dread Tide',
'Plague Prophet',
'Cataclysmic Portent',
'Mystic War',
'Cruel Fates',
];
const locations = [
'Torn Reality',
'Ancient Lair',
'Twisted Labrynth',
'Dark Fens',
'Shallow Grave',
'Charred Citadel',
'Shadowy Keep',
'Forsaken Castle',
'Bleak Shrine',
'Rusted City',
'Distant Isles',
'Murky Mire',
'Infernal Grotto',
'Ominous Chasm',
'Misty Woods',
'Black Crypt',
'Lost Shrine',
'Sunken Dungeon',
'Wretched Wastes',
'Festering Abyss',
'Gallows Cross',
'Arid Glade'
];
let output = [];
const generateList = () => {
const selectedQuests = [];
const selectedLocations = [];
const selectedRumors = [];
for (let i = 0; i < 22; i++) {
let quest = quests[Math.floor(Math.random() * quests.length)];
output.push(`Quest: ${quest}`);
quests.splice(quests.indexOf(quest), 1);
}
for (let i = 0; i < 22; i++) {
let location = locations[Math.floor(Math.random() * locations.length)];
output.push(`Location: ${location}`);
locations.splice(locations.indexOf(location), 1);
}
for (let i = 0; i < 22; i++) {
let rumor = rumors[Math.floor(Math.random() * rumors.length)];
output.push(`Rumor: ${rumor}`);
rumors.splice(rumors.indexOf(rumor), 1);
}
}
const shuffle = (array) => {
let currentIndex = array.length, randomIndex;
// While there remain elements to shuffle.
while (currentIndex != 0) {
// Pick a remaining element.
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex--;
// And swap it with the current element.
[array[currentIndex], array[randomIndex]] = [
array[randomIndex], array[currentIndex]];
}
return array;
}
generateList();
let iteration = 25;
for (let x = 0; x < iteration; x++) {
shuffle(output);
};
output.forEach((el, i) => {
// i % 3 === 0 ? process.stdout.write(`\n`) : null;
console.log(el, i + 1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment