code:
:: AssayJS [script]

window.isSlim = function(slave) {
	var slim = false;
	var ArcologyZero = State.variables.arcologies[0];

	if ((slave.boobs < 500) && (slave.butt < 3)) {
		if ((slave.muscles <= 30) && (ArcologyZero.FSPhysicalIdealist === "unset") && (slave.weight <= 10) && (ArcologyZero.FSHedonisticDecadence === "unset")) {
			slim = true;
		} else if (ArcologyZero.FSPhysicalIdealist !== "unset") {
			if ((ArcologyZero.FSPhysicalIdealistStrongFat === 1) && (slave.weight <= 30)) {
				slim = true;
			}
		} else if ((ArcologyZero.FSHedonisticDecadence !== "unset") && (slave.weight <= 30)) {
			if (ArcologyZero.FSHedonisticDecadenceStrongFat === 1) {
				slim = true;
			} else if (slave.muscles <= 30) {
				slim = true;
			}
		}
	}

	return slim;
};

window.isStacked = function(slave) {
	return (slave.butt > 4) && (slave.boobs > 800);
};

window.isModded = function(slave) {
	var tatScore = TatScore(slave);
	var piercingScore = PiercingScore(slave);
	var modScore = piercingScore+tatScore;

	return ((modScore > 15) || (piercingScore > 8) && (tatScore > 5));
};

window.isUnmodded = function(slave) {
	var tatScore = TatScore(slave);
	var piercingScore = PiercingScore(slave);

	return !isModded(slave) && (slave.corsetPiercing === 0) && (piercingScore < 3) && (tatScore < 2);
};

window.isXY = function(slave) {
	return (slave.dick > 0);
};

window.isYoung = function(slave) {
	return (slave.visualAge < 30);
};

window.isPreg = function(slave) {
	return ((slave.bellyPreg >= 5000) || (slave.bellyImplant >= 5000));
};

window.isNotPreg = function(slave) {
	return !isPreg(slave) && (slave.belly < 100) && (slave.weight < 30) && !setup.fakeBellies.includes(slave.bellyAccessory);
};

window.isPure = function(slave) {
	return ((slave.boobsImplant === 0) && (slave.buttImplant === 0) && (slave.waist >= -95) && (slave.lipsImplant === 0) && (slave.faceImplant < 30) && (slave.bellyImplant === -1) && (Math.abs(slave.shouldersImplant) < 2) && (Math.abs(slave.hipsImplant) < 2));
};

window.modScore = function modScore(slave) {
	const V = State.variables;
	V.piercingScore = PiercingScore(slave);
	V.tatScore = TatScore(slave);
	V.modScore = V.tatScore + V.piercingScore;
};

window.PiercingScore = function(slave) {
	var piercingScore = 0;

	if (slave.earPiercing > 0) {
		piercingScore += slave.earPiercing*0.75-0.5;
	}
	if (slave.nosePiercing > 0) {
		piercingScore += slave.nosePiercing*0.75-0.5;
	}
	if (slave.eyebrowPiercing > 0) {
		piercingScore += slave.eyebrowPiercing*0.75-0.5;
	}
	if (slave.navelPiercing > 0) {
		piercingScore += slave.navelPiercing*0.75-0.5;
	}
	if (slave.corsetPiercing > 0) {
		piercingScore += slave.corsetPiercing*0.75+0.5;
	}
	if (slave.nipplesPiercing > 0) {
		piercingScore += slave.nipplesPiercing*0.75-0.25;
	}
	if (slave.areolaePiercing > 0) {
		piercingScore += slave.areolaePiercing*0.75+0.5;
	}
	if (slave.lipsPiercing > 0) {
		piercingScore += slave.lipsPiercing*0.75-0.25;
	}
	if (slave.tonguePiercing > 0 ) {
		piercingScore += slave.tonguePiercing*0.75-0.25;
	}
	if (slave.clitPiercing === 3) {
		piercingScore += 1.25; /* smart piercing */
	} else if (slave.clitPiercing > 0) {
		piercingScore += slave.clitPiercing*0.75-0.25;
	}
	if (slave.vaginaPiercing > 0) {
		piercingScore += slave.vaginaPiercing*0.75-0.25;
	}
	if (slave.dickPiercing > 0) {
		piercingScore += slave.dickPiercing*0.75-0.25;
	}
	if (slave.anusPiercing > 0) {
		piercingScore += slave.anusPiercing*0.75-0.25;
	}
	return piercingScore;
};

window.TatScore = function(slave) {
	var tatScore = 0;

	if (slave.boobsTat !== 0) {
		tatScore += 1.25;
	}
	if (slave.buttTat !== 0) {
		tatScore += 1.25;
	}
	if (slave.lipsTat !== 0) {
		tatScore += 1.25;
	}
	if (slave.shouldersTat !== 0) {
		tatScore += 1;
	}
	if (slave.backTat !== 0) {
		tatScore += 1.25;
	}
	if (slave.armsTat !== 0) {
		tatScore += 1;
	}
	if (slave.legsTat !== 0) {
		tatScore += 1;
	}
	if (slave.stampTat !== 0) {
		tatScore += 1;
	}
	if (slave.vaginaTat !== 0) {
		tatScore += 1;
	}
	if (slave.dickTat !== 0) {
		tatScore += 1;
	}
	if (slave.bellyTat !== 0) {
		if (((slave.preg > 30) && (slave.pregType >= 20)) || (slave.belly >= 300000)) {
			tatScore += 0.75;
		} else if (((slave.preg > 20) && (slave.pregType >= 20)) || ((slave.preg > 30) && (slave.pregType >= 10)) || (slave.belly >= 150000)) {
			tatScore += 1;
		} else if ((slave.belly >= 10000) || (slave.bellyImplant >= 8000)) {
			tatScore += 1;
		} else if (((slave.preg >= 10) && (slave.pregType >= 20)) || ((slave.preg > 10) && (slave.pregType >= 10)) || (slave.belly >= 5000)) {
			tatScore += 0.5;
		} else if (slave.belly >= 1500) {
			tatScore += 0.25;
		} else {
			tatScore += 0.1;
		}
	}
	if (slave.anusTat === "bleached") {
		tatScore += 0.5;
	} else if (slave.anusTat !== 0) {
		tatScore += 1.25;
	}

	return tatScore;
};

window.slimPass = function(slave) {
	var slimPass = 0;
	var ArcologyZero = State.variables.arcologies[0];

	if (ArcologyZero.FSSlimnessEnthusiastLaw === 1) {
		if ((slave.boobs < 300) && (slave.butt <= 1) && (slave.waist <= 10)) {
			State.variables.slimPass = 1;
			if ((ArcologyZero.FSPhysicalIdealist === "unset") && (ArcologyZero.FSHedonisticDecadenceStrongFat === 0) && (slave.muscles > 30)) { /*muscle check*/
				slimPass = 0;
			}
			if (State.variables.slimPass === 1) {
				if ((ArcologyZero.FSHedonisticDecadence !== "unset") || (ArcologyZero.FSPhysicalIdealistStrongFat === 1)) { /*weight check*/
					if (slave.weight > 30) {
						slimPass = 0;
					}
				} else if (slave.weight > 10) {
					slimPass = 0;
				}
			}
		}
	}

	return slimPass;
};

window.sameAssignmentP = function sameAssignmentP(A, B) {
	return A.assignment === B.assignment;
};

window.haveRelationP = function haveRelationP(slave, target) {
	return slave.relationTarget === target.ID;
};

window.haveRelationshipP = function haveRelationshipP(slave, target) {
	return slave.relationshipTarget === target.ID;
};

window.isRivalP = function isRivalP(slave, target) {
	return slave.rivalryTarget === target.ID;
};

window.supremeRaceP = function supremeRaceP(slave) {
	return State.variables.arcologies[0].FSSupremacistRace === slave.race;
};

window.inferiorRaceP = function inferiorRaceP(slave) {
	return State.variables.arcologies[0].FSSubjugationistRace === slave.race;
};

window.isLeaderP = function isLeaderP(slave) {
	const V = State.variables;
	const leaders = [V.HeadGirl, V.Bodyguard, V.Recruiter, V.Concubine, V.Nurse, V.Attendant, V.Matron, V.Madam, V.DJ, V.Milkmaid, V.Stewardess, V.Schoolteacher, V.Wardeness];
	return leaders.some(leader => leader.ID && leader.ID === slave.ID);
};

// helper function returning PC's title
window.properTitle = function properTitle() {
	const PC = State.variables.PC;
	if (PC.customTitle) return PC.customTitle;
	else if (PC.title !== 0) return "Sir";
	else return "Ma'am";
};

window.newSlave = function newSlave(slave) {
	const V = State.variables;

	if (slave.override_Eye_Color != 1) {
		switch (slave.eyeColor) {
			case "blind blue":
				slave.origEye = "deep blue";
				break;
			case "milky white":
			case "implant":
				slave.origEye = jsEither(["blue", "green", "brown", "hazel", "light blue", "light green", "dark green", "dark blue"]);
				break;
			default:
				slave.origEye = slave.eyeColor;
				break;
		}
	}

	if (slave.override_Race != 1) {
		slave.origRace = slave.race;
	}
	if (slave.override_H_Color != 1) {
		slave.origHColor = slave.hColor;
	}
	if (slave.override_Arm_H_Color != 1) {
		slave.underArmHColor = slave.hColor;
	}
	if (slave.override_Pubic_H_Color != 1) {
		slave.pubicHColor = slave.hColor;
	}
	if (slave.override_Brow_H_Color != 1) {
		slave.eyebrowHColor = slave.hColor;
	}
	if (slave.override_Skin != 1) {
		slave.origSkin = slave.skin;
	}

	slave.override_Race = 0;
	slave.override_H_Color = 0;
	slave.override_Arm_H_Color = 0;
	slave.override_Pubic_H_Color = 0;
	slave.override_Brow_H_Color = 0;
	slave.override_Skin = 0;
	slave.override_Eye_Color = 0;

	if (V.surnamesForbidden === 1) {
		slave.slaveSurname = 0;
	}

	if (slave.preg > 0) {
		slave.pregWeek = slave.preg;
	} else {
		slave.pregWeek = 0;
	}

	if (V.familyTesting === 1) {
		slave.sisters = 0;
		slave.daughters = 0;
		if (slave.mother === -1 || slave.father === -1) {
			V.PC.daughters += 1;
		}
		if (areSisters(V.PC, slave) > 0) {
			V.PC.sisters += 1;
		}
		for (let k = 0; k < V.slaves.length; k++) {
			if (V.slaves[k].mother === slave.ID || V.slaves[k].father === slave.ID) {
				slave.daughters++;
			}
			if (slave.mother === V.slaves[k].ID || slave.father === V.slaves[k].ID) {
				V.slaves[k].daughters++;
			}
			if (areSisters(V.slaves[k], slave) > 0) {
				slave.sisters++;
				V.slaves[k].sisters++;
			}
		}
	}

	if (slave.dick > 0 &&
		slave.balls > 0 &&
		slave.devotion <= 50 &&
		(slave.fetish !== "buttslut" || slave.fetishKnown !== 1) &&
		slave.sexualFlaw !== "hates women") {
		V.REFeminizationCheckinIDs.push(slave.ID);
	}
	if (slave.actualAge > 35 && slave.face < 40 && slave.analSkill <= 30) {
		V.REMILFCheckinIDs.push(slave.ID);
	}
	if (slave.attrXY <= 60 && slave.attrXX > 60 ) {
		V.REOrientationCheckinIDs.push(slave.ID);
	}
	if (slave.face < -10) {
		V.REUglyCheckinIDs.push(slave.ID);
	}
	if (slave.anus < 2) {
		V.REButtholeCheckinIDs.push(slave.ID);
	}
	if (slave.boobs < 800) {
		V.REReductionCheckinIDs.push(slave.ID);
	}

	if (slave.fuckdoll > 0) {
		slave.pronoun = "it";
		slave.possessivePronoun = "its";
		slave.possessive = "its";
		slave.object = "it";
		slave.objectReflexive = "itself";
		slave.noun = "toy";
	} else if (slave.dick > 0 && slave.vagina === -1 && V.diversePronouns === 1) {
		slave.pronoun = "he";
		slave.possessivePronoun = "his";
		slave.possessive = "his";
		slave.object = "him";
		slave.objectReflexive = "himself";
		slave.noun = "boy";
	} else {
		slave.pronoun = "she";
		slave.possessivePronoun = "hers";
		slave.possessive = "her";
		slave.object = "her";
		slave.objectReflexive = "herself";
		slave.noun = "girl";
	}

	SetBellySize(slave);
	addSlave(slave);

	if (slave.origin !== "She was your slave, but you freed her, which she repaid by participating in a coup attempt against you. It failed, and she is again your chattel." && slave.ID !== V.boomerangSlave.ID) {
		V.genePool.push(slave);
	} else {
		if (V.genePool.findIndex(function(s) { return s.ID === slave.ID; }) === -1) {
			V.genePool.push(slave);
		}
	}

	/* add to facilities array if needed */
	if (slave.assignment !== "rest") {
		assignJob(slave, slave.assignment);
	}

	/** do not run the Rules Assistant before adding the new slave to the slaves list! **/
	if (V.ui !== "start" && V.universalRulesNewSlavesRA === 1 && V.rulesAssistantAuto !== 0) {
		DefaultRules(slave);
	}
};

window.addSlave = function addSlave(slave) {
	State.variables.slaves.push(slave);
	State.variables.slaveIndices[slave.ID] = State.variables.slaves.length - 1;
};
window.removeSlave = function removeSlave(index) {
	const ret = State.variables.slaves.deleteAt(index);
	State.variables.slaveIndices = slaves2indices();
	return ret;
};
window.slaves2indices = function slaves2indices() {
	const obj = {};
	State.variables.slaves.forEach((slave, i) => obj[slave.ID] = i);
	return obj;
};
window.getSlave = function getSlave(ID) {
	const index = State.variables.slaveIndices[ID];
	if (index === undefined) return undefined;
	else return State.variables.slaves[index];
};
window.getPronouns = function getPronouns(slave) {
	return {
		pronoun: slave.pronoun,
		possessivePronoun: slave.possessivePronoun,
		possessive: slave.possessive,
		object: slave.object,
		objectReflexive: slave.objectReflexive,
		noun: slave.noun };
};

