From 08df0cadd43a599a2c794fac72f4edb972a04697 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Mon, 26 Oct 2020 00:14:25 -0400
Subject: [PATCH] start brothel rep

---
 src/uncategorized/brothelReport.js | 416 +++++++++++++++++++++++++++++
 src/uncategorized/brothelReport.tw | 357 +------------------------
 2 files changed, 417 insertions(+), 356 deletions(-)
 create mode 100644 src/uncategorized/brothelReport.js

diff --git a/src/uncategorized/brothelReport.js b/src/uncategorized/brothelReport.js
new file mode 100644
index 00000000000..fabcf015299
--- /dev/null
+++ b/src/uncategorized/brothelReport.js
@@ -0,0 +1,416 @@
+globalThis.brothelReport = function() {
+	const el = new DocumentFragment();
+	let His, Him, He, he, him, his, hers, himself, girl, loli, wife;
+	let His2, Him2, He2, he2, him2, his2, hers2, himself2, girl2, loli2, wife2;
+	let r;
+
+	const brothelStats = document.createElement("span");
+	brothelStats.id = "brothel-stats";
+	el.append(brothelStats);
+
+	const _slaves = App.Utils.sortedEmployees(App.Entity.facilities.brothel);
+	let _DL = _slaves.length, _SL = V.slaves.length, _FLsFetish = 0, _profits = 0, _minBonus = 50, _maxBonus = 150;
+	V.legendaryWhoreID = 0;
+	V.legendaryWombID = 0;
+
+
+	// <!-- Statistics gathering -->
+	V.facility = V.facility || {};
+	V.facility.brothel = initFacilityStatistics(V.facility.brothel);
+	const _brothelNameCaps = capFirstChar(V.brothelName);
+
+	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";
+				}
+			} 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);
+		({
+			he, him, his, hers, himself, girl, He, His, loli, wife
+		} = getPronouns(S.Madam));
+		// &nbsp;&nbsp;&nbsp;&nbsp;
+		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} <span class="fetish-gain">really likes fucking them.</span>`);
+		} 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} <span class="fetish inc">becomes more dominant.</span>`);
+		}
+		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 <span class="cash inc">improve</span> business at ${V.brothelName}.`);
+		} else if ((S.Madam.skill.whoring <= 60)) {
+			r.push(`${S.Madam.slaveName}'s skills <span class="cash inc">improve</span> business at ${V.brothelName}.`);
+		} else if ((S.Madam.skill.whoring < 100)) {
+			r.push(`${S.Madam.slaveName}'s skills greatly <span class="cash inc">improve</span> business at ${V.brothelName}.`);
+		} else {
+			r.push(`${S.Madam.slaveName}'s mastery immensely <span class="cash inc">improves</span> business at ${V.brothelName}.`);
+		}
+		if (S.Madam.actualAge > 35) {
+			r.push(`${His} age and experience also contribute.`);
+		}
+		if (setup.madamCareers.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.`);
+		}
+		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.`);
+		}
+		for (const _slave of _slaves) {
+			V.i = V.slaveIndices[_slave.ID];
+			({
+				he, him, his, hers, himself, girl, He, His, loli, wife
+			} = getPronouns(_slave).appendSuffix('2'));
+			/* for the included passages */
+
+			if (S.Madam.rivalryTarget === _slave.ID) {
+				r.push(`${He} forces ${his} ${rivalryTerm(S.Madam)}, 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 {
+						r.push(`A`);
+						if (_slave.muscles < 30) {
+							r.push(`n unmuscled,`);
+						}
+						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`);
+						}
+						r.push(`.`);
+					}
+				}
+			} 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 _slave.slaveName`);
+						if (_slave.dick === 0) {
+							r.push(` doesn't have a dick`);
+						} else if (_slave.balls === 0) {
+							r.push(`'s not producing cum`);
+						} else {
+							r.push(`'s orgasms just aren't messy enough`);
+						}
+						r.push(`.`);
+					}
+				}
+			} 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`);
+					}
+					r.push(`.`);
+				}
+			}
+		}
+
+		if ((_DL + V.brothelSlavesGettingHelp < 10) && V.MadamNoSex !== 1 && !slaveResting(S.Madam)) {
+			({
+				he, him, his, hers, himself, girl, He, His, loli, wife
+			} = getPronouns(S.Madam));
+			let _oldCash = V.cash;
+			if (V.showEWD !== 0) {
+				// <br>&nbsp;&nbsp;&nbsp;&nbsp;
+				r.push(`${He} ${App.SlaveAssignment.whore(S.Madam)}`);
+			} else {
+				r.push(App.SlaveAssignment.whore(S.Madam));
+			}
+			// <br>&nbsp;&nbsp;&nbsp;&nbsp;
+			r.push(`${He} whores ${himself} because ${he} doesn't have enough whores to manage to keep ${him} busy, and makes <span class="cash inc">${cashFormat(S.Madam.lastWeeksCashIncome)}.</span> ${He} can charge more for ${his} time, since many citizens find it erotic to fuck the Madam.`);
+			_profits += V.cash - _oldCash;
+			_oldCash = V.cash;
+		}
+		if (_DL > 0) {
+			// <br><br>
+		}
+	}
+	App.Events.addNode(el, r, "div");
+	if (_DL > 0) {
+		const whoreNumber = document.createElement("div");
+		whoreNumber.classList.add("indent", "bold");
+
+		if (_DL !== 1) {
+			whoreNumber.append(`There are ${_DL} slave whores working out of ${V.brothelName}.`);
+		} else {
+			whoreNumber.append(`There is one slave whore working out of ${V.brothelName}.`);
+		}
+		el.append(whoreNumber);
+	}
+
+	if (V.MadamID !== 0) {
+		V.i = V.slaveIndices[V.MadamID];
+		/* apply following SA passages to facility leader */
+		if (V.showEWD !== 0) {
+			// <br><br>
+			if (V.seeImages && V.seeReportImages) {
+				const artDiv = document.createElement("div");
+				artDiv.classList.add("imageRef", "tinyImg");
+				artDiv.append(SlaveArt(S.Madam, 0, 0));
+				el.append(artDiv);
+			}
+			el.append(App.EndWeek.favoriteIcon(S.Madam));
+			App.UI.DOM.appendNewElement("span", el, SlaveFullName(S.Madam), "slave-name");
+			el.append(` is serving as the Madam.`);
+			// <br>&nbsp;&nbsp;&nbsp;
+			r.push(App.SlaveAssignment.choosesOwnClothes(S.Madam));
+			tired(S.Madam);
+			el.append(App.UI.DOM.renderPassage("SA rules"));
+			r.push(App.SlaveAssignment.diet(S.Madam));
+			r.push(App.SlaveAssignment.longTermEffects(S.Madam));
+			r.push(App.SlaveAssignment.drugs(S.Madam));
+			r.push(App.SlaveAssignment.relationships(S.Madam));
+			r.push(App.SlaveAssignment.rivalries(S.Madam));
+			// <br>&nbsp;&nbsp;&nbsp;&nbsp;
+			r.push(App.SlaveAssignment.devotion(S.Madam));
+		} else {
+			App.SlaveAssignment.choosesOwnClothes(S.Madam);
+			tired(S.Madam);
+			App.UI.DOM.renderPassage("SA rules");
+			App.SlaveAssignment.diet(S.Madam);
+			App.SlaveAssignment.longTermEffects(S.Madam);
+			App.SlaveAssignment.drugs(S.Madam);
+			App.SlaveAssignment.relationships(S.Madam);
+			App.SlaveAssignment.rivalries(S.Madam);
+			App.SlaveAssignment.devotion(S.Madam);
+		}
+	}
+
+	if (_DL > 0) {
+		let healthBonus = 0, _aphrod = 0;
+		if (V.brothelUpgradeDrugs === 1) {
+			healthBonus += 1, _aphrod = 1;
+		} else if ((V.brothelUpgradeDrugs === 2)) {
+			healthBonus += 3, _aphrod = 2;
+		}
+		let _oldCash = V.cash;
+		for (const _slave of _slaves) {
+			V.i = V.slaveIndices[_slave.ID];
+			({
+				he, him, his, hers, himself, girl, He, His, loli, wife
+			} = getPronouns(_slave));
+			if ((V.legendaryWombID === 0) && (!isAmputee(_slave)) && (_slave.preg > _slave.pregData.normalBirth / 1.33) && (_slave.broodmother === 0) && (_slave.eggType === "human") && (_slave.counter.births > 10) && (_slave.devotion > 50) && (_slave.prestige === 0)) {
+				V.legendaryWombID = _slave.ID;
+			}
+			if ((V.legendaryWhoreID === 0) && (_slave.skill.whoring >= 100) && (_slave.devotion > 50) && (_slave.prestige === 0)) {
+				V.legendaryWhoreID = _slave.ID;
+			}
+
+			/* Perform facility based rule changes */
+			improveCondition(_slave, healthBonus);
+			_slave.aphrodisiacs = _aphrod;
+			switch (V.brothelDecoration) {
+				case "Degradationist":
+				case "standard":
+					_slave.rules.living = "spare";
+				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 > 40 && _slave.energy < 95) {
+				_slave.energy++;
+			}
+
+			if (V.showEWD !== 0) {
+				// <br><br>
+				if (V.seeImages && V.seeReportImages) {
+					const artDiv = document.createElement("div");
+					artDiv.classList.add("imageRef", "tinyImg");
+					artDiv.append(SlaveArt(S.Madam, 0, 0));
+					el.append(artDiv);
+				}
+				el.append(App.EndWeek.favoriteIcon(_slave));
+				App.UI.DOM.appendNewElement("span", el, SlaveFullName(_slave), "slave-name");
+				el.append(` is serving as the Madam.`);
+				if (_slave.choosesOwnAssignment === 2) {
+					r.push(App.SlaveAssignment.choosesOwnJob(_slave));
+				} else {
+					r.push(`is working out of ${V.brothelName}.`);
+				}
+				// <br>&nbsp;&nbsp;&nbsp;&nbsp;
+				el.append(`${He} ${App.SlaveAssignment.whore(_slave)}`);
+				// <br>&nbsp;&nbsp;&nbsp;
+				r.push(App.SlaveAssignment.choosesOwnClothes(_slave));
+				r.push(App.UI.DOM.renderPassage("SA rules"));
+				r.push(App.SlaveAssignment.diet(_slave));
+				r.push(App.SlaveAssignment.longTermEffects(_slave));
+				r.push(App.SlaveAssignment.drugs(_slave));
+				r.push(App.SlaveAssignment.relationships(_slave));
+				r.push(App.SlaveAssignment.rivalries(_slave));
+				// <br>&nbsp;&nbsp;&nbsp;&nbsp;
+				r.push(App.SlaveAssignment.devotion(_slave));
+			} else {
+				App.SlaveAssignment.choosesOwnJob(_slave);
+				App.SlaveAssignment.whore(_slave);
+				App.SlaveAssignment.choosesOwnClothes(_slave);
+				App.UI.DOM.renderPassage("SA rules");
+				App.SlaveAssignment.diet(_slave);
+				App.SlaveAssignment.longTermEffects(_slave);
+				App.SlaveAssignment.drugs(_slave);
+				App.SlaveAssignment.relationships(_slave);
+				App.SlaveAssignment.rivalries(_slave);
+				App.SlaveAssignment.devotion(_slave);
+			}
+
+			const _seed = Math.max(App.Ads.getMatchedCategoryCount(_slave, "brothel"), 1);
+			const _adsIncome = _seed * random(50, 60) * Math.trunc(V.brothelAdsSpending / 1000);
+			const _cashX = _adsIncome;
+			getSlaveStatisticData(_slave, V.facility.brothel).adsIncome += _adsIncome;
+			cashX(_cashX, "brothelAds");
+		}
+
+		App.UI.DOM.appendNewElement("p", el, App.Ads.report("brothel"));
+
+		_profits += V.cash - _oldCash;
+		// <!-- Record statistics gathering -->
+		let b = State.variables.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 = State.variables.brothelAdsSpending;
+		b.maintenance = State.variables.brothel * State.variables.facilityCost * (1.0 + 0.2 * State.variables.brothelUpgradeDrugs);
+		b.totalIncome = b.whoreIncome + b.adsIncome;
+		b.totalExpenses = b.whoreCosts + b.adsCosts + b.maintenance;
+		b.profit = b.totalIncome - b.totalExpenses;
+
+		r.push(`${_brothelNameCaps} makes you <span class="cash inc" > ${cashFormat(_profits)}</span > this week.`);
+
+		if (V.brothelDecoration !== "standard") {
+			App.UI.DOM.appendNewElement("p", el, `${_brothelNameCaps}'s customers enjoyed <span class="reputation inc">fucking whores in ${V.brothelDecoration} surroundings.</span>`);
+		}
+		/*
+			<!-- Statistics output -->
+			<<includeDOM App.Facilities.Brothel.Stats(false)>>
+			<<timed 50ms>>
+				<<replace #brothel-stats>>
+					<<includeDOM App.Facilities.Brothel.Stats(true)>>
+				<</replace>>
+			<</timed>>*/
+	}
+
+	if (_DL > 0 || V.MadamID !== 0) {
+		// <br><br>
+	}
+	return el;
+};
diff --git a/src/uncategorized/brothelReport.tw b/src/uncategorized/brothelReport.tw
index d735efced5a..933e96f16f5 100644
--- a/src/uncategorized/brothelReport.tw
+++ b/src/uncategorized/brothelReport.tw
@@ -1,358 +1,3 @@
 :: Brothel Report [nobr]
 
