code:
App.EndWeek.brothelReport = function() {
	const el = document.createElement("p");
	let r;

	const brothelStats = document.createElement("span");
	el.append(brothelStats);

	const madam = S.Madam ? App.SlaveAssignment.reportSlave(S.Madam) : undefined;
	const slaves = App.Utils.sortedEmployees(App.Entity.facilities.brothel);
	const SL = slaves.length;
	let profits = 0;

	// Statistics gathering
	V.facility = V.facility || {};
	V.facility.brothel = initFacilityStatistics(V.facility.brothel);
	const brothelNameCaps = capFirstChar(V.brothelName);

	function madamText() {
		let FLsFetish = 0;
		let r = [];
		if (V.MadamID !== 0) {
			if (S.Madam.health.condition < -80) {
				improveCondition(S.Madam, 20);
			} else if (S.Madam.health.condition < -40) {
				improveCondition(S.Madam, 15);
			} else if (S.Madam.health.condition < 0) {
				improveCondition(S.Madam, 10);
			} else if (S.Madam.health.condition < 90) {
				improveCondition(S.Madam, 7);
			}
			if (S.Madam.devotion <= 45) {
				S.Madam.devotion += 5;
			}
			if (S.Madam.trust < 45) {
				S.Madam.trust += 5;
			}
			if (S.Madam.rules.living !== "luxurious") {
				S.Madam.rules.living = "luxurious";
			}
			if (S.Madam.rules.rest !== "restrictive") {
				S.Madam.rules.rest = "restrictive";
			}
			if (S.Madam.fetishStrength <= 95) {
				if (S.Madam.fetish !== "dom") {
					if (fetishChangeChance(S.Madam) > random(0, 100)) {
						FLsFetish = 1;
						S.Madam.fetishKnown = 1;
						S.Madam.fetish = "dom";
						S.Madam.fetishStrength = 10;
					}
				} else if (S.Madam.fetishKnown === 0) {
					FLsFetish = 1;
					S.Madam.fetishKnown = 1;
				} else {
					FLsFetish = 2;
					S.Madam.fetishStrength += 4;
				}
			}
			/* Make sure we have registered living expenses as for any other slave */
			getSlaveStatisticData(S.Madam, V.facility.brothel);
			const {
				he, him, his, himself, He, His, wife
			} = getPronouns(S.Madam);

			r = [];
			r.push(`${SlaveFullName(S.Madam)} is serving as the madam.`);
			if (S.Madam.relationship === -3 && S.Madam.devotion > 50) {
				r.push(`As your loving ${wife}, ${he} does ${his} best to attract attention to your brothel.`);
			}
			if (FLsFetish === 1) {
				r.push(`${He} isn't above sampling the merchandise ${himself}; before long it's obvious to ${his} girls that ${he}`);
				r.push(App.UI.DOM.makeElement("span", `really likes fucking them.`, "fetish-gain"));
			} else if (FLsFetish === 2) {
				r.push(`${He}'s careful that all of the whores under ${his} supervision are all warmed up and ready to get fucked every morning, and ${he}`);
				r.push(App.UI.DOM.makeElement("span", `really likes fucking them.`, ["fetish", "inc"]));
			}
			const improve = App.UI.DOM.makeElement("span", "improve", ["cash", "inc"]);
			if (S.Madam.skill.whoring <= 10) {
				r.push(`Though ${S.Madam.slaveName} does ${his} best to manage the brothel, with ${his} lack of skill ${he} can do little.`);
			} else if (S.Madam.skill.whoring <= 30) {
				r.push(`${S.Madam.slaveName}'s basic skills marginally`, improve, `business at ${V.brothelName}.`);
			} else if (S.Madam.skill.whoring <= 60) {
				r.push(`${S.Madam.slaveName}'s skills`, improve, `business at ${V.brothelName}.`);
			} else if (S.Madam.skill.whoring < 100) {
				r.push(`${S.Madam.slaveName}'s skills greatly`, improve, `business at ${V.brothelName}.`);
			} else {
				r.push(`${S.Madam.slaveName}'s mastery immensely`, improve, `business at ${V.brothelName}.`);
			}
			if (S.Madam.actualAge > 35) {
				r.push(`${His} age and experience also contribute.`);
			}
			if (App.Data.Careers.Leader.madam.includes(S.Madam.career)) {
				r.push(`${He} has experience from ${his} life before ${he} was a slave that helps ${him} in the seedy business of selling other people's bodies for sex.`);
			} else if (S.Madam.skill.madam >= V.masteredXP) {
				r.push(`${He} has experience from working for you that helps ${him} in the seedy business of selling other people's bodies for sex.`);
			} else if (S.Madam.skill.madam > 120) {
				r.push(`${He} understands how to handle whores while keeping customers happy.`);
			} else if (S.Madam.skill.madam > 60) {
				r.push(`${He} understands how to read the customer and please them effectively.`);
			} else if (S.Madam.skill.madam > 20) {
				r.push(`${He} has basic knowledge of how to run a whorehouse.`);
			}
			if (S.Madam.skill.madam < V.masteredXP) {
				const skillIncrease = jsRandom(1, Math.ceil((S.Madam.intelligence + S.Madam.intelligenceImplant) / 15) + 8);
				r.push(slaveSkillIncrease('madam', S.Madam, skillIncrease));
			}
			if (S.Madam.intelligence + S.Madam.intelligenceImplant > 15) {
				r.push(`${He} is a clever manager.`);
			}
			if (S.Madam.dick > 2 && canPenetrate(S.Madam)) {
				r.push(`${His} turgid dick helps ${him} manage the bitches.`);
			}
			App.Events.addParagraph(el, r);

			r = [];
			for (const slave of slaves) {
				const {
					he2, him2, his2
				} = getPronouns(slave).appendSuffix('2');

				if (S.Madam.rivalryTarget === slave.ID) {
					r.push(`${He} forces ${his} ${rivalryTerm(S.Madam)}, ${slave.slaveName}, to service all the men in the brothel.`);
					slave.devotion -= 2;
					slave.trust -= 2;
					if (canDoVaginal(slave)) {
						seX(slave, "vaginal", "public", "penetrative", 10);
					}
					if (canDoAnal(slave)) {
						seX(slave, "anal", "public", "penetrative", 12);
					}
					seX(slave, "anal", "public", "penetrative", 10);
					if (random(1, 100) > 65) {
						S.Madam.rivalry++;
						slave.rivalry++;
					}
				} else if (S.Madam.relationshipTarget === slave.ID) {
					r.push(`${He} dotes over ${his} ${relationshipTerm(S.Madam)}, ${slave.slaveName}, making sure ${he2} is safe, but unfortunately driving potential customers away from ${him2}.`);
					slave.devotion++;
				} else if (areRelated(S.Madam, slave)) {
					r.push(`${He} pays special attention to ${his} ${relativeTerm(S.Madam, slave)}, ${slave.slaveName}, making sure ${he2} is treated well and showing off ${his2} skills.`);
					slave.trust++;
				}
				if (slave.prestigeDesc === "$He is a famed Free Cities whore, and commands top prices.") {
					r.push(`${He} makes sure to promote ${slave.slaveName}, the famed whore, in order to capitalize on ${his2} popularity.`);
				} else if (slave.prestigeDesc === "$He is a famed Free Cities slut, and can please anyone.") {
					r.push(`${He} makes sure to promote ${slave.slaveName}, the famed entertainer, in order to capitalize on ${his2} popularity.`);
				} else if (slave.prestigeDesc === "$He is remembered for winning best in show as a dairy cow.") {
					if (V.arcologies[0].FSPhysicalIdealist !== "unset") {
						if (slave.muscles > 60 && slave.weight < 30 && slave.lactation > 0 && (slave.boobs - slave.boobsImplant) > 6000) {
							r.push(`${He} shows off how even a cow like ${slave.slaveName} can achieve physical perfection.`);
						} else {
							if (slave.muscles < 30) {
								r.push(`An unmuscled,`);
							} else {
								r.push(`A`);
							}
							if (slave.weight > 30) {
								r.push(`fat,`);
							}
							r.push(`'prestigious'`);
							if (slave.lactation > 0) {
								r.push(`cow`);
							} else if ((slave.boobs - slave.boobsImplant) > 6000) {
								r.push(`mass of titflesh`);
							} else {
								r.push(`slave`);
							}
							r.push(`like ${slave.slaveName} is woefully out of fashion, so ${S.Madam.slaveName} tries to draw attention away from ${him2}.`);
						}
					} else {
						if (slave.lactation > 0 && (slave.boobs - slave.boobsImplant) > 6000) {
							r.push(`${He} makes sure to massage ${slave.slaveName}'s huge breasts to get the milk flowing before enticing clients to suckle and play with ${him2}.`);
						} else {
							r.push(`${He} would like to show off ${slave.slaveName}'s huge udders, but ${slave.slaveName}`);
							if (slave.lactation === 0) {
								r.push(`isn't producing milk anymore.`);
							} else {
								r.push(`doesn't exactly have huge udders anymore.`);
							}
						}
					}
				} else if (slave.prestigeDesc === "$He is remembered for winning best in show as a cockmilker.") {
					if (V.arcologies[0].FSGenderFundamentalist !== "unset") {
						/* this needs review - doesn't fit right. An XY slave would be expected to be masculine. */
						if (slave.balls === 0 && slave.dick === 0 && slave.vagina > -1) {
							r.push(`${He} uses ${slave.slaveName} as an example of how even a huge-balled freak like ${him2} can be restored to proper femininity.`);
						} else {
							r.push(`${He} tries to hide ${slave.slaveName}, 'her' body being notorious for its defiance of conventional femininity.`);
						}
					} else {
						if (((slave.balls > 5) && (slave.dick !== 0)) || ((slave.balls > 4) && (slave.dick !== 0) && (slave.prostate > 1))) {
							r.push(`${He} shows off ${slave.slaveName}'s copious loads by putting a condom over ${his2} dick and teasing ${him2} till ${he2} bursts it. The show draws multiple clients that want to play with ${his2} oversized junk and messy orgasms.`);
						} else {
							r.push(`${He} would love to show off ${slave.slaveName}'s copious loads, but`);
							if (slave.dick === 0) {
								r.push(`${slave.slaveName} doesn't have a dick.`);
							} else if (slave.balls === 0) {
								r.push(`${slave.slaveName}'s not producing cum.`);
							} else {
								r.push(`${slave.slaveName}'s orgasms just aren't messy enough.`);
							}
						}
					}
				} else if (slave.prestigeDesc === "$He is remembered for winning best in show as a breeder.") {
					if (slave.bellyPreg >= 5000) {
						r.push(`${He} makes sure ${slave.slaveName}'s growing pregnancy is well taken care of, even if it means driving away potential customers away when the mother-to-be needs a rest.`);
					} else if (canGetPregnant(slave)) {
						r.push(`${He} makes sure to play off ${slave.slaveName}'s fame and fertility by enticing potential customers to be the one to claim ${his2} womb by filling it with their child.`);
					} else {
						r.push(`${He} would love to play off of ${slave.slaveName}'s fame and fertility, but unfortunately ${he2}`);
						if (slave.pregKnown === 1 && slave.bellyPreg < 1500) {
							r.push(`is already pregnant and not far enough along to show it.`);
						} else if (slave.pregKnown === 1 && slave.bellyPreg < 5000) {
							r.push(`already pregnant, but not enough to be exciting.`);
						} else {
							r.push(`is unable to get knocked up.`);
						}
					}
				}
			}
			App.Events.addNode(el, r);

			if ((SL + V.brothelSlavesGettingHelp < 10) && V.MadamNoSex !== 1 && !slaveResting(madam)) {
				const oldCash = V.cash;
				if (V.showEWD !== 0) {
					App.Events.addParagraph(
						el,
						[
							He,
							App.SlaveAssignment.whore(madam)
						]
					);
				} else {
					App.SlaveAssignment.whore(madam);
				}
				App.Events.addParagraph(
					el,
					[
						`${He} whores ${himself} because ${he} doesn't have enough whores to manage to keep ${him} busy, and makes`,
						App.UI.DOM.makeElement("span", `${cashFormat(S.Madam.lastWeeksCashIncome)}.`, ["cash", "inc"]),
						`${He} can charge more for ${his} time, since many citizens find it erotic to fuck the Madam.`
					]
				);
				profits += V.cash - oldCash;
			}
		}
	}

	madamText();

	if (SL > 0) {
		const whoreNumber = document.createElement("p");
		whoreNumber.classList.add("indent", "bold");

		if (SL === 1) {
			whoreNumber.append(`There is one slave whore working out of ${V.brothelName}.`);
		} else {
			whoreNumber.append(`There are ${SL} slave whores working out of ${V.brothelName}.`);
		}
		el.append(whoreNumber);
	}

	if (madam) {
		tired(madam);
		if (V.showEWD !== 0) {
			const madamEntry = App.UI.DOM.appendNewElement("div", el, '', "slave-report");
			const artSpan = App.UI.DOM.appendNewElement("span", madamEntry);
			App.SlaveAssignment.appendSlaveLinks(madamEntry, madam);
			App.Events.addNode(
				madamEntry,
				[
					App.UI.DOM.makeElement("span", SlaveFullName(madam), "slave-name"),
					`is serving as the Madam.`
				]
			);
			madamEntry.append(App.SlaveAssignment.standardSlaveReport(madam, false));
			App.SlaveAssignment.appendSlaveArt(artSpan, madam);
		} else {
			App.SlaveAssignment.standardSlaveReport(madam, true);
		}
	}

	if (SL > 0) {
		let healthBonus = 0;
		let aphrodisiacs = 0;
		if (V.brothelUpgradeDrugs === 1) {
			healthBonus += 1;
			aphrodisiacs = 1;
		} else if (V.brothelUpgradeDrugs === 2) {
			healthBonus += 3;
			aphrodisiacs = 2;
		}
		let oldCash = V.cash;
		for (const slave of App.SlaveAssignment.reportSlaves(slaves)) {
			/* Perform facility based rule changes */
			improveCondition(slave, healthBonus);
			slave.aphrodisiacs = aphrodisiacs;
			switch (V.brothelDecoration) {
				case "Degradationist":
				case "standard":
					slave.rules.living = "spare";
					break;
				default:
					slave.rules.living = "normal";
			}
			if (slave.health.condition < -80) {
				improveCondition(slave, 20);
			} else if (slave.health.condition < -40) {
				improveCondition(slave, 15);
			} else if (slave.health.condition < 0) {
				improveCondition(slave, 10);
			} else if (slave.health.condition < 90) {
				improveCondition(slave, 7);
			}
			if (slave.devotion <= 20 && slave.trust >= -20) {
				slave.devotion -= 5;
				slave.trust -= 5;
			} else if (slave.devotion < 45) {
				slave.devotion += 4;
			} else if (slave.devotion > 50) {
				slave.devotion -= 4;
			}
			if (slave.trust < 30) {
				slave.trust += 5;
			}
			if (slave.energy.isBetween(40, 95)) {
				slave.energy++;
			}

			if (V.showEWD !== 0) {
				const {He} = getPronouns(slave);
				const slaveEntry = App.UI.DOM.appendNewElement("div", el, '', "slave-report");
				const artSpan = App.UI.DOM.appendNewElement("span", slaveEntry);
				App.SlaveAssignment.appendSlaveLinks(slaveEntry, slave);
				r = [];
				r.push(App.UI.DOM.makeElement("span", SlaveFullName(slave), "slave-name"));
				if (slave.choosesOwnAssignment === 2) {
					r.push(App.SlaveAssignment.choosesOwnJob(slave));
				} else {
					r.push(`is working out of ${V.brothelName}.`);
				}
				App.Events.addNode(slaveEntry, r);

				App.Events.addNode(
					slaveEntry,
					[
						He,
						App.SlaveAssignment.whore(slave),
					],
					"div",
					"indent"
				);
				slaveEntry.append(App.SlaveAssignment.standardSlaveReport(slave, false));
				App.SlaveAssignment.appendSlaveArt(artSpan, slave);
			} else {
				// discard return values silently
				App.SlaveAssignment.choosesOwnJob(slave);
				App.SlaveAssignment.whore(slave);
				App.SlaveAssignment.standardSlaveReport(slave, true);
			}

			const seed = Math.max(App.Ads.getMatchedCategoryCount(slave, "brothel"), 1);
			const adsIncome = seed * random(50, 60) * Math.trunc(V.brothelAdsSpending / 1000);
			getSlaveStatisticData(slave, V.facility.brothel).adsIncome += adsIncome;
			cashX(adsIncome, "brothelAds");
		}
		App.Events.addNode(el, [App.Ads.report("brothel", false)]);

		profits += V.cash - oldCash;

		// Record statistics gathering
		const b = V.facility.brothel;
		b.whoreIncome = 0;
		b.customers = 0;
		b.whoreCosts = 0;
		b.rep = 0;
		for (const si of b.income.values()) {
			b.whoreIncome += si.income + si.adsIncome;
			b.customers += si.customers;
			b.whoreCosts += si.cost;
			b.rep += si.rep;
		}
		b.adsCosts = V.brothelAdsSpending;
		b.maintenance = V.brothel * V.facilityCost * (1.0 + 0.2 * V.brothelUpgradeDrugs);
		b.totalIncome = b.whoreIncome + b.adsIncome;
		b.totalExpenses = b.whoreCosts + b.adsCosts + b.maintenance;
		b.profit = b.totalIncome - b.totalExpenses;

		App.Events.addNode(
			el,
			[
				`${brothelNameCaps} makes you`,
				App.UI.DOM.makeElement("span", cashFormat(profits), ["cash", "inc"]),
				`this week.`
			]
		);

		if (V.brothelDecoration !== "standard") {
			App.Events.addParagraph(
				el,
				[
					`${brothelNameCaps}'s customers enjoyed`,
					App.UI.DOM.makeElement("span", `fucking whores in ${V.brothelDecoration} surroundings.`, ["reputation", "inc"])
				]
			);
		}

		// Brothel stats
		el.append(App.Facilities.Brothel.Stats(false));
		brothelStats.append(App.Facilities.Brothel.Stats(true));
	}
	return el;
};