window.SlavePronouns = function SlavePronouns(slave) {
	const V = State.variables;
	var pronouns = getPronouns(slave);
	V.pronoun = pronouns.pronoun;
	V.pronounCap = capFirstChar(pronouns.pronoun);
	V.possessive = pronouns.possessive;
	V.possessiveCap = capFirstChar(pronouns.possessive);
	V.object = pronouns.object;
};

window.WrittenMaster = function WrittenMaster(slave) {
	const V = State.variables;
	if (slave !== undefined)
		Enunciate(slave);
	else if (V.titleEnunciate === undefined)
		Enunciate(V.activeSlave);
	return V.writtenTitle;
};

window.Enunciate = function Enunciate(slave) {
	const V = State.variables;
	if (SlaveStatsChecker.checkForLisp(slave)) {
		if (V.PC.customTitleLisp !== undefined)
			V.titleEnunciate = V.PC.customTitleLisp;
		else if (V.PC.title !== 0)
			V.titleEnunciate = "Mathter";
		else
			V.titleEnunciate = "Mithtreth";
		if (V.allowFamilyTitles === 1) {
			if (slave.father === -1) {
				if (slave.actualAge < 4 && slave.physicalAge < 4)
					V.titleEnunciate = "Dadda";
				else if (slave.actualAge < 9)
					V.titleEnunciate = "Daddy";
				else
					V.titleEnunciate = "Dad";
			} else if (slave.mother === -1) {
				if (slave.actualAge < 4 && slave.physicalAge < 4)
					V.titleEnunciate = "Mama";
				else if (slave.actualAge < 9)
					V.titleEnunciate = "Mommy";
				else
					V.titleEnunciate = "Mom";
			} else if (V.PC.mother === slave.ID || V.PC.father === slave.ID) {
				if (V.PC.title === 1)
					V.titleEnunciate = "Thon";
				else if (V.PC.title === 0)
					V.titleEnunciate = "Daughter";
			} else if (areSisters(slave, V.PC) > 0) {
				if (V.PC.title === 1) {
					if (slave.actualAge < 18)
						V.titleEnunciate = "Bro";
					else
						V.titleEnunciate = "Brother";
				} else if (V.PC.title === 0) {
					if (slave.actualAge < 18)
						V.titleEnunciate = "Thith";
					else
						V.titleEnunciate = "Thithter";
				}
			}
		}
		if (slave.customTitleLisp && slave.customTitleLisp !== "")
			V.titleEnunciate = slave.customTitleLisp;
		V.sayEnunciate = "lisp";
		V.sEnunciate = "th";
		V.SEnunciate = "Th";
		V.ssEnunciate = "th";
		V.cEnunciate = "th";
		V.ccEnunciate = "th";
		V.zEnunciate = "th";
		V.shEnunciate = "th";
		V.ShEnunciate = "Th";
		V.xEnunciate = "kth";
	} else {
		if (V.PC.customTitle !== undefined)
			V.titleEnunciate = V.PC.customTitle;
		else if (V.PC.title !== 0)
			V.titleEnunciate = "Master";
		else
			V.titleEnunciate = "Mistress";
		if (V.allowFamilyTitles === 1) {
			if (slave.father === -1) {
				if (slave.actualAge < 4 && slave.physicalAge < 4)
					V.titleEnunciate = "Dadda";
				else if (slave.actualAge < 9)
					V.titleEnunciate = "Daddy";
				else
					V.titleEnunciate = "Dad";
			} else if (slave.mother === -1) {
				if (slave.actualAge < 4 && slave.physicalAge < 4)
					V.titleEnunciate = "Mama";
				else if (slave.actualAge < 9)
					V.titleEnunciate = "Mommy";
				else
					V.titleEnunciate = "Mom";
			} else if (V.PC.mother === slave.ID || V.PC.father === slave.ID) {
				if (V.PC.title === 1)
					V.titleEnunciate = "Son";
				else if (V.PC.title === 0)
					V.titleEnunciate = "Daughter";
			} else if (areSisters(slave, V.PC) > 0) {
				if (V.PC.title === 1) {
					if (slave.actualAge < 18)
						V.titleEnunciate = "Bro";
					else
						V.titleEnunciate = "Brother";
				} else if (V.PC.title === 0) {
					if (slave.actualAge < 18)
						V.titleEnunciate = "Sis";
					else
						V.titleEnunciate = "Sister";
				}
			}
		}
		if (slave.customTitle !== undefined && slave.customTitle !== "")
			V.titleEnunciate = slave.customTitle;
		if (V.PC.customTitle !== undefined)
			V.writtenTitle = V.PC.customTitle;
		else if (V.PC.title !== 0)
			V.writtenTitle = "Master";
		else
			V.writtenTitle = "Mistress";
		if (slave.customTitle !== undefined && slave.customTitle !== "" && slave.rudeTitle === 0)
			V.writtenTitle = slave.customTitle;
		V.sayEnunciate = "say";
		V.sEnunciate = "s";
		V.SEnunciate = "S";
		V.ssEnunciate = "ss";
		V.cEnunciate = "c";
		V.ccEnunciate = "cc";
		V.zEnunciate = "z";
		V.shEnunciate = "sh";
		V.ShEnunciate = "Sh";
		V.xEnunciate = "x";
	}
};

window.fetishChangeChance = function fetishChangeChance(slave) {
	const V = State.variables;
	var chance = 0, sex = 0;

	if (slave.clitSetting !== slave.fetish) {
		if (slave.balls) {
			sex = V.potencyAge - slave.actualAge;
		}
		else if (slave.ovaries || slave.mpreg) {
			sex = V.fertilityAge - slave.actualAge;
		}
		chance = Math.trunc(Math.clamp((slave.devotion/4)-(slave.fetishStrength/4)-(Math.max(sex,0)*10), 0, 100));
	}

	return chance;
};

window.SlaveFullName = function SlaveFullName(slave) {
	const V = State.variables;
	const pair = slave.slaveSurname ? [slave.slaveName, slave.slaveSurname] : [slave.slaveName];
	if (V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(slave.nationality))
		pair.reverse();
	return pair.join(" ");
};

window.PlayerName = function PlayerName() {
	const V = State.variables;
	const surnamesFirstCountries = [
		"Cambodian",
		"Chinese",
		"Hungarian",
		"Japanese",
		"Korean",
		"Mongolian",
		"Taiwanese",
		"Vietnamese"];
	let names = V.PC.surname ? [V.PC.name, V.PC.surname] : [V.PC.name];
	if ((V.surnameOrder !== 1) && (surnamesFirstCountries.includes(V.PC.nationality)))
		names.reverse();
	return names.join(" ");
};