-<span id="brothel-stats">
-</span>
-
-<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.brothel)>>
-<<set _DL = _slaves.length, _SL = $slaves.length, $legendaryWhoreID = 0, _FLsFetish = 0, _profits = 0>>
-<<set $legendaryWombID = 0>>
-<<set _minBonus = 50, _maxBonus = 150>>
-
-<!-- Statistics gathering -->
-<<set $facility = $facility || {}, $facility.brothel = initFacilityStatistics($facility.brothel)>>
-<<set _brothelNameCaps = capFirstChar($brothelName)>>
-
-<<if ($MadamID != 0)>>
-	<<if (_S.Madam.health.condition < -80)>>
-		<<run improveCondition(_S.Madam, 20)>>
-	<<elseif _S.Madam.health.condition < -40>>
-		<<run improveCondition(_S.Madam, 15)>>
-	<<elseif _S.Madam.health.condition < 0>>
-		<<run improveCondition(_S.Madam, 10)>>
-	<<elseif _S.Madam.health.condition < 90>>
-		<<run improveCondition(_S.Madam, 7)>>
-	<</if>>
-	<<if _S.Madam.devotion <= 45>>
-		<<set _S.Madam.devotion += 5>>
-	<</if>>
-	<<if _S.Madam.trust < 45>>
-		<<set _S.Madam.trust += 5>>
-	<</if>>
-	<<if _S.Madam.rules.living != "luxurious">>
-		<<set _S.Madam.rules.living = "luxurious">>
-	<</if>>
-	<<if _S.Madam.rules.rest != "restrictive">>
-		<<set _S.Madam.rules.rest = "restrictive">>
-	<</if>>
-	<<if _S.Madam.fetishStrength <= 95>>
-		<<if _S.Madam.fetish != "dom">>
-			<<if fetishChangeChance(_S.Madam) > random(0,100)>>
-				<<set _FLsFetish = 1, _S.Madam.fetishKnown = 1, _S.Madam.fetish = "dom">>
-			<</if>>
-		<<elseif _S.Madam.fetishKnown == 0>>
-			<<set _FLsFetish = 1, _S.Madam.fetishKnown = 1>>
-		<<else>>
-			<<set _FLsFetish = 2, _S.Madam.fetishStrength += 4>>
-		<</if>>
-	<</if>>
-	/% Make sure we have registered living expenses as for any other slave %/
-	<<run getSlaveStatisticData(_S.Madam, $facility.brothel)>>
-	<<setLocalPronouns _S.Madam>>
-	&nbsp;&nbsp;&nbsp;&nbsp;<<= SlaveFullName(_S.Madam)>> is serving as the Madam.
-	<<if _S.Madam.relationship == -3 && _S.Madam.devotion > 50>>
-		As your loving $wife, $he does $his best to attract attention to your brothel.
-	<</if>>
-	<<if (_FLsFetish == 1)>>
-		$He isn't above sampling the merchandise $himself; before long it's obvious to $his girls that $he <span class="fetish-gain">really likes fucking them.</span>
-	<<elseif (_FLsFetish == 2)>>
-		$He's careful that all of the whores under $his supervision are all warmed up and ready to get fucked every morning, and $he <span class="fetish inc">becomes more dominant.</span>
-	<</if>>
-	<<if (_S.Madam.skill.whoring <= 10)>>
-		Though _S.Madam.slaveName does $his best to manage the brothel, with $his lack of skill $he can do little.
-	<<elseif (_S.Madam.skill.whoring <= 30)>>
-		_S.Madam.slaveName's basic skills marginally <span class="cash inc">improve</span> business at $brothelName.
-	<<elseif (_S.Madam.skill.whoring <= 60)>>
-		_S.Madam.slaveName's skills <span class="cash inc">improve</span> business at $brothelName.
-	<<elseif (_S.Madam.skill.whoring < 100)>>
-		_S.Madam.slaveName's skills greatly <span class="cash inc">improve</span> business at $brothelName.
-	<<else>>
-		_S.Madam.slaveName's mastery immensely <span class="cash inc">improves</span> business at $brothelName.
-	<</if>>
-	<<if (_S.Madam.actualAge > 35)>>
-		$His age and experience also contribute.
-	<</if>>
-	<<if setup.madamCareers.includes(_S.Madam.career)>>
-		$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.
-	<<elseif _S.Madam.skill.madam >= $masteredXP>>
-		$He has experience from working for you that helps $him in the seedy business of selling other people's bodies for sex.
-	<</if>>
-	<<if (_S.Madam.intelligence+_S.Madam.intelligenceImplant > 15)>>
-		$He is a clever manager.
-	<</if>>
-	<<if (_S.Madam.dick > 2) && (canPenetrate(_S.Madam))>>
-		$His turgid dick helps $him manage the bitches.
-	<</if>>
-	<<for _slave range _slaves>>
-		<<set $i = $slaveIndices[_slave.ID]>> /% for the included passages %/
-
-		<<if _S.Madam.rivalryTarget == _slave.ID>>
-			$He forces $his <<print rivalryTerm(_S.Madam)>>, to service all the men in the brothel.
-			<<set _slave.devotion -= 2, _slave.trust -= 2>>
-			<<if canDoVaginal(_slave)>>
-				<<run seX(_slave, "vaginal", "public", "penetrative", 10)>>
-			<</if>>
-			<<if canDoAnal(_slave)>>
-				<<run seX(_slave, "anal", "public", "penetrative", 12)>>
-			<</if>>
-			<<run seX(_slave, "anal", "public", "penetrative", 10)>>
-			<<if random(1,100) > 65>>
-				<<set _S.Madam.rivalry++, _slave.rivalry++>>
-			<</if>>
-		<<elseif _S.Madam.relationshipTarget == _slave.ID>>
-			<<setLocalPronouns _slave 2>>
-			$He dotes over $his <<print relationshipTerm(_S.Madam)>>, _slave.slaveName, making sure _he2 is safe, but unfortunately driving potential customers away from _him2.
-			<<set _slave.devotion++>>
-		<<elseif areRelated(_S.Madam, _slave)>>
-			<<setLocalPronouns _slave 2>>
-			$He pays special attention to $his <<print relativeTerm(_S.Madam,_slave)>>, _slave.slaveName, making sure _he2 is treated well and showing off _his2 skills.
-			<<set _slave.trust++>>
-		<</if>>
-		<<if _slave.prestigeDesc == "$He is a famed Free Cities whore, and commands top prices.">>
-			<<setLocalPronouns _slave 2>>
-			$He makes sure to promote _slave.slaveName, the famed whore, in order to capitalize on _his2 popularity.
-		<<elseif _slave.prestigeDesc == "$He is a famed Free Cities slut, and can please anyone.">>
-			<<setLocalPronouns _slave 2>>
-			$He makes sure to promote _slave.slaveName, the famed entertainer, in order to capitalize on _his2 popularity.
-		<<elseif _slave.prestigeDesc == "$He is remembered for winning best in show as a dairy cow.">>
-			<<setLocalPronouns _slave 2>>
-			<<if ($arcologies[0].FSPhysicalIdealist != "unset")>>
-				<<if (_slave.muscles > 60) && (_slave.weight < 30) && (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
-					$He shows off how even a cow like _slave.slaveName can achieve physical perfection.
-				<<else>>
-					A<<if (_slave.muscles < 30)>>n unmuscled,<</if>><<if (_slave.weight > 30)>> fat,<</if>> 'prestigious' <<if (_slave.lactation > 0)>>cow<<elseif ((_slave.boobs-_slave.boobsImplant) > 6000)>>mass of titflesh<<else>>slave<</if>> like _slave.slaveName is woefully out of fashion, so _S.Madam.slaveName tries to draw attention away from _him2.
-				<</if>>
-			<<else>>
-				<<if (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
-					$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>>
-					$He would like to show off _slave.slaveName's huge udders, but _slave.slaveName <<if (_slave.lactation == 0)>>isn't producing milk anymore<<else>>doesn't exactly have huge udders anymore<</if>>.
-				<</if>>
-			<</if>>
-		<<elseif _slave.prestigeDesc == "$He is remembered for winning best in show as a cockmilker.">>
-			<<setLocalPronouns _slave 2>>
-			<<if $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)>>
-					$He uses _slave.slaveName as an example of how even a huge-balled freak like _him2 can be restored to proper femininity.
-				<<else>>
-					$He tries to hide _slave.slaveName, 'her' body being notorious for its defiance of conventional femininity.
-				<</if>>
-			<<else>>
-				<<if ((_slave.balls > 5) && (_slave.dick != 0)) || ((_slave.balls > 4) && (_slave.dick != 0) && (_slave.prostate > 1))>>
-					$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>>
-					$He would love to show off _slave.slaveName's copious loads, but _slave.slaveName<<if _slave.dick == 0>> doesn't have a dick<<elseif _slave.balls == 0>>'s not producing cum<<else>>'s orgasms just aren't messy enough<</if>>.
-				<</if>>
-			<</if>>
-		<<elseif _slave.prestigeDesc == "$He is remembered for winning best in show as a breeder.">>
-			<<setLocalPronouns _slave 2>>
-			<<if _slave.bellyPreg >= 5000>>
-				$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.
-			<<elseif canGetPregnant(_slave)>>
-				$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>>
-				$He would love to play off of _slave.slaveName's fame and fertility, but unfortunately _he2 <<if _slave.pregKnown == 1 && _slave.bellyPreg < 1500>>is already pregnant and not far enough along to show it<<elseif _slave.pregKnown == 1 && _slave.bellyPreg < 5000>>already pregnant, but not enough to be exciting<<else>>is unable to get knocked up<</if>>.
-			<</if>>
-		<</if>>
-	<</for>>
-
-	<<if (_DL+$brothelSlavesGettingHelp < 10) && $MadamNoSex != 1 && !slaveResting(_S.Madam)>>
-		<<setLocalPronouns _S.Madam>>
-		<<set _oldCash = $cash>>
-		<<if $showEWD != 0>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.whore(_S.Madam)>>
-		<<else>>
-			<<run App.SlaveAssignment.whore(_S.Madam)>>
-		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;
-		$He whores $himself because $he doesn't have enough whores to manage to keep $him busy, and makes <span class="cash inc"><<print cashFormat(_S.Madam.lastWeeksCashIncome)>>.</span> $He can charge more for $his time, since many citizens find it erotic to fuck the Madam.
-		<<set _profits += $cash - _oldCash, _oldCash = $cash>>
-	<</if>>
-	<<if (_DL > 0)>><br><br><</if>>
-<</if>>
-
-<<if (_DL > 0)>>
-	<div class="indent" style="font-weight:bold">
-		<<if _DL != 1>>
-			There are _DL slave whores working out of $brothelName.
-		<<else>>
-			There is one slave whore working out of $brothelName.
-		<</if>>
-	</div>
-<</if>>
-
-<<if $MadamID != 0>>
-	<<set $i = $slaveIndices[$MadamID]>> /* apply following SA passages to facility leader */
-	<<if $showEWD != 0>>
-		<br><br>
-		/* 000-250-006 */
-		<<if $seeImages && $seeReportImages>>
-		<div class="imageRef tinyImg">
-			<<= SlaveArt(_S.Madam, 0, 0)>>
-		</div>
-		<</if>>
-		/* 000-250-006 */
-		<<includeDOM App.EndWeek.favoriteIcon(_S.Madam)>>
-		<span class="slave-name"><<= SlaveFullName(_S.Madam)>></span> is serving as the Madam.
-		<br>&nbsp;&nbsp;&nbsp;
-		<<= App.SlaveAssignment.choosesOwnClothes(_S.Madam)>>
-		<<run tired(_S.Madam)>>
-		<<includeDOM App.SlaveAssignment.rules(_S.Madam)>>
-		<<= App.SlaveAssignment.diet(_S.Madam)>>
-		<<includeDOM App.SlaveAssignment.longTermEffects(_S.Madam)>>
-		<<= App.SlaveAssignment.drugs(_S.Madam)>>
-		<<= App.SlaveAssignment.relationships(_S.Madam)>>
-		<<= App.SlaveAssignment.rivalries(_S.Madam)>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;<<= App.SlaveAssignment.devotion(_S.Madam)>>
-	<<else>>
-		<<run App.SlaveAssignment.choosesOwnClothes(_S.Madam)>>
-		<<run tired(_S.Madam)>>
-		<<run App.SlaveAssignment.rules(_S.Madam)>>
-		<<run App.SlaveAssignment.diet(_S.Madam)>>
-		<<run App.SlaveAssignment.longTermEffects(_S.Madam)>>
-		<<run App.SlaveAssignment.drugs(_S.Madam)>>
-		<<run App.SlaveAssignment.relationships(_S.Madam)>>
-		<<run App.SlaveAssignment.rivalries(_S.Madam)>>
-		<<run App.SlaveAssignment.devotion(_S.Madam)>>
-	<</if>>
-<</if>>
-
-<<if (_DL > 0)>>
-	<<set _healthBonus = 0, _aphrod = 0>>
-	<<if ($brothelUpgradeDrugs == 1)>>
-		<<set _healthBonus += 1, _aphrod = 1>>
-	<<elseif ($brothelUpgradeDrugs == 2)>>
-		<<set _healthBonus += 3, _aphrod = 2>>
-	<</if>>
-	<<set _oldCash = $cash>>
-	<<for _slave range _slaves>>
-		<<set $i = $slaveIndices[_slave.ID]>>
-		<<setLocalPronouns _slave>>
-		<<if ($legendaryWombID == 0) && (!isAmputee(_slave)) && (_slave.preg > _slave.pregData.normalBirth/1.33) && (_slave.broodmother == 0) && (_slave.eggType == "human") && (_slave.counter.births > 10) && (_slave.devotion > 50) && (_slave.prestige == 0)>>
-			<<set $legendaryWombID = _slave.ID>>
-		<</if>>
-		<<if ($legendaryWhoreID == 0) && (_slave.skill.whoring >= 100) && (_slave.devotion > 50) && (_slave.prestige == 0)>>
-			<<set $legendaryWhoreID = _slave.ID>>
-		<</if>>
-
-		/* Perform facility based rule changes */
-		<<run improveCondition(_slave, _healthBonus)>>
-		<<set _slave.aphrodisiacs = _aphrod>>
-		<<switch $brothelDecoration>>
-		<<case "Degradationist" "standard">>
-			<<set _slave.rules.living = "spare">>
-		<<default>>
-			<<set _slave.rules.living = "normal">>
-		<</switch>>
-		<<if (_slave.health.condition < -80)>>
-			<<run improveCondition(_slave, 20)>>
-		<<elseif _slave.health.condition < -40>>
-			<<run improveCondition(_slave, 15)>>
-		<<elseif _slave.health.condition < 0>>
-			<<run improveCondition(_slave, 10)>>
-		<<elseif _slave.health.condition < 90>>
-			<<run improveCondition(_slave, 7)>>
-		<</if>>
-		<<if (_slave.devotion <= 20) && (_slave.trust >= -20)>>
-			<<set _slave.devotion -= 5, _slave.trust -= 5>>
-		<<elseif (_slave.devotion < 45)>>
-			<<set _slave.devotion += 4>>
-		<<elseif (_slave.devotion > 50)>>
-			<<set _slave.devotion -= 4>>
-		<</if>>
-		<<if (_slave.trust < 30)>>
-			<<set _slave.trust += 5>>
-		<</if>>
-		<<if _slave.energy > 40 && _slave.energy < 95>>
-			<<set _slave.energy++>>
-		<</if>>
-
-		<<if $showEWD != 0>>
-			<br><br>
-			/* 000-250-006 */
-			<<if $seeImages && $seeReportImages>>
-			<div class="imageRef tinyImg">
-				<<= SlaveArt(_slave, 0, 0)>>
-			</div>
-			<</if>>
-			/* 000-250-006 */
-			<<includeDOM App.EndWeek.favoriteIcon(_slave)>>
-			<span class="slave-name"><<= SlaveFullName(_slave)>></span>
-			<<if _slave.choosesOwnAssignment == 2>>
-				<<= App.SlaveAssignment.choosesOwnJob(_slave)>>
-			<<else>>
-				is working out of $brothelName.
-			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.whore(_slave)>>
-			<br>&nbsp;&nbsp;&nbsp;
-			<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
-			<<includeDOM App.SlaveAssignment.rules(_slave)>>
-			<<= App.SlaveAssignment.diet(_slave)>>
-			<<includeDOM App.SlaveAssignment.longTermEffects(_slave)>>
-			<<= App.SlaveAssignment.drugs(_slave)>>
-			<<= App.SlaveAssignment.relationships(_slave)>>
-			<<= App.SlaveAssignment.rivalries(_slave)>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;<<= App.SlaveAssignment.devotion(_slave)>>
-		<<else>>
-			<<run App.SlaveAssignment.choosesOwnJob(_slave)>>
-			<<run App.SlaveAssignment.whore(_slave)>>
-			<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
-			<<run App.SlaveAssignment.rules(_slave)>>
-			<<run App.SlaveAssignment.diet(_slave)>>
-			<<run App.SlaveAssignment.longTermEffects(_slave)>>
-			<<run App.SlaveAssignment.drugs(_slave)>>
-			<<run App.SlaveAssignment.relationships(_slave)>>
-			<<run App.SlaveAssignment.rivalries(_slave)>>
-			<<run App.SlaveAssignment.devotion(_slave)>>
-		<</if>>
-
-		<<set _seed = Math.max(App.Ads.getMatchedCategoryCount(_slave, "brothel"), 1)>>
-		<<set _adsIncome = _seed * random(50,60) * Math.trunc($brothelAdsSpending/1000)>>
-		<<set _cashX = _adsIncome, getSlaveStatisticData(_slave, $facility.brothel).adsIncome += _adsIncome>>
-		<<run cashX(_cashX, "brothelAds")>>
-	<</for>>
-
-	<p>
-		<<= App.Ads.report("brothel")>>
-	</p>
-
-	<<set _profits += $cash-_oldCash>>
-	<!-- Record statistics gathering -->
-	<<script>>
-		var b = State.variables.facility.brothel;
-		b.whoreIncome = 0;
-		b.customers = 0;
-		b.whoreCosts = 0;
-		b.rep = 0;
-		for (var 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 = State.variables.brothelAdsSpending;
-		b.maintenance = State.variables.brothel * State.variables.facilityCost * (1.0 + 0.2 * State.variables.brothelUpgradeDrugs);
-		b.totalIncome = b.whoreIncome + b.adsIncome;
-		b.totalExpenses = b.whoreCosts + b.adsCosts + b.maintenance;
-		b.profit = b.totalIncome - b.totalExpenses;
-	<</script>>
-
-	_brothelNameCaps makes you <span class="cash inc"><<print cashFormat(_profits)>></span> this week.
-
-	<<if $brothelDecoration != "standard">>
-		<p>
-			_brothelNameCaps's customers enjoyed <span class="reputation inc">fucking whores in $brothelDecoration surroundings.</span>
-		</p>
-	<</if>>
-
-	<!-- Statistics output -->
-	<<includeDOM App.Facilities.Brothel.Stats(false)>>
-	<<timed 50ms>>
-		<<replace #brothel-stats>>
-			<<includeDOM App.Facilities.Brothel.Stats(true)>>
-		<</replace>>
-	<</timed>>
-<</if>>
-
-<<if _DL > 0 || $MadamID != 0>>
-	<br><br>
-<</if>>
+<<includeDOM brothelReport()>>
-- 
GitLab