code:
/**
 * @returns {DocumentFragment}
 */
App.EndWeek.cellblockReport = function() {
	const el = new DocumentFragment();
	let r;

	const slaves = App.Utils.sortedEmployees(App.Entity.facilities.cellblock);
	let brokenSlaves = 0;
	let idleBonus = 0;
	let softenedQuirks = 0;
	let trustMalus = 0;
	let FLsFetish = 0;
	let devBonus = (V.cellblockDecoration !== "standard") ? 1 : 0;
	let confinedResults;

	const cellblockNameCaps = capFirstChar(V.cellblockName);
	V.flSex = App.EndWeek.getFLSex(App.Entity.facilities.cellblock);/* FIXME: should be local, passed as a parameter to saRules */

	if (S.Wardeness) {
		const {
			He, His,
			he, his, him, wife
		} = getPronouns(S.Wardeness);
		r = [];

		if (S.Wardeness.health.condition < -80) {
			improveCondition(S.Wardeness, 20);
		} else if (S.Wardeness.health.condition < -40) {
			improveCondition(S.Wardeness, 15);
		} else if (S.Wardeness.health.condition < 0) {
			improveCondition(S.Wardeness, 10);
		} else if (S.Wardeness.health.condition < 90) {
			improveCondition(S.Wardeness, 7);
		}
		if (S.Wardeness.devotion <= 60) {
			S.Wardeness.devotion += 2;
		}
		S.Wardeness.devotion += devBonus;
		if (S.Wardeness.trust < 60) {
			S.Wardeness.trust += 3;
		}
		if (S.Wardeness.rules.living !== "luxurious") {
			S.Wardeness.rules.living = "luxurious";
		}
		if (S.Wardeness.rules.rest !== "restrictive") {
			S.Wardeness.rules.rest = "restrictive";
		}
		if (S.Wardeness.fetishStrength <= 95) {
			if (S.Wardeness.fetish !== "sadist") {
				if (fetishChangeChance(S.Wardeness) > random(0, 100)) {
					FLsFetish = 1;
					S.Wardeness.fetishKnown = 1;
					S.Wardeness.fetish = "sadist";
					S.Wardeness.fetishStrength = 10;
				}
			} else if (S.Wardeness.fetishKnown === 0) {
				FLsFetish = 1;
				S.Wardeness.fetishKnown = 1;
			} else {
				FLsFetish = 2;
				S.Wardeness.fetishStrength += 4;
			}
		}
		if (S.Wardeness.energy > 95 || S.Wardeness.fetish === "sadist") {
			devBonus++;
			trustMalus++;
			idleBonus++;
		}
		r.push(`${SlaveFullName(S.Wardeness)} is serving as the Wardeness.`);
		if (S.Wardeness.relationship === -3 && S.Wardeness.devotion > 50) {
			devBonus++;
			trustMalus++;
			idleBonus++;
			r.push(`As your ${wife}, ${he} tries ${his} best to break the disobedient slaves to your will.`);
		}
		if (FLsFetish === 1) {
			r.push(`One day ${he} demands obedience. The next day ${he} strikes a slave when it isn't given. The next, ${he} seems more excited than embarrassed when beating a prisoner. Soon, ${he}'s looking for an excuse to punish. ${He}'s become more of a sadist.`);
		} else if (FLsFetish === 2) {
			r.push(`Being not only allowed but encouraged to get off while punishing prisoners <span class="lightsalmon">deepens ${his} sadism.</span>`);
		}
		if (App.Data.Careers.Leader.wardeness.includes(S.Wardeness.career)) {
			devBonus++;
			trustMalus++;
			idleBonus++;
			r.push(`${He} has experience with detecting security issues and grinding down potential miscreants from ${his} life before ${he} was a slave, making ${him} more effective.`);
		} else if (S.Wardeness.skill.wardeness >= V.masteredXP) {
			devBonus++;
			trustMalus++;
			idleBonus++;
			r.push(`${He} has experience with detecting security issues and grinding down potential miscreants from working for you, making ${him} more effective.`);
		} else {
			const skillIncrease = random(1, Math.ceil((S.Wardeness.intelligence + S.Wardeness.intelligenceImplant) / 15) + 8);
			r.push(slaveSkillIncrease('wardeness', S.Wardeness, skillIncrease));
		}
		if (S.Wardeness.fetish === "sadist") {
			r.push(`${He} uses the prisoners to gratify ${his} sadism, terrifying them and quickly breaking their resistance.`);
		} else if (S.Wardeness.energy > 95) {
			r.push(`${He} is so sexually depraved that ${he} constantly molests the prisoners, breaking them to a life of servitude.`);
		}
		if (S.Wardeness.sexualFlaw === "malicious" || S.Wardeness.sexualFlaw === "abusive") {
			devBonus++;
			trustMalus += 2;
			idleBonus += 2;
			r.push(`Sexual abuse of prisoners has become an end for ${him}, not a means. ${He} inspires ${his} prisoners to do everything possible to qualify to get away from ${him}, even as ${he} slowly grinds away their interest in sex to do it.`);
		} else if (S.Wardeness.sexualQuirk === "caring") {
			devBonus--;
			trustMalus--;
			idleBonus--;
			r.push(`${His} kindness sometimes shows through ${his} tough façade, letting prisoners get off easier than they should.`);
		}
		if (S.Wardeness.dick > 2 && canPenetrate(S.Wardeness)) {
			devBonus++;
			trustMalus++;
			idleBonus++;
			r.push(`${His} molestation of the prisoners is more varied and effective because ${he} has a dick to fuck them with.`);
		}
		if (S.Wardeness.muscles > 35) {
			devBonus++;
			trustMalus++;
			idleBonus++;
			r.push(`${He} is strong enough to restrain anyone that tries anything with ${his} own hands.`);
		}
		if (S.Wardeness.devotion > 95) {
			devBonus++;
			trustMalus++;
			idleBonus++;
			r.push(`${His} devotion to you is so absolute that ${he} sees breaking bitches for your service as a noble calling.`);
		}
		App.Events.addNode(el, r, "div", "indent");
		for (const slave of slaves) {
			r = [];
			if (S.Wardeness.rivalryTarget === slave.ID) {
				r.push(`${He} greatly enjoys breaking ${his} ${rivalryTerm(S.Wardeness)}, ${slave.slaveName}'s will.`);
				slave.devotion++;
				slave.trust -= 3;
				if (random(1, 100) > 30) {
					S.Wardeness.rivalry++;
					slave.rivalry++;
				}
			} else if (S.Wardeness.relationshipTarget === slave.ID) {
				r.push(`${He} hates having to break ${his} ${relationshipTerm(S.Wardeness)}, ${slave.slaveName}, but ${his} devotion to you wins out in the end.`);
				slave.devotion++;
				slave.trust -= 3;
				if (random(1, 100) >= 50) {
					r.push(`${His} and ${slave.slaveName}'s relationship has been shattered by these events.`);
					S.Wardeness.relationship = 0;
					S.Wardeness.relationshipTarget = 0;
					slave.relationship = 0;
					slave.relationshipTarget = 0;
				}
			} else if (areRelated(S.Wardeness, slave)) {
				const {he2, his2} = getPronouns(slave).appendSuffix("2");
				r.push(`${He} shows ${his} ${relativeTerm(S.Wardeness, slave)} ${slave.slaveName} no mercy, making sure ${he2} understands ${his2} place.`);
				slave.devotion++;
				slave.trust--;
			}
			App.Events.addNode(el, r, "div", "indent");
		}
		if (slaves.length < V.cellblock && !slaveResting(S.Wardeness)) {
			const seed = random(1, 10) + ((V.cellblock - slaves.length) * (random(150, 170) + (idleBonus * 10)));
			cashX(seed, "cellblock", S.Wardeness);
			App.Events.addNode(el, [`Since ${he} doesn't have enough prisoners to manage to keep ${him} busy, ${he} works on citizens' slaves, earning <span class="yellowgreen"> ${cashFormat(seed)}.</span>`], "div", "indent");
		}
	}

	if (slaves.length > 0) {
		if (slaves.length === 1) {
			App.UI.DOM.appendNewElement("div", el, `One slave is being confined in ${V.cellblockName} until they are willing to obey.`, "indent");
		} else {
			App.UI.DOM.appendNewElement("div", el, `${slaves.length} slaves are being confined in ${V.cellblockName} until they are willing to obey.`, "indent");
		}
	}

	if (S.Wardeness) {
		const slave = App.SlaveAssignment.reportSlave(S.Wardeness);
		tired(slave);
		/* apply following SA passages to facility leader */
		if (V.showEWD !== 0) {
			const wardenessEntry = App.UI.DOM.appendNewElement("div", el, '', "slave-report");
			const artSpan = App.UI.DOM.appendNewElement("span", wardenessEntry);
			App.SlaveAssignment.appendSlaveLinks(wardenessEntry, slave);
			App.Events.addNode(
				wardenessEntry,
				[
					App.UI.DOM.makeElement("span", SlaveFullName(slave), "slave-name"),
					`is serving as the Wardeness in ${V.cellblockName}.`,
				]
			);
			wardenessEntry.append(App.SlaveAssignment.standardSlaveReport(slave, false));
			App.SlaveAssignment.appendSlaveArt(artSpan, slave);
		} else {
			App.SlaveAssignment.standardSlaveReport(slave, true);
		}
	}

	for (const slave of App.SlaveAssignment.reportSlaves(slaves)) {
		const {He} = getPronouns(slave);
		if (slave.devotion <= 20) {
			if (slave.trust >= -20) {
				if (
					(slave.hears === -1 && slave.earwear !== "hearing aids") ||
					(slave.hears === 0 && slave.earwear === "muffling ear plugs") ||
					(slave.hears === -2)
				) {
					slave.devotion -= 2;
					slave.trust -= 2;
				} else {
					slave.devotion -= 4;
					slave.trust -= 4;
				}
			} else {
				slave.devotion++;
			}
		}
		switch (V.cellblockDecoration) {
			case "Paternalist":
				slave.rules.living = "normal";
				if (slave.inflation > 0) {
					deflate(slave);
				}
				break;
			case "Pastoralist":
				slave.rules.living = "spare";
				if (slave.inflation === 0) {
					if (slave.pregKnown === 0 && slave.bellyImplant < 1500) {
						slave.inflation = 2;
						slave.inflationType = "milk";
						slave.inflationMethod = 1;
					} else {
						slave.inflation = 1;
						slave.inflationType = "milk";
						slave.inflationMethod = 1;
					}
					SetBellySize(slave);
				}
				break;
			case "Hedonistic":
				slave.rules.living = "spare";
				if (slave.weight < 200) {
					if (slave.weightDirection === 1) {
						slave.weight += 5;
					} else if (slave.weightDirection === -1) {
						slave.weight += 1;
					} else {
						slave.weight += 3;
					}
				}
				if (slave.muscles > -100) {
					slave.muscles -= 2;
				}
				if (slave.inflation === 0) {
					if (slave.pregKnown === 0 && slave.bellyImplant < 1500) {
						slave.inflation = 3;
						slave.inflationType = "food";
						slave.inflationMethod = 1;
					} else {
						slave.inflation = 1;
						slave.inflationType = "food";
						slave.inflationMethod = 1;
					}
					SetBellySize(slave);
				}
				break;
			default:
				slave.rules.living = "spare";
				if (slave.inflation > 0) {
					deflate(slave);
				}
		}
		if (V.cellblockUpgrade === 1) {
			if (slave.behavioralFlaw !== "none" && slave.behavioralQuirk === "none") {
				SoftenBehavioralFlaw(slave);
				slave.devotion -= 10;
				softenedQuirks++;
			} else if (slave.sexualFlaw !== "none" && slave.sexualQuirk === "none") {
				SoftenSexualFlaw(slave);
				slave.devotion -= 10;
				softenedQuirks++;
			}
		}
		slave.devotion += devBonus;
		slave.trust -= trustMalus;
		if (S.Wardeness && S.Wardeness.sexualFlaw === "malicious" && slave.energy >= 2) {
			slave.energy -= 2;
		}
		if (slave.health.condition < -80) {
			improveCondition(slave, 20);
		} else if (slave.health.condition < -40) {
			improveCondition(slave, 15);
		} else if (slave.health.condition < 0) {
			improveCondition(slave, 10);
		} else if (slave.health.condition < 40) {
			improveCondition(slave, 7);
		} else if (slave.health.condition < 100) {
			improveCondition(slave, 3);
		}

		if (V.showEWD !== 0) {
			const slaveEntry = App.UI.DOM.appendNewElement("div", el, '', "slave-report");
			const artSpan = App.UI.DOM.appendNewElement("span", slaveEntry);
			App.SlaveAssignment.appendSlaveLinks(slaveEntry, slave);
			r = [];
			r.push(App.UI.DOM.makeElement("span", SlaveFullName(slave), "slave-name"));
			if (slave.choosesOwnAssignment === 2) {
				r.push(App.SlaveAssignment.choosesOwnJob(slave));
			} else {
				r.push(`is confined in ${V.cellblockName}.`);
			}
			App.Events.addNode(slaveEntry, r);

			confinedResults = App.SlaveAssignment.stayConfined(slave);
			App.Events.addNode(slaveEntry, [He, confinedResults.text], "div", "indent");
			if (confinedResults.broken) {
				brokenSlaves++;
				continue; // slave has been reassigned; remaining report will run at her new assignment
			}
			slaveEntry.append(App.SlaveAssignment.standardSlaveReport(slave, false));
			App.SlaveAssignment.appendSlaveArt(artSpan, slave);
		} else {
			// discard return values silently
			App.SlaveAssignment.choosesOwnJob(slave);
			confinedResults = App.SlaveAssignment.stayConfined(slave);
			if (confinedResults.broken) {
				brokenSlaves++;
				continue; // slave has been reassigned; remaining report will run at her new assignment
			}
			App.SlaveAssignment.standardSlaveReport(slave, true);
		}
	}
	if (softenedQuirks || brokenSlaves) {
		r = [];
		if (softenedQuirks > 0) {
			r.push(`${cellblockNameCaps}'s advanced compliance systems successfully softened`);
			if (softenedQuirks === 1) {
				r.push(`one slave's mental flaw into an <span class="green">appealing quirk,</span> though the constant correction caused them <span class="mediumorchid">considerable anguish.</span>`);
			} else {
				r.push(`${softenedQuirks} slaves' mental flaws into <span class="green">appealing quirks,</span> though the constant correction caused them <span class="mediumorchid">considerable anguish.</span>`);
			}
		}
		if (brokenSlaves > 0) {
			if (brokenSlaves === 1) {
				r.push(`One slave is now willing to <span class="hotpink">do as they're told</span> and has been released.`);
			} else {
				r.push(`${brokenSlaves} slaves are now willing to <span class="hotpink">do as they're told</span> and have been released.`);
			}
			if (V.cellblockDecoration !== "standard") {
				App.Events.addNode(el, r, "p", "indent");
				r = [];
				r.push(`${cellblockNameCaps}'s ${V.cellblockDecoration} atmosphere <span class="hotpink">had an impact on them while they were</span> imprisoned.`);
			}
		}
		App.Events.addNode(el, r, "p", "indent");
	}
	return el;
};