window.PCTitle = function PCTitle() {
	const V = State.variables;
	let titles = [];

	V.PCTitle = PlayerName();

	if (V.cheater === 1) {
		V.PCTitle = (V.PCTitle + " the Cheater");
	} else if (V.arcologies[0].FSRestart > 10) {
		V.PCTitle = (V.PCTitle + " of the Societal Elite");
	} else if (V.rep > 18000) {
		V.PCTitle = (V.PCTitle + " the Great");
	} else if (V.rep > 17000) {
		V.PCTitle = ("the exalted " + V.PCTitle);
	} else if (V.rep > 16000) {
		V.PCTitle = ("the illustrious " + V.PCTitle);
	} else if (V.rep > 15000) {
		V.PCTitle = ("the prestigious " + V.PCTitle);
	} else if (V.rep > 14000) {
		V.PCTitle = ("the renowned " + V.PCTitle);
	} else if (V.rep > 13000) {
		V.PCTitle = ("the famed " + V.PCTitle);
	} else if (V.rep > 12000) {
		V.PCTitle = ("the celebrated " + V.PCTitle);
	} else if (V.rep > 11000) {
		V.PCTitle = ("the honored " + V.PCTitle);
	} else if (V.rep > 10000) {
		V.PCTitle = ("the acclaimed " + V.PCTitle);
	} else if (V.rep > 9000) {
		V.PCTitle = ("the eminent " + V.PCTitle);
	} else if (V.rep > 8250) {
		V.PCTitle = ("the prominent " + V.PCTitle);
	} else if (V.rep > 7500) {
		V.PCTitle = ("the distinguished " + V.PCTitle);
	} else if (V.rep > 6750) {
		V.PCTitle = ("the admired " + V.PCTitle);
	} else if (V.rep > 6000) {
		V.PCTitle = ("the esteemed " + V.PCTitle);
	} else if (V.rep > 5250) {
		V.PCTitle = ("the respected " + V.PCTitle);
	} else if (V.rep > 4500) {
		V.PCTitle = ("the known " + V.PCTitle);
	} else if (V.rep > 3750) {
		V.PCTitle = ("the recognized " + V.PCTitle);
	} else if (V.rep > 3000) {
		V.PCTitle = ("the rumored " + V.PCTitle);
	}

	V.PCTitle = (V.PCTitle + ", ");

	if (V.PC.name === "FC Dev") {
		titles.push("the Creator");
	}

	if (V.plot === 1) {
		if (V.invasionVictory === 3) {
			if (V.PC.title === 1) {
				titles.push("Hero of the City");
			} else {
				titles.push("Heroine of the City");
			}
		} else if (V.invasionVictory === 2) {
			titles.push("Defender of the City");
		}
		if (V.daughtersVictory === 3) {
			titles.push("Destroyer of the Daughters");
		} else if (V.daughtersVictory === 2) {
			if (V.PC.title === 1) {
				titles.push("Victor over the Daughters");
			} else {
				titles.push("Victrix over the Daughters");
			}
		}
	}

	if (V.mercenaries >= 5) {
		if (V.mercenariesTitle === "Evocati") {
			titles.push("Princeps of the " + V.mercenariesTitle);
		} else if (V.mercenariesTitle === "Knights") {
			if (V.PC.title === 1) {
				titles.push("Lord Commander of the " + V.mercenariesTitle);
			} else {
				titles.push("Lady Commander of the " + V.mercenariesTitle);
			}
		} else if (V.mercenariesTitle === "Immortals") {
			titles.push("Tyrant of the " + V.mercenariesTitle);
		} else {
			titles.push("Commander of the " + V.mercenariesTitle);
		}
	} else if (V.mercenaries >= 1) {
		titles.push("Commander of the Mercenaries");
	}

	if (V.dispensary === 1) {
		if (V.PC.title === 1) {
			titles.push("Pharmacologos");
		} else {
			titles.push("Pharmacologes");
		}
	}

	if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.9) {
		titles.push("Grand Champion of the Blood");
	} else if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.6) {
		titles.push("Champion of the Blood");
	} else if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.3) {
		titles.push("Defender of the Blood");
	}

	if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.9) {
		titles.push("Grand Overseer of the Inferior Race");
	} else if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.6) {
		titles.push("Overseer of the Inferior Race");
	} else if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.3) {
		titles.push("Subduer of the Inferior Race");
	}

	if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.9) {
		titles.push("Buttfucker of All Slaves");
	} else if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.6) {
		titles.push("Sodomizer of the Traps");
	} else if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.3) {
		if (V.PC.title === 1) {
			titles.push("Penetrator of the Sissies");
		} else {
			titles.push("Penetratrix of the Sissies");
		}
	}

	if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.9) {
		if (V.PC.title === 1) {
			titles.push("Father to the City");
		} else {
			titles.push("Mother to the City");
		}
	} else if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.6) {
		titles.push("Defender of Women");
	} else if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.3) {
		titles.push("Restorer of Morals");
	}

	if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.9) {
		if (V.PC.title === 1) {
			titles.push("Protector to All Slaves");
		} else {
			titles.push("Protectrix to All Slaves");
		}
	} else if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.6) {
		if (V.PC.title === 1) {
			titles.push("Benefactor of Slaves");
		} else {
			titles.push("Benefactrix of Slaves");
		}
	} else if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.3) {
		titles.push("Pursuer of Justice");
	}

	if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.9) {
		titles.push("the Savior of the Future");
	} else if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.6) {
		titles.push("the Holder of the Future");
	} else if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.3) {
		titles.push("the Repopulist");
	}

	if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.9) {
		titles.push("Holder of the Rod and the Lash");
	} else if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.6) {
		titles.push("Subduer of Slaves");
	} else if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.3) {
		titles.push("Pursuer of Justice");
	}

	if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.9) {
		titles.push("the Purifier of the Breasts");
	} else if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.6) {
		titles.push("the Discerning");
	} else if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.3) {
		titles.push("the Tasteful");
	}

	if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.9) {
		titles.push("the Expander of the Breasts");
	} else if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.6) {
		titles.push("the Expander");
	} else if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.3) {
		if (V.PC.title === 1) {
			titles.push("the Implantor");
		} else {
			titles.push("the Implantrix");
		}
	}

	if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.9) {
		if (V.PC.title === 1) {
			titles.push("the Master of Stock");
		} else {
			titles.push("the Mistress of Stock");
		}
	} else if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.6) {
		titles.push("the Rancher");
	} else if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.3) {
		titles.push("the Farmer");
	}

	if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.9) {
		titles.push("beloved of Brodin");
	} else if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.6) {
		if (V.PC.title === 1) {
			titles.push("he of the godlike Body");
		} else {
			titles.push("she of the godlike Body");
		}
	} else if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.3) {
		titles.push("advancer of Gains");
	}

	if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.9) {
		if (V.PC.title === 1) {
			titles.push("Master of Softness");
		} else {
			titles.push("Lady of Softness");
		}
	} else if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.6) {
		titles.push("Thickness Enthusiast");
	} else if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.3) {
		titles.push("the Feeder");
	}

	if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.9) {
		titles.push("Grand Preserver of MILFS");
	} else if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.6) {
		titles.push("Fucker of MILFS");
	} else if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.3) {
		if (V.PC.title === 1) {
			titles.push("he of the notorious MILF preference");
		} else {
			titles.push("she of the notorious MILF preference");
		}
	}

	if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.9) {
		titles.push("Keeper of the Magnificent Young Harem");
	} else if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.6) {
		titles.push("Keeper of Virgins");
	} else if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.3) {
		titles.push("the Virginbreaker");
	}

	if (V.arcologies[0].FSChattelReligionistLaw === 1) {
		titles.push("the Prophet");
	} else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.9) {
		titles.push("Keeper of the Blade and Chalice");
	} else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.6) {
		titles.push("Champion of the Faith");
	} else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.3) {
		titles.push("the Holy");
	}

	if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.9) {
		titles.push("First Consul");
	} else if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.6) {
		titles.push("Aedile");
	} else if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.3) {
		titles.push("Quaestor");
	}

	if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.9) {
		titles.push("Tlatcani");
	} else if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.6) {
		titles.push("Cihuacoatl");
	} else if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.3) {
		titles.push("Tlatoani");
	}

	if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.9) {
		if (V.PC.title === 1) {
			titles.push("the Living God");
		} else {
			titles.push("the Living Goddess");
		}
	} else if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.6) {
		titles.push("Pharaoh");
	} else if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.3) {
		if (V.PC.title === 1) {
			titles.push("Prince of the Nile");
		} else {
			titles.push("Princess of the Nile");
		}
	}

	if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.9) {
		if (V.PC.title === 1) {
			titles.push("Emperor and Descendant of Amaterasu");
		} else {
			titles.push("Amaterasu Reborn");
		}
	} else if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.6) {
		titles.push("Shogun");
	} else if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.3) {
		titles.push("Daimyo");
	}

	if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.9) {
		if (V.PC.title === 1) {
			titles.push("Caliph");
		} else {
			titles.push("Handmaiden of Allah");
		}
	} else if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.6) {
		if (V.PC.title === 1) {
			titles.push("Sultan");
		} else {
			titles.push("Sultana");
		}
	} else if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.3) {
		titles.push("Beloved of Allah");
	}

	if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.9) {
		if (V.PC.title === 1) {
			titles.push("Emperor and Holder of the Mandate of Heaven");
		} else {
			titles.push("Empress and Holder of the Mandate of Heaven");
		}
	} else if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.6) {
		if (V.PC.title === 1) {
			titles.push("Emperor");
		} else {
			titles.push("Empress");
		}
	} else if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.3) {
		if (V.PC.title === 1) {
			titles.push("Governor of the Province");
		} else {
			titles.push("Governess of the Province");
		}
	}

	if (V.brothelSlaves >= 15) {
		if (V.PC.title === 1) {
			titles.push("Procurator of the Brothel");
		} else {
			titles.push("Procuratrix of the Brothel");
		}
	}

	if (V.clubSlaves >= 15) {
		titles.push("First on the Club");
	}
	if (V.dairySlaves >= 15) {
		titles.push("Keeper of the Cattle");
	}
	if (V.cumSlaves >= 15) {
		if (V.PC.title === 1) {
			titles.push("Extractor of the Ejaculate");
		} else {
			titles.push("Extractrix of the Ejaculate");
		}
	}
	if (V.servantsQuartersSlaves >= 15) {
		if (V.PC.title === 1) {
			titles.push("Director of the Servants");
		} else {
			titles.push("Directrix of the Servants");
		}
	}
	if (V.schoolroomSlaves >= 10) {
		if (V.PC.title === 1) {
			titles.push("Educator of the Slaves");
		} else {
			titles.push("Educatrix of the Slaves");
		}
	}
	if (V.spaSlaves >= 10) {
		titles.push("Order of the Bath");
	}
	if (V.arcadeSlaves >= 15) {
		titles.push("Comptroller of the Arcade");
	}
	if (V.nurserySlave >= 10) {
		titles.push("Caretaker of the Infants");
	}

	let schoolsPresent = [], schoolsPerfected = [], schoolTitle = "";
	if (V.TSS.schoolProsperity >= 10) {
		schoolsPerfected.push("The Slave School");
	} else if (V.TSS.schoolPresent === 1) {
		schoolsPresent.push("The Slave School");
	}
	if (V.GRI.schoolProsperity >= 10) {
		schoolsPerfected.push("The Growth Research Institute");
	} else if (V.GRI.schoolPresent === 1) {
		schoolsPresent.push("The Growth Research Institute");
	}
	if (V.SCP.schoolProsperity >= 10) {
		schoolsPerfected.push("St. Claver Preparatory");
	} else if (V.SCP.schoolPresent === 1) {
		schoolsPresent.push("St. Claver Preparatory");
	}
	if (V.LDE.schoolProsperity >= 10) {
		schoolsPerfected.push("L'École des Enculées");
	} else if (V.LDE.schoolPresent === 1) {
		schoolsPresent.push("L'École des Enculées");
	}
	if (V.TGA.schoolProsperity >= 10) {
		schoolsPerfected.push("The Gymnasium-Academy");
	} else if (V.TGA.schoolPresent === 1) {
		schoolsPresent.push("The Gymnasium-Academy");
	}
	if (V.HA.schoolProsperity >= 10) {
		schoolsPerfected.push("The Hippolyta Academy");
	} else if (V.HA.schoolPresent === 1) {
		schoolsPresent.push("The Hippolyta Academy");
	}
	if (V.TCR.schoolProsperity >= 10) {
		schoolsPerfected.push("The Cattle Ranch");
	} else if (V.TCR.schoolPresent === 1) {
		schoolsPresent.push("The Cattle Ranch");
	}
	if (schoolsPerfected.length > 0) {
		if (V.PC.title === 1) {
			schoolTitle = "Benefactor of ";
		} else {
			schoolTitle = "Benefactrix of ";
		}
		if (schoolsPerfected.length === 1) {
			schoolTitle += schoolsPerfected[0];
		} else if (schoolsPerfected.length === 2) {
			schoolTitle += schoolsPerfected[0] + " and " + schoolsPerfected[1];
		} else {
			schoolsPerfected[schoolsPerfected.length - 1] = "and " + schoolsPerfected[schoolsPerfected.length - 1];
			schoolTitle += schoolsPerfected.join(", ");
		}
		titles.push(schoolTitle);
	}

	if (schoolsPresent.length > 0) {
		schoolTitle = "Supporter of ";
		if (schoolsPresent.length === 1) {
			schoolTitle += schoolsPresent[0];
		} else if (schoolsPresent.length === 2) {
			schoolTitle += schoolsPresent[0] + " and " + schoolsPresent[1];
		} else {
			schoolsPresent[schoolsPresent.length - 1] = "and " + schoolsPresent[schoolsPresent.length - 1];
			schoolTitle += schoolsPresent.join(", ");
		}
		titles.push(schoolTitle);
	}

	if (V.TFS.schoolProsperity >= 10) {
		titles.push("Honorary Sibling of the Futanari Sisters");
	} else if (V.TFS.schoolPresent === 1) {
		if (V.PC.title === 1) {
			titles.push("Protector of the Futanari Sisters");
		} else {
			titles.push("Protectrix of the Futanari Sisters");
		}
	}

	if (V.slaves.length > 50) {
		if (V.PC.title === 1) {
			titles.push("Master of Slaves");
		} else {
			titles.push("Mistress of Slaves");
		}
	} else if (V.slaves.length > 40) {
		titles.push("Holder of Slaves");
	} else if (V.slaves.length > 30) {
		titles.push("Keeper of Slaves");
	} else if (V.slaves.length > 20) {
		titles.push("Manager of Slaves");
	} else if (V.slaves.length > 10) {
		titles.push("owner of slaves");
	}

	if (V.corpValue > 500000) {
		titles.push("Corporate Titan");
	} else if (V.corpValue > 250000) {
		titles.push("corporate innovator");
	} else if (V.corpValue > 100000) {
		titles.push("corporate founder");
	} else if (V.corpValue > 0) {
		if (V.PC.title === 1) {
			titles.push("noted corporate businessman");
		} else {
			titles.push("noted corporate businesswoman");
		}
	}

	if (V.rep > 18000) {
		if (V.PC.title === 1) {
			titles.push("unquestioned Master of the Arcology");
		} else {
			titles.push("unquestioned Mistress of the Arcology");
		}
	} else if (V.rep > 15000) {
		if (V.PC.title === 1) {
			titles.push("Lord of the Arcology");
		} else {
			titles.push("Lady of the Arcology");
		}
	} else if (V.rep > 12000) {
		titles.push("Ruler of the Arcology");
	} else if (V.rep > 9000) {
		titles.push("chief officer of the arcology");
	} else {
		titles.push("owner of the arcology");
	}

	if (titles.length === 1) {
		V.PCTitle += titles[0];
	} else if (titles.length === 2) {
		V.PCTitle += titles[0] + " and " + titles[1];
	} else {
		titles[titles.length - 1] = "and " + titles[titles.length - 1];
		V.PCTitle += titles.join(", ");
	}
};

window.PoliteRudeTitle = function PoliteRudeTitle(slave) {
	const V = State.variables, PC = V.PC, s = V.sEnunciate, ss = V.ssEnunciate;

	var r = "";
	if (slave.nationality === "Japanese") {
		if (slave.trust > 0) {
			r += `${PC.name}${PC.title > 0 ? "kun" : "chan"}`;
		} else {
			r += (PC.surname ? PC.surname : `${PC.name}${s}an`);
		}
	} else {
		if (slave.intelligence+slave.intelligenceImplant < -95) {
			r += V.titleEnunciate;
		} else if (slave.intelligence+slave.intelligenceImplant > 50) {
			r += (PC.title > 0 ? `Ma${s}ter` : `Mi${s}tre${ss}`);
		} else if (slave.trust > 0) {
			r += PC.name;
		} else {
			r += (PC.surname ? PC.surname : PC.name);
		}
	}
	return r;
};

