2023-02-18 01:32:13 +00:00
|
|
|
import { groupGenSettings } from "settings/Datatypes";
|
2023-02-08 13:13:11 +00:00
|
|
|
|
|
|
|
|
export function generatorGroups(settings:groupGenSettings) {
|
|
|
|
|
const adjectives = settings.adj;
|
|
|
|
|
const nouns = settings.nouns;
|
|
|
|
|
const nounsPlural = settings.nounsP;
|
|
|
|
|
const groupTypes = settings.groupTypes;
|
|
|
|
|
const singleDescriptors = settings.singleDescriptors;
|
2023-02-03 10:55:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
const i = Math.floor(Math.random() * 10); {
|
|
|
|
|
let names;
|
|
|
|
|
if (i < 4) {
|
2023-02-08 13:13:11 +00:00
|
|
|
const rnd0 = Math.floor(Math.random() * adjectives.length);
|
|
|
|
|
const rnd1 = Math.floor(Math.random() * nouns.length);
|
|
|
|
|
const rnd2 = Math.floor(Math.random() * groupTypes.length);
|
|
|
|
|
names = "The " + adjectives[rnd0] + " " + nouns[rnd1] + " " + groupTypes[rnd2];
|
2023-02-03 10:55:51 +00:00
|
|
|
} else if (i < 8) {
|
2023-02-08 13:13:11 +00:00
|
|
|
const rnd0 = Math.floor(Math.random() * adjectives.length);
|
|
|
|
|
const rnd1 = Math.floor(Math.random() * nounsPlural.length);
|
|
|
|
|
names = "The " + adjectives[rnd0] + " " + nounsPlural[rnd1];
|
2023-02-03 10:55:51 +00:00
|
|
|
} else {
|
2023-02-08 13:13:11 +00:00
|
|
|
const rnd0 = Math.floor(Math.random() * singleDescriptors.length);
|
|
|
|
|
names = "The " + singleDescriptors[rnd0];
|
2023-02-03 10:55:51 +00:00
|
|
|
}
|
|
|
|
|
return names;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|