repo_name: Banyanael/fc

license: mit


code:
/**
 * Details week-to-week changes in children in the Nursery
 * @returns {DocumentFragment}
 */
App.Facilities.Nursery.childrenReport = function childrenReport() {
	const frag = new DocumentFragment();

	const Matron = S.Matron;
	const nannies = App.Utils.sortedEmployees(App.Entity.facilities.nursery);
	const NL = App.Entity.facilities.nursery.employeesIDs().size;
	const CL = V.cribs.length;

	const medianNannyIntelligence = NL ? findMedianNannyIntelligence() : null;
	const medianNannyIntelligenceImplant = NL ? findMedianNannyIntelligenceImplant() : null;

	for (const child of V.cribs) {
		const childDiv = App.UI.DOM.appendNewElement("div", frag, '', "child-section");

		childDiv.append(childGrowTime(child));

		if (child.actualAge >= 3) {
			if (Matron) {
				if (Matron.fetish !== "none") {
					childDiv.append(matronFetishEffects(child));
				}

				childDiv.append(matronEducationEffects(child));
				// childDiv.append(matronFitnessEffects(child));
			}

			if (NL > 0) {
				const randomNanny = NL > 1 ? jsRandom(0, nannies.length - 1) : 0;
				const nanny = nannies[randomNanny];

				if (nanny.fetish !== "none") {
					childDiv.append(nannyFetishEffects(child, nanny));
				}

				childDiv.append(nannyEducationEffects(child));
				// childDiv.append(nannyFitnessEffects(child));
			}

			if (multipleChildrenOverTargetAge(V.cribs.findIndex(c => c.ID === child.ID))) {
				childDiv.append(childFriendshipRivalries(child));
			}

			// TODO: rework these entirely
			if (Matron || nannies) {
				childDiv.appendChild(weightRulesEffects(child));
				childDiv.appendChild(musclesRulesEffects(child));
			}
		} else {
			// TODO:
		}
	}

	// MARK: Matron Effects

	function matronFetishEffects(child) {
		const chance = jsRandom(1, 100);

		if ((chance > 90 && child.fetish === "none") || chance > 95) {
			child.fetish = Matron.fetish;

			return `${child.slaveName} has taken a few cues from ${Matron.slaveName}, and ${newChildFetish(child.fetish)}. `;
		}
	}

	function matronEducationEffects(child) {
		// TODO: expand this
		const {he, him, his} = getPronouns(Matron);

		const theChildren = CL > 1 ? `the children` : `${child.slaveName}`;

		if (Matron.intelligence + Matron.intelligenceImplant > 65) {
			child.intelligenceImplant += 3;

			return `${Matron.slaveName} is so intelligent and well-educated that ${he} is able to teach ${theChildren} very effectively, and so ${CL > 1 ? `they gradually grow` : `${child.slaveName} gradually grows`} smarter. `;
		} else if (Matron.intelligenceImplant > 20) {
			child.intelligenceImplant += 2;

			return `${Matron.slaveName}'s education makes up for the fact that ${he} isn't the brightest and allows ${him} to teach ${theChildren} quite effectively, and so ${CL > 1 ? `they grow` : `${child.slaveName} grows`} a bit smarter. `;
		} else if (Matron.intelligence > 50) {
			child.intelligenceImplant += 2;

			return `Though ${Matron.slaveName} has had little to no formal education, ${his} natural brilliance allows ${him} to teach ${theChildren} quite effectively, and so ${CL > 1 ? `they grow` : `${child.slaveName} grows`} a bit smarter. `;
		} else {
			const totalSpan = App.UI.DOM.makeElement("span", `${Matron.slaveName} isn't the brightest and not well educated, `);
			const damageSpan = App.UI.DOM.makeElement("span", `damaging the amount of real education ${theChildren} receive. `, "red");

			child.intelligenceImplant--;

			totalSpan.appendChild(damageSpan);

			return totalSpan;
		}
	}

	// function matronFitnessEffects(child) {
	// 	// TODO:
	// 	return;
	// }

	// MARK: Nanny Effects

	function nannyFetishEffects(child, slave) {
		const {he} = getPronouns(child);
		const chance = jsRandom(1, 100);

		if (chance > 85) {
			if (child.fetish === "none") {
				child.fetish = slave.fetish;

				return `${slave.slaveName} has left quite an impression on ${child.slaveName}, and ${he} ${newChildFetish(child.fetish)}. `;
			} else {
				if (chance > 90) {
					child.fetish = slave.fetish;

					return `${child.slaveName} seems to have taken to ${slave.slaveName}'s example, and ${newChildFetish(child.fetish)}. `;
				}
			}
		}
	}

	function nannyEducationEffects(child) {
		// TODO: redo this entire section
		// TODO: expand this
		const firstNanny = nannies[0];
		const theNanniesAre = NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`;
		const theChildren = CL > 1 ? `the children` : child.slaveName;

		if (medianNannyIntelligence + medianNannyIntelligenceImplant > 65) {
			child.intelligenceImplant += 3;

			return `${theNanniesAre} very intelligent and well educated and are able to teach ${theChildren} very effectively. `;
		} else if (medianNannyIntelligence > 50) {
			child.intelligenceImplant += 2;

			return `${theNanniesAre} very intelligent and able to teach ${theChildren} quite effectively. `;
		} else if (medianNannyIntelligenceImplant > 25) {
			child.intelligenceImplant += 2;

			return `${theNanniesAre} very well educated and able to teach ${theChildren} quite effectively. `;
		} else if (medianNannyIntelligenceImplant > 15) {
			child.intelligenceImplant++;

			return `${theNanniesAre} well educated and able to teach ${theChildren} fairly effectively. `;
		}
	}

	// function nannyFitnessEffects(child) {
	// 	// TODO:
	// 	return;
	// }

	// MARK: Nursery Rules Effects

	function weightRulesEffects(child) {
		// TODO: redo this entire section
		// TODO: double check these classes, make sure they make sense
		const span = document.createElement("span");
		const {he, He, His} = getPronouns(child);

		if (V.nurseryWeight) {
			const firstNanny = NL > 0 ? nannies[0] : null;
			const caretaker = Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName;

			if (V.nurseryWeightSetting === 1) {
				const weightSpan = App.UI.DOM.makeElement("span", 'rapid weight gain.', ["health", "dec"]);

				if (child.weight < 200) {
					child.weight += 5;
				}

				span.append(`${He} is being fed an excessive amount of food, causing`, weightSpan);
			} else if (V.nurseryWeightSetting === 2) {
				const weightSpan = App.UI.DOM.makeElement("span", `decreases the amount of food ${he} eats. `, "improvement");

				if (child.weight > 10) {
					child.weight--;

					span.append(`${caretaker} notices ${he} is overweight and `, weightSpan);
				} else if (child.weight <= -10) {
					const weightSpan = App.UI.DOM.makeElement("span", `increases the amount of food ${he} eats. `, "improvement");

					child.weight++;

					span.append(`${caretaker} notices ${he} is underweight and `, weightSpan);
				} else {
					const weightSpan = App.UI.DOM.makeElement("span", 'currently a healthy weight;', ["change", "positive"]);

					span.append(`${He} is `, weightSpan, ` efforts will be made to maintain it. `);
				}
			} else if (V.nurseryWeightSetting === 0) {
				if (child.weight > -20) {
					const weightSpan = App.UI.DOM.makeElement("span", 'quickly sheds its gained weight.', ["health", "dec"]);

					child.weight -= 40;

					span.append(`${His} developing body `, weightSpan);
				}
			}
		} else {
			if (child.weight > -20) {
				const weightSpan = App.UI.DOM.makeElement("span", 'quickly sheds its gained weight. ', ["health", "dec"]);

				child.weight -= 40;

				span.append(`${His} developing body `, weightSpan);
			}
		}

		return span;
	}

	function musclesRulesEffects(child) {
		const div = document.createElement("div");

		// TODO: rewrite these
		// FIXME: this entire section needs a rewrite - numbers and text don't line up at all
		if (V.nurseryMuscles) {
			const firstNanny = NL > 0 ? nannies[0] : null;
			const caretaker = Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName;
			const {His, He, he} = getPronouns(child);

			const muscleSpan = App.UI.DOM.makeElement("div", 'rapid muscle development.', "improvement");

			div.append(`${He} is being worked out as often as possible, resulting in `, muscleSpan);

			if (V.nurseryMusclesSetting === 2) {
				const muscleSpan = App.UI.DOM.makeElement("span", `decreases the amount of exercise ${he} receives. `, "improvement");

				if (child.muscles > 100) {
					child.muscles -= 5;
				}

				div.append(`${caretaker} notices ${he} is overly muscular and `, muscleSpan);
			} else if (V.nurseryMusclesSetting === 1) {
				if (child.muscles < -10) {
					const muscleSpan = App.UI.DOM.makeElement("span", `increases the amount of exercise ${he} receives. `, "improvement");

					child.muscles--;

					div.append(`${caretaker} notices ${he} is weak and `, muscleSpan);
				} else if (child.muscles > 10) {
					const muscleSpan = App.UI.DOM.makeElement("span", 'a healthy musculature;', ["change", "positive"]);

					child.muscles++;

					div.append(`${He} has `, muscleSpan, ` efforts will be made to maintain it. `);
				} else {
					const muscleSpan = App.UI.DOM.makeElement("span", 'quickly loses its gained muscle.', ["health", "dec"]);

					div.append(`${His} developing body `, muscleSpan);
				}
			} else if (V.nurseryMusclesSetting === 0) {
				const muscleSpan = App.UI.DOM.makeElement("span", 'quickly loses its gained muscle.', ["health", "dec"]);

				if (child.muscles > 100) {
					child.muscles -= 40;
					div.append(`${His} developing body `, muscleSpan);
				}
			}
		}

		return div;
	}

	// MARK: Miscellaneous Functions

	function childFriendshipRivalries(child) {
		const el = new DocumentFragment();
		const cribsCopy = Array.from(V.cribs);

		cribsCopy.splice(V.cribs.findIndex(c => c.ID === child.ID));

		for (const target of cribsCopy) {
			const becomeFriends = () => `${child.slaveName} and ${target.slaveName} have realized that they have more in common that they originally thought, and have become friends. `;
			const becomeRivals = () => `${child.slaveName} and ${target.slaveName} have more differences between them than they could put aside and have become rivals. `;
			const haveSameFetish = () => child.fetish === target.fetish && child.fetish !== "none";
			const haveSameBehavioralQuirk = () => child.behavioralQuirk && child.behavioralQuirk === target.behavioralQuirk && child.behavioralQuirk !== "none";
			const haveSameSexualQuirk = () => child.sexualQuirk && child.sexualQuirk === target.sexualQuirk && child.sexualQuirk !== "none";

			const div = document.createElement("div");

			const {his} = getPronouns(target);
			const chance = jsRandom(1, 100);

			let friend = 0;
			let rival = 0;

			if (target.actualAge >= 3) {
				if (haveSameFetish()) {
					div.append(`${sameFetish(child, target)}, a fact over which they bond. `);

					friend++;
				}

				if (haveSameBehavioralQuirk()) {	// TODO:
					div.append(`Since ${sameBehavioralQuirk(child, target)}, they learn to get along a bit better. `);

					friend++;
				}

				if (haveSameSexualQuirk()) {
					div.append(`Because ${sameSexualQuirk(child, target, haveSameBehavioralQuirk())}, the two grow a bit closer. `);

					friend++;
				}

				if (target.fetish === "sadist" || target.fetish === "dom") {
					div.append(`${target.slaveName} is a ${target.fetish}, and ${child.slaveName} is often ${his} target, which ${child.slaveName} doesn't particularly like. `);

					rival++;
				} else if (child.fetish === "sadist" || child.fetish === "dom") {
					div.append(`${child.slaveName} is a ${child.fetish}, and ${target.slaveName} is often ${his} target, which ${target.slaveName} doesn't particularly like. `);

					rival++;
				}

				if (areRelated(child, target) || areCousins(child, target)) {
					if (areRelated(child, target)) {
						if (rival) {
							div.append(`${child.slaveName} and ${target.slaveName} are siblings, and find it difficult to really stay mad at each other, and they make up their differences somewhat. `);

							friend += 2;
						} else {
							div.append(`${child.slaveName} and ${target.slaveName} are siblings, a fact that draws them closer together. `);

							friend += 2;
						}
					} else {
						if (rival) {
							div.append(`${child.slaveName} and ${target.slaveName} are cousins, and find it difficult to really stay mad at each other, and they make up their differences somewhat. `);

							friend++;
						} else {
							div.append(`${child.slaveName} and ${target.slaveName} are cousins, a fact that draws them closer together. `);

							friend++;
						}
					}
				}

				if (friend) {
					if (rival) {
						if (friend > rival && child.relationshipTarget !== target.ID) {
							if (chance > 75) {
								div.append(becomeFriends());

								child.relationship = 1;
								child.relationshipTarget = target.ID;

								target.relationship = 1;
								target.relationshipTarget = child.ID;
							}
						}
					} else {
						if (chance > 60) {
							div.append(becomeRivals());

							child.relationship = 1;
							child.relationshipTarget = target.ID;

							target.relationship = 1;
							target.relationshipTarget = child.ID;
						}
					}
				}

				if (rival) {
					if (friend) {
						if (rival > friend) {
							if (chance > 75) {
								div.append(becomeRivals());
							}
						}
					} else {
						if (chance > 60) {
							div.append(becomeFriends());
						}
					}
				}
			}

			el.append(div);
		}
		return el;

		function sameFetish(child, target) {
			switch (child.fetish) {
				case "submissive":
					return `${child.slaveName} and ${target.slaveName} are both sexually submissive`;
				case "cumslut":
					return `Neither ${child.slaveName} nor ${target.slaveName} can get enough cum`;
				case "humiliation":
					return `Both ${child.slaveName} and ${target.slaveName} have a fetish for humiliation`;
				case "buttslut":
					return `Neither ${child.slaveName} nor ${target.slaveName} can get enough assplay`;
				case "boobs":
					return `${child.slaveName} and ${target.slaveName} both love breastplay`;
				case "sadist":
					return `Both ${child.slaveName} are ${target.slaveName} are sadists`;
				case "masochist":
					return `${child.slaveName} and ${target.slaveName} are both masochists`;
				case "dom":
					return `Both ${child.slaveName} and ${target.slaveName} are sexually dominant`;
				case "pregnancy":
					return `The idea of pregnancy titillates both ${child.slaveName} and ${target.slaveName}`;
				default:
					throw Error(`Unexpected value ${child.fetish} in sameFetish(). Please report this.`);
			}
		}

		function sameBehavioralQuirk(child, target) {
			switch (child.behavioralQuirk) {
				case "confident":
					return `${child.slaveName} and ${target.slaveName} are both naturally confident`;
				case "cutting":
					return `both ${child.slaveName} and ${target.slaveName} have a cutting wit about them`;
				case "funny":
					return `${child.slaveName} and ${target.slaveName} can both make the other laugh`;
				case "fitness":
					return `${child.slaveName} and ${target.slaveName} both love to try to stay in shape`;
				case "adores women":
					return `${child.slaveName} and ${target.slaveName} both adore women`;
				case "adores men":
					return `both ${child.slaveName} are ${target.slaveName} adore men`;
				case "insecure":
					return `${child.slaveName} and ${target.slaveName} are both equally insecure`;
				case "sinful":
					return `both ${child.slaveName} and ${target.slaveName} love breaking cultural and religious mores`;
				case "advocate":
					return `${child.slaveName} and ${target.slaveName} can both make a strong case for slavery`;
				default:
					throw Error(`Unexpected value ${child.behavioralQuirk} in sameBehavioralQuirk(). Please report this.`);
			}
		}

		// TODO: incorporate minimumSlaveAge
		function sameSexualQuirk(child, target, sameQuirk = false) {
			switch (child.sexualQuirk) {
				case "gagfuck queen":
					return `${sameQuirk ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} love having their little throats fucked`;
				case "painal queen":
					return `${sameQuirk ? `neither` : `neither ${child.slaveName} nor ${target.slaveName}`} can get enough painal`;
				case "strugglefuck queen":
					return `${sameQuirk ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} love to put up a struggle during sex`;
				case "tease":
					return `${sameQuirk ? `the two are also both teases` : `${child.slaveName} and ${target.slaveName} are both teases`}`;
				case "romantic":
					return `${sameQuirk ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} see the world from under a romantic lens`;
				case "perverted":
					return `${sameQuirk ? `the two are also` : `${child.slaveName} and ${target.slaveName} are both`} big-time perverts`;
				case "caring":
					return `${sameQuirk ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} care about their partners`;
				case "unflinching":
					return `${sameQuirk ? `the two can also` : `${child.slaveName} and ${target.slaveName} can both`} take whatever their partner might throw at them `;
				case "size queen":
					return `${sameQuirk ? `the two also` : `${child.slaveName} and ${target.slaveName} both`} have a love for huge cock`;
				default:
					throw Error(`Unexpected value ${child.fetish} in sameSexualQuirk(). Please report this.`);
			}
		}
	}

	function newChildFetish(fetish = "none") {
		switch (fetish) {
			case "submissive":
				return `is now sexually submissive`;
			case "cumslut":
				return `is now a cumslut`;
			case "humiliation":
				return `now has a fetish for humiliation`;
			case "buttslut":
				return `is now a buttslut`;
			case "boobs":
				return `now has a fetish for all things breast-related`;
			case "sadist":
				return `now gets off on causing pain`;
			case "masochist":
				return `now gets off on pain`;
			case "dom":
				return `is now very sexually dominant`;
			case "pregnancy":
				return `has developed a fascination for all things pregnancy-related`;
			default:
				throw Error(`Unexpected fetish value of "${fetish}" in newChildFetish(). Please report this.`);
		}
	}

	function childGrowTime(child) {
		const nameSpan = App.UI.DOM.makeElement("span", child.slaveName, "pink");
		const limeSpan = App.UI.DOM.makeElement("span", 'ready for release.', "lime");
		const mainSpan = document.createElement("span");

		const {He} = getPronouns(child);

		if (child.growTime > 0) {
			mainSpan.append(nameSpan, ` is growing steadily. ${He} will be ready for release in about ${years(child.growTime)}. `);
		} else {
			mainSpan.append(nameSpan, ' is ', limeSpan, ` ${He} will be removed from ${V.nurseryName} upon your approach. `);
		}

		return mainSpan;
	}

	function findMedianNannyIntelligence() {
		return median(nannies.map(n => n.intelligence));
	}

	function findMedianNannyIntelligenceImplant() {
		return median(nannies.map(n => n.intelligenceImplant));
	}

	/**
	 * Checks if there are more than one children over the target age in the Nursery
	 * @param {number} index
	 * @param {number} [age=3]
	 */
	function multipleChildrenOverTargetAge(index, age = 3) {
		const cribsCopy = Array.from(V.cribs);

		cribsCopy.splice(index, 1);

		return V.cribs.length > 1 && cribsCopy.some(c => c.actualAge >= age);
	}

	return frag;
};