window.SlaveTitle = function SlaveTitle(slave) {
	const V = State.variables;
	let r = "";
	if (V.newDescriptions === 1) {
		if (slave.dick > 0 && slave.balls > 0 && slave.boobs > 300 && slave.vagina > -1 && slave.ovaries === 1) {
			if (jsRandom(1,100) > 50) {
				r = "futanari";
			} else {
				r = "herm";
			}
		} else if (slave.dick > 0 && slave.balls === 0 && slave.boobs > 300 && slave.vagina > -1 && slave.ovaries === 1) {
			r = "dickgirl";
		} else if (slave.dick > 0 && slave.vagina > -1 && slave.ovaries === 0) {
			r = "shemale";
		} else if (slave.dick > 0 && slave.balls === 0 && slave.vagina === -1 && slave.ovaries === 0) {
			r = "eunuch";
		} else if (slave.dick > 0 && slave.balls > 0 && slave.vagina === -1 && slave.ovaries === 0) {
			if (slave.face > 10 && slave.hips > -1 && slave.shoulders < 1 && slave.faceShape !== "masculine") {
				r = "trap";
			} else if (slave.boobs > 800) {
				r = "tittyboy";
			} else if (slave.dick === 1 && slave.balls === 1) {
				r = "sissy";
			} else if (slave.dick > 1 && slave.balls > 1 && slave.height < 165 && slave.muscles < 5 && slave.visualAge < 19 && slave.faceShape !== "masculine") {
				r = "twink";
			} else if (slave.dick > 1 && slave.balls > 1 && slave.height < 160 && slave.muscles < 5 && slave.visualAge < 19) {
				r = "boytoy";
			} else if (slave.muscles > 95 && slave.height >= 185) {
				r = "titan";
			} else if (slave.muscles > 30) {
				r = "muscleboy";
			} else {
				r = "slaveboy";
			}
		} else if (slave.dick === 0 && slave.balls === 0 && slave.vagina > -1) {
			if ((slave.shoulders > slave.hips || slave.faceShape === "masculine") && slave.boobs < 400 && slave.genes === "XY") {
				r = "cuntboy";
			} else if (slave.ovaries === 0 && slave.genes === "XY") {
				r = "tranny";
			} else if (slave.weight > 10 && slave.boobs > 800 && slave.birthsTotal > 0 && slave.physicalAge > 59) {
				r = "GMILF";
			} else if (slave.weight > 10 && slave.boobs > 800 && slave.birthsTotal > 0 && slave.physicalAge > 35) {
				r = "MILF";
			} else if (slave.lips > 70 && slave.boobs > 2000 && slave.butt > 3) {
				r = "bimbo";
			} else if (slave.hips > 1 && slave.boobs > 2000 && slave.butt > 3 && slave.waist < 50) {
				r = "hourglass";
			} else if (slave.muscles > 95 && slave.height >= 185) {
				r = "amazon";
			} else if (slave.muscles > 30) {
				r = "musclegirl";
			} else {
				r = "slavegirl";
			}
		} else if (slave.dick === 0 && slave.balls === 0 && slave.vagina === -1) {
			r = "neuter";
		} else if (slave.dick === 0 && slave.vagina === -1) {
			r = "ballslave";
		} else {
			r = "slave";
		}

		if (slave.visualAge < 13) {
			if (slave.genes === "XY" && slave.vagina === -1) {
				r = "shota " + r;
			} else {
				r = "loli " + r;
			}
		}

		if (slave.dick > 9 && slave.balls > 9 && slave.boobs > 12000) {
			r = "hyper " + r;
		}

		if (slave.boobs > 4000 && slave.lactation > 0) {
			if (slave.physicalAge < 13) {
				r = r + " calf";
			} else {
				r = r + " cow";
			}
		} else if (slave.lactation > 0) {
			r = "milky " + r;
		}

		if (slave.boobs > 20000) {
			r = "supermassive titted " + r;
		} else if (slave.boobs > 10000) {
			r = "giant titted " + r;
		} else if (slave.boobs > 4000) {
			r = "huge titted " + r;
		} else if (slave.boobs > 1000) {
			r = "busty " + r;
		}

		if (slave.dick > 5 && slave.balls > 5) {
			r = "womb filling " + r;
		} else if (slave.dick > 5) {
			r = "well hung " + r;
		}

		if (slave.butt >= 12) {
			r = "colossal assed " + r;
		} else if (slave.butt >= 12) {
			r = "massive assed " + r;
		} else if (slave.butt >= 8) {
			r = "fat assed " + r;
		} else if (slave.butt >= 6) {
			r = "bottom heavy " + r;
		} else if (slave.butt >= 4) {
			r = "big bottomed " + r;
		}

		if (slave.weight > 10 && slave.weight < 100 && slave.boobs > 5000 && slave.butt > 5 && slave.hips >= 2 && slave.bellyPreg >= 30000 && slave.births >= 10) {
			r = r + "fertility goddess";
		} else if (slave.births >= 6) {
			r = r + " broodmother";
		} else if (slave.births >= 3) {
			r = r + " breeder";
		}

		if (slave.indenture > -1) {
			r = "indentured " + r;
		}

		if (slave.preg > 10 && slave.pregKnown === 1) {
			r = "pregnant " + r;
		} else if (slave.bellyFluid >= 5000) {
			r = "bloated " + r;
		} else if (slave.belly >= 5000) {
			r = "gravid " + r;
		}

		if (slave.fuckdoll > 0) {
			r = r + " fuckdoll";
		}
	} else {
		r = "slave"; /* I don't tihnk there is an 'else'? */
		if ((slave.dick === 0) && (slave.vagina === -1)) { /* NULLS */
			r = "null";
				if ((slave.lactation > 0) && (slave.boobs > 2000)) {
					r = r + " cow";
				} else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) {
					r = r + " bimbo ";
				} else if (slave.boobs > 6000) {
					r = r + " boob";
				} else if (slave.butt > 6) {
					r = r + " ass";
				} else if ((slave.muscles > 30) && (slave.height < 185)) {
						r = r + " muscle";
				}
					if (slave.visualAge > 55) {
						r = r + "GILF";
					} else if (slave.visualAge > 35) {
						r = r + "MILF";
					} else if (slave.visualAge >= 25) {
						r = r + "slave";
					} else {
						r = r + "girl";
					}
		}

		if ((slave.dick === 0) && (slave.vagina !== -1)) { /* FEMALES */
			if (slave.visualAge > 55) {
				r = "GILF";
			} else if (slave.visualAge > 35) {
				r = "MILF";
			} else if (slave.visualAge >= 25) {
				r = "slave";
			} else {
				r = "slavegirl";
			}
				if ((slave.muscles > 30) && (slave.height < 185)) {
					r = "muscle " + r;
				} else if ((slave.lactation > 0) && (slave.boobs > 2000)) {
					r = r + " cow";
				} else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) {
					r = r + " bimbo";
				} else if (slave.boobs > 6000) {
					r = "boob" + r;
				} else if (slave.butt > 6) {
					r = "ass" + r;
				}
		}

		if ((slave.dick !== 0) && (slave.vagina !== -1)) {
				if (slave.balls > 0) { /* FUTANARI: cock & balls & vagina */
					r = "futanari ";
				} else { /* FUTANARI: cock & vagina */
					r = "futa ";
				}
					if ((slave.lactation > 0) && (slave.boobs > 2000)) {
						r = r + "cow";
					} else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) {
						r = r + "bimbo ";
					} else if (slave.boobs > 6000) {
						r = r + "boob";
					} else if (slave.butt > 6) {
						r = r + "ass";
					} else if ((slave.muscles > 30) && (slave.height < 185)) {
						r = r + "muscle";
					}
						if (slave.visualAge > 55) {
							r = r + "GILF";
						} else if (slave.visualAge > 35) {
							r = r + "MILF";
						} else if (slave.visualAge >= 25) {
							r = r + "slave";
						} else {
							r = r + "girl";
						}
							if (slave.dick > 5 && slave.balls > 5 && slave.boobs > 5000) {
								r = "hyper " + r;
							}
		}

		if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls > 0) && (slave.boobs > 300) && (slave.butt > 2)) { /* SHEMALES: cock & balls, T&A above minimum */
			if (slave.visualAge > 55) {
				r = "sheGILF";
			} else if (slave.visualAge > 35) {
				r = "sheMILF";
			} else if (slave.visualAge >= 25) {
				r = "shemale";
			} else {
				r = "tgirl";
			}
				if ((slave.muscles > 30) && (slave.height < 185)) {
					r = "muscle" + r;
				} else if ((slave.lactation > 0) && (slave.boobs > 2000)) {
					r = r + " cow";
				} else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) {
					r = r + " bimbo";
				} else if (slave.boobs > 6000) {
					r = "topheavy " + r;
				} else if (slave.butt > 6) {
					r = "bottomheavy " + r;
				}
		}

		if ((slave.boobs < 300) || (slave.butt < 2)) {
			if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls > 0)) {
				if ((slave.shoulders < 1) || (slave.muscles <= 30)) {
					if ((slave.faceShape === "masculine") || (slave.faceShape === "androgynous")) { /* SISSIES: feminine shoulders or muscles, masculine faces */
						if (slave.visualAge > 55) {
							r = "sissyGILF";
						} else if (slave.visualAge > 35) {
							r = "sissyMILF";
						} else {
							r = "sissy";
						}
					} else { /* TRAPS: feminine shoulders or muscles, feminine faces */
						if (slave.visualAge > 55) {
							r = "trapGILF";
						} else if (slave.visualAge > 35) {
							r = "trapMILF";
						} else if (slave.visualAge >= 25) {
							r = "trap";
						} else {
							r = "trapgirl";
						}
					}
						if (slave.lactation > 0) {
							r = r + " cow";
						} else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) {
							r = r + " bimbo";
						}
				}
			}
		}

		if ((slave.boobs < 300) || (slave.butt < 2)) {
			if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls > 0)) {
				if ((slave.shoulders > 1) || (slave.muscles >= 30)) {	/* BITCHES: masculine shoulders or muscles */
					r = "bitch";
						if ((slave.muscles > 30) && (slave.height < 185)) {
							r = "muscle" + r;
						} else if (slave.lactation > 0) {
							r = r + "cow";
						} else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) {
							r = "bimbo " + r;
						}
						if (slave.visualAge > 55) {
							r = "aged " + r;
						} else if (slave.visualAge > 35) {
							r = "mature " + r;
						} else if (slave.visualAge < 25) {
							r = "young " + r;
						}
				}
			}
		}

		if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls === 0)) {
			r = "dick";
				if (slave.visualAge > 55) {
					r = r + "GILF";
				} else if (slave.visualAge > 35) {
					r = r + "MILF";
				} else if (slave.visualAge >= 25) {
					r = r + "slave";
				} else {
					r = r + "girl";
				}
					if ((slave.muscles > 30) && (slave.height < 185)) {
						r = "muscle" + r;
					} else if ((slave.lactation > 0) && (slave.boobs > 2000)) {
						r = r + " cow";
					} else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) {
						r = r + " bimbo";
					} else if (slave.boobs > 6000) {
						r = "boob " + r;
					} else if (slave.butt > 6) {
						r = "ass " + r;
					}
		}

		if ((slave.muscles > 30) && (slave.height > 185)) {
			r = "amazon " + r;
		} else if ((slave.muscles < 30) && (slave.height > 185)) {
			r = "statuesque " + r;
		} else if ((slave.boobs < 800) && (slave.height < 150)) {
			r = "petite " + r;
		} else if ((slave.boobs > 800) && (slave.height < 150)) {
			r = "shortstack " + r;
		}

		if (slave.births >= 5) {
			r = r + " broodmother";
		} else if (slave.births >= 2) {
			r = r + " breeder";
		}

		if (slave.indenture > -1) {
			r = "indentured " + r;
		}

		if (slave.preg > 10 && slave.pregKnown === 1) {
			r = "pregnant " + r;
		} else if (slave.bellyFluid >= 5000) {
			r = "bloated " + r;
		} else if (slave.belly >= 5000) {
			r = "gravid " + r;
		}

		if (slave.fuckdoll > 0) {
			r = r + " fuckdoll";
		}
	}
	return r;
};

window.DegradingName = function DegradingName(slave) {
	const V = State.variables;
	const leadershipPosition = [
		"be the Attendant",
		"be the Matron",
		"be the Stewardess",
		"be the Milkmaid",
		"be the DJ",
		"be your Concubine",
		"be the Madam",
		"be the Schoolteacher",
		"be the Wardeness",
		"be the Nurse",
		"be your Head Girl",
		"guard you",
		"recruit girls"];
	let names = [];
	let suffixes = [];

	if (slave.fuckdoll > 0) {
		slave.slaveName = "Fuckdoll No. " + slave.ID;
		slave.slaveSurname = 0;
	} else if (slave.assignment === "work in the dairy" && V.dairyRestraintsSetting >= 2) {
		slave.slaveName = "Bioreactor No. " + slave.ID;
		slave.slaveSurname = 0;
	} else {
		if (V.seeRace === 1) {
			switch (slave.race) {
				case "white":
					names.push("Pale", "White");
					break;
				case "asian":
					names.push("Asian", "Yellow");
					break;
				case "latina":
					names.push("Brown", "Latina");
					break;
				case "black":
					names.push("Black", "Dark");
					break;
				case "pacific islander":
					names.push("Islander", "Pacific", "Sea");
					break;
				case "malay":
					names.push("Cinnamon", "Pinoy", "Spice");
					break;
				case "southern european":
					names.push("Mediterranean", "Olive");
					break;
				case "amerindian":
					names.push("Indian", "Reservation");
					break;
				case "semitic":
					names.push("Semite", "Semitic");
					break;
				case "middle eastern":
					names.push("Arab", "Sand");
					break;
				case "indo-aryan":
					names.push("Brown", "Indian");
					break;
				case "mixed race":
					names.push("Mixed", "Mulatto", "Mutt");
					break;
			}
		}
		names.push(slave.hColor);
		if (slave.eyes === -2) {
			names.push("Blind", "Eyeless", "Sightless");
		}
		if (slave.hears === -2) {
			names.push("Deaf", "Earless", "Unhearing");
		}
		if (slave.boobs >= 2000) {
			suffixes.push("Boob", "Boobs", "Titty");
		}
		if (slave.boobs < 500 && slave.butt < 3) {
			names.push("Girly", "Slim", "Thin");
		}
		if (slave.boobs < 300) {
			names.push("Flat");
		}
		if (slave.anus > 2 || slave.vagina > 2) {
			names.push("Gaping", "Hallway", "Slit", "Wideopen");
		}
		if (slave.weight > 160) {
			names.push("Blimp", "Cow", "Fat", "Fatass", "Whale");
		} else if (slave.weight > 30) {
			names.push("Chubby", "Fat", "Whale");
		} else if (slave.weight <= -30) {
			names.push("Bony", "Rail", "Skinny");
		}
		if (slave.muscles > 30) {
			names.push("Huge", "Muscles", "Ripped", "Strong");
		}
		if (slave.fetishKnown === 1) {
			if (slave.fetish === "buttslut") {
				names.push("Anal", "Sodomy");
			}
			if (slave.fetish === "cumslut") {
				names.push("Cum", "Dicksuck", "Sucker");
			}
			if (slave.fetish === "humiliation") {
				names.push("Rape");
			}
			if (slave.fetish === "masochist") {
				names.push("Pain", "Rape", "Struggle");
			}
			if (slave.fetish === "pregnancy") {
				names.push("Fertile");
			}
		}
		if (slave.boobs*slave.lactation > 1000) {
			names.push("Creamy", "Milky");
			suffixes.push("Cow");
		}
		if (slave.oralSkill <= 30 && slave.analSkill <= 30) {
			names.push("Cheap", "Fail", "Gutter");
		}
		if (slave.nipples === "fuckable") {
			names.push("Nipplefuck", "Nipplecunt");
		} else if (slave.nipples !== "tiny" && slave.nipples !== "cute") {
			names.push("Pointy", "Titclit");
			suffixes.push("Nipples");
		}
		if (slave.visualAge > 35) {
			names.push("Mature");
			suffixes.push("Cougar", "MILF");
		} else if (slave.visualAge < 25) {
			names.push("Girly", "Thin", "Young");
		}
		if (slave.amp === 1) {
			names.push("Stumpy");
			suffixes.push("Stumpy");
		}
		if (slave.boobsImplant > 1000 || slave.buttImplant > 3) {
			names.push("Fake", "Plastic", "Silicone");
		}
		if (slave.dick > 5 && slave.balls > 5) {
			names.push("Potent");
			suffixes.push("Cannon", "Daddy");
		}
		if (slave.preg > 30) {
			if (slave.broodmother === 2) {
				names.push("Bursting", "Seeded");
				suffixes.push("Factory", "Nursery");
			} else if (slave.broodmother === 1) {
				names.push("Bloated", "Stuffed");
				suffixes.push("Breeder", "Factory");
			}
		}
		if (slave.bellyPreg >= 450000) {
			names.push("Bulging", "Squirming");
		}
		if (slave.bellyPreg >= 5000) {
			names.push("Preg");
			suffixes.push("Belly", "Mommy");
		}
		if (slave.belly > 150000) {
			suffixes.push("Balloon");
		}
		if (slave.belly > 1500) {
			suffixes.push("Belly");
		}
		if (slave.dick > 0) {
			if (slave.dick > 4) {
				names.push("Dangle", "Hung");
				suffixes.push("Cock", "Dick");
			}
			if (slave.balls === 0) {
				names.push("Cut", "Gelded", "Soft");
			} else {
				names.push("Erect", "Hard", "Stiff");
			}
		}
		if (slave.dick === 1) {
			names.push("Micro", "Tiny");
			suffixes.push("Bitch");
		}
		if (slave.height >= 185) {
			names.push("Tall", "Top");
			suffixes.push("Tower");
		} else if (slave.height < 150) {
			names.push("Stumpy", "Tiny");
			suffixes.push("Shortstack", "Stumpy");
		}
		if (slave.whoreSkill > 95) {
			names.push("Money", "Street");
			suffixes.push("Whore");
		}
		if (slave.entertainSkill > 95) {
			names.push("Easy", "Club");
			suffixes.push("Slut");
		}
		if (slave.oralSkill > 95) {
			names.push("Suck");
			suffixes.push("Throat");
		}
		if (slave.vaginalSkill > 95) {
			suffixes.push("Channel", "Kegel", "Pussy");
		}
		if (slave.analSkill > 95) {
			suffixes.push("Asspussy", "Sphincter");
		}
		if (slave.intelligence+slave.intelligenceImplant > 50) {
			names.push("Bright", "Clever", "Smart");
			if (slave.intelligenceImplant >= 15) {
				names.push("College", "Graduate", "Nerdy");
			}
		} else if (slave.intelligence+slave.intelligenceImplant < -50) {
			names.push("Cretin", "Dumb", "Retarded", "Stupid");
		}
		if (slave.vagina === 1 && slave.vaginaSkill <= 10) {
			names.push("Fresh", "New", "Tight");
		}
		if (slave.devotion < -75) {
			names.push("Angry", "Biter", "Caged");
		} else if (slave.devotion < -50) {
			names.push("Cell", "Cuffs");
		} else if (slave.devotion < -20) {
			names.push("Bag", "Box");
		} else if (slave.devotion <= 20) {
			names.push("Sad", "Whiner");
		} else if (slave.devotion > 50) {
			names.push("Prize");
			if (slave.visualAge > 35) {
				names.push("Queen");
			} else if (slave.visualAge < 25) {
				names.push("Princess");
			}
		}
		if (slave.trust < -50) {
			names.push("Screaming");
			suffixes.push("Sobber");
		} else if (slave.trust < -20) {
			names.push("Crying");
			suffixes.push("Meat", "Tears", "Thing", "Weeper");
		} else if (slave.trust < 20) {
			names.push("Begging");
		}

		if (slave.dick === 0) {
			if (slave.vagina === -1) {
				suffixes.push("Null");
			} else {
				if (slave.visualAge < 25) {
					suffixes.push("Girl");
				}
			}
		} else {
			if (slave.vagina !== -1) {
				suffixes.push("Futa");
			} else {
				if (slave.balls > 0) {
					if (slave.boobs > 300 && slave.butt > 2) { /* SHEMALES: cock & balls, T&A above minimum */
						suffixes.push("Shemale");
					} else {
						if (slave.shoulders < 1 && slave.muscles <= 30) {
							if (slave.faceShape === "masculine" || slave.faceShape === "androgynous") { /* SISSIES: feminine shoulders or muscles, masculine faces */
								suffixes.push("Sissy");
							} else { /* TRAPS: feminine shoulders or muscles, feminine faces */
								suffixes.push("Trap");
							}
						} else { /* BITCHES: masculine shoulders or muscles */
							suffixes.push("Bitch");
						}
					}
				} else {
					if (slave.visualAge > 35) {
						suffixes.push("DickMILF");
					} else if (slave.visualAge >= 25) {
						suffixes.push("Dickslave");
					} else {
						suffixes.push("Dickgirl");
					}
				}
			}
		}
		if (slave.anus > 0) {
			suffixes.push("Anus", "Asshole", "Backdoor", "Butt", "Butthole");
		}
		if (slave.anus === 1) {
			suffixes.push("Tightass", "Tightbutt");
		}
		if (slave.vagina > 0) {
			suffixes.push("Cunt", "Pussy", "Vagina");
		}
		if (slave.boobs < 500 && slave.butt < 3 && slave.dick > 0) {
			suffixes.push("Bitch", "Bottom", "Sissy", "Trap");
		}
		if (slave.energy > 95) {
			suffixes.push("Fuck", "Fuckaddict", "Nympho", "Sexaddict");
		}
		if (slave.fetishKnown === 1) {
			if (slave.fetish === "humiliation") {
				suffixes.push("Rapebait", "Showgirl");
			}
			if (slave.fetish === "submissive") {
				suffixes.push("Bottom", "Fuckee", "Rapebait");
			}
			if (slave.fetish === "dom") {
				suffixes.push("Dom", "Fucker", "Top");
			}
			if (slave.fetish === "pregnancy") {
				suffixes.push("Breeder", "Mommy");
			}
			if (slave.fetish === "boobs") {
				suffixes.push("Boob", "Boobie", "Tit", "Titty");
			}
		}
		if (slave.births >= 2) {
			suffixes.push("Breeder");
			if (slave.births >= 5) {
				suffixes.push("Broodmother");
			}
		}
		if (slave.areolae > 2) {
			suffixes.push("Areolas", "Headlights");
		}
		if (slave.lips > 40) {
			suffixes.push("Lips", "Pillows");
		}
		if (slave.labia > 1) {
			suffixes.push("Curtains", "Flower", "Lips");
		}
		if (slave.breedingMark === 1 && V.propOutcome === 1) {
			suffixes.push("Breeder", "Oven", "Womb");
		}
		if (slave.butt > 5) {
			suffixes.push("Ass", "Bottom", "Butt");
		}
		if (slave.vagina === 0) {
			suffixes.push("Virgin");
		}

		slave.slaveName = jsEither(names);
	}
	if (leadershipPosition.includes(slave.assignment)) {
		switch (slave.assignment) {
			case "be the Attendant":
				slave.slaveName = jsEither(["Bath", "Spa"]);
				break;
			case "be the Matron":
				slave.slaveName = jsEither(["Nursery", "Matron"]);
				break;
			case "be the Stewardess":
				slave.slaveName = jsEither(["Servant", "Maid"]);
				break;
			case "be the Milkmaid":
				if (V.cumSlaves > 3) {
					slave.slaveName = jsEither(["Fucker", "Milker"]);
				} else {
					slave.slaveName = jsEither(["Dairy", "Farm"]);
				}
				break;
			case "be the DJ":
				slave.slaveName = jsEither(["Bass", "Booth"]);
				break;
			case "be your Concubine":
				slave.slaveName = jsEither(["Bed", "Master"]);
				break;
			case "be the Madam":
				slave.slaveName = jsEither(["Madam", "Pimp"]);
				break;
			case "be the Schoolteacher":
				slave.slaveName = jsEither(["Classroom", "Teacher"]);
				break;
			case "be the Wardeness":
				slave.slaveName = jsEither(["Jail", "Prison"]);
				break;
			case "be the Nurse":
				slave.slaveName = jsEither(["Clinic", "Nurse"]);
				break;
			case "be your Head Girl":
				slave.slaveName = jsEither(["Chief", "Head"]);
				break;
			case "guard you":
				slave.slaveName = jsEither(["Battle", "Guard"]);
				break;
			case "recruit girls":
				slave.slaveName = jsEither(["Cam", "Recruiter"]);
				break;
		}
	}
	let surname = jsEither(suffixes);
	if (typeof surname === "string" && surname.toLowerCase() === slave.slaveName.toLowerCase()) {
		DegradingName(slave);
	}
	slave.slaveName = capFirstChar(slave.slaveName);
	slave.slaveSurname = surname;
};

