Added Dungeon and Plot hook gens

This commit is contained in:
Daniel Stirba 2023-02-10 12:19:49 +11:00
parent deaa5a16f5
commit cfd6f9bab5
4 changed files with 120 additions and 5 deletions

47
generators/dungeon.ts Normal file
View file

@ -0,0 +1,47 @@
import { dungeonGenSettings } from "main";
export function generateDungeonName(settings: dungeonGenSettings): string {
const prefix: string[] = settings.dungeonTypes;
const adjective: string[] = settings.adjectives;
const noun: string[] = settings.nouns;
const locations: string[] = settings.locations;
const randomDesc: string[] = settings.randomDesc;
const prefixIndex = Math.floor(Math.random() * prefix.length);
const adjIndex = Math.floor(Math.random() * adjective.length);
const locIndex = Math.floor(Math.random() * locations.length);
const randomDescIndex = Math.floor(Math.random() * randomDesc.length);
const nounIndex = Math.floor(Math.random() * noun.length);
const usePrefix = Math.random() > 0.5;
let result;
if (usePrefix) {
result = {
name: `${prefix[prefixIndex]} of the ${adjective[adjIndex]} ${noun[nounIndex]}`,
description: generateDungeonDescription(locations[locIndex], prefix[prefixIndex], randomDesc[randomDescIndex])
};
} else {
result = {
name: `The ${adjective[adjIndex]} ${noun[nounIndex]}`,
description: generateDungeonDescription(locations[locIndex], prefix[prefixIndex], randomDesc[randomDescIndex])
}
}
return `${result.name}\nDescription: ${result.description}`
}
function generateDungeonDescription(location: string, dungeonType: string, randomDesc: string): string {
const templates = [
`Located in ${location}, this ${dungeonType} is known for ${randomDesc}.`,
`A ${dungeonType} that is known for ${randomDesc}.`,
`In the heart of ${location} lies this ${dungeonType}, notorious for ${randomDesc}.`,
`Deep within ${location}, the ${dungeonType} is feared for its ${randomDesc}.`,
`This ${dungeonType} located in ${location} is infamous for its ${randomDesc}.`,
`The ${dungeonType} in ${location} is a place to be reckoned with, famous for its ${randomDesc}.`
];
const templateIndex = Math.floor(Math.random() * templates.length);
return templates[templateIndex];
}

19
generators/plothook.ts Normal file

File diff suppressed because one or more lines are too long

45
main.ts

File diff suppressed because one or more lines are too long

View file

@ -19,9 +19,11 @@ import { generateInn } from "generators/inn";
import { generatePathfinderName } from "generators/Pathfinder/pathfinderName";
import { ISettlementDomainObject } from "fantasy-content-generator/dist/interfaces";
import { generateMiscellaneousArtifacts } from "generators/artifact";
import { generateDungeonName } from "generators/dungeon";
import { generatePlotHook } from "generators/plothook";
const races: string[] = ["none","none", "inn", "settlement", "none", "airships", "drinks","artifacts", "loot", "metals", "magicaltrees", "ship", "none", "animalgroups", "groups", "religion", "none", "aasimars", "catfolk", "fetchlings","halfelf","halforc","hobgoblin","ifrits","kobalds","oreads","ratfolk","sylphs","tengu","tians","tiefling","undines","angel", "cavePerson", "darkelf", "demon", "dragon", "drow", "dwarf", "elf", "fairy", "gnome", "goblin", "halfdemon", "halfling", "highelf", "highfairy", "human", "ogre", "orc"];
const racesDisplayName: string[] = ["Select a Generator to Start","--[Settlements and Buildings]--", "Inn's & Taverns", "Settlement", "--[Objects and Vehicles]--", "Airships", "Drinks","Artifacts", "Loot And Treasure", "Metals", "Magical Trees", "Ship", "--[Groups and Religions]--", "Animal Groups", "Groups", "Religion", "--[Races]--", "Aasimars", "Catfolk", "Fetchlings","Half-Elf","Half-Orc","Hobgoblin","Ifrits","Kobalds","Oreads","Ratfolk","Sylphs","Tengu","Tians","Tiefling","Undines","Angel", "Cave Person", "Dark Elf", "Demon", "Dragon", "Drow", "Dwarf", "Elf", "Fairy", "Gnome", "Goblin", "Half Demon", "Halfling", "High Elf", "High Fairy", "Human", "Ogre", "Orc"];
const races: string[] = ["none", "none", "dungeon", "inn", "settlement", "none", "airships", "drinks", "artifacts", "loot", "metals", "magicaltrees", "ship", "none", "animalgroups", "groups", "religion", "none", "aasimars", "catfolk", "fetchlings", "halfelf", "halforc", "hobgoblin", "ifrits", "kobalds", "oreads", "ratfolk", "sylphs", "tengu", "tians", "tiefling", "undines", "angel", "cavePerson", "darkelf", "demon", "dragon", "drow", "dwarf", "elf", "fairy", "gnome", "goblin", "halfdemon", "halfling", "highelf", "highfairy", "human", "ogre", "orc", "none", "plothook"];
const racesDisplayName: string[] = ["Select a Generator to Start", "--[Settlements and Buildings]--", "Dungeons & Labryinths", "Inn's & Taverns", "Settlement", "--[Objects and Vehicles]--", "Airships", "Drinks", "Artifacts", "Loot And Treasure", "Metals", "Magical Trees", "Ship", "--[Groups and Religions]--", "Animal Groups", "Groups", "Religion", "--[Races]--", "Aasimars", "Catfolk", "Fetchlings", "Half-Elf", "Half-Orc", "Hobgoblin", "Ifrits", "Kobalds", "Oreads", "Ratfolk", "Sylphs", "Tengu", "Tians", "Tiefling", "Undines", "Angel", "Cave Person", "Dark Elf", "Demon", "Dragon", "Drow", "Dwarf", "Elf", "Fairy", "Gnome", "Goblin", "Half Demon", "Halfling", "High Elf", "High Fairy", "Human", "Ogre", "Orc", "--[Story Tools]--", "Plot & Story Hooks"];
const pathfinderFilter = ["aasimars", "catfolk", "fetchlings","halfelf","halforc","hobgoblin","ifrits","kobalds","oreads","ratfolk","sylphs","tengu","tians","tiefling","undines"];
let genSettings = {
@ -61,7 +63,13 @@ export class GeneratorModal extends Modal {
break;
case "ship":
this.generatorCustomSettings(optionsDiv, amountToGen, generateShipName);
break;
break;
case "dungeon":
this.generatorCustomSettings(optionsDiv, amountToGen, generateDungeonName, this.plugin.settings.dungeonSettings);
break;
case "plothook":
this.generatorCustomSettings(optionsDiv, amountToGen, generatePlotHook);
break;
case "religion":
this.generatorCustomSettings(optionsDiv, amountToGen, generatorReligions);
break;