code:
App.EndWeek.clinicReport = function() {
	let frag = document.createDocumentFragment();

	const slaves = App.Utils.sortedEmployees(App.Entity.facilities.clinic);
	let devBonus = (V.clinicDecoration !== "standard") ? 1 : 0;
	let healthBonus = 0;
	V.flSex = App.EndWeek.getFLSex(App.Entity.facilities.clinic); // FIXME: should be local, passed as a parameter to saRules

	function nurseText() {
		let r = [];
		let FLsFetish = 0;
		let idleBonus = 0;

		if (S.Nurse) {
			if (S.Nurse.health.condition < 100) {
				improveCondition(S.Nurse, 20);
			}
			if (S.Nurse.devotion <= 60) {
				S.Nurse.devotion++;
			}
			if (S.Nurse.trust < 60) {
				S.Nurse.trust++;
			}

			if (S.Nurse.rules.living !== "luxurious") {
				S.Nurse.rules.living = "luxurious";
			}
			if (S.Nurse.rules.rest !== "restrictive") {
				S.Nurse.rules.rest = "restrictive";
			}

			S.Nurse.devotion += devBonus;
			if (S.Nurse.fetishStrength <= 95) {
				if (S.Nurse.fetish !== "dom") {
					if (fetishChangeChance(S.Nurse) > jsRandom(0, 100)) {
						FLsFetish = 1;
						S.Nurse.fetishKnown = 1;
						S.Nurse.fetish = "dom";
						S.Nurse.fetishStrength = 10;
					}
				} else if (S.Nurse.fetishKnown === 0) {
					FLsFetish = 1;
					S.Nurse.fetishKnown = 1;
				} else {
					FLsFetish = 2;
					S.Nurse.fetishStrength += 4;
				}
			}
			const {He, he, His, his, him, himself, wife} = getPronouns(S.Nurse);
			r.push(`${SlaveFullName(S.Nurse)} is serving as the clinical nurse.`);
			if (S.Nurse.relationship === -3 && S.Nurse.devotion > 50) {
				r.push(`${He} does ${his} best to be a caring and nurturing ${wife}.`);
				healthBonus += 2;
			}
			if (FLsFetish === 1) {
				r.push(`${His} job involves giving naked sex slaves orders for their own good. Even though most of these commands are medical rather than sexual, ${he} can be forgiven for not always seeing the difference, and becomes more dominant.`);
			} else if (FLsFetish === 2) {
				r.push(`Every new patient in the clinic is a new target for ${his} authority. <span class="fetish inc">${He} becomes more dominant.</span>`);
			}
			if (App.Data.Careers.Leader.nurse.includes(S.Nurse.career)) {
				r.push(`${He} has experience with medicine from ${his} life before ${he} was a slave, and can often recognize conditions before even the medical scanners can.`);
				idleBonus++;
				healthBonus++;
			} else if (S.Nurse.skill.nurse >= V.masteredXP) {
				r.push(`${He} has experience with medicine from working for you, and can often recognize conditions before even the medical scanners can.`);
				idleBonus++;
				healthBonus++;
			} else {
				const skillIncrease = jsRandom(1, Math.ceil((S.Nurse.intelligence + S.Nurse.intelligenceImplant) / 15) + 8);
				r.push(slaveSkillIncrease('nurse', S.Nurse, skillIncrease));
			}
			if (S.Nurse.fetish === "dom") {
				r.push(`${He} raps out commands with the confidence of long and partly sexual experience, so patients are inclined to follow even unpleasant medical instructions.`);
				idleBonus++;
				healthBonus++;
			}
			if (S.Nurse.muscles > 5) {
				r.push(`${He}'s strong enough to gently but firmly restrain resistant slaves, allowing ${him} to be sparing with the inescapable but less healthy restraints.`);
				idleBonus++;
				healthBonus++;
			}
			if (S.Nurse.intelligence + S.Nurse.intelligenceImplant > 50) {
				r.push(`The diagnostic equipment is state-of-the-art, but ${he}'s smart and perceptive enough that on occasion, ${he} can add meaningfully to its medical scans.`);
				idleBonus++;
				healthBonus++;
			}
			if (S.Nurse.face > 40) {
				r.push(`Patients rarely object to seeing ${his} gorgeous face hovering over them.`);
				idleBonus++;
				devBonus++;
			}
			if (S.Nurse.devotion >= 60) {
				healthBonus++;
			}
			for (const slave of slaves) {
				const {He2, His2, he2, his2, him2} = getPronouns(slave).appendSuffix('2');
				if (S.Nurse.rivalryTarget === slave.ID) {
					r.push(`${He} purposefully neglects the needs of ${his} ${rivalryTerm(S.Nurse)}, ${slave.slaveName}, <span class="health dec">hindering ${his2} recovery</span> and deepening their dislike for each other.`);
					slave.devotion--;
					slave.trust--;
					healthDamage(slave, 3);
					if (jsRandom(1, 100) > 65) {
						S.Nurse.rivalry++;
						slave.rivalry++;
					}
				} else if (S.Nurse.relationshipTarget === slave.ID) {
					r.push(`${He} dedicates most of ${his} attention to ${his} ${relationshipTerm(S.Nurse)}, ${slave.slaveName}, making sure ${he2} has everything ${he2} needs and more. This lavish attention detracts from ${his} overall effectiveness.`);
					idleBonus -= 3;
					slave.devotion++;
					slave.trust++;
					improveCondition(slave, 3);
				} else if (areRelated(S.Nurse, slave)) {
					r.push(`${He} makes sure to spend extra time caring for ${his} ${relativeTerm(S.Nurse, slave)}, ${slave.slaveName}.`);
					slave.trust++;
					improveCondition(slave, 1);
				}
				switch (slave.prestigeDesc) {
					case "$He is a famed Free Cities whore, and commands top prices.":
						r.push(`${He} does ${his} best to aid the famous whore, ${slave.slaveName}, making sure to pay special attention to ${his2} worn holes.`);
						improveCondition(slave, 2);
						break;
					case "$He is a famed Free Cities slut, and can please anyone.":
						r.push(`${He} does ${his} best to aid the famous entertainer, ${slave.slaveName}, making sure ${he2} can show off as soon as possible.`);
						improveCondition(slave, 2);
						break;
					case "$He is remembered for winning best in show as a cockmilker.":
						if (slave.balls > 4 && slave.dick !== 0) {
							r.push(`${He} does ${his} best to aid the dribbling ${slave.slaveName}, paying special attention to ${his2} huge cock and balls as well as making sure to milk ${his2}`);
							if (canAchieveErection(slave)) {
								r.push(`erect`);
							}
							r.push(`dick hourly.`);
							improveCondition(slave, 4);
							if (jsRandom(1, 100) > 65 && canTaste(S.Nurse)) {
								if (S.Nurse.fetish === "none") {
									r.push(`It's not uncommon for ${him} to receive a load to the face; before long, <span class="fetish gain">${he} starts to enjoy the taste.</span>`);
									S.Nurse.fetish = "cumslut";
								} else if (S.Nurse.fetish === "cumslut") {
									r.push(`${canSmell(S.Nurse) ? `The smell of ${his2}` : `${His2}`} semen is irresistible to ${him} and sometimes ${he} can't help but`);
									if (slave.chastityPenis === 0 && slave.rules.release.facilityLeader === 1) {
										r.push(`wrap ${his} lips around ${him2} and sample the stuff directly,`);
										seX(S.Nurse, "oral", slave, "penetrative");
									} else {
										r.push(`catch a little of it in a cup for further "analysis",`);
									}
									r.push(`<span class="fetish inc">further feeding ${his} cum fetishism.</span>`);
									S.Nurse.fetishStrength = Math.clamp(S.Nurse.fetishStrength + 4, 0, 100);
								}
							}
						}
						break;
					case "$He is remembered for winning best in show as a dairy cow.":
						if (slave.lactation > 0 && (slave.boobs - slave.boobsImplant - slave.boobsMilk) > 6000) {
							r.push(`${He} does ${his} best to aid the leaking ${slave.slaveName}, paying special attention to ${his2} huge breasts as well as making sure to milk ${him2} hourly.`);
							improveCondition(slave, 4);
							slave.lactationDuration = 2;
							if (jsRandom(1, 100) > 65 && canTaste(S.Nurse)) {
								if (S.Nurse.fetish === "none") {
									r.push(`Those lovely globes are just too tantalizing for ${him} to resist, <span class="fetish gain">${he} can't help but take a drink ${himself}.</span>`);
									S.Nurse.fetish = "boobs";
								} else if (S.Nurse.fetish === "boobs") {
									r.push(`${He} takes the opportunity to <span class="fetish gain">feed ${his} breast fetishism</span> by getting up close and personal with ${his2} prized udders.`);
									S.Nurse.fetishStrength = Math.clamp(S.Nurse.fetishStrength + 4, 0, 100);
								}
							}
						}
						break;
					case "$He is remembered for winning best in show as a breeder.":
						if (slave.bellyPreg >= 1500) {
							r.push(`${He} does ${his} best to aid the pregnant ${slave.slaveName}, paying special attention to ${his2} swollen belly and the welfare of the life within.`);
							improveCondition(slave, 6);
						} else if (slave.ovaries === 1 || slave.mpreg === 1) {
							r.push(`${He} does ${his} best to aid the breeder ${slave.slaveName}, paying special attention to ${his2} fertility and reproductive organs.`);
							improveCondition(slave, 4);
						} else {
							r.push(`${He} lays out plans on how to restore the breeder ${slave.slaveName} to ${his2} former gravid glory.`);
						}
						break;
				}
				if (slave.bellyImplant > -1 && V.clinicInflateBelly === 1) {
					r.push(`
${slave.slaveName} spent a lot of time during the week under IV-like stands with bags of inert filler steadily flowing into ${his2} belly implant, slowly pushing ${his2} belly further and further out. Careful attention, along with several drug injections, were used to make sure ${his2} body was able to safely adjust to the implant's rapid growth.`);
					healthDamage(slave, 10);
					slave.bellyImplant += 5000;
					if (slave.devotion > 50) {
						slave.devotion += 4;
						slave.trust += 3;
					} else if (slave.devotion >= -20) {
						slave.trust -= 5;
					} else {
						slave.devotion -= 5;
						slave.trust -= 10;
					}
					if (slave.bellyImplant > (V.arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000)) {
						slave.bellyImplant = (V.arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000);
						r.push(`${He2} is filled to the maximum that ${his2} implant can stand.`);
					}
					r.push(`</div>`);
				}
				if (slave.pregKnown === 1 && slave.preg < slave.pregData.normalBirth && slave.pregControl === "speed up") {
					r.push(`<div class="indent"><span class="slave-name">${slave.slaveName}</span> spends most of ${his2} time on bedrest being filled with rapid gestation agents and concentrated slave food. All ${he2} can do is`);
					if (hasAnyArms(slave) && canSee(slave)) {
						r.push(`watch and feel ${his2} belly pushing further and further out with life.`);
					} else if (canSee(slave)) {
						r.push(`watch ${his2} belly bulging further and further out with life.`);
					} else if (hasAnyArms(slave)) {
						r.push(`feel ${his2} belly pushing further and further out with life beneath ${his2} fingers.`);
					} else {
						r.push(`feel the ever growing pressure inside ${his2} abdomen.`);
					}
					r.push(`Careful attention, along with numerous drug injections, are used to make sure ${his2} body is able to safely adjust to ${his2} pregnancy's rapid growth.`);
					healthDamage(slave, 10);
					if (slave.devotion > 50) {
						slave.devotion += 2;
						slave.trust += 1;
					} else if (slave.devotion >= -20) {
						slave.trust -= 5;
					} else {
						slave.devotion -= 5;
						slave.trust -= 10;
					}
					if (slave.preg >= slave.pregData.normalBirth && slave.pregControl === "speed up") {
						slave.pregControl = "none";
						r.push(`${His2} child is ready to pop out of ${his2} womb; <span class="yellow">${his2} course of rapid gestation agents is finished.</span>`);
					}
					r.push(`</div>`);
				} else if (slave.preg > 2 && slave.pregKnown === 0) {
					r.push(`During ${his} tests, ${he} discovers that ${slave.slaveName} <span class="lime">is pregnant.</span>`);
					slave.pregKnown = 1;
				}
			}

			if (slaves.length < V.clinic && !slaveResting(S.Nurse)) {
				const idlePay = jsRandom(1, 10) + ((V.clinic - slaves.length) * (jsRandom(150, 170) + (idleBonus * 10)));
				cashX(idlePay, "clinic", S.Nurse);
				r.push(`
Since ${he} doesn't have enough patients to occupy all of ${his} time, ${V.clinicName} takes in citizens' slaves on a contract basis and ${he} helps them too, earning ${cashFormat(idlePay)}.
`);
			}
		}

		return r.join(" ");
	}

	const nurseEffects = App.UI.DOM.appendNewElement("p", frag, '', "indent");
	$(nurseEffects).append(nurseText());

	if (slaves.length > 0) {
		const intro = App.UI.DOM.appendNewElement("p", frag, '', "indent");
		if (slaves.length > 1) {
			$(intro).append(`<strong>There are ${slaves.length} slaves receiving treatment in the clinic.</strong>`);
		} else {
			$(intro).append(`<strong>There is one slave receiving treatment in the clinic.</strong>`);
		}
	}

	if (S.Nurse) {
		const slave = App.SlaveAssignment.reportSlave(S.Nurse);
		tired(slave);
		/* apply following SA passages to facility leader */
		if (V.showEWD !== 0) {
			const nurseEntry = App.UI.DOM.appendNewElement("div", frag, '', "slave-report");
			const artSpan = App.UI.DOM.appendNewElement("span", nurseEntry);
			App.SlaveAssignment.appendSlaveLinks(nurseEntry, slave);
			$(nurseEntry).append(`<span class='slave-name'>${SlaveFullName(slave)}</span> is serving as the clinical nurse.`);
			nurseEntry.append(App.SlaveAssignment.standardSlaveReport(slave, false));
			App.SlaveAssignment.appendSlaveArt(artSpan, slave);
		} else {
			App.SlaveAssignment.standardSlaveReport(slave, true);
		}
	}

	let restedSlaves = 0;
	for (const slave of App.SlaveAssignment.reportSlaves(slaves)) {
		if (slave.devotion < 45) {
			slave.devotion += 4;
		}
		slave.devotion += devBonus;

		if (slave.health.condition < -80) {
			improveCondition(slave, 20 + (V.curativeUpgrade * 10) + healthBonus);
		} else if (slave.health.condition < -40) {
			improveCondition(slave, 10 + (V.curativeUpgrade * 10) + healthBonus);
		} else if (slave.health.condition < 0) {
			improveCondition(slave, 7 + (V.curativeUpgrade * 10) + healthBonus);
		} else if (slave.health.condition < 90) {
			improveCondition(slave, 3 + (V.curativeUpgrade * 10) + healthBonus);
		}

		/* the clinic is a well-equipped medical facility and can allow the Nurse or player to
		* directly cure serious wounds caused by injury and surgery with minimal side effects */
		if (slave.health.shortDamage >= 10) {
			if (S.Nurse) {
				healthCure(slave, 5 + healthBonus);
			} else {
				healthCure(slave, V.PC.skill.medicine / 15); /* maximum of 6...even a bad full-time nurse will be better than a player doctor */
			}
		}

		switch (V.clinicDecoration) {
			case "Eugenics":
			case "Gender Fundamentalist":
			case "Gender Radicalist":
			case "Hedonistic":
			case "Intellectual Dependency":
			case "Maturity Preferentialist":
			case "Paternalist":
			case "Petite Admiration":
			case "Repopulationist":
			case "Slimness Enthusiast":
			case "Statuesque Glorification":
			case "Youth Preferentialist":
				slave.rules.living = "luxurious";
				break;
			case "Arabian Revivalist":
			case "Aztec Revivalist":
			case "Chattel Religionist":
			case "Chinese Revivalist":
			case "Edo Revivalist":
			case "Egyptian Revivalist":
			case "Roman Revivalist":
				slave.rules.living = "normal";
				break;
			default:
				slave.rules.living = "spare";
		}

		if (S.Nurse) {
			if (V.clinicSpeedGestation === 1 && slave.pregKnown === 1) {
				slave.pregControl = "speed up";
			}
			if (slave.chem > 10 && V.clinicUpgradeFilters >= 1) {
				if (slave.health.health > -50 && (V.clinicUpgradePurge > 0)) {
					slave.chem -= 100 * V.clinicUpgradePurge;
					healthDamage(slave, 15);
				}
				slave.chem = Math.max(slave.chem - 5, 0);
			}
			if (slave.lactation > 0) {
				slave.boobs -= slave.boobsMilk;
				slave.boobsMilk = 0;
			}
		}

		/* Evaluate why the slave even needs to be here, and eject her if she doesn't */
		const {He, he, his} = getPronouns(slave);
		const remainReasons = [];
		if (slave.health.illness > 0) {
			remainReasons.push(`since ${he} is still sick`);
		}
		if (slave.health.shortDamage >= 20) {
			remainReasons.push(`to recover from ${his} injuries`);
		}
		if (slave.health.condition < -20) {
			remainReasons.push(`since ${his} health is still poor`);
		} else if (slave.health.condition <= 40) {
			remainReasons.push(`since ${his} health could be better`);
		}
		if (S.Nurse) {
			if (slave.chem > 15 && V.clinicUpgradeFilters === 1) {
				remainReasons.push(`to have unhealthy chemicals flushed from ${his} system`);
			}
			if (slave.pregKnown === 1 && (V.clinicSpeedGestation > 0 || slave.pregControl === "speed up")) {
				remainReasons.push(`to hurry ${his} pregnancy along safely`);
			}
			if (V.clinicObservePregnancy === 1 && (slave.pregAdaptation * 1000 < slave.bellyPreg || slave.preg > slave.pregData.normalBirth / 1.33)) {
				remainReasons.push(`to wait for childbirth`);
			}
			if (V.clinicInflateBelly > 0 && slave.bellyImplant >= 0 && (slave.bellyImplant <= (V.arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))) {
				remainReasons.push(`as ${his} implants can still receive more filling`);
			}
		}

		if (remainReasons.length === 0) {
			const reassignment = App.UI.DOM.appendNewElement("p", frag, '');
			let r = [];
			r.push(`<span class="slave-name">${slave.slaveName}</span> has been cured${(S.Nurse && V.clinicUpgradeFilters > 0) ? ' and purified' : ''},`);
			r.push(`<span class="noteworthy">`);
			if (V.assignmentRecords[slave.ID]) {
				const oldJob = V.assignmentRecords[slave.ID];
				assignJobSafely(slave, oldJob);
				if (slave.choosesOwnAssignment === 1) {
					r.push(`and ${he} is resting before choosing another task.`);
				} else if (slave.assignment === "rest") {
					if (oldJob !== "rest") {
						r.push(`and since ${he} was unable to return to ${his} old task to ${oldJob}, ${his} assignment has defaulted to rest.`);
					} else {
						r.push(`so ${he} has returned to rest.`);
					}
				} else {
					r.push(`so ${he} goes back to ${slave.assignment}.`);
				}
			} else {
				r.push(`so ${his} assignment has defaulted to rest.`);
				removeJob(slave, "get treatment in the clinic");
			}
			r.push(`</span>`);
			restedSlaves++;
			$(reassignment).append(r.join(" "));
			continue;
		}

		if (V.showEWD !== 0) {
			const slaveEntry = App.UI.DOM.appendNewElement("div", frag, '', "slave-report");
			const artSpan = App.UI.DOM.appendNewElement("span", slaveEntry);
			App.SlaveAssignment.appendSlaveLinks(slaveEntry, slave);
			$(slaveEntry).append(`<span class='slave-name'>${SlaveFullName(slave)}</span> `);
			if (slave.choosesOwnAssignment === 2) {
				$(slaveEntry).append(App.SlaveAssignment.choosesOwnJob(slave));
			} else {
				$(slaveEntry).append(`is receiving treatment in ${V.clinicName}.`);
			}
			const patientContent = App.UI.DOM.appendNewElement("div", slaveEntry, '', "indent");
			$(patientContent).append(`${He} ${App.SlaveAssignment.rest(slave)} `);
			if (remainReasons.length > 0) {
				$(patientContent).append(`${He} stays in the clinic ${toSentence(remainReasons)}.`);
			}
			slaveEntry.append(App.SlaveAssignment.standardSlaveReport(slave, false));
			App.SlaveAssignment.appendSlaveArt(artSpan, slave);
		} else {
			// discard return values silently
			App.SlaveAssignment.choosesOwnJob(slave);
			App.SlaveAssignment.rest(slave);
			App.SlaveAssignment.standardSlaveReport(slave, true);
		}
	}

	if (restedSlaves > 0) {
		const rested = App.UI.DOM.appendNewElement("p", frag, '', "indent");
		rested.append((restedSlaves === 1) ? `One slave has` : `${restedSlaves} slaves have`, " been returned to ");
		App.UI.DOM.appendNewElement("span", rested, `health${(S.Nurse && V.clinicUpgradeFilters > 0) ? ' and purity' : ''}`, "green");
		rested.append(` and will be released from the clinic before the end of the week.`);

		if (V.clinicDecoration !== "standard") {
			const decorationEffects = App.UI.DOM.appendNewElement("p", frag, '', "indent");
			$(decorationEffects).append(`${capFirstChar(V.clinicName)}'s ${V.clinicDecoration} atmosphere <span class="hotpink">had an impact on them</span> while they were getting treatment.`);
		}
	}

	return frag;
};