window.SlaveSort = function SlaveSort(slaves, main=false) {
	const V = State.variables;
	if (main) {
		switch (V.sortSlavesBy) {
		case "name":
			if (V.sortSlavesOrder === "ascending")
				slaves = slaves.sort((a, b) => a.slaveName < b.slaveName ? -1 : 1);
			else
				slaves = slaves.sort((a, b) => a.slaveName > b.slaveName ? -1 : 1);
			break;
		case "assignment":
			if (V.sortSlavesOrder === "ascending")
				slaves = slaves.sort((a, b) => a.assignment < b.assignment ? -1 : 1);
			else
				slaves = slaves.sort((a, b) => a.assignment > b.assignment ? -1 : 1);
			break;
		case "seniority":
			if (V.sortSlavesOrder === "ascending")
				slaves = slaves.sort((a, b) => b.weekAcquired - a.weekAcquired);
			else
				slaves = slaves.sort((a, b) => a.weekAcquired - b.weekAcquired);
			break;
		case "actualAge":
			if (V.sortSlavesOrder === "ascending")
				slaves = slaves.sort((a, b) => a.actualAge - b.actualAge);
			else
				slaves = slaves.sort((a, b) => b.actualAge - a.actualAge);
			break;
		case "visualAge":
			if (V.sortSlavesOrder === "ascending")
				slaves = slaves.sort((a, b) => a.visualAge - b.visualAge);
			else
				slaves = slaves.sort((a, b) => b.visualAge - a.visualAge);
			break;
		case "physicalAge":
			if (V.sortSlavesOrder === "physicalAge")
				slaves = slaves.sort((a, b) => a.physicalAge - b.physicalAge);
			else
				slaves = slaves.sort((a, b) => b.physicalAge - a.physicalAge);
			break;
		default:
			if (V.sortSlavesOrder === "ascending")
				slaves = slaves.sort((a, b) => a.devotion - b.devotion);
			else
				slaves = slaves.sort((a, b) => b.devotion - a.devotion);
			break;
		}
		V.slaveIndices = slaves2indices();
	} else {
		V.slaveIndices = slaves2indices();
		filterInPlace(slaves, s => V.slaveIndices[s] !== undefined);
		slaves.sort((a, b) => V.slaveIndices[a] - V.slaveIndices[b]);
	}
};

window.slaveSortMinor = function slaveSortMinor(slaves) {
	slaves = slaves.sort((a, b) => a.slaveName < b.slaveName ? -1 : 1);
}

window.MenialPopCap = function MenialPopCap () {
	const V = State.variables;
	let popCap = 500;
	let r = "";

	for (let mwi = 20; mwi < V.sectors.length; mwi++) {
		if (V.sectors[mwi].type === "Pens") {
			popCap += 500;
		}
	}
	let overMenialCap = V.helots + V.fuckdolls + V.menialBioreactors - popCap;
	if (overMenialCap > 0) {
		let price = menialSlaveCost();
		if (V.helots > 0) {
			if (V.helots > overMenialCap) {
				V.cash += overMenialCap * price;
				V.menialDemandFactor -= overMenialCap;
				V.helots -= overMenialCap;
				overMenialCap = 0;
				r += "You don't have enough room for all your menials and are obliged to sell some.";
			} else {
				V.cash += V.helots * price;
				V.menialDemandFactor -= V.helots;
				overMenialCap -= V.helots;
				V.helots = 0;
				r += "You don't have enough room for your menials and are obliged to sell them.";
			}
		}
		if (overMenialCap > 0 && V.fuckdolls > 0) {
			if (V.fuckdolls > overMenialCap) {
				V.cash += overMenialCap * (price * 2);
				V.menialDemandFactor -= overMenialCap;
				V.fuckdolls -= overMenialCap;
				overMenialCap = 0;
				r += "You don't have enough room for all your fuckdolls and are obliged to sell some.";
			} else {
				V.cash += V.fuckdolls * (price * 2);
				V.menialDemandFactor -= V.fuckdolls;
				overMenialCap -= V.fuckdolls;
				V.fuckdolls = 0;
				r += "You don't have enough room for your fuckdolls and are obliged to sell them.";
			}
		}
		if (overMenialCap > 0 && V.menialBioreactors > 0) {
			V.cash += overMenialCap * (price - 100);
			V.menialDemandFactor -= overMenialCap;
			V.menialBioreactors -= overMenialCap;
			r += "You don't have enough room for all your menial bioreactors and are obliged to sell some.";
		}
	}
	V.PopCap = popCap;
	return r;
};

window.faceIncrease = function faceIncrease(slave, amount) {
	const pronouns = getPronouns(slave);
	const his = pronouns.possessive;
	const His = capFirstChar(his);
	let r = "";
	if (slave.face <= -95)
		r += `<span class="green">${His} face is no longer horrifying,</span> and is now merely ugly.`;
	else if (slave.face <= -40 && slave.face + amount > -40)
		r += `<span class="green">${His} face is no longer ugly,</span> and is now merely unattractive.`;
	else if (slave.face <= -10 && slave.face + amount > -10)
		r += `<span class="green">${His} face is no longer unattractive,</span> and is now somewhat tolerable.`;
	else if (slave.face <= 10 && slave.face + amount > 10)
		r += `<span class="green">${His} face is now decently attractive,</span> rather than merely tolerable.`;
	else if (slave.face <= 40 && slave.face + amount > 40)
		r += `<span class="green">${His} face is now quite beautiful,</span> rather than merely pretty.`;
	else if (slave.face <= 95 && slave.face + amount > 95)
		r += `<span class="green">${His} face is now perfect.</span> It's difficult to imagine how it could be any more beautiful.`;
	slave.face = Math.clamp(slave.face + amount,-100,100);
	if (slave.face > 95) slave.face = 100;
	return r;
};


code:
:: assignJob [script]

