App.Intro.generateEstablishedArcologies = function() {
	/* setup */
	let allowedFS = ["ArabianRevivalist", "AssetExpansionist", "AztecRevivalist", "BodyPurist", "ChattelReligionist", "ChineseRevivalist", "EdoRevivalist", "EgyptianRevivalist", "Eugenics", "HedonisticDecadence", "IntellectualDependency", "MaturityPreferentialist", "Multiculturalist", "Pastoralist", "Paternalist", "PetiteAdmiration", "PhysicalIdealist", "Repopulationist", "RomanRevivalist", "SlaveProfessionalism", "SlimnessEnthusiast", "StatuesqueGlorification", "Subjugationist", "Supremacist", "TransformationFetishist", "YouthPreferentialist"];
	if (V.seeDicks !== 0) {
		allowedFS.push("GenderRadicalist");
	}
	if (V.seeDicks !== 100) {
		allowedFS.push("GenderFundamentalist");
	}
	if (V.seeExtreme !== 0) {
		allowedFS.push("Degradationist");
	}
	const terrainTypes = ["marine", "marine", "oceanic", "ravine", "rural", "rural", "rural", "urban", "urban"];
	const continents = ["Africa", "Asia", "Asia", "Australia", "Europe", "Europe", "Japan", "North America", "North America", "South America", "the Middle East"];
	const races = ["amerindian", "asian", "black", "indo-aryan", "latina", "malay", "middle eastern", "mixed race", "pacific islander", "semitic", "southern european", "white"];

	let targets = 4;
	if (V.PC.career === "arcology owner") {
		targets += 2;
	}

	/* generation */
	const fragment = document.createDocumentFragment();
	for (let i = 0; i < targets; i++) {
		fragment.append(arcologyCard());
	}
	return fragment;

	function arcologyCard() {
		const arcology = generateArcology();
		const div = document.createElement("div");
		div.classList.add("card");

		div.append(App.UI.DOM.passageLink(arcology.name, "Intro Summary", () => {
			V.targetArcology = arcology;
			V.terrain = arcology.terrain;
			V.continent = arcology.continent;
			V.language = arcology.language;
			arcology.apply();
		}));

		div.append(" is an established arcology located in a Free City ");
		if (arcology.terrain === "urban") {
			div.append(`carved out of an urban area of ${arcology.continent}.`);
		} else if (arcology.terrain === "rural") {
			div.append(`built in a rural area of ${arcology.continent}.`);
		} else if (arcology.terrain === "marine") {
			div.append(`constructed just offshore of ${arcology.continent}.`);
		} else if (arcology.terrain === "ravine") {
			div.append(`constructed in a large canyon of ${arcology.continent}.`);
		} else {
			div.append(`in the middle of the ocean.`);
		}

		function newLine(...content) {
			const line = document.createElement("div");
			line.classList.add("indent");
			line.append(...content);
			div.append(line);
		}

		if (arcology.prosperity >= 60) {
			newLine("It is unusually prosperous for a vulnerable arcology.");
		} else if (arcology.prosperity <= 40) {
			newLine("It has little economic prosperity and is vulnerable.");
		}

		if (arcology.citizens > 0) {
			newLine("It has an unusually high ratio of citizens to sex slaves, increasing demand for sexual services.");
		} else if (arcology.citizens < 0) {
			newLine("It has an unusually low ratio of citizens to sex slaves, reducing demand for sexual services.");
		}

		let innerDiv = document.createElement("div");
		innerDiv.classList.add("indent");
		div.append(innerDiv);

		innerDiv.append("Its society ");
		if (arcology.FSProgress >= 50) {
			innerDiv.append("has advanced towards");
		} else if (arcology.FSProgress >= 30) {
			innerDiv.append("has devoted resources to");
		} else {
			innerDiv.append("has just begun to adopt");
		}
		innerDiv.append(" ");
		switch (arcology.fs) {
			case "Supremacist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Supremacy of the ${arcology.race} ${arcology.race !== "mixed race" ? "race" : ""}.`, ["intro", "question"]));
				break;
			case "Subjugationist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Subjugation of the ${arcology.race} ${arcology.race !== "mixed race" ? "race" : ""}.`, ["intro", "question"]));
				break;
			case "GenderRadicalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Gender Radicalism,`, ["intro", "question"]), " a movement that supports feminization of slavegirls with dicks.");
				break;
			case "GenderFundamentalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Gender Fundamentalism,`, ["intro", "question"]), " a reaction to modern libertinism that seeks to reinforce gender roles.");
				break;
			case "Paternalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Paternalism,`, ["intro", "question"]), " an optimistic strain of slavery that protects and improves slaves.");
				break;
			case "Degradationist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Degradationism,`, ["intro", "question"]), " an extreme branch of modern slavery that treats slaves as subhuman.");
				break;
			case "AssetExpansionist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Asset Expansionism,`, ["intro", "question"]), " a societal preoccupation with expansion of body parts, especially breasts.");
				break;
			case "SlimnessEnthusiast":
				innerDiv.append(App.UI.DOM.makeElement("span", `Slimness Enthusiasm,`, ["intro", "question"]), " an aesthetic movement that fetishizes the lithe female form.");
				break;
			case "TransformationFetishist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Transformation Fetishism,`, ["intro", "question"]), " a focus on implants and other kinds of surgical alteration.");
				break;
			case "BodyPurist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Body Purism,`, ["intro", "question"]), " a reaction to extreme surgical fetishism that prefers bodies grown biologically.");
				break;
			case "MaturityPreferentialist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Maturity Preferentialism,`, ["intro", "question"]), " an appetite for mature slaves based on MILF fetishism.");
				break;
			case "YouthPreferentialist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Youth Preferentialism,`, ["intro", "question"]), " which focuses on youth and virginity in slaves.");
				break;
			case "Pastoralist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Pastoralism,`, ["intro", "question"]), " an appetite for products of the human body, especially milk.");
				break;
			case "PhysicalIdealist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Physical Idealism,`, ["intro", "question"]), " an aspirational movement which fetishizes muscle and physical fitness.");
				break;
			case "ChattelReligionist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Chattel Religionism,`, ["intro", "question"]), " a religious revival in the context of modern slavery.");
				break;
			case "RomanRevivalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Roman Revivalism,`, ["intro", "question"]), " which seeks to recreate the glory that was ancient Rome.");
				innerDiv.append(App.UI.DOM.makeElement("div", "It has an established lingua franca: Latin."));
				break;
			case "AztecRevivalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Aztec Revivalism,`, ["intro", "question"]), " which aspires to reach the heights of the Aztec Empire at it's peak.");
				innerDiv.append(App.UI.DOM.makeElement("div", "It has an established lingua franca: Nahuatl."));
				break;
			case "EgyptianRevivalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Egyptian Revivalism,`, ["intro", "question"]), " a movement to rebuild the monuments and greatness of ancient Egypt.");
				innerDiv.append(App.UI.DOM.makeElement("div", "It has an established lingua franca: Ancient Egyptian."));
				break;
			case "EdoRevivalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Edo Revivalism,`, ["intro", "question"]), " an insular movement with a focus on the cultural superiority of old Japan.");
				innerDiv.append(App.UI.DOM.makeElement("div", "It has an established lingua franca: Japanese."));
				break;
			case "ArabianRevivalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Arabian Revivalism,`, ["intro", "question"]), " a melding of Arabian history and recent mythology of the Near East.");
				innerDiv.append(App.UI.DOM.makeElement("div", "It has an established lingua franca: Arabic."));
				break;
			case "ChineseRevivalist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Chinese Revivalism,`, ["intro", "question"]), " which modernizes the assumed superiority of the Middle Kingdom.");
				innerDiv.append(App.UI.DOM.makeElement("div", "It has an established lingua franca: Chinese."));
				break;
			case "Repopulationist":
				innerDiv.append(App.UI.DOM.makeElement("span", `Repopulationism,`, ["intro", "question"]), " the belief that the key to humanity's survival is a child in every fertile womb.");
				break;
			case "Eugenics":
				innerDiv.append(App.UI.DOM.makeElement("span", `Eugenics,`, ["intro", "question"]), " the belief that the world's failings were caused by rampant breeding of the inferior, and as such, only society's best should reproduce.");
				break;
			case "HedonisticDecadence":
				innerDiv.append(App.UI.DOM.makeElement("span", `Decadent Hedonism,`, ["intro", "question"]), " a movement to embody life's pleasures, particularly eating and sex.");
				break;
			case "IntellectualDependency":
				innerDiv.append(App.UI.DOM.makeElement("span", `Intellectual Dependency,`, ["intro", "question"]), " an appetite for horny, stupid slaves based on bimbo fetishism.");
				break;
			case "SlaveProfessionalism":
				innerDiv.append(App.UI.DOM.makeElement("span", `Slave Professionalism,`, ["intro", "question"]), " a strain of slavery that seeks smart, skilled, elegant slaves to hone to perfection.");
				break;
			case "PetiteAdmiration":
				innerDiv.append(App.UI.DOM.makeElement("span", `Petite Admiration,`, ["intro", "question"]), " which prefers its slaves to stand heads and shoulders shorter than their masters.");
				break;
			case "StatuesqueGlorification":
				innerDiv.append(App.UI.DOM.makeElement("span", `Statuesque Glorification,`, ["intro", "question"]), " an obsession, both sexual and otherwise, over height.");
				break;
			default:
				innerDiv.append(App.UI.DOM.makeElement("span", `Multiculturalism,`, ["intro", "question"]), " a celebration of the total liberty that was the original purpose of the Free Cities.");
		}
		div.append(innerDiv);
		div.append(App.UI.DOM.makeElement("span", arcology.building.render(), "intro"));
		return div;
	}

	function generateArcology() {
		const arcology = {};
		arcology.fs = getFS();
		arcology.name = getName();
		arcology.FSProgress = either(10, 30, 50);
		arcology.prosperity = either(40, 50, 60);
		arcology.citizens = random(-1, 1);
		arcology.terrain = terrainTypes.random();
		arcology.continent = continents.random();
		arcology.language = getLanguage();

		const env = {terrain: arcology.terrain, established: true, fs: arcology.fs};
		const preset = App.Arcology.randomPreset(env).construct(env);
		arcology.building = preset.building;
		arcology.apply = preset.apply;

		return arcology;

		function getFS() {
			const type = allowedFS.pluck();
			if (type === "Supremacist" || type === "Subjugationist") {
				arcology.race = races.random();
			}
			return type;
		}

		function getName() {
			switch (arcology.fs) {
				case "Supremacist":
					switch (arcology.race) {
						case "white":
							return setup.ArcologyNamesSupremacistWhite.random();
						case "asian":
							return setup.ArcologyNamesSupremacistAsian.random();
						case "latina":
							return setup.ArcologyNamesSupremacistLatina.random();
						case "middle eastern":
							return setup.ArcologyNamesSupremacistMiddleEastern.random();
						case "black":
							return setup.ArcologyNamesSupremacistBlack.random();
						case "indo-aryan":
							return setup.ArcologyNamesSupremacistIndoAryan.random();
						case "pacific islander":
							return setup.ArcologyNamesSupremacistPacificIslander.random();
						case "malay":
							return setup.ArcologyNamesSupremacistMalay.random();
						case "amerindian":
							return setup.ArcologyNamesSupremacistAmerindian.random();
						case "southern european":
							return setup.ArcologyNamesSupremacistSouthernEuropean.random();
						case "semitic":
							return setup.ArcologyNamesSupremacistSemitic.random();
						default:
							return setup.ArcologyNamesSupremacistMixedRace.random();
					}
				case "Subjugationist":
					switch (arcology.race) {
						case "white":
							return setup.ArcologyNamesSubjugationistWhite.random();
						case "asian":
							return setup.ArcologyNamesSubjugationistAsian.random();
						case "latina":
							return setup.ArcologyNamesSubjugationistLatina.random();
						case "middle eastern":
							return setup.ArcologyNamesSubjugationistMiddleEastern.random();
						case "black":
							return setup.ArcologyNamesSubjugationistBlack.random();
						case "indo-aryan":
							return setup.ArcologyNamesSubjugationistIndoAryan.random();
						case "pacific islander":
							return setup.ArcologyNamesSubjugationistPacificIslander.random();
						case "malay":
							return setup.ArcologyNamesSubjugationistMalay.random();
						case "amerindian":
							return setup.ArcologyNamesSubjugationistAmerindian.random();
						case "southern european":
							return setup.ArcologyNamesSubjugationistSouthernEuropean.random();
						case "semitic":
							return setup.ArcologyNamesSubjugationistSemitic.random();
						default:
							return setup.ArcologyNamesSubjugationistMixedRace.random();
					}
				case "GenderRadicalist":
					return setup.ArcologyNamesGenderRadicalist.random();
				case "GenderFundamentalist":
					return setup.ArcologyNamesGenderFundamentalist.random();
				case "Paternalist":
					return setup.ArcologyNamesPaternalist.random();
				case "Degradationist":
					return setup.ArcologyNamesDegradationist.random();
				case "AssetExpansionist":
					return setup.ArcologyNamesAssetExpansionist.random();
				case "SlimnessEnthusiast":
					return setup.ArcologyNamesSlimnessEnthusiast.random();
				case "TransformationFetishist":
					return setup.ArcologyNamesTransformationFetishist.random();
				case "BodyPurist":
					return setup.ArcologyNamesBodyPurist.random();
				case "MaturityPreferentialist":
					return setup.ArcologyNamesMaturityPreferentialist.random();
				case "YouthPreferentialist":
					if (V.pedo_mode === 1 || V.minimumSlaveAge < 6) {
						return setup.ArcologyNamesYouthPreferentialistLow.random();
					} else if (V.minimumSlaveAge < 14) {
						return setup.ArcologyNamesYouthPreferentialist.concat(setup.ArcologyNamesYouthPreferentialistLow).random();
					} else {
						return setup.ArcologyNamesYouthPreferentialist.random();
					}
				case "Pastoralist":
					return setup.ArcologyNamesPastoralist.random();
				case "PhysicalIdealist":
					return setup.ArcologyNamesPhysicalIdealist.random();
				case "ChattelReligionist":
					return setup.ArcologyNamesChattelReligionist.random();
				case "RomanRevivalist":
					return setup.ArcologyNamesRomanRevivalist.random();
				case "AztecRevivalist":
					return setup.ArcologyNamesAztecRevivalist.random();
				case "EgyptianRevivalist":
					return setup.ArcologyNamesEgyptianRevivalist.random();
				case "EdoRevivalist":
					return setup.ArcologyNamesEdoRevivalist.random();
				case "ArabianRevivalist":
					return setup.ArcologyNamesArabianRevivalist.random();
				case "ChineseRevivalist":
					return setup.ArcologyNamesChineseRevivalist.random();
				case "Repopulationist":
					return setup.ArcologyNamesRepopulationist.random();
				case "Eugenics":
					return setup.ArcologyNamesEugenics.random();
				case "HedonisticDecadence":
					return setup.ArcologyNamesHedonisticDecadence.random();
				case "IntellectualDependency":
					return setup.ArcologyNamesIntellectualDependency.random();
				case "SlaveProfessionalism":
					return setup.ArcologyNamesSlaveProfessionalism.random();
				case "PetiteAdmiration":
					return setup.ArcologyNamesPetiteAdmiration.random();
				case "StatuesqueGlorification":
					return setup.ArcologyNamesStatuesqueGlorification.random();
				default:
					return "Arcology X-4";
			}
		}

		function getLanguage() {
			switch (arcology.fs) {
				case "RomanRevivalist":
					return "Latin";
				case "AztecRevivalist":
					return "Nahuatl";
				case "EgyptianRevivalist":
					return "Ancient Egyptian";
				case "EdoRevivalist":
					return "Japanese";
				case "ArabianRevivalist":
					return "Arabic";
				case "ChineseRevivalist":
					return "Chinese";
				default:
					switch (arcology.terrain) {
						case "South America":
							return "Spanish";
						case "Brazil":
							return "Portuguese";
						case "the Middle East":
						case "Africa": /* shouldn't that be portuguese, spanish or something? */
							return "Arabic";
						case "Asia":
							return "Chinese";
						case "Europe":
							return "German";
						case "Japan":
							return "Japanese";
						case "oceanic":
						case "North America":
						case "Australia":
						default:
							return "English";
					}
			}
		}
	}
};

src/events/intro/arcologySelection.js