code:
/**
 * @returns {DocumentFragment}
 */
App.EndWeek.clubReport = function() {
	const el = new DocumentFragment();
	let r;

	const slaves = App.Utils.sortedEmployees(App.Entity.facilities.club);

	// Statistics gathering; income is rep boosts in numbers, and profit will be rep per cash unit, or cash unit per rep
	V.facility = V.facility || {};
	V.facility.club = initFacilityStatistics(V.facility.club);
	const clubStats = document.createElement("div");
	el.append(clubStats);

	if (S.DJ) {
		let FLsFetish = 0;
		r = [];
		if (S.DJ.health.condition < -80) {
			improveCondition(S.DJ, 20);
		} else if (S.DJ.health.condition < -40) {
			improveCondition(S.DJ, 15);
		} else if (S.DJ.health.condition < 0) {
			improveCondition(S.DJ, 10);
		} else if (S.DJ.health.condition < 90) {
			improveCondition(S.DJ, 7);
		}
		if (S.DJ.devotion <= 60) {
			S.DJ.devotion += 5;
		}
		if (S.DJ.trust < 60) {
			S.DJ.trust += 3;
		}
		if (S.DJ.fetishStrength <= 95) {
			if (S.DJ.fetish !== "humiliation") {
				if (fetishChangeChance(S.DJ) > random(0, 100)) {
					FLsFetish = 1;
					S.DJ.fetishKnown = 1;
					S.DJ.fetish = "humiliation";
					S.DJ.fetishStrength = 10;
				}
			} else if (S.DJ.fetishKnown === 0) {
				FLsFetish = 1;
				S.DJ.fetishKnown = 1;
			} else {
				FLsFetish = 2;
				S.DJ.fetishStrength += 4;
			}
		}
		if (S.DJ.rules.living !== "luxurious") {
			S.DJ.rules.living = "luxurious";
		}
		if (S.DJ.rules.rest !== "restrictive") {
			S.DJ.rules.rest = "restrictive";
		}
		/* Make sure we have registered living expenses as for any other slave */
		getSlaveStatisticData(S.DJ, V.facility.club);
		const {
			he, him, his, He, His, wife, himself
		} = getPronouns(S.DJ);
		r.push(`${SlaveFullName(S.DJ)} is performing as the DJ.`);
		if (S.DJ.relationship === -3 && S.DJ.devotion > 50) {
			r.push(`${He} tries ${his} best to be your energetic, cheerful ${wife}.`);
		}
		if (FLsFetish === 1) {
			r.push(`${He}'s expected to be the innovative, beautiful DJ spinning beats one minute, and come out of ${his} booth to grind on the floor the next; ${he} enjoys the interplay, and finds greater pleasure in exhibitionism.`);
		} else if (FLsFetish === 2) {
			r.push(`Every day ${he} gets to enjoy hundreds of stares on ${his} skin, and <span class="lightsalmon">becomes more of an exhibitionist.</span>`);
		}
		if (getBestVision(S.DJ) === 0) {
			r.push(`${His} lack of eyesight doesn't slow ${him} down; rather, it strengthens ${his} other senses. ${His} tracks have a distinct sound, since ${he} experiences noise as ${his} sight.`);
		}
		if (S.DJ.skill.entertainment <= 10) {
			r.push(`Though ${S.DJ.slaveName} does ${his} best to lead on the club, with ${his} lack of skill ${he} can do little.`);
		} else if (S.DJ.skill.entertainment <= 30) {
			r.push(`${S.DJ.slaveName}'s basic skills marginally <span class="green">improve</span> the atmosphere in ${V.clubName}.`);
		} else if (S.DJ.skill.entertainment <= 60) {
			r.push(`${S.DJ.slaveName}'s skills <span class="green">improve</span> the atmosphere in ${V.clubName}.`);
		} else if (S.DJ.skill.entertainment < 100) {
			r.push(`${S.DJ.slaveName}'s skills greatly <span class="green">improve</span> the atmosphere in ${V.clubName}.`);
		} else if (S.DJ.skill.entertainment >= 100) {
			r.push(`${S.DJ.slaveName}'s mastery immensely <span class="green">improves</span> the atmosphere in ${V.clubName}.`);
		}
		if (S.DJ.muscles > 5 && S.DJ.muscles <= 95) {
			r.push(`${His} toned body helps ${him} lead ${his} fellow club sluts by letting ${him} dance all night.`);
		}
		if (S.DJ.intelligence + S.DJ.intelligenceImplant > 15) {
			r.push(`${He}'s smart enough to make an actual contribution to the music, greatly enhancing the entire experience.`);
		}
		if (S.DJ.face > 95) {
			r.push(`${His} great beauty is a further draw, even when ${he}'s in ${his} DJ booth, but especially when ${he} comes out to dance.`);
		}
		if (App.Data.Careers.Leader.DJ.includes(S.DJ.career)) {
			r.push(`${He} has musical experience from ${his} life before ${he} was a slave, a grounding that gives ${his} tracks actual depth.`);
		} else if (S.DJ.skill.DJ >= V.masteredXP) {
			r.push(`${He} has musical experience from working for you, giving ${his} tracks actual depth.`);
		} else if (S.DJ.skill.DJ > 120) {
			r.push(`${He} understands what tracks pair well with each other and how to tailor them to ${his} audience.`);
		} else if (S.DJ.skill.DJ > 60) {
			r.push(`${He} knows how to properly manage a playlist, allowing ${him} more time on the dance floor.`);
		} else if (S.DJ.skill.DJ > 20) {
			r.push(`${He} has basic musical knowledge and can keep the party going.`);
		}
		if (S.DJ.skill.DJ < V.masteredXP) {
			const skillIncrease = random(1, Math.ceil((S.DJ.intelligence + S.DJ.intelligenceImplant) / 15) + 8);
			r.push(slaveSkillIncrease('DJ', S.DJ, skillIncrease));
		}
		App.Events.addNode(el, r, "p", "indent");
		if (slaves.length + V.clubSlavesGettingHelp < 10 && V.DJnoSex !== 1 && !slaveResting(S.DJ)) {
			App.Events.addNode(
				el,
				[`Since ${he} doesn't have enough sluts in ${V.clubName} to make it worthwhile for ${him} to be on stage 24/7, ${he} spends ${his} extra time slutting it up ${himself}. ${He} has sex with ${S.DJ.sexAmount} citizens, pleasing them immensely, since it's more appealing to fuck the DJ than some club slut.`],
				"div",
				"indent"
			);
			if (V.showEWD !== 0) {
				App.Events.addNode(
					el,
					[
						He,
						App.SlaveAssignment.serveThePublic(S.DJ)
					],
					"div",
					"indent"
				);
			} else {
				App.SlaveAssignment.serveThePublic(S.DJ);
			}
		}
	}

	if (slaves.length > 0) {
		r = [];
		if (slaves.length !== 1) {
			r.push(App.UI.DOM.makeElement("span", `The ${slaves.length} slaves pleasing citizens in ${V.clubName}`, "bold"));
		} else {
			r.push(App.UI.DOM.makeElement("span", `The one slave pleasing citizens in ${V.clubName}`, "bold"));
		}
		r.push(`worked hard to <span class="green">increase your reputation</span> this week.`);
		App.Events.addNode(el, r, "p", "indent");
	}

	if (S.DJ) {
		const slave = App.SlaveAssignment.reportSlave(S.DJ);
		tired(slave);
		/* apply following SA passages to facility leader */
		if (V.showEWD !== 0) {
			const DJEntry = App.UI.DOM.appendNewElement("div", el, '', "slave-report");
			const artSpan = App.UI.DOM.appendNewElement("span", DJEntry);
			App.SlaveAssignment.appendSlaveLinks(DJEntry, slave);
			App.Events.addNode(
				DJEntry,
				[
					App.UI.DOM.makeElement("span", SlaveFullName(slave), "slave-name"),
					`is performing as the DJ in ${V.clubName}.`,
				]
			);
			DJEntry.append(App.SlaveAssignment.standardSlaveReport(slave, false));
			App.SlaveAssignment.appendSlaveArt(artSpan, slave);
		} else {
			App.SlaveAssignment.standardSlaveReport(slave, true);
		}
	}

	if (slaves.length > 0) {
		for (const slave of App.SlaveAssignment.reportSlaves(slaves)) {
			if (slave.devotion <= 20 && slave.trust >= -20) {
				slave.devotion -= 5;
				slave.trust -= 5;
			} else if (slave.devotion < 45) {
				slave.devotion += 4;
			} else if (slave.devotion > 50) {
				slave.devotion -= 4;
			}

			if (slave.trust < 30) {
				slave.trust += 5;
			}

			if (slave.health.condition < -80) {
				improveCondition(slave, 20);
			} else if (slave.health.condition < -40) {
				improveCondition(slave, 15);
			} else if (slave.health.condition < 0) {
				improveCondition(slave, 10);
			} else if (slave.health.condition < 90) {
				improveCondition(slave, 7);
			}

			if (slave.rules.living !== "normal") {
				slave.rules.living = "normal";
			}

			if (V.showEWD !== 0) {
				const slaveEntry = App.UI.DOM.appendNewElement("div", el, '', "slave-report");
				const artSpan = App.UI.DOM.appendNewElement("span", slaveEntry);
				App.SlaveAssignment.appendSlaveLinks(slaveEntry, slave);
				r = [];
				r.push(App.UI.DOM.makeElement("span", SlaveFullName(slave), "slave-name"));
				if (slave.choosesOwnAssignment === 2) {
					r.push(App.SlaveAssignment.choosesOwnJob(slave));
				} else {
					r.push(`is serving in ${V.clubName}.`);
				}
				App.Events.addNode(slaveEntry, r);

				const {He} = getPronouns(slave);
				App.Events.addNode(
					slaveEntry,
					[
						He,
						App.SlaveAssignment.serveThePublic(slave),
					],
					"div",
					"indent"
				);
				slaveEntry.append(App.SlaveAssignment.standardSlaveReport(slave, false));
				App.SlaveAssignment.appendSlaveArt(artSpan, slave);
			} else {
				// discard return values silently
				App.SlaveAssignment.choosesOwnJob(slave);
				App.SlaveAssignment.serveThePublic(slave);
				App.SlaveAssignment.standardSlaveReport(slave, true);
			}
		}

		App.Events.addNode(el, [App.Ads.report("club")], "p", "indent");

		// Record statistics gathering
		const b = V.facility.club;
		b.whoreIncome = 0;
		b.customers = 0;
		b.whoreCosts = 0;
		b.rep = 0;
		for (const si of b.income.values()) {
			b.whoreIncome += si.income;
			b.customers += si.customers;
			b.whoreCosts += si.cost;
			b.rep += si.rep;
		}
		b.adsCosts = V.clubAdsSpending;
		b.maintenance = V.club * V.facilityCost * (1.0 + 0.2 * V.clubUpgradePDAs);
		b.totalIncome = b.whoreIncome + b.adsIncome;
		b.totalExpenses = b.whoreCosts + b.adsCosts + b.maintenance;
		b.profit = b.totalIncome / b.totalExpenses;
		if (V.clubDecoration !== "standard") {
			App.Events.addNode(
				el,
				[
					`${capFirstChar(V.clubName)}'s customers enjoy <span class="green">having sex in ${V.clubDecoration} surroundings.</span>`
				],
				"p",
				"indent"
			);
		}

		// Club stats
		el.append(App.Facilities.Club.Stats(false));
		clubStats.append(App.Facilities.Club.Stats(true));
	}
	return el;
};