window.assignJob = function assignJob(slave, job) {
	"use strict";
	const V = State.variables;
	let r = "";

	if (job === "Pit" || job === "Coursing Association")
		return r;

	removeJob(slave, slave.assignment);
	const idx = V.slaveIndices[slave.ID];

	/* use .toLowerCase() to get rid of a few dupe conditions. */
	switch (job.toLowerCase()) {
		case "be confined in the arcade":
		case "arcade":
			slave.assignment = "be confined in the arcade";
			slave.assignmentVisible = 0;
			V.arcadeSlaves++;
			V.ArcadeiIDs.push(slave.ID);
			slave.clothing = "none";
			slave.shoes = "none";
			slave.collar = "none";
			slave.livingRules = "spare";
			break;

		case "work in the brothel":
		case "brothel":
			slave.assignment = "work in the brothel";
			slave.assignmentVisible = 0;
			V.brothelSlaves++;
			V.BrothiIDs.push(slave.ID);
			switch (V.brothelDecoration) {
				case "Degradationist":
				case "standard":
					slave.livingRules = "spare";
					break;
				default:
					slave.livingRules = "normal";
					break;
			}
			break;

		case "be confined in the cellblock":
		case "cellblock":
			slave.assignment = "be confined in the cellblock";
			slave.assignmentVisible = 0;
			V.cellblockSlaves++;
			V.CellBiIDs.push(slave.ID);
			switch (V.cellblockDecoration) {
				case "Paternalist":
					slave.livingRules = "normal";
					break;
				default:
					slave.livingRules = "spare";
					break;
			}
			break;

		case "get treatment in the clinic":
		case "clinic":
			slave.assignment = "get treatment in the clinic";
			slave.assignmentVisible = 0;
			V.clinicSlaves++;
			V.CliniciIDs.push(slave.ID);
			switch (V.clinicDecoration) {
				case "Repopulation Focus":
				case "Eugenics":
				case "Gender Radicalist":
				case "Gender Fundamentalist":
				case "Paternalist":
				case "Maturity Preferentialist":
				case "Youth Preferentialist":
				case "Slimness Enthusiast":
				case "Hedonistic":
					slave.livingRules = "luxurious";
					break;

				case "Roman Revivalist":
				case "Aztec Revivalist":
				case "Egyptian Revivalist":
				case "Arabian Revivalist":
				case "Chinese Revivalist":
				case "Chattel Religionist":
				case "Edo Revivalist":
					slave.livingRules = "normal";
					break;

				default:
					slave.livingRules = "spare";
					break;
			}
			break;

		case "serve in the club":
		case "club":
			slave.assignment = "serve in the club";
			slave.assignmentVisible = 0;
			V.clubSlaves++;
			V.ClubiIDs.push(slave.ID);
			slave.livingRules = "normal";
			break;

		case "work in the dairy":
		case "dairy":
			slave.assignment = "work in the dairy";
			slave.assignmentVisible = 0;
			V.dairySlaves++;
			V.DairyiIDs.push(slave.ID);
			switch (V.dairyDecoration) {
				case "Roman Revivalist":
				case "Aztec Revivalist":
				case "Chinese Revivalist":
				case "Chattel Religionist":
				case "Edo Revivalist":
				case "Arabian Revivalist":
				case "Egyptian Revivalist":
				case "Supremacist":
				case "Subjugationist":
				case "Degradationist":
					slave.livingRules = "spare";
					break;
				default:
					slave.livingRules = "normal";
					break;
			}
			break;

		case "live with your head girl":
		case "head girl suite":
		case "hgsuite":
			slave.assignment = "live with your Head Girl";
			slave.assignmentVisible = 0;
			V.HGSuiteSlaves++;
			V.HGSuiteiIDs.push(slave.ID);
			slave.livingRules = "luxurious";
			break;

		case "serve in the master suite":
		case "master suite":
		case "mastersuite":
			slave.assignment = "serve in the master suite";
			slave.assignmentVisible = 0;
			V.masterSuiteSlaves++;
			V.MastSiIDs.push(slave.ID);
			if(V.masterSuiteUpgradeLuxury > 0)
				slave.livingRules = "luxurious";
			else
				slave.livingRules = "spare";
			break;

		case "learn in the schoolroom":
		case "schoolroom":
			slave.assignment = "learn in the schoolroom";
			slave.assignmentVisible = 0;
			V.schoolroomSlaves++;
			V.SchlRiIDs.push(slave.ID);
			slave.livingRules = "normal";
			break;

		case "work as a servant":
		case "servants' quarters":
		case "servantsquarters":
			slave.assignment = "work as a servant";
			slave.assignmentVisible = 0;
			V.servantsQuartersSlaves++;
			V.ServQiIDs.push(slave.ID);
			switch (V.servantsQuartersDecoration) {
				case "Roman Revivalist":
				case "Aztec Revivalist":
				case "Chinese Revivalist":
				case "Chattel Religionist":
				case "Edo Revivalist":
				case "Supremacist":
				case "Subjugationist":
				case "Degradationist":
				case "Arabian Revivalist":
				case "Egyptian Revivalist":
					slave.livingRules = "spare";
					break;
				default:
					slave.livingRules = "normal";
					break;
			}
			break;

		case "rest in the spa":
		case "spa":
			slave.assignment = "rest in the spa";
			slave.assignmentVisible = 0;
			V.spaSlaves++;
			V.SpaiIDs.push(slave.ID);
			switch (V.spaDecoration) {
				case "Chattel Religionist":
				case "Chinese Revivalist":
					slave.livingRules = "normal";
					break;
				case "Degradationist":
					slave.livingRules = "spare";
					break;
				default:
					slave.livingRules = "luxurious";
					break;
			}
			break;

		case "work as a nanny":
		case "nursery":
			slave.assignment = "work as a nanny";
			slave.assignmentVisible = 0;
			V.nurserySlaves++;
			V.NurseryiIDs.push(slave.ID);
			slave.livingRules = "normal";
			break;

		case "be the attendant":
		case "be the matron":
		case "be the dj":
		case "be the madam":
		case "be the milkmaid":
		case "be the nurse":
		case "be the schoolteacher":
		case "be the stewardess":
		case "be the wardeness":
		case "be the matron":
			slave.assignment = job;
			slave.assignmentVisible = 0; /* non-visible leadership roles */
			slave.livingRules = "luxurious";
			break;

		case "be your concubine":
			slave.assignment = job;
			slave.assignmentVisible = 0; /* non-visible leadership roles */
			if(V.masterSuiteUpgradeLuxury > 0)
				slave.livingRules = "luxurious";
			else
				slave.livingRules = "normal";
			break;

		case "be your head girl":
			slave.assignment = job;
			if (V.HGSuite === 1) {
				slave.livingRules = "luxurious";
			}
			break;

		case "guard you":
			slave.assignment = job;
			if (V.dojo > 1) {
				slave.livingRules = "luxurious";
			}
			if (V.pitBG == 1 && V.fighterIDs.includes(slave.ID))
				V.fighterIDs.delete(slave.ID);
			break;

		case "be your agent":
		case "live with your agent":
			slave.assignment = job;
			slave.assignmentVisible = 0;
			slave.useRulesAssistant = 0; /* non-visible roles exempt from Rules Assistant */
			if (job === "be your agent") {
				V.leaders.push(slave);
			}
			break;

		case "choose her own job":
			slave.assignment = job;
			slave.choosesOwnAssignment = 1; /* removeJob already set assignmentVisible = 1 */
			break;

		default:
			slave.assignment = job; /* removeJob already set assignmentVisible = 1 and choosesOwnAssignment = 0 */
			break;
	}

	if (slave.assignmentVisible === 0 && Array.isArray(V.personalAttention)) {
		const awi = V.personalAttention.findIndex(function(s) { return s.ID === slave.ID; });
		if (awi != -1) {
			V.personalAttention.deleteAt(awi);
			if (V.personalAttention.length === 0) {
				if (V.PC.career === "escort")
					V.personalAttention = "whoring";
				else if (V.PC.career === "servant")
					V.personalAttention = "upkeep";
				else
					V.personalAttention = "business";
				r += `${slave.slaveName} no longer has your personal attention; you plan to focus on ${V.personalAttention}.`;
			} else
				r += `${slave.slaveName} no longer has your personal attention.`;
		}
	}
	if (idx >= 0)
		V.slaves[idx] = slave;

	return r;
};

window.removeJob = function removeJob(slave, assignment) {
	"use strict";
	const V = State.variables;
	let r = "";

	const idx = V.slaveIndices[slave.ID];

	if (assignment === "Pit")
		V.fighterIDs.delete(slave.ID);

	else if (assignment === "Coursing Association")
		V.Lurcher = 0;

	else {
		if (V.HeadGirl !== 0 && slave.ID === V.HeadGirl.ID)
			V.HeadGirl = 0;
		if (V.Recruiter !== 0 && slave.ID == V.Recruiter.ID)
			V.Recruiter = 0;
		if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID)
			V.Bodyguard = 0;
		if (V.Madam !== 0 && slave.ID === V.Madam.ID)
			V.Madam = 0;
		if (V.DJ !== 0 && slave.ID === V.DJ.ID)
			V.DJ = 0;
		if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID)
			V.Milkmaid = 0;
		if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID)
			V.Schoolteacher = 0;
		if (V.Attendant !== 0 && slave.ID === V.Attendant.ID)
			V.Attendant = 0;
		if (V.Matron !== 0 && slave.ID === V.Matron.ID)
			V.Matron = 0;
		if (V.Nurse !== 0 && slave.ID === V.Nurse.ID)
			V.Nurse = 0;
		if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID)
			V.Stewardess = 0;
		if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID)
			V.Wardeness = 0;
		if (V.Concubine !== 0 && slave.ID === V.Concubine.ID)
			V.Concubine = 0;
		if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID)
			V.Collectrix = 0;

		/* use .toLowerCase() to get rid of a few dupe conditions. */
		switch (assignment.toLowerCase()) {
		case "be confined in the arcade":
		case "arcade":
			slave.assignment = "work a glory hole";
			V.ArcadeiIDs.delete(slave.ID);
			V.arcadeSlaves--;
			break;

		case "work in the brothel":
		case "brothel":
			slave.assignment = "whore";
			V.BrothiIDs.delete(slave.ID);
			V.brothelSlaves--;
			break;

		case "be confined in the cellblock":
		case "cellblock":
			slave.assignment = "rest";
			if (slave.inflation > 0) {
				slave.inflation = 0;
				slave.inflationType = "none";
				slave.inflationMethod = 0;
				SetBellySize(slave);
			}
			V.CellBiIDs.delete(slave.ID);
			V.cellblockSlaves--;
			break;

		case "get treatment in the clinic":
		case "clinic":
			slave.assignment = "rest";
			V.CliniciIDs.delete(slave.ID);
			V.clinicSlaves--;
			break;

		case "serve in the club":
		case "club":
			slave.assignment = "serve the public";
			V.ClubiIDs.delete(slave.ID);
			V.clubSlaves--;
			break;

		case "work in the dairy":
		case "dairy":
			slave.assignment = "get milked";
			V.DairyiIDs.delete(slave.ID);
			V.dairySlaves--;
			break;

		case "learn in the schoolroom":
		case "schoolroom":
			slave.assignment = "rest";
			V.SchlRiIDs.delete(slave.ID);
			V.schoolroomSlaves--;
			break;

		case "rest in the spa":
		case "spa":
			slave.assignment = "rest";
			V.SpaiIDs.delete(slave.ID);
			V.spaSlaves--;
			break;

		case "work as a servant":
		case "servants' quarters":
		case "servantsquarters":
			slave.assignment = "be a servant";
			V.ServQiIDs.delete(slave.ID);
			V.servantsQuartersSlaves--;
			break;

		case "serve in the master suite":
		case "master suite":
		case "mastersuite":
			slave.assignment = "please you";
			V.MastSiIDs.delete(slave.ID);
			V.masterSuiteSlaves--;
			break;

		case "live with your head girl":
		case "head girl suite":
		case "hgsuite":
			slave.assignment = "rest";
			V.HGSuiteiIDs.delete(slave.ID);
			V.HGSuiteSlaves--;
			break;

		case "work as a nanny":
		case "nursery":
			slave.assignment = "rest";
			V.NurseryiIDs.delete(slave.ID);
			V.nurserySlaves--;
			break;

		case "be your head girl":
			slave.assignment = "rest";
			if (V.HGSuiteEquality === 0 && V.personalAttention === "HG") {
				if (V.PC.career === "escort")
					V.personalAttention = "whoring";
				else if (V.PC.career === "servant")
					V.personalAttention = "upkeep";
				else
					V.personalAttention = "business";

				r += `You no longer have a slave assigned to be your Head Girl, so you turn your personal attention to focus on ${V.personalAttention}.`;
			}
			break;

		case "be your agent":
		case "live with your agent":
			slave.assignment = "rest";
			const _leaderIndex = V.leaders.findIndex(function(x) { return x.ID === slave.ID; });
			if (_leaderIndex !== -1)
				V.leaders.deleteAt(_leaderIndex);

			if (slave.relationshipTarget > 0) { /* following code assumes there can be at most one companion */
				const _lover = V.slaves.findIndex(function(s) { return haveRelationshipP(s, slave) && s.assignment === "live with your agent"; });
				if (_lover !== -1) {
					V.slaves[_lover].assignment = "rest";
					V.slaves[_lover].assignmentVisible = 1;
				}
			}
			break;

		default:
			slave.assignment = "rest";
			break;
		}

		if (slave.livingRules === "luxurious" && slave.assignmentVisible !== 1)
			slave.livingRules = "normal";

		slave.assignmentVisible = 1;
		slave.choosesOwnAssignment = 0;
		slave.sentence = 0;
	}
	if (idx >= 0)
		V.slaves[idx] = slave;

	return r;
};


code:
:: colorModeJS [script]

window.flipColors = function (lightColorMap){
	if ( !window.savedColorMap ){
		window.savedColorMap = setColors(lightColorMap);
	} else {
		restoreColors(window.savedColorMap);
		window.savedColorMap = null;
	}
}

window.setColors = function(colorMap){
	let originalState = [];
	let props = ["color","backgroundColor","backgroundImage"];
	let styleSheetArray = Array.from(document.styleSheets);
	styleSheetArray.forEach( styleSheet => {
		let cssRules = Array.from(styleSheet.cssRules);
		cssRules.forEach( cssRule => {
			if ( cssRule.type === 1 ){
				props.forEach( propName => {
					let currentValue = cssRule.style[propName];
					if (
						currentValue != "" &&
						currentValue != "inherit" &&
						currentValue != "transparent"){
						let newVal = colorMap[currentValue];
						if ( typeof newVal != "undefined" ){
							cssRule.style[propName] = newVal;
							originalState.push(
								{
									element: cssRule,
									propName: propName,
									value: currentValue
								}
							);
						}
					}
				})
			}
		});
	});
	return originalState;
}

window.restoreColors = function(styleMap){
	styleMap.forEach(
		item => {
			item.element.style[item.propName] = item.value
		}
	)
}


code:
:: Datatype Cleanup JS [script]

/*
	This function does not ensure values make sense. For example, it does not fix weird relations/relationships/rivalries/pregnancies/prosthetics.
	It only makes sure most datatypes are correct, and sets to default if not. Number values are clamped to the correct bounds.
	Any values that are supposed to be objects or arrays are not handled (yet).

	A tutorial on how to add to this passage:
		The || operator can be very useful for setting default values. To be precise,
			x = y || z
		is the same thing as
			if (y) {x = y}
			else {x = z}
		This means that if z is the default value, in the ideal case you could write x = x || z. If x is already in use, this won't change it, and if x is not defined it will set it to z.
		However, for example, if x is 0 but the default is -1 this will actually set x to -1! So care must be taken.

		Let's say you want to add slave.value to this function, and you want it to be a number.
		First, you need to take whatever slave.value currently is, and turn it into a number. You can use either +slave.value or Number(slave.value) to do this.
		Second, you need to determine what range to restrict slave.value to. You'll either use Math.max, Math.min, Math.clamp, or none of them.
		Finally, you need to consider the default value if the .max/.min/.clamp returned 0 (or NaN). To make a long story short,
			Use slave.value = Math.max(+slave.value, a) || default; if you need slave.value >= a.
			Use slave.value = Math.min(+slave.value, a) || default; if you need slave.value <= a.
			Use slave.value = Math.clamp(+slave.value, a, b) || default; if you need a <= slave.value <= b.
			Use slave.value = +slave.value || default; if slave.value can be any number.
		The exception to this is if the default != 0. In this case, it's usually good enough to just check if slave.value !== 0 first. The strict equality is important!

		If you want slave.value to be a string, there's no easy tricks to make sure it's already an accepted value. The simplest way is the following
			if (typeof slave.value !== "string") slave.value = default;
*/
window.SlaveDatatypeCleanup = function SlaveDatatypeCleanup (slave) {
	const V = State.variables;

	slave.weekAcquired = Math.max(+slave.weekAcquired, 1) || 1;
	slave.prestige = Math.clamp(+slave.prestige, 0, 3) || 0;
	slave.pornFeed = Math.clamp(+slave.pornFeed, 0, 1) || 0;
	slave.pornFame = Math.max(+slave.pornFame, 0) || 0;
	slave.pornFameSpending = Math.max(+slave.pornFameSpending, 0) || 0;
	slave.pornPrestige = Math.clamp(+slave.pornPrestige, 0, 3) || 0;
	if (typeof slave.pornPrestigeDesc !== "string") {
		slave.pornPrestigeDesc = 0;
	}
	if (typeof slave.pornFameType !== "string") {
		slave.pornFameType = "none";
	}
	if (typeof slave.pornFocus !== "string") {
		slave.pornFocus = "none";
	}
	slave.pornTypeGeneral = Math.max(+slave.pornTypeGeneral, 0) || 0;
	slave.pornTypeFuckdoll = Math.max(+slave.pornTypeFuckdoll, 0) || 0;
	slave.pornTypeRape = Math.max(+slave.pornTypeRape, 0) || 0;
	slave.pornTypePreggo = Math.max(+slave.pornTypePreggo, 0) || 0;
	slave.pornTypeBBW = Math.max(+slave.pornTypeBBW, 0) || 0;
	slave.pornTypeGainer = Math.max(+slave.pornTypeGainer, 0) || 0;
	slave.pornTypeStud = Math.max(+slave.pornTypeStud, 0) || 0;
	slave.pornTypeLoli = Math.max(+slave.pornTypeLoli, 0) || 0;
	slave.pornTypeDeepThroat = Math.max(+slave.pornTypeDeepThroat, 0) || 0;
	slave.pornTypeStruggleFuck = Math.max(+slave.pornTypeStruggleFuck, 0) || 0;
	slave.pornTypePainal = Math.max(+slave.pornTypePainal, 0) || 0;
	slave.pornTypeTease = Math.max(+slave.pornTypeTease, 0) || 0;
	slave.pornTypeRomantic = Math.max(+slave.pornTypeRomantic, 0) || 0;
	slave.pornTypePervert = Math.max(+slave.pornTypePervert, 0) || 0;
	slave.pornTypeCaring = Math.max(+slave.pornTypeCaring, 0) || 0;
	slave.pornTypeUnflinching = Math.max(+slave.pornTypeUnflinching, 0) || 0;
	slave.pornTypeSizeQueen = Math.max(+slave.pornTypeSizeQueen, 0) || 0;
	slave.pornTypeNeglectful = Math.max(+slave.pornTypeNeglectful, 0) || 0;
	slave.pornTypeCumAddict = Math.max(+slave.pornTypeCumAddict, 0) || 0;
	slave.pornTypeAnalAddict = Math.max(+slave.pornTypeAnalAddict, 0) || 0;
	slave.pornTypeAttentionWhore = Math.max(+slave.pornTypeAttentionWhore, 0) || 0;
	slave.pornTypeBreastGrowth = Math.max(+slave.pornTypeBreastGrowth, 0) || 0;
	slave.pornTypeAbusive = Math.max(+slave.pornTypeAbusive, 0) || 0;
	slave.pornTypeMalicious = Math.max(+slave.pornTypeMalicious, 0) || 0;
	slave.pornTypeSelfHating = Math.max(+slave.pornTypeSelfHating, 0) || 0;
	slave.pornTypeBreeder = Math.max(+slave.pornTypeBreeder, 0) || 0;
	slave.pornTypeSub = Math.max(+slave.pornTypeSub, 0) || 0;
	slave.pornTypeCumSlut = Math.max(+slave.pornTypeCumSlut, 0) || 0;
	slave.pornTypeAnal = Math.max(+slave.pornTypeAnal, 0) || 0;
	slave.pornTypeHumiliation = Math.max(+slave.pornTypeHumiliation, 0) || 0;
	slave.pornTypeBoobs = Math.max(+slave.pornTypeBoobs, 0) || 0;
	slave.pornTypeDom = Math.max(+slave.pornTypeDom, 0) || 0;
	slave.pornTypeSadist = Math.max(+slave.pornTypeSadist, 0) || 0;
	slave.pornTypeMasochist = Math.max(+slave.pornTypeMasochist, 0) || 0;
	slave.pornTypePregnancy = Math.max(+slave.pornTypePregnancy, 0) || 0;
	slave.mother = +slave.mother || 0;
	slave.father = +slave.father || 0;
	if (V.familyTesting == 0) {
		slave.relationTarget = Math.max(+slave.relationTarget, 0) || 0;
	}
	slave.relationship = Math.clamp(+slave.relationship, -3, 5) || 0;
	slave.relationshipTarget = Math.max(+slave.relationshipTarget, 0) || 0;
	slave.rivalryTarget = Math.max(+slave.rivalryTarget, 0) || 0;
	slave.rivalry = Math.clamp(+slave.rivalry, 0, 3) || 0;
	slave.subTarget = Math.max(+slave.subTarget, 0) || 0;
	slave.canRecruit = Math.clamp(+slave.canRecruit, 0, 1) || 0;
	slave.choosesOwnAssignment = Math.clamp(+slave.choosesOwnAssignment, 0) || 0;
	slave.sentence = Math.max(+slave.sentence, 0) || 0;
	slave.training = Math.clamp(+slave.training, 0, 150) || 0;
	if (slave.indenture !== 0) {
		slave.indenture = Math.max(+slave.indenture, -1) || -1;
	}
	slave.indentureRestrictions = Math.clamp(+slave.indentureRestriction, 0, 2) || 0;
	slave.birthWeek = Math.clamp(+slave.birthWeek, 0, 51) || 0;
	if (slave.age > 0) {
		slave.actualAge = Math.max(+slave.actualAge, 0) || slave.age; /* if negative or undefined, this sets to slave.age */
	} else {
		slave.actualAge = Math.max(+slave.actualAge, 0) || 18;
		slave.age = slave.actualAge;
	}
	slave.visualAge = Math.max(+slave.visualAge, 0) || slave.actualAge;
	slave.physicalAge = Math.max(+slave.physicalAge, 0) || slave.actualAge;
	slave.ovaryAge = Math.max(+slave.ovaryAge, 0) || slave.actualAge;
	slave.ageImplant = Math.clamp(+slave.ageImplant, 0, 1) || 0;
	slave.health = Math.clamp(+slave.health, -100, 100) || 0;
	if (typeof slave.minorInjury !== "string") {
		slave.minorInjury = 0;
	}
	slave.devotion = Math.clamp(+slave.devotion, -100, 100) || 0;
	slave.oldDevotion = Math.clamp(+slave.oldDevotion, -100, 100) || 0;
	slave.trust = Math.clamp(+slave.trust, -100, 100) || 0;
	slave.oldTrust = Math.clamp(+slave.oldTrust, -100, 100) || 0;
	slave.muscles = Math.clamp(+slave.muscles, -100, 100) || 0;
	slave.weight = Math.clamp(+slave.weight, -100, 200) || 0;
	slave.waist = Math.clamp(+slave.waist, -100, 100) || 0;
	if (typeof slave.nationality !== "string") {
		slave.nationality = "slave";
	}
	if (typeof slave.race !== "string") {
		nationalityToRace(slave);
	}
	if (typeof slave.origRace !== "string") {
		slave.origRace = slave.race;
	}
	slave.height = Math.round(Math.max(+slave.height, 0)) || Math.round(Height.mean(slave));
	slave.heightImplant = Math.clamp(+slave.heightImplant, -1, 1) || 0;
	if (typeof slave.markings !== "string") {
		slave.markings = "none";
	}
	slave.eyes = Math.clamp(+slave.eyes, -3, 1) || 1; /* if 0 or undefined, this sets to 1 */
	if (typeof slave.eyeColor !== "string") {
		slave.eyeColor = "brown";
	}
	if (typeof slave.origEye !== "string") {
		slave.origEye = slave.eyeColor;
	}
	if (typeof slave.pupil !== "string") {
		slave.pupil = "circular";
	}
	if (typeof slave.sclerae !== "string") {
		slave.sclerae = "white";
	}
	if (typeof slave.eyewear !== "string") {
		slave.eyewear = "none";
	}
	slave.hears = Math.clamp(+slave.hears, -2, 0) || 0;
	if (typeof slave.earwear !== "string") {
		slave.earwear = "none";
	}
	slave.earImplant = Math.clamp(+slave.earImplant, 0, 1) || 0;
	if (typeof slave.hColor !== "string") {
		slave.hColor = "brown";
	}
	if (typeof slave.origHColor !== "string") {
		slave.origHColor = slave.hColor;
	}
	if (typeof slave.pubicHColor !== "string") {
		slave.pubicHColor = slave.hColor;
	}
	if (typeof slave.underArmHColor !== "string") {
		slave.underArmHColor = "slave.hColor";
	}
	if (typeof slave.eyebrowHColor !== "string") {
		slave.eyebrowHColor = "slave.hColor";
	}
	if (typeof slave.skin !== "string") {
		slave.skin = "light";
	}
	if (typeof slave.origSkin !== "string") {
		slave.origSkin = slave.skin;
	}
	if (slave.hLength !== 0) {
		slave.hLength = Math.clamp(+slave.hLength, 0, 300) || 60;
	}
	if (typeof slave.hStyle !== "string") {
		slave.hStyle = "long";
	}
	if (typeof slave.pubicHStyle !== "string") {
		slave.pubicHStyle = "neat";
	}
	if (typeof slave.underArmHStyle !== "string") {
		slave.underArmHStyle = "waxed";
	}
	if (typeof slave.eyebrowHStyle !== "string") {
		slave.eyebrowHStyle = "natural";
	}
	if (typeof slave.eyebrowFullness !== "string") {
		slave.eyebrowFullness = "natural";
	}
	slave.corsetPiercing = Math.clamp(+slave.corsetPiercing, 0, 1) || 0;
	slave.amp = Math.clamp(+slave.amp, -5, 1) || 0;
	slave.PLimb = Math.clamp(+slave.PLimb, 0, 1) || 0;
	slave.heels = Math.clamp(+slave.heels, 0, 1) || 0;
	slave.voiceImplant = Math.clamp(+slave.voiceImplant, -1, 1) || 0;
	if (slave.voice !== 0) {
		slave.voice = Math.clamp(+slave.voice, 0, 3) || 1;
	}
	slave.electrolarynx = Math.clamp(+slave.electrolarynx, 0, 1) || 0;
	slave.accent = Math.clamp(+slave.accent, 0, 3) || 0;
	slave.shoulders = Math.clamp(+slave.shoulders, -2, 2) || 0;
	slave.shouldersImplant = Math.clamp(+slave.shouldersImplant, -1, 1) || 0;
	slave.boobs = Math.max(+slave.boobs, 100) || 200;
	slave.boobsImplant = Math.max(+slave.boobsImplant, 0) || 0;
	slave.boobsImplantType = Math.clamp(+slave.boobsImplantType, 0, 1) || 0;
	if (typeof slave.boobShape !== "string") {
		slave.boobShape = "normal";
	}
	if (typeof slave.nipples !== "string") {
		slave.nipples = "cute";
	}
	slave.nipplesPiercing = Math.clamp(+slave.nipplesPiercing, 0, 2) || 0;
	if (typeof slave.nipplesAccessory !== "string") {
		slave.nipplesAccessory = "none";
	}
	slave.areolae = Math.clamp(+slave.areolae, 0, 3) || 0;
	slave.areolaePiercing = Math.clamp(+slave.areolaePiercing, 0, 2) || 0;
	if (typeof slave.areolaeShape !== "string") {
		slave.areolaeShape = "circle";
	}
	if (typeof slave.boobsTat !== "string") {
		slave.boobsTat = 0;
	}
	slave.lactation = Math.clamp(+slave.lactation, 0, 2) || 0;
	slave.lactationAdaptation = Math.clamp(+slave.lactationAdaptation, 0, 100) || 0;
	slave.milk = Math.max(+slave.milk, 0) || 0;
	slave.cum = Math.max(+slave.cum, 0) || 0;
	slave.hips = Math.clamp(+slave.hips, -2, 3) || 0;
	slave.hipsImplant = Math.clamp(+slave.hipsImplant, -1, 1) || 0;
	if (slave.butt !== 0) {
		slave.butt = Math.clamp(+slave.butt, 0, 20) || 1;
	}
	slave.buttImplant = Math.clamp(+slave.buttImplant, 0, 3) || 0;
	slave.buttImplantType = Math.clamp(+slave.buttImplantType, 0, 1) || 0;
	if (typeof slave.buttTat !== "string") {
		slave.buttTat = 0;
	}
	slave.face = Math.clamp(+slave.face, -100, 100) || 0;
	slave.faceImplant = Math.clamp(+slave.faceImplant, 0, 100) || 0;
	if (typeof slave.faceShape !== "string") {
		slave.faceShape = "normal";
	}
	if (slave.lips !== 0) {
		slave.lips = Math.clamp(+slave.lips, 0, 100) || 15;
	}
	slave.lipsImplant = Math.clamp(+slave.lipsImplant, 0, 100) || 0;
	slave.lipsPiercing = Math.clamp(+slave.lipsPiercing, 0, 2) || 0;
	if (typeof slave.lipsTat !== "string") {
		slave.lipsTat = 0;
	}
	slave.tonguePiercing = Math.clamp(+slave.tonguePiercing, 0, 2) || 0;
	slave.vagina = Math.clamp(+slave.vagina, -1, 10) || 0;
	slave.vaginaLube = Math.clamp(+slave.vaginaLube, 0, 2) || 0;
	slave.vaginaPiercing = Math.clamp(+slave.vaginaPiercing, 0, 2) || 0;
	if (typeof slave.vaginaTat !== "string") {
		slave.vaginaTat = 0;
	}
	if (slave.pregAdaptation !== 0) {
		slave.pregAdaptation = Math.max(+slave.pregAdaptation, 0) || 50;
	}
	slave.superfetation = Math.clamp(+slave.superfetation, 0, 1) || 0;
	slave.ovaImplant = Math.clamp(+slave.ovaImplant, -1, 2) || 0;
	slave.broodmother = Math.clamp(+slave.broodmother, 0, 3) || 0;
	slave.broodmotherFetuses = Math.max(+slave.broodmotherFetuses, 0) || 0;
	slave.broodmotherOnHold = Math.clamp(+slave.broodmotherOnHold, 0, 1) || 0;
	slave.pregSource = +slave.pregSource || 0;
	slave.labor = Math.clamp(+slave.labor, 0, 1) || 0;
	slave.births = Math.max(+slave.births, 0) || 0;
	slave.birthsTotal = Math.max(+slave.birthsTotal, 0) || slave.births;
	slave.laborCount = Math.max(+slave.laborCount, 0) || slave.birthsTotal;
	slave.cSec = Math.clamp(+slave.cSec, 0, 1) || 0;
	if (typeof slave.bellyAccessory !== "string") {
		slave.bellyAccessory = "none";
	}
	slave.labia = Math.clamp(+slave.labia, 0, 3) || 0;
	slave.clit = Math.clamp(+slave.clit, 0, 5) || 0;
	slave.clitPiercing = Math.clamp(+slave.clitPiercing, 0, 3) || 0;
	slave.foreskin = Math.max(+slave.foreskin, 0) || 0;
	slave.anus = Math.clamp(+slave.anus, 0, 4) || 0;
	slave.dick = Math.max(+slave.dick, 0) || 0;
	if (slave.dick && slave.prostate !== 0) {
		slave.prostate = Math.clamp(+slave.prostate, 0, 3) || 1;
	} else {
		slave.prostate = Math.clamp(+slave.prostate, 0, 3) || 0;
	}
	slave.balls = Math.max(+slave.balls, 0) || 0;
	slave.scrotum = Math.max(+slave.scrotum, 0) || slave.balls;
	slave.ovaries = Math.clamp(+slave.ovaries, 0, 1) || 0;
	slave.analArea = Math.max(+slave.analArea, 0) || 0;
	slave.dickPiercing = Math.clamp(+slave.dickPiercing, 0, 2) || 0;
	if (typeof slave.dickTat !== "string") {
		slave.dickTat = 0;
	}
	slave.anusPiercing = Math.clamp(+slave.anusPiercing, 0, 2) || 0;
	if (typeof slave.anusTat !== "string") {
		slave.anusTat = 0;
	}
	slave.makeup = Math.clamp(+slave.makeup, 0, 8) || 0;
	slave.nails = Math.clamp(+slave.nails, 0, 9) || 0;
	slave.brand = Math.clamp(+slave.brand, 0, 1) || 0;
	if (typeof slave.brandLocation !== "string") {
		slave.brandLocation = 0;
	}
	slave.earPiercing = Math.clamp(+slave.earPiercing, 0, 2) || 0;
	slave.nosePiercing = Math.clamp(+slave.nosePiercing, 0, 2) || 0;
	slave.eyebrowPiercing = Math.clamp(+slave.eyebrowPiercing, 0, 2) || 0;
	slave.navelPiercing = Math.clamp(+slave.navelPiercing, 0, 2) || 0;
	if (typeof slave.shouldersTat !== "string") {
		slave.shouldersTat = 0;
	}
	if (typeof slave.armsTat !== "string") {
		slave.armsTat = 0;
	}
	if (typeof slave.legsTat !== "string") {
		slave.legsTat = 0;
	}
	if (typeof slave.backTat !== "string") {
		slave.backTat = 0;
	}
	if (typeof slave.stampTat !== "string") {
		slave.stampTat = 0;
	}
	slave.oralSkill = Math.clamp(+slave.oralSkill, 0, 100) || 0;
	slave.vaginalSkill = Math.clamp(+slave.vaginalSkill, 0, 100) || 0;
	slave.analSkill = Math.clamp(+slave.analSkill, 0, 100) || 0;
	slave.whoreSkill = Math.clamp(+slave.whoreSkill, 0, 100) || 0;
	slave.entertainSkill = Math.clamp(+slave.entertainSkill, 0, 100) || 0;
	slave.combatSkill = Math.clamp(+slave.combatSkill, 0, 1) || 0;
	if (typeof slave.standardPunishment !== "string") {
		slave.standardPunishment = "situational";
	}
	if (typeof slave.standardReward !== "string") {
		slave.standardReward = "situational";
	}
	if (slave.useRulesAssistant !== 0) {
		slave.useRulesAssistant = 1;
	}
	if (typeof slave.diet !== "string") {
		slave.diet = "healthy";
	}
	slave.dietCum = Math.clamp(+slave.dietCum, 0, 2) || 0;
	slave.dietMilk = Math.clamp(+slave.dietMilk, 0, 2) || 0;
	slave.tired = Math.clamp(+slave.tired, 0, 1) || 0;
	slave.hormones = Math.clamp(+slave.hormones, -2, 2) || 0;
	if (typeof slave.drugs !== "string") {
		slave.drugs = "no drugs";
	}
	slave.aphrodisiacs = Math.clamp(+slave.aphrodisiacs, 0, 2) || 0;
	slave.curatives = Math.clamp(+slave.curatives, 0, 2) || 0;
	slave.chem = Math.max(+slave.chem, 0) || 0;
	slave.addict = Math.max(+slave.addict, 0) || 0;
	slave.fuckdoll = Math.clamp(+slave.fuckdoll, 0, 100) || 0;
	slave.choosesOwnClothes = Math.clamp(+slave.choosesOwnClothes, 0, 1) || 0;
	if (typeof slave.clothes !== "string") {
		slave.clothes = "no clothing";
	}
	if (typeof slave.collar !== "string") {
		slave.collar = "none";
	}
	if (typeof slave.shoes !== "string") {
		slave.shoes = "none";
	}
	if (typeof slave.vaginalAccessory !== "string") {
		slave.vaginalAccessory = "none";
	}
	if (typeof slave.dickAccessory !== "string") {
		slave.dickAccessory = "none";
	}
	if (typeof slave.legAccessory !== "string") {
		slave.legAccessory = "none";
	}
	if (typeof slave.buttplug !== "string") {
		slave.buttplug = "none";
	}
	if (typeof slave.buttplugAttachment !== "string") {
		slave.buttplugAttachment = "none";
	}
	slave.intelligence = Math.clamp(+slave.intelligence, -100, 100) || 0;
	slave.intelligenceImplant = Math.clamp(+slave.intelligenceImplant, 0, 30) || 0;
	slave.energy = Math.clamp(+slave.energy, 0, 100) || 0;
	slave.need = Math.max(+slave.need, 0) || 0;
	slave.attrXY = Math.clamp(+slave.attrXY, 0, 100) || 0;
	slave.attrXX = Math.clamp(+slave.attrXX, 0, 100) || 0;
	slave.attrKnown = Math.clamp(+slave.attrKnown, 0, 1) || 0;
	slave.fetishStrength = Math.clamp(+slave.fetishStrength, 0, 100) || 0;
	slave.fetishKnown = Math.clamp(+slave.fetishKnown, 0, 1) || 0;
	slave.oralCount = Math.max(+slave.oralCount, 0) || 0;
	slave.vaginalCount = Math.max(+slave.vaginalCount, 0) || 0;
	slave.analCount = Math.max(+slave.analCount, 0) || 0;
	slave.publicCount = Math.max(+slave.publicCount, 0) || 0;
	slave.mammaryCount = Math.max(+slave.mammaryCount, 0) || 0;
	slave.penetrativeCount = Math.max(+slave.penetrativeCount, 0) || 0;
	slave.pitKills = Math.max(+slave.pitKills, 0) || 0;
	if (typeof slave.headAccessory !== "string") {
		slave.headAccessory = "none";
	}
	if (typeof slave.rearAccessory !== "string") {
		slave.rearAccessory = "none";
	}
	if (typeof slave.backAccessory !== "string") {
		slave.backAccessory = "none";
	}
	if (typeof slave.customTat !== "string") {
		slave.customTat = "";
	}
	if (typeof slave.customLabel !== "string") {
		slave.customLabel = "";
	}
	if (typeof slave.customDesc !== "string") {
		slave.customDesc = "";
	}
	if (typeof slave.customTitle !== "string") {
		slave.customTitle = "";
	}
	if (typeof slave.customTitleLisp !== "string") {
		slave.customTitleLisp = "";
	}
	slave.rudeTitle = Math.clamp(+slave.rudeTitle, 0, 1) || 0;
	if (typeof slave.customImage !== "string") {
		slave.customImage = 0;
	}
	if (typeof slave.bellyTat !== "string") {
		slave.bellyTat = 0;
	}
	slave.induce = Math.clamp(+slave.induce, 0, 1) || 0;
	slave.mpreg = Math.clamp(+slave.mpreg, 0, 1) || 0;
	slave.inflation = Math.clamp(+slave.inflation, 0, 3) || 0;
	if (typeof slave.inflationType !== "string") {
		slave.inflationType = "none";
	}
	slave.inflationMethod = Math.clamp(+slave.inflationMethod, 0, 3) || 0;
	slave.milkSource = Math.max(+slave.milkSource, 0) || 0;
	slave.cumSource = Math.max(+slave.cumSource, 0) || 0;
	slave.burst = Math.clamp(+slave.burst, 0, 1) || 0;
	SetBellySize(slave);
	if (slave.bellyImplant !== 0) {
		slave.bellyImplant = Math.max(+slave.bellyImplant, -1) || -1;
	}
	slave.bellySag = Math.max(+slave.bellySag, 0) || 0;
	slave.bellySagPreg = Math.max(+slave.bellySagPreg, 0) || slave.bellySag;
	slave.bellyPain = Math.clamp(+slave.bellyPain, 0, 2) || 0;
	slave.cervixImplant = Math.clamp(+slave.cervixImplant, 0, 1) || 0;
	slave.pubertyAgeXX = Math.max(+slave.pubertyAgeXX, 0) || V.fertilityAge;
	slave.pubertyAgeXY = Math.max(+slave.pubertyAgeXY, 0) || V.potencyAge;
	slave.scars = Math.clamp(+slave.scars, 0, 6) || 0;
	slave.breedingMark = Math.clamp(+slave.breedingMark, 0, 1) || 0;
	slave.bodySwap = Math.max(+slave.bodySwap, 0) || 0;
	slave.HGExclude = Math.clamp(+slave.HGExclude, 0, 1) || 0;
	if (typeof slave.ballType !== "string") {
		slave.ballType = "human";
	}
	if (typeof slave.eggType !== "string") {
		slave.eggType = "human";
	}
	slave.reservedChildren = Math.max(+slave.reservedChildren, 0) || 0;
	slave.reservedChildrenNursery = Math.max(+slave.reservedChildrenNursery, 0) || 0;
	slave.choosesOwnChastity = Math.clamp(+slave.choosesOwnChastity, 0, 1) || 0;
	if (typeof slave.pregControl !== "string") {
		slave.pregControl = "none";
	}
	slave.ageAdjust = Math.clamp(+slave.ageAdjust, -40, 40) || 0;
	slave.bald = Math.clamp(+slave.bald, 0, 1) || 0;
	if (typeof slave.origBodyOwner !== "string") {
		slave.origBodyOwner = "";
	}
	slave.origBodyOwnerID = Math.max(+slave.origBodyOwnerID, 0) || 0;
	if (typeof slave.death !== "string") {
		slave.death = "";
	}
	slave.hormoneBalance = Math.clamp(+slave.hormoneBalance, -400, 400) || 0;
	slave.onDiet = Math.clamp(+slave.onDiet, 0, 1) || 0;
	slave.breastMesh = Math.clamp(+slave.breastMesh, 0, 1) || 0;
	slave.slavesFathered = Math.max(+slave.slavesFathered, 0) || 0;
	slave.PCChildrenFathered = Math.max(+slave.PCChildrenFathered, 0) || 0;
	slave.slavesKnockedUp = Math.max(+slave.slavesKnockedUp, 0) || 0;
	slave.PCKnockedUp = Math.max(+slave.PCKnockedUp, 0) || 0;
	slave.prematureBirth = Math.clamp(+slave.prematureBirth, 0, 1) || 0;
	slave.premature = Math.clamp(+slave.premature, 0, 1) || 0;
	slave.vasectomy = Math.clamp(+slave.vasectomy, 0, 1) || 0;
	slave.haircuts = Math.clamp(+slave.haircuts, 0, 1) || 0;
	slave.newGamePlus = Math.clamp(+slave.newGamePlus, 0, 1) || 0;
	slave.skillHG = Math.clamp(+slave.skillHG, 0, 200) || 0;
	slave.skillRC = Math.clamp(+slave.skillRC, 0, 200) || 0;
	slave.skillBG = Math.clamp(+slave.skillBG, 0, 200) || 0;
	slave.skillMD = Math.clamp(+slave.skillMD, 0, 200) || 0;
	slave.skillDJ = Math.clamp(+slave.skillDJ, 0, 200) || 0;
	slave.skillNU = Math.clamp(+slave.skillNU, 0, 200) || 0;
	slave.skillTE = Math.clamp(+slave.skillTE, 0, 200) || 0;
	slave.skillAT = Math.clamp(+slave.skillAT, 0, 200) || 0;
	slave.skillMT = Math.clamp(+slave.skillMT, 0, 200) || 0;
	slave.skillST = Math.clamp(+slave.skillST, 0, 200) || 0;
	slave.skillMM = Math.clamp(+slave.skillMM, 0, 200) || 0;
	slave.skillWA = Math.clamp(+slave.skillWA, 0, 200) || 0;
	slave.skillS = Math.clamp(+slave.skillS, 0, 200) || 0;
	slave.skillE = Math.clamp(+slave.skillE, 0, 200) || 0;
	slave.skillW = Math.clamp(+slave.skillW, 0, 200) || 0;
	slave.tankBaby = Math.clamp(+slave.tankBaby, 0, 2) || 0;
	slave.NCSyouthening = Math.max(+slave.NCSyouthening, 0) || 0;
	slave.missingEyes = Math.clamp(+slave.missingEyes, 0, 3) || 0;
	slave.missingArms = Math.clamp(+slave.missingArms, 0, 3) || 0;
	slave.missingLegs = Math.clamp(+slave.missingLegs, 0, 3) || 0;
	generatePronouns(slave);
};