code:
App.Ads = {};
App.Ads.Categories = {};

/* Ad categories can classify individual slaves into many values, but at the facility level they get reduced to positive, zero, and negative to see whether the ads were effective */

App.Ads.Categories.age = {
	varSuffix: "Old",

	classifySlave: function(slave) {
		if (isYoung(slave)) {
			if (slave.physicalAge >= 18) {
				return -1; // young adult
			} else if (slave.physicalAge >= 13) {
				return -2; // teen
			} else {
				return -3; // loli
			}
		}
		return 1; // mature
	},

	classifyLocalPreference: function() {
		if ((V.arcologies[0].FSMaturityPreferentialist !== "unset") && (V.arcologies[0].FSMaturityPreferentialist >= 80)) {
			return 1; // mature
		} else if ((V.arcologies[0].FSYouthPreferentialist !== "unset") && (V.arcologies[0].FSYouthPreferentialist >= 80)) {
			return -1; // young
		}
		return 0;
	}
};

App.Ads.Categories.assetSize = {
	varSuffix: "Stacked",

	classifySlave: function(slave) {
		if (isStacked(slave)) {
			return 1;
		} else if (isSlim(slave)) {
			return -1;
		} else {
			return 0;
		}
	},

	classifyLocalPreference: function() {
		if ((V.arcologies[0].FSAssetExpansionist !== "unset") && (V.arcologies[0].FSAssetExpansionist >= 80)) {
			return 1; // stacked
		} else if ((V.arcologies[0].FSSlimnessEnthusiast !== "unset") && (V.arcologies[0].FSSlimnessEnthusiast >= 80)) {
			return -1; // slim
		}
		return 0;
	}
};

App.Ads.Categories.assetOrigin = {
	varSuffix: "Implanted",

	classifySlave: function(slave) {
		if (isSurgicallyImproved(slave)) {
			return 1;
		} else if (isPure(slave)) {
			return -1;
		}
		return 0;
	},

	classifyLocalPreference: function() {
		if ((V.arcologies[0].FSTransformationFetishist !== "unset") && (V.arcologies[0].FSTransformationFetishist >= 80)) {
			return 1; // implanted
		} else if ((V.arcologies[0].FSBodyPurist !== "unset") && (V.arcologies[0].FSBodyPurist >= 80)) {
			return -1; // natural
		}
		return 0;
	}
};

App.Ads.Categories.mods = {
	varSuffix: "Modded",

	classifySlave: function(slave) {
		if (SlaveStatsChecker.isModded(slave)) {
			return 1;
		} else if (SlaveStatsChecker.isUnmodded(slave)) {
			return -1;
		}
		return 0;
	},

	classifyLocalPreference: function() {
		if ((V.arcologies[0].FSDegradationist !== "unset") && (V.arcologies[0].FSDegradationist >= 80)) {
			return 1; // modded
		} else if ((V.arcologies[0].FSBodyPurist !== "unset") && (V.arcologies[0].FSBodyPurist >= 80)) {
			return -1; // natural
		}
		return 0;
	}
};

App.Ads.Categories.preg = {
	varSuffix: "Preg",

	classifySlave: function(slave) {
		if (isPreg(slave)) {
			return 1;
		} else if (isNotPreg(slave)) {
			return -1;
		}
		return 0;
	},

	classifyLocalPreference: function() {
		if ((V.arcologies[0].FSRepopulationFocus !== "unset") && (V.arcologies[0].FSRepopulationFocus >= 80)) {
			return 1; // pregnant
		} else if ((V.arcologies[0].FSRestart !== "unset") && (V.arcologies[0].FSRestart >= 80)) {
			return -1; // non-pregnant
		}
		return 0;
	}
};

App.Ads.Categories.genitalia = {
	varSuffix: "XX",

	classifySlave: function(slave) {
		if (slave.dick === 0 && slave.vagina > -1) {
			return 1; // pussies, no dicks
		} else if (slave.dick > 0) {
			return -1; // dicks, pussies optional
		}
		return 0; // null?
	},

	classifyLocalPreference: function() {
		if ((V.arcologies[0].FSGenderFundamentalist !== "unset") && (V.arcologies[0].FSGenderFundamentalist >= 80)) {
			return 1; // pussies, no dicks
		} else if ((V.arcologies[0].FSGenderRadicalist !== "unset") && (V.arcologies[0].FSGenderRadicalist >= 80)) {
			return -1; // dicks, pussies optional
		}
		return 0;
	}
};

/** Returns all the ad categories in the system. */
App.Ads.getAllCategories = function() {
	return _.values(App.Ads.Categories);
};

/** categorizes a girl in all the categories and returns the total categories in which she matches the advertisements */
App.Ads.getMatchedCategoryCount = function(slave, facility) {
	let matchedCategories = 0;

	for (const cat of App.Ads.getAllCategories()) {
		const result = cat.classifySlave(slave);
		if (result === V[`${facility}Ads${cat.varSuffix}`]) {
			++matchedCategories;
		}
	}

	return matchedCategories;
};

/** Manages the ads for a facility. Use example: <<set _adMgr = new App.Ads.AdManager("brothel")>> */
App.Ads.AdManager = class {
	constructor(facility) {
		this.varPrefix = `${facility}Ads`;
		this.totalSlaves = 0;
		this.missedBonuses = 0;
		for (const cat of App.Ads.getAllCategories()) {
			this[`tally${cat.varSuffix}`] = new Map();
		}
	}

	/** categorizes a girl in all the categories and adds the results to the running totals */
	tallySlave(slave) {
		++this.totalSlaves;
		for (const cat of App.Ads.getAllCategories()) {
			const result = cat.classifySlave(slave);
			this[`tally${cat.varSuffix}`].set(result, (this[`tally${cat.varSuffix}`].get(result) || 0) + 1);
		}
	}

	_coalesceTally(category) {
		const catMap = this[`tally${category.varSuffix}`];
		let neg = 0;
		let pos = 0;
		for (let [key, tally] of catMap) {
			if (key < 0) {
				neg += tally;
			} else if (key > 0) {
				pos += tally;
			} /* index == 0 is deliberately ignored */
		}
		return {neg, pos};
	}

	/** returns -1 if the majority of the girls have a negative value, +1 if the majority of the girls have a positive value, and 0 otherwise */
	slavesMajority(category) {
		const {neg, pos} = this._coalesceTally(category);
		if (neg > this.totalSlaves * 0.5) {
			return -1;
		} else if (pos > this.totalSlaves * 0.5) {
			return +1;
		} else {
			return 0;
		}
	}

	/** returns true if the majority of the girls fit the local preferences in the given category */
	slavesMatchPrefs(category) {
		const majority = this.slavesMajority(category);
		return (majority !== 0 && majority === category.classifyLocalPreference());
	}

	/** returns true if the majority of the girls fit the ad campaign in the given category */
	slavesMatchAds(category) {
		const majority = this.slavesMajority(category);
		return (majority !== 0 && majority === V[`${this.varPrefix}${category.varSuffix}`]);
	}

	/** returns true if the local preferences match the ad campaign in the given category */
	prefsMatchAds(category) {
		const prefs = category.classifyLocalPreference();
		return (prefs !== 0 && prefs === V[`${this.varPrefix}${category.varSuffix}`]);
	}

	/** returns -1 if the category qualifies for a variety bonus but the facility failed to get it, 1 if the category qualifies for a variety bonus and the facility got it, or 0 if it did not qualify */
	varietyBonus(category) {
		// qualifies for variety bonus only if the category has no preference, we are spending money on ads, and our ads show no preference
		if (category.classifyLocalPreference() !== 0 || V[`${this.varPrefix}Spending`] === 0 || V[`${this.varPrefix}${category.varSuffix}`] !== 0) {
			return 0;
		}
		// check to see if we achieved variety bonus
		const {neg, pos} = this._coalesceTally(category);
		if (neg > 0 && pos > 0 && Math.abs(pos - neg) <= (this.totalSlaves / 3)) {
			return 1; // got it
		} else {
			this.missedBonuses++;
			return -1; // qualified but failed
		}
	}

	overallVarietyBonus() {
		return (this.missedBonuses === 0);
	}
};

App.Ads.report = function(building, preview) {
	"use strict";
	if (typeof preview === undefined) {
		preview =false;
	}
	let r = ``;

	/** @type {App.Entity.Facilities.Facility} */
	const facility = App.Entity.facilities[building];
	const DL = facility.employeesIDs().size;

	let adMgr = new App.Ads.AdManager(building);
	facility.employees().forEach(s => {
		adMgr.tallySlave(s);
	});
	if (facility.manager.currentEmployee) {
		adMgr.tallySlave(facility.manager.currentEmployee);
	}

	let adCampaign = {
		stacked: V[building + "AdsStacked"],
		preg: V[building + "AdsPreg"],
		modded: V[building + "AdsModded"],
		implanted: V[building + "AdsImplanted"],
		XX: V[building + "AdsXX"],
		age: V[building + "AdsOld"],
		spending: V[building + "AdsSpending"]
	};

	return report(building, preview);

	function report(building, preview) {
		if (preview) {
			r += `<p><h3>Asset size</h3>`;
			r += stacked(building, preview);
			r += links(building, "stacked");
			r += `</p>`;

			r += `<p><h3>Asset origin</h3>`;
			r += implanted(building, preview);
			r += links(building, "implanted");
			r += `</p>`;

			r += `<p><h3>Body mods</h3>`;
			r += modded(building, preview);
			r += links(building, "modded");
			r += `</p>`;

			if (V.seePreg !== 0) {
				r += `<p><h3>Pregnancy</h3>`;
				r += preg(building, preview);
				r += links(building, "preg");
				r += `</p>`;
			}

			r += `<p><h3>Age</h3>`;
			r += age(building, preview);
			r += links(building, "age");
			r += `</p>`;

			if (V.seeDicks !== 0) {
				r += `<p><h3>Genitalia</h3>`;
				r += XX(building, preview);
				r += links(building, "XX");
				r += `</p>`;
			}

			r += `<p>`;
			r += final(building, preview);
			r += `</p>`;
		} else {
			r += `<p>`;
			r += intro(building, preview);
			r += `</p><p>`;
			r += stacked(building, preview);
			r += `</p><p>`;
			r += preg(building, preview);
			r += `</p><p>`;
			r += modded(building, preview);
			r += `</p><p>`;
			r += implanted(building, preview);
			r += `</p><p>`;
			r += XX(building, preview);
			r += `</p><p>`;
			r += age(building, preview);
			r += `</p><p>`;
			r += final(building, preview);
			r += `</p>`;
		}
		return r;
	}
	function intro(building, preview) {
		let t = ``;
		if (adCampaign.spending !== 0) {
			if (building === "brothel") {
				t += `<div>An ad campaign is supporting business there, and `;
				if (building === "brothel") {
					t += `whores `;
				 } else {
					t += `sluts `;
				 }
				 t += `that match it make more ¤.</div>`;
			} else if (building === "club") {
				t += `<div>An ad campaign is getting citizens into the ${building} every night, and sluts that match it gratify patrons.</div>`;
			}
		}
		return t;
	}

	function payVarietyBonus() {
		if (!preview) {
			if (building === "brothel") {
				const adsIncome = DL*random(20, 30);
				V.facility[building].adsIncome += adsIncome;
				cashX(adsIncome, (building + "Ads"));
			} else if (building === "club") {
				repX(DL*random(5, 10), (building + "Ads"));
			}
		}
	}

	function payAdBonus() {
		if (!preview) {
			if (building === "brothel") {
				const adsIncome = DL*random(20, 30);
				V.facility[building].adsIncome += adsIncome;
				cashX(adsIncome, (building + "Ads"));
			} else if (building === "club") {
				repX(DL*random(5, 10), (building + "Ads"));
			}
		}
	}

	function stacked(building, preview) {
		let t = ``;
		const pref = App.Ads.Categories.assetSize.classifyLocalPreference();
		let girls = adMgr.slavesMajority(App.Ads.Categories.assetSize);
		if (V.debugMode === 1) { t += `Girls: ${girls}, Pref: ${pref}, Ads: ${adCampaign.stacked}`; }

		// Ads
		if (adCampaign.spending !== 0) {
			t += `<div>`;
			if (adCampaign.stacked === 1) {
				t += `Its advertisements feature girls with plenty up top and rears to match. `;
			} else if (adCampaign.stacked === -1) {
				t += `Its advertisements feature trim girls with little in the way of T&A. `;
			} else {
				t += `Its advertisements feature a variety of girls, some that are trim and others that are curvaceous. `;
			}
			t += `</div>`;
		}

		// Preferences
		if (pref === 1) {
			t += `Most customers prefer their girls well endowed. `;
		} else if (pref === -1) {
			t += `Most customers prefer their girls light. `;
		} else {
			let variety = adMgr.varietyBonus(App.Ads.Categories.assetSize);
			if (variety === 1) {
				payVarietyBonus();
				t += `The ${building} offers a `;
				if (building === "brothel") {
					t+= `<span class="yellowgreen">`;
				} else if (building === "club") {
					t+= `<span class="green">`;
				}
				t += `wide</span> variety of slim and stacked slaves. `;
			}
			t += `Most customers don't mind the selection of assets. `;
		}

		// Girls
		if (girls === -1) {
			t += `Most of the slaves in the ${building} have small tits and asses. `;
		} else if (girls === 1) {
			t += `Most of the slaves in the ${building} have large tits and asses. `;
		} else {
			t += `The slaves in the ${building} vary in asset size. `;
		}

		// Results
		if (pref === 0) { /* customers don't care*/
		} else if (adCampaign.spending > 0) {
			if ((adCampaign.stacked === pref) && (girls === adCampaign.stacked)) {
				payAdBonus();
				t += `Its advertising for `;
				if (adCampaign.stacked === 1) {
					t += `stacked `;
				} else if (adCampaign.stacked === -1) {
					t += `trim `;
				}
				t += `girls matched most customers' preferences and the girls in the ${building} matched its advertisements. `;
				t += reputation(building, 1, preview);
			} else if ((adCampaign.stacked === pref) && (girls !== adCampaign.stacked)) {
				t += `Its advertising for `;
				if (adCampaign.stacked === 1) {
					t += `stacked `;
				} else if (adCampaign.stacked === -1) {
					t += `trim `;
				}
				t += `girls matched most customers preferences, but most of the girls in the ${building} were not as advertised. `;
				t += reputation(building, -1, preview);
			} else if ((girls === pref) && (girls !== adCampaign.stacked)) {
				t += `The `;
				if (girls === 1) {
					t += `stacked `;
				} else if (girls === -1) {
					t += `trim `;
				}
				t += `girls in the ${building} did not match its advertisements, but since the girls in the ${building} matched most customers preferences for `;
				if (pref === 1) {
					t += `stacked `;
				} else if (pref === -1) {
					t += `slim `;
				}
				t += `girls, `;
				t += reputation(building, 0, preview);
			} else if (girls !== pref) {
				t += `Some customers were put off since the `;
				if (girls === 1) {
					t += `stacked `;
				} else if (girls === -1) {
					t += `trim `;
				}
				t += `girls there did not match their preferences for `;
				if (pref === 1) {
					t += `stacked `;
				} else if (pref === -1) {
					t += `slim `;
				}
				t += `girls. `;
				t += reputation(building, -1, preview);
			}
		} else {
			if (girls === pref) {
				t += `The `;
				if (girls === 1) {
					t += `stacked `;
				} else if (girls === -1) {
					t += `trim `;
				}
				t += `girls in the ${building} match most customers' preferences for `;
				if (pref === 1) {
					t += `stacked `;
				} else if (pref === -1) {
					t += `slim `;
				}
				t += `girls. `;
				t += reputation(building, 1, preview);
			} else {
				t += `Some customers were put off since the `;
				if (girls === 1) {
					t += `stacked `;
				} else if (girls === -1) {
					t += `trim `;
				}
				t += `girls there did not match their preferences for `;
				if (pref === 1) {
					t += `large `;
				} else if (pref === -1) {
					t += `slim `;
				}
				t += `girls. `;
				t += reputation(building, -1, preview);
			}
		}
		return t;
	}

	function preg(building, preview) {
		let t = ``;
		const pref = App.Ads.Categories.preg.classifyLocalPreference();
		let girls = adMgr.slavesMajority(App.Ads.Categories.preg);
		if (V.debugMode === 1) { t += `Girls: ${girls}, Pref: ${pref}, Ads: ${adCampaign.preg}`; }
		if (V.seePreg === 1) {
			// Ads
			if (adCampaign.spending > 0) {
				t += `<div>`;
				if (adCampaign.preg === 1) {
					t += `Its advertisements feature girls that are clearly pregnant. `;
				} else if (adCampaign.preg === -1) {
					t += `Its advertisements feature girls that have flat, usually firm, bellies. `;
				} else {
					t += `Its advertisements feature some girls that are pregnant. `;
				}
				t += `</div>`;
			}

			// Preferences
			if (pref === 1) {
				t += `Most customers prefer their girls rounded with child. `;
			} else if (pref === -1) {
				t += `Most customers prefer girls that aren't gravid. `;
			} else {
				let variety = adMgr.varietyBonus(App.Ads.Categories.preg);
				if (variety === 1) {
					payVarietyBonus();
					t += `The ${building} offers a `;
					if (building === "brothel") {
						t+= `<span class="yellowgreen">`;
					} else if (building === "club") {
						t+= `<span class="green">`;
					}
					t += `wide</span> selection of slaves with a variety of middles. `;
				}
				t += `Most customers don't have preferences for either big-bellied or flat-bellied girls. `;
			}

			// Girls
			if (girls === -1) {
				t += `Most of the slaves in the ${building} sport flat bellies. `;
			} else if (girls === 1) {
				t += `Most of the slaves in the ${building} sport gravid middles. `;
			} else {
				t += `The slaves in the ${building} vary in belly type. `;
			}

			// Results
			if (pref === 0) { /* customers don't care*/
			} else if (adCampaign.spending > 0) {
				if ((adCampaign.preg === pref) && (girls === adCampaign.preg)) {
					payAdBonus();
					t += `Its advertising for `;
					if (adCampaign.preg === 1) {
						t += `pregnant `;
					} else if (adCampaign.preg === -1) {
						t += `flat-bellied `;
					}
					t += `girls matched most customers' preferences and the girls in the ${building} matched its advertisements. `;
					t += reputation(building, 1, preview);
				} else if ((adCampaign.preg === pref) && (girls !== adCampaign.preg)) {
					t += `Its advertising for `;
					if (adCampaign.preg === 1) {
						t += `pregnant `;
					} else if (adCampaign.preg === -1) {
						t += `flat-bellied `;
					}
					t += `girls matched most customers' preferences, but the girls in the ${building} did not. `;
					t += reputation(building, -1, preview);
				} else if ((girls === pref) && (girls !== adCampaign.preg)) {
					t += `The `;
					if (girls === 1) {
						t += `pregnant `;
					} else if (girls === -1) {
						t += `flat-bellied `;
					}
					t += `girls in the ${building} did not match its advertisements, but since the girls in the ${building} matched most customers preferences for `;
					if (pref === 1) {
						t += `fecund `;
					} else if (pref === -1) {
						t += `flat-bellied `;
					}
					t += `girls, `;
					t += reputation(building, 0, preview);
				} else if (girls !== pref) {
					t += `Some customers were put off since the `;
					if (girls === 1) {
						t += `pregnant `;
					} else if (girls === -1) {
						t += `flat-bellied `;
					}
					t += `girls there did not match their preferences for `;
					if (pref === 1) {
						t += `fecund `;
					} else if (pref === -1) {
						t += `flat-bellied `;
					}
					t += `girls. `;
					t += reputation(building, -1, preview);
				}
			} else {
				if (girls === pref) {
					t += `The `;
					if (girls === 1) {
						t += `pregnant `;
					} else if (girls === -1) {
						t += `flat-bellied `;
					}
					t += `girls in the ${building} match most customers' preferences for `;
					if (pref === 1) {
						t += `fecund `;
					} else if (pref === -1) {
						t += `	flat-bellied `;
					}
					t += `girls. `;
					t += reputation(building, 1, preview);
				} else {
					t += `Some customers were put off since the `;
					if (girls === 1) {
						t += `pregnant `;
					} else if (girls === -1) {
						t += `flat-bellied `;
					}
					t += `girls there did not match their preferences for `;
					if (pref === 1) {
						t += `fecund `;
					} else if (pref === -1) {
						t += `flat-bellied `;
					}
					t += `girls. `;
					t += reputation(building, -1, preview);
				}
			}
		}
		return t;
	}

	function modded(building, preview) {
		let t = ``;
		const pref = App.Ads.Categories.mods.classifyLocalPreference();
		let girls = adMgr.slavesMajority(App.Ads.Categories.mods);
		if (V.debugMode === 1) { t += `Girls: ${girls}, Pref: ${pref}, Ads: ${adCampaign.modded}`; }

		// Ads
		if (adCampaign.spending > 0) {
			t += `<div>`;
			if (adCampaign.modded === 1) {
				t += `Its advertisements feature girls that are heavily pierced and tattooed. `;
			} else if (adCampaign.modded === -1) {
				t += `Its advertisements feature girls that are free from piercings and tattoos. `;
			} else {
				t += `Its advertisements feature some girls that are tattooed and pierced, and some that aren't. `;
			}
			t += `</div>`;
		}

		// Preferences
		if (pref === 1) {
			t += `Most customers prefer heavily modified girls. `;
		} else if (pref === -1) {
			t += `Most customers prefer natural girls. `;
		} else {
			let variety = adMgr.varietyBonus(App.Ads.Categories.mods);
			if (variety === 1) {
				payVarietyBonus();
				t += `The ${building} offers `;
				if (building === "brothel") {
					t+= `<span class="yellowgreen">`;
				} else if (building === "club") {
					t+= `<span class="green">`;
				}
				t += `both</span> a selection of heavily altered slaves and those with more natural bodies. `;
			}
			t += `Most customers don't have preferences for either modded or natural slaves. `;
		}

		// Girls
		if (girls === 1) {
			t += `Most of the slaves in the ${building} are heavily pierced and tattooed. `;
		} else if (girls === -1) {
			t += `Most of the slaves in the ${building} have natural, unmodded bodies. `;
		} else {
			t += `Some girls in the ${building} have piercings or tattoos, some have none and others have both. `;
		}

		// Results
		if (pref === 0) { /* customers don't care*/
		} else if (adCampaign.spending > 0) {
			if ((adCampaign.modded === pref) && (girls === adCampaign.modded)) {
				payAdBonus();
				t += `Its advertising for `;
				if (adCampaign.modded === 1) {
					t += `heavily modified `;
				} else if (adCampaign.modded === -1) {
					t += `natural bodied `;
				}
				t += `girls matched most customers' preferences and the girls in the ${building} matched its advertisements. `;
				t += reputation(building, 1, preview);
			} else if ((adCampaign.modded === pref) && (girls !== adCampaign.modded)) {
				t += `Its advertising for `;
				if (adCampaign.modded === 1) {
					t += `heavily modified ;`;
				} else if (adCampaign.modded === -1) {
					t += `natural bodied `;
				}
				t += `girls matched most customers preferences, but the girls in the ${building} did not. `;
				t += reputation(building, -1, preview);
			} else if ((girls === pref) && (girls !== adCampaign.modded)) {
				t += `The `;
				if (girls === 1) {
					t += `heavily modified `;
				} else if (girls === -1) {
					t += `natural bodied `;
				}
				t += `girls in the ${building} did not match its advertisements, but since the girls in the ${building} matched most customers preferences for `;
				if (pref === 1) {
					t += `heavily modded `;
				} else if (pref === -1) {
					t += `natural bodied `;
				}
				t += `girls, `;
				t += reputation(building, 0, preview);
			} else if (girls !== pref) {
				t += `Some customers were put off since the `;
				if (girls === 1) {
					t += `heavily modified `;
				} else if (girls === -1) {
					t += `natural bodied `;
				}
				t += `girls there did not match their preferences for `;
				if (pref === 1) {
					t += `heavily modded `;
				} else if (pref === -1) {
					t += `natural bodied `;
				}
				t += `girls. `;
				t += reputation(building, -1, preview);
			}
		} else {
			if (girls === pref) {
				t += `The `;
				if (girls === 1) {
					t += `heavily modified `;
				} else if (girls === -1) {
					t += `natural bodied `;
				}
				t += `girls in the ${building} match most customers' preferences for `;
				if (pref === 1) {
					t += `heavily modded `;
				} else if (pref === -1) {
					t += `natural unmodded `;
				}
				t += `girls. `;
				t += reputation(building, 1, preview);
			} else {
				t += `Some customers were put off since the `;
				if (girls === 1) {
					t += `heavily modified `;
				} else if (girls === -1) {
					t += `natural bodied `;
				}
				t += `girls there did not match their preferences for `;
				if (pref === 1) {
					t += `heavily modded `;
				} else if (pref === -1) {
					t += `natural bodied `;
				}
				t += `girls. `;
				t += reputation(building, -1, preview);
			}
		}
		return t;
	}

	function implanted(building, preview) {
		let t = ``;
		const pref = App.Ads.Categories.assetOrigin.classifyLocalPreference();
		let girls = adMgr.slavesMajority(App.Ads.Categories.assetOrigin);
		if (V.debugMode === 1) { t += `Girls: ${girls}, Pref: ${pref}, Ads: ${adCampaign.implanted}`; }

		// Ads
		if (adCampaign.spending > 0) {
			t += `<div>`;
			if (adCampaign.implanted === 1) {
				t += `Its advertisements feature girls that are augmented by implants or improved surgically. `;
			} else if (adCampaign.implanted === -1) {
				t += `Its advertisements feature girls that have all natural bodies. `;
			} else {
				t += `Its advertisements feature some girls that are surgically improved and implanted and some that are all-natural. `;
			}
			t += `</div>`;
		}

		// Preferences
		if (pref === 1) {
			t += `Most customers prefer heavily implanted and surgically enhanced girls. `;
		} else if (pref === -1) {
			t += `Most customers prefer all-natural girls. `;
		} else {
			let variety = adMgr.varietyBonus(App.Ads.Categories.assetOrigin);
			if (variety === 1) {
				payVarietyBonus();
				t += `The ${building} offers `;
				if (building === "brothel") {
					t+= `<span class="yellowgreen">`;
				} else if (building === "club") {
					t+= `<span class="green">`;
				}
				t+= `both</span> all-natural girls, and slaves whose beauty has been improved by surgical means. `;
			}
			t += `Most customers don't have preferences for either all-natural or surgically enhanced and implanted girls. `;
		}

		// Girls
		if (girls === 1) {
			t += `Most of the slaves in the ${building} are heavily implanted or surgically enhanced. `;
		} else if (girls === -1) {
			t += `Most of the slaves in the ${building} have naturally pure bodies. `;
		} else {
			t += `The slaves in the ${building} vary in body modification. `;
		}

		// Results
		if (pref === 0) { /* customers don't care*/
		} else if (adCampaign.spending > 0) {
			if ((adCampaign.implanted === pref) && (girls === adCampaign.implanted)) {
				payAdBonus();
				t += `Its advertising for `;
				if (adCampaign.implanted === 1) {
					t += `implanted or surgically improved `;
				} else if (adCampaign.implanted === -1) {
					t += `naturally pure `;
				}
				t += `girls matched most customers' preferences and the girls in the ${building} matched its advertisements. `;
				t += reputation(building, 1, preview);
			} else if ((adCampaign.implanted === pref) && (girls !== adCampaign.implanted)) {
				t += `Its advertising for `;
				if (adCampaign.implanted === 1) {
					t += `implanted or surgically improved `;
				} else if (adCampaign.implanted === -1) {
					t += `naturally pure `;
				}
				t += `girls matched most customers preferences, but the girls in the ${building} did not. `;
				t += reputation(building, -1, preview);
			} else if ((girls === pref) && (girls !== adCampaign.implanted)) {
				t += `The `;
				if (girls === 1) {
					t += `implanted or surgically improved `;
				} else if (girls === -1) {
					t += `naturally pure `;
				}
				t += `girls in the ${building} did not match its advertisements, but since the girls in the ${building} matched most customers preferences for `;
				if (pref === 1) {
					t += `implanted or surgically improved `;
				} else if (pref === -1) {
					t += `naturally pure `;
				}
				t += `girls, `;
				t += reputation(building, 0, preview);
			} else if (girls !== pref) {
				t += `Some customers were put off since the `;
				if (girls === 1) {
					t += `implanted or surgically improved `;
				} else if (girls === -1) {
					t += `naturally pure `;
				}
				t += `girls there did not match their preferences for `;
				if (pref === 1) {
					t += `implanted or surgically improved `;
				} else if (pref === -1) {
					t += `naturally pure `;
				}
				t += `girls. `;
				t += reputation(building, -1, preview);
			}
		} else {
			if (girls === pref) {
				t += `The `;
				if (girls === 1) {
					t += `implanted or surgically improved `;
				} else if (girls === -1) {
					t += `naturally pure `;
				}
				t += `girls in the ${building} match most customers' preferences for `;
				if (pref === 1) {
					t += `implanted or surgically improved `;
				} else if (pref === -1) {
					t += `natural unmodded `;
				}
				t += `girls. `;
				t += reputation(building, 1, preview);
			} else {
				t += `Some customers were put off since the `;
				if (girls === 1) {
					t += `implanted or surgically improved `;
				} else if (girls === -1) {
					t += `naturally pure `;
				}
				t += `girls there did not match their preferences for `;
				if (pref === 1) {
					t += `implanted or surgically improved `;
				} else if (pref === -1) {
					t += `naturally pure `;
				}
				t += `girls. `;
				t += reputation(building, -1, preview);
			}
		}
		return t;
	}

	function XX(building, preview) {
		let t = ``;
		const pref = App.Ads.Categories.genitalia.classifyLocalPreference();
		let girls = adMgr.slavesMajority(App.Ads.Categories.genitalia);
		if (V.debugMode === 1) { t += `Girls: ${girls}, Pref: ${pref}, Ads: ${adCampaign.XX}`; }
		if (V.seeDicks !== 0) {
			// Ads
			if (adCampaign.spending > 0) {
				t += `<div>`;
				if (adCampaign.XX === 1) {
					t += `Its advertisements feature girls with female genitalia. `;
				} else if (adCampaign.XX === -1) {
					t += `Its advertisements feature girls with male genitalia. `;
				} else {
					t += `Its advertisements feature a variety of girls with both male and female genitalia. `;
				}
				t += `</div>`;
			}

			// Preferences
			if (pref === 1) {
				t += `Most customers prefer girls with pussies. `;
			} else if (pref === -1) {
				t += `Most customers prefer girls with dicks. `;
			} else {
				let variety = adMgr.varietyBonus(App.Ads.Categories.genitalia);
				if (variety === 1) {
					payVarietyBonus();
					t += `The ${building} offers a `;
					if (building === "brothel") {
						t+= `<span class="yellowgreen">`;
					} else if (building === "club") {
						t+= `<span class="green">`;
					}
					t += `mix</span> of `;
					if (building === "brothel") {
						t += `whores `;
					 } else {
						t += `sluts `;
					 }
					t+= `that can appeal to varied tastes in genitalia. `;
				}
				t += `Most customers don't have preferences for either girls with dicks or girls with pussies. `;
			}

			// Girls
			if (girls === 1) {
				t += `Most of the slaves in the ${building} have female genitalia. `;
			} else if (girls === -1) {
				t += `Most of the slaves in the ${building} have male genitalia. `;
			} else {
				t += `The slaves in the ${building} vary in genitalia. `;
			}

			// Results
			if (pref === 0) { /* customers don't care*/
			} else if (adCampaign.spending > 0) {
				if ((adCampaign.XX === pref) && (girls === adCampaign.XX)) {
					payAdBonus();
					t += `Its advertising for girls `;
					if (adCampaign.XX === 1) {
						t += `with pussies `;
					} else if (adCampaign.XX === -1) {
						t += `with dicks `;
					}
					t += `matches most customers' preferences as advertised. `;
					t += reputation(building, 1, preview);
				} else if ((adCampaign.XX === pref) && (girls !== adCampaign.XX)) {
					t += `Its advertising for girls `;
					if (adCampaign.XX === 1) {
						t += `with pussies `;
					} else if (adCampaign.XX === -1) {
						t += `with dicks `;
					}
					t += `matched most customers preferences, but the girls in the ${building} are not as advertised. `;
					t += reputation(building, -1, preview);
				} else if ((girls === pref) && (girls !== adCampaign.XX)) {
					t += `The girls `;
					if (girls === 1) {
						t += ` with pussies`;
					} else if (girls === -1) {
						t += ` with dicks`;
					}
					t += `in the ${building} did not match the advertisements, but since the girls in the ${building} matched most customers preferences for girls`;
					if (pref === 1) {
						t += ` with pussies`;
					} else if (pref === -1) {
						t += ` with dicks`;
					}
					t += `, `;
					t += reputation(building, 0, preview);
				} else if (girls !== pref) {
					t += `Some customers were put off since the girls `;
					if (girls === 1) {
						t += `with female genitalia `;
					} else if (girls === -1) {
						t += `with male genitalia `;
					}
					t += `did not match their preferences for girls`;
					if (pref === 1) {
						t += ` with pussies`;
					} else if (pref === -1) {
						t += ` with dicks`;
					}
					t += `. `;
					t += reputation(building, -1, preview);
				}
			} else {
				if (girls === pref) {
					t += `The girls in the ${building} match most customers preferences for girls `;
					if (girls === 1) {
						t += `with female genitalia `;
					} else if (girls === -1) {
						t += `with male genitalia `;
					}
					t += `. `;
					t += reputation(building, 1, preview);
				} else {
					t += `Some customers were put off since the girls `;
					if (girls === 1) {
						t += `with female genitalia `;
					} else if (girls === -1) {
						t += `with male genitalia `;
					}
					t += `did not match their preferences for girls `;
					if (pref === 1) {
						t += `with pussies`;
					} else if (pref === -1) {
						t += `with dicks`;
					}
					t += `. `;
					t += reputation(building, -1, preview);
				}
			}
		}
		return t;
	}

	function age(building, preview) {
		let t = ``;
		const pref = App.Ads.Categories.age.classifyLocalPreference();
		let girls = adMgr.slavesMajority(App.Ads.Categories.age);
		if (V.debugMode === 1) { t += `Girls: ${girls}, Pref: ${pref}, Ads: ${adCampaign.age}`; }

		// Ads
		if (adCampaign.spending > 0) {
			t += `<div>`;
			switch (adCampaign.age) {
				case 1:
					t += `Its advertisements feature mature slaves. `;
					break;
				case -1:
					t += `Its advertisements feature young slaves. `;
					break;
				case -2:
					t += `Its advertisements feature teenagers. `;
					break;
				case -3:
					t += `Its advertisements feature lolis. `;
					break;
				default:
					t += `Its advertisements feature slaves of a variety of ages. `;
					break;
			}
			t += `</div>`;
		}

		// Preferences
		if (pref === 1) {
			t += `Most customers prefer mature girls. `;
		} else if (pref === -1) {
			t += `Most customers prefer young girls. `;
		} else {
			let variety = adMgr.varietyBonus(App.Ads.Categories.age);
			if (variety === 1) {
				payVarietyBonus();
				t += `The ${building} offers girls `;
				if (building === "brothel") {
					t+= `<span class="yellowgreen">`;
				} else if (building === "club") {
					t+= `<span class="green">`;
				}
				t += `both</span> young and mature. `;
			}
			t += `Most customers don't have preferences for either mature or young girls. `;
		}

		// Girls
		if (girls === -1) {
			t += `Most of the slaves in the ${building} are young. `;
		} else if (girls === 1) {
			t += `Most of the slaves in the ${building} are mature. `;
		} else {
			t += `The slaves in the ${building} vary in age. `;
		}

		// Results
		if (pref === 0) { /* customers don't care*/
		} else if (adCampaign.spending > 0) {
			if ((adCampaign.age === pref) && (girls === adCampaign.age)) {
				payAdBonus();
				t += `Its advertising matches most customers' age preferences and the girls in the ${building} match the ages as advertised. `;
				t += reputation(building, 1, preview);
			} else if ((adCampaign.age === pref) && (girls !== adCampaign.age)) {
				t += `Its advertising matched most customers age preferences, but the girls in the ${building} are not as advertised. `;
				t += reputation(building, -1, preview);
			} else if ((girls === pref) && (girls !== adCampaign.age)) {
				t += `The ages of girls in the ${building} did not match the ages as advertised, but since the girls in the ${building} matched most customers age preferences, `;
				t += reputation(building, 0, preview);
			} else if (girls !== pref) {
				t += `Some customers were put off since the ages of girls there did not match their preferences. `;
				t += reputation(building, -1, preview);
			}
		} else {
			if (girls === pref) {
				t += `The girls in the ${building} match most customers' age preferences. `;
				t += reputation(building, 1, preview);
			} else {
				t += `Some customers were put off since the ages of girls there did not match their preferences. `;
				t += reputation(building, -1, preview);
			}
		}
		return t;
	}

	function final(building, preview) {
		let t = ``;
		if (adMgr.overallVarietyBonus()) {
			if (!preview) {
				if (building === "brothel") {
					const adsIncome = DL*random(40, 60);
					V.facility[building].adsIncome += adsIncome;
					cashX(adsIncome, (building + "Ads"));
				} else if (building === "club") {
					repX(DL*random(10, 15), (building + "Ads"));
				}
			}
			t += `<div>There is a `;
			if (building === "brothel") {
				t += `<span class="yellowgreen" style="font-weight:bold">perfect variety</span> of slave whores `;
			} else if (building === "club") {
				t += `<span class="green" style="font-weight:bold">perfect variety</span> of slave sluts `;
			}
			t += `working in the ${building}.</div>`;
		} else {
			if (building === "club") {
				t += `<div>${capFirstChar(V.clubName)} does not offer enough variety to satisfy all visitors.</div>`;
			}
		}
		return t;
	}

	function reputation(building, change, preview) {
		const minBonus = 50;
		const maxBonus = 150;
		if (change > 0) {
			if (preview) {
				return `<div>The current campaign would <span class="green">increase</span> your reputation.</div>`;
			} else {
				repX(random(minBonus, maxBonus), building);
				return `Your <span class="green">reputation</span> increased slightly as a result. `;
			}
		} else if (change < 0) {
			if (preview) {
				return `<div>The current campaign would <span class="red">lower</span> your reputation.</div>`;
			} else {
				repX(forceNeg(random(minBonus, maxBonus)), building);
				return `Your <span class="red">reputation</span> dropped slightly as a result. `;
			}
		} else if (change === 0) {
			if (preview) {
				return `<div>your reputation would not be affected.</div>`;
			} else {
				return `your reputation was not affected. `;
			}
		}
	}

	function links(building, category) {
		let r = ``;
		let passage = (capFirstChar(building) + " Advertisement");

		function radioLink(name, variable, value, last) {
			let r = ``;
			if (V[variable] !== value) {
				r += App.UI.passageLink(name, passage, `$${variable} = ${value}`);
			} else {
				r += name;
			}
			if (!last) {
				r += " | ";
			}
			return r;
		}

		switch (category) {
			case "stacked":
				r+= `<div>`;
				r+= radioLink("Stacked", `${building}AdsStacked`, 1, false);
				r+= radioLink("Slim", `${building}AdsStacked`, -1, false);
				r+= radioLink("Variety", `${building}AdsStacked`, 0, true);
				r+= `</div>`;
				return r;
			case "preg":
				r+= `<div>`;
				r+= radioLink("Gravid", `${building}AdsPreg`, 1, false);
				r+= radioLink("None", `${building}AdsPreg`, -1, false);
				r+= radioLink("Variety", `${building}AdsPreg`, 0, true);
				r+= `</div>`;
				return r;
			case "modded":
				r+= `<div>`;
				r+= radioLink("Modded", `${building}AdsModded`, 1, false);
				r+= radioLink("Unmodded", `${building}AdsModded`, -1, false);
				r+= radioLink("Variety", `${building}AdsModded`, 0, true);
				r+= `</div>`;
				return r;
			case "implanted":
				r+= `<div>`;
				r+= radioLink("Implants", `${building}AdsImplanted`, 1, false);
				r+= radioLink("All natural", `${building}AdsImplanted`, -1, false);
				r+= radioLink("Variety", `${building}AdsImplanted`, 0, true);
				r+= `</div>`;
				return r;
			case "XX":
				r+= `<div>`;
				r+= radioLink("Pussies", `${building}AdsXX`, 1, false);
				r+= radioLink("Dicks", `${building}AdsXX`, -1, false);
				r+= radioLink("Variety", `${building}AdsXX`, 0, true);
				r+= `</div>`;
				return r;
			case "age":
				r+= `<div>`;
				r+= radioLink("MILF", `${building}AdsOld`, 1, false);
				r+= radioLink("Young", `${building}AdsOld`, -1, false);
				if (V.minimumSlaveAge < 18) {
					r+= radioLink("Teen", `${building}AdsOld`, -2, false);
				}
				if (V.minimumSlaveAge < 13) {
					r+= radioLink("Loli", `${building}AdsOld`, -3, false);
				}
				r+= radioLink("Variety", `${building}AdsOld`, 0, true);
				r+= `</div>`;
				return r;
			default:
				console.log("You done fucked up. Building: " + building + " Category: " + category);
		}
	}
};


code:
App.Data.Facilities.arcade = {
	baseName: "arcade",
	genericName: null,
	jobs: {
		assignee: {
			position: "inmate",
			assignment: Job.ARCADE,
			publicSexUse: true,
			fuckdollAccepted: true
		},
	},
	defaultJob: "assignee",
	manager: null
};

App.Entity.Facilities.ArcadeJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * Can slave be employed at this position
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);
		if (slave.indentureRestrictions > 0) {
			r.push(`${slave.slaveName}'s indenture forbids arcade service.`);
		}
		return r;
	}
};

App.Entity.facilities.arcade = new App.Entity.Facilities.SingleJobFacility(
	App.Data.Facilities.arcade,
	{
		assignee: new App.Entity.Facilities.ArcadeJob()
	}
);

repo_name: Welptard/fc

license: mit


code:
App.Data.Facilities.armory = {
	baseName: "dojo",
	genericName: "Armory",
	jobs: {	},
	defaultJob: null,
	manager: {
		position: "bodyguard",
		positionAbbreviation: "BG",
		assignment: Job.BODYGUARD,
		careers: App.Data.misc.bodyguardCareers,
		skill: "bodyguard",
		publicSexUse: true,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: true,
		shouldSee: true,
		shouldHear: true,
		shouldTalk: false,
		shouldThink: true,
		requiredDevotion: 51
	}
};

App.Entity.facilities.armory = new App.Entity.Facilities.Facility(App.Data.Facilities.armory);


code:
:: Brothel Assignment Scene [nobr]

<<set $nextButton = "Continue", $nextLink = $returnTo>>
<<run Enunciate(getSlave($AS))>>
<<run App.Utils.setLocalPronouns(getSlave($AS))>>

	/* 000-250-006 */
	<<if $seeImages == 1>>
		<<if $imageChoice == 1>>

<<= SlaveArt(getSlave($AS), 2, 0)>>

		<<else>>

<<= SlaveArt(getSlave($AS), 2, 0)>>

		<</if>>
	<</if>>
	/* 000-250-006 */

You could direct $assistant.name to relay your orders to <<= getSlave($AS).slaveName>>, but you've decided to avoid relying too much on machine assistance. So, $he is merely directed to report to your office. The
<<if getSlave($AS).devotion > 95>>
	worshipful $girl <<if hasAnyLegs(getSlave($AS))>>hurries in as soon as $he possibly can<<else>>comes in as soon as $he can get another slave to carry $him in<</if>>, happy $his beloved <<= getWrittenTitle(getSlave($AS))>> is taking an interest in $him.
<<elseif getSlave($AS).devotion > 50>>
	devoted $girl <<if hasAnyLegs(getSlave($AS))>>hurries in promptly<<else>>comes in as soon as $he can get another slave to carry $him in<</if>>, eager to do whatever you demand of $him.
<<elseif getSlave($AS).devotion > 20>>
	$girl, broken to your will, <<if hasAnyLegs(getSlave($AS))>>comes in promptly<<else>>comes in as soon as $he can get another slave to carry $him in<</if>>, clearly ready to follow orders.
<<elseif (getSlave($AS).trust < -20) && (getSlave($AS).devotion > -10)>>
	fearful slave <<if hasAnyLegs(getSlave($AS))>>comes in promptly<<else>>comes in as soon as $he can get another slave to carry $him in<</if>>, afraid of what will happen to $him if $he doesn't.
<<elseif (getSlave($AS).trust < -50)>>
	terrified slave <<if hasAnyLegs(getSlave($AS))>>comes in hurriedly<<else>>comes in as soon as $he can get another slave to carry $him in<</if>>, almost paralyzed by terror of what will happen to $him if $he doesn't.
<<else>>
	rebellious slave <<if hasAnyLegs(getSlave($AS))>>comes in slowly, having decided that $he can always decide to resist once $he hears what you want<<else>>comes in as soon as you order another slave to carry $him in, since $he can't exactly resist this without <<if isAmputee(getSlave($AS))>>limbs<<else>>legs<</if>><</if>>.
<</if>>
You tell $him $he's to report to <<if $MadamID != 0>>_S.Madam.slaveName immediately, to serve in $brothelName<<else>>$brothelName immediately, to serve there<</if>> until further notice.

<<if getSlave($AS).devotion > 50>>

	<<if (getSlave($AS).fetishKnown == 1) && (getSlave($AS).fetishStrength > 60) && (getSlave($AS).fetish != "none")>>
		$He looks excited.
		<<if canTalk(getSlave($AS))>>
			"<<Master>>, I hoped you would <<s>>end me down there <<s>>ometime!
			<<switch getSlave($AS).fetish>>
			<<case "submissive">>
				I mean, I'll have to do whatever the cu<<s>>tomer<<s>> pay for, right?" $His eyes go a little unfocused. "And, they'll hold me down..." $He trails off.
			<<case "masochist">>
				I mean, it'<<s>> hard being a brothel whore, right? And when I get tired or <<s>>ore, I'll <<s>>till be <<s>>old. Even when it hurt<<s>> me to fuck any more." $His eyes glow with an unhealthy light.
			<<case "cumslut">>
				I mean," $he licks $his lips unconsciously,
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					"I hear there are <<s>>ome ni<<c>>e ladie<<s>> that go there for lunchtime cunnilingu<<s>>."
				<<else>>
					"the blowjob<<s>>. Ju<<s>>t, the blowjob<<s>>. That'<<s>> all."
				<</if>>
			<<case "humiliation">>
				There'<<s>> a window that fa<<c>>e<<s>> the hallway there, right? <<if $MadamID != 0>>Do you think _S.Madam.slaveName would let me<<else>>Could I<</if>> get fucked there? Where everyone could <<s>>ee me being fucked for money?"
			<<case "buttslut">>
				I mean," and $he shifts $his weight, $his mind obviously on $his backdoor,
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					"there have to be ladie<<s>> who want to buttfuck a whore, right? At lea<<s>>t, I really hope there are."
				<<else>>
					"the other <<s>>lave<<s>> tell me that whore<<s>> there get fucked up the a<<ss>> all day and all night. <<S>>ound<<s>> like fun to me."
				<</if>>
			<<case "boobs">>
				I mean," and $he sticks out $his chest a little,
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					"I hear from the other <<s>>lave<<s>> there'<<s>> thi<<s>> ni<<c>>e lady who goe<<s>> there every morning and pay<<s>> to have a whore <<s>>uck her nipple<<s>> for, like, an hour. I," $he licks $his lips, "could do that."
				<<else>>
					"the other <<s>>lave<<s>> tell me that whore<<s>> there get tittyfucked all the time. <<S>>ound<<s>> like fun to me."
				<</if>>
			<<case "pregnancy">>
				I mean," $he says meditatively,
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					"I hear from the other <<s>>lave<<s>> there'<<s>> thi<<s>> pregnant lady who goe<<s>> there every night and pay<<s>> to have a whore cuddle her. Ju<<s>>t cuddle, all night. That would be kind of hard, ju<<s>>t cuddling, but I could do it."
				<<elseif getSlave($AS).vagina == -1>>
					"<<s>>in<<c>>e it'<<s>> all bareback, I'm going to have a fuckton of cum in me. I wonder how much cum it take<<s>> to get a butthole pregnant? I'm gonna try, anyway."
				<<elseif isFertile(getSlave($AS))>>
					"<<s>>in<<c>>e it'<<s>> all bareback, I'm going to have a fuckton of cum in me. I wonder how much cum it would take to get my poor womb pregnant?"
				<<elseif getSlave($AS).pregKnown == 1>>
					"I'm going to be a pregnant whore. That'<<s>> pretty fucking <<s>>e<<x>>y."
				<<elseif getSlave($AS).preg > 0>>
					"<<s>>in<<c>>e it'<<s>> all bareback, I'm going to have a fuckton of cum in me. I wonder how much cum it would take to get my poor womb pregnant?"
				<<elseif getSlave($AS).ovaries == 1 && getSlave($AS).pubertyXX == 0>>
					"I can't wait till I can get pregnant. That'd be pretty fucking <<s>>e<<x>>y."
				<<else>>
					"I hear from the other <<s>>lave<<s>> there'<<s>> thi<<s>> pregnant lady who goe<<s>> there every night and pay<<s>> to have a whore cuddle her. Ju<<s>>t cuddle, all night. That would be kind of hard, ju<<s>>t cuddling, but I could do it."
				<</if>>
			<<case "dom">>
				I heard from the other <<s>>lave<<s>> that <<s>>ome <<c>>iti<<z>>en<<s>> bring their girl<<s>> there. Ju<<s>>t to make them take it from a whore."
			<<case "sadist">>
				I heard from the other <<s>>lave<<s>> that <<s>>ome <<c>>iti<<z>>en<<s>> bring their girl<<s>> there. Becau<<s>>e nobody know<<s>> how to hurt a bitch like a whore doe<<s>>." $He shivers.
			<</switch>>
		<<else>>
			<<switch getSlave($AS).fetish>>
			<<case "submissive">>
				$He gestures that $he'll be at the mercy of $his customers. $His eyes go a little unfocused as $he clearly begins to fantasize.
			<<case "masochist">>
				$He gestures that $he'll probably get roughed up by some of $his customers and that there will be no breaks for $his sore holes. $His eyes glow with an unhealthy light as $he clearly begins to fantasize.
			<<case "cumslut">>
				$He licks $his lips unconsciously and motions
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					tounging a clit.
				<<else>>
					sucking cock.
				<</if>>
			<<case "humiliation">>
				$He gestures if $he could be fucked in public there.
			<<case "buttslut">>
				$He shifts $his weight, $his mind obviously on $his backdoor, and gestures
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					if any girls would want to buttfuck $him.
				<<else>>
					that $he knows whores take it up the ass there and can't wait to join them.
				<</if>>
			<<case "boobs">>
				$He sticks out $his chest a little and gestures
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					that $he's heard a woman comes by each day just to have her nipples sucked. $He licks $his lips, clearly savoring the thought.
				<<else>>
					that $he knows tittyfucking is popular there and can't wait to give $his pair up for sale.
				<</if>>
			<<case "pregnancy">>
				$He gestures
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					that $he's heard that a pregnant woman has been coming every night to pay for a whore to cuddle her. $He asks if $he could be that $girl.
				<<elseif getSlave($AS).vagina == -1>>
					how much $he wishes $he could get pregnant from all the cum loads $he's going to get shot up $his rear.
				<<elseif isFertile(getSlave($AS))>>
					that $he knows all the sex is bareback. By the look in $his eyes, you can tell $he is wondering how long it will take for some guy's seed to take root in $him.
				<<elseif getSlave($AS).pregKnown == 1>>
					how sexy $he thinks pregnant whores are.
				<<elseif getSlave($AS).preg > 0>>
					that $he knows all the sex is bareback. By the look in $his eyes, you can tell $he is wondering how long it will take for some guy's seed to take root in $him.
				<<elseif getSlave($AS).ovaries == 1 && getSlave($AS).pubertyXX == 0>>
					how excited $he is for the day $he starts $his menstrual cycle. Will $he even see $his first period, or will every egg $he makes get fertilized?
				<<else>>
					that $he's heard a pregnant woman has been coming every night to pay for a whore to cuddle her. $He hopes that one day $he'll be chosen.
				<</if>>
			<<case "dom">>
				$He gestures that $he knows citizens sometimes bring their toys there just to let them get pushed around by a whore. $He'd like that to be true. A lot.
			<<case "sadist">>
				$He gestures that $he knows citizens sometimes bring their toys there for punishment. $He shivers with anticipation.
			<</switch>>
		<</if>>
	<<else>>
		$He looks
		<<if canTalk(getSlave($AS))>>
			determined. "<<Master>>, I will do my be<<s>>t to be a good whore, and get lot<<s>> of <<c>>iti<<z>>en<<s>> to pay good money for my body."
		<<else>>
			determined and gestures that $he'll do $his best to get lots of citizens to pay to use $him.
		<</if>>
	<</if>>

<<elseif (getSlave($AS).devotion > 20) || ((getSlave($AS).devotion >= -20) && (getSlave($AS).trust < -20) && (getSlave($AS).trust >= -50))>>
	<<if canTalk(getSlave($AS))>>
		<<if (getSlave($AS).fetishKnown == 1) && (getSlave($AS).fetishStrength > 60) && (getSlave($AS).fetish != "none")>>
			$He looks cautiously excited. "<<Master>>,
			<<switch getSlave($AS).fetish>>
			<<case "submissive">>
				I'll have to do whatever the cu<<s>>tomer<<s>> pay for, right?" $His eyes go a little unfocused. "And, they'll hold me down..." $He trails off.
			<<case "masochist">>
				it'<<s>> hard being a brothel whore, right? And when I get tired or <<s>>ore, I'll <<s>>till be <<s>>old. Even when it hurt<<s>> me to fuck any more." $His eyes glow with an unhealthy light.
			<<case "cumslut">>
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					"I hear there are <<s>>ome ni<<c>>e ladie<<s>> that go there for lunchtime cunnilingu<<s>>."
				<<else>>
					"the blowjob<<s>>. Ju<<s>>t, the blowjob<<s>>. That'<<s>> all."
				<</if>>
			<<case "humiliation">>
				there'<<s>> a window that fa<<c>>e<<s>> the hallway there, right? <<if $MadamID != 0>>Do you think _S.Madam.slaveName would let me<<else>>Could I<</if>> get fucked there? Where everyone could <<s>>ee me being fucked for money?"
			<<case "buttslut">>

				uh," and $he shifts $his weight, $his mind obviously on $his backdoor,
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					"there have to be ladie<<s>> who want to buttfuck a whore, right? At lea<<s>>t, I really hope there are."
				<<else>>
					"the other <<s>>lave<<s>> tell me that whore<<s>> there get fucked up the a<<ss>> all day and all night. <<S>>ound<<s>> like fun to me."
				<</if>>
			<<case "boobs">>
				$He sticks out $his chest a little and gestures
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					that $he's heard a woman comes by each day just to have her nipples sucked. $He licks $his lips, clearly savoring the thought.
				<<else>>
					that $he knows tittyfucking is popular there and can't wait to give $his pair up for sale.
				<</if>>
			<<case "pregnancy">>
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					I hear from the other <<s>>lave<<s>> there'<<s>> thi<<s>> pregnant lady who goe<<s>> there every night and pay<<s>> to have a whore cuddle her. Ju<<s>>t cuddle, all night. That would be kind of hard, ju<<s>>t cuddling, but I could do it."
				<<elseif getSlave($AS).vagina == -1>>
					<<s>>in<<c>>e it'<<s>> all bareback, I'm going to have a fuckton of cum in me. I wonder how much cum it take<<s>> to get a butthole pregnant? I'm gonna try, anyway."
				<<elseif isFertile(getSlave($AS))>>
					<<s>>in<<c>>e it'<<s>> all bareback, I'm going to have a fuckton of cum in me. I wonder how much cum it would take to get my poor womb pregnant?"
				<<elseif getSlave($AS).pregKnown == 1>>
					"I'm going to be a pregnant whore. That'<<s>> pretty fucking <<s>>e<<x>>y."
				<<elseif getSlave($AS).preg > 0>>
					"<<s>>in<<c>>e it'<<s>> all bareback, I'm going to have a fuckton of cum in me. I wonder how much cum it would take to get my poor womb pregnant?"
				<<elseif getSlave($AS).ovaries == 1 && getSlave($AS).pubertyXX == 0>>
					"I can't wait till I can get pregnant. That'd be pretty fucking <<s>>e<<x>>y."
				<<else>>
					"I hear from the other <<s>>lave<<s>> there'<<s>> thi<<s>> pregnant lady who goe<<s>> there every night and pay<<s>> to have a whore cuddle her. Ju<<s>>t cuddle, all night. That would be kind of hard, ju<<s>>t cuddling, but I could do it."
				<</if>>
			<<case "dom">>
				I heard from the other <<s>>lave<<s>> that <<s>>ome <<c>>iti<<z>>en<<s>> bring their girl<<s>> there. Ju<<s>>t to make them take it from a whore."
			<<case "sadist">>
				I heard from the other <<s>>lave<<s>> that <<s>>ome <<c>>iti<<z>>en<<s>> bring their girl<<s>> there. Becau<<s>>e nobody know<<s>> how to hurt a bitch like a whore doe<<s>>." $He shivers.
			<</switch>>
		<<elseif getSlave($AS).sexualFlaw != "none">>
			"Ye<<s>>, <<Master>>," $he says obediently. $He hesitates, looking concerned.
			<<switch getSlave($AS).sexualFlaw>>
			<<case "hates oral">>
				"I — I'm going to h-have to <<s>>uck a lot of dick there, aren't I." $He swallows nervously. $His lower lip quivers, and $he does $his best not to cry in front of you.
			<<case "hates anal">>
				"C-cu<<s>>tomer<<s>> are really going to ream me up the butt hole, aren't they." $He <<if !hasAnyArms(getSlave($AS))>>shifts uncomfortably, unconsciously trying to shield $his rear as best $he can manage without <<if isAmputee(getSlave($AS))>>limbs<<else>>hands<</if>><<else>>unconsciously reaches around behind $himself, not quite shielding $his anus with $his hand<<if hasBothArms(getSlave($AS))>>s<</if>><</if>>. $His lower lip quivers, and $he does $his best not to cry in front of you.
			<<case "hates penetration">>
				"C-cu<<s>>tomer<<s>> are really going to fuck me <<s>>ore, aren't they." $He <<if !hasAnyArms(getSlave($AS))>>shifts uncomfortably, unconsciously trying to shield $his rear as best $he can manage without <<if isAmputee(getSlave($AS))>>limbs<<else>>hands<</if>><<elseif getSlave($AS).vagina > 0>>unconsciously lets $his hand<<if hasBothArms(getSlave($AS))>>s<</if>> fall to $his crotch, but catches $himself and doesn't quite shield $his pussy<<else>>unconsciously reaches around behind $himself, not quite shielding $his anus with $his hand<<if hasBothArms(getSlave($AS))>>s<</if>><</if>>. $His lower lip quivers, and $he does $his best not to cry in front of you.
			<<case "repressed">>
				"Being a whore i<<s>> a <<s>>in," $he <<say>>s quietly, half to $himself. "I'm going t-to b-be <<s>>o dirty. I'm going to h-hell." $He starts to cry quietly. "<<S>>-<<s>>orry, <<Master>>. I'll do my be<<s>>t."
			<<case "idealistic">>
				"I'm going to be <<s>>old for <<s>>e<<x>>," $he <<say>>s quietly, half to $himself. "Men are going to pay, and then they're g-going to <<s>>tick their dick<<s>> in me, and then they're going to leave." $He starts to cry quietly. "<<S>>-<<s>>orry, <<Master>>. I'll do my be<<s>>t."
			<<case "shamefast">>
				"I'm going to be meat in a brothel," $he <<say>>s quietly, half to $himself. "I'm going to <<s>>tand there naked with the other <<s>>lave<<s>>, and men will pick me and then u<<s>>e my body. Over and over." $He starts to cry quietly. "<<S>>-<<s>>orry, <<Master>>. I'll do my be<<s>>t."
			<<case "apathetic">>
				"I gue<<ss>> I'll lie there," $he sighs quietly, half to $himself. "A man will pay and then he'll come into my room where I'm lying on the bed, and he'll <<s>>tick hi<<s>> cock in me and cum and leave. And then the ne<<x>>t man will come in." $He starts to cry quietly. "<<S>>-<<s>>orry, <<Master>>. I'll do my be<<s>>t."
			<<case "crude">>
				"Okay," $he <<say>>s, thinking. "My poor cornhole i<<s>> going to be <<s>>uch a <<s>>eminal <<s>>ewer." $He looks doubtful. "<<Sh>>ould I not have <<s>>aid that, <<Master>>?"
			<<case "judgemental">>
				"Gro<<ss>>," $he <<say>>s curtly. "Well, no more hand<<s>>ome boy<<s>> for me, then. Fat pathetic guy<<s>> who patroni<<z>>e whore<<s>>, all the way down. Fuck."
			<</switch>>
		<<else>>
			$He tries to be brave. "<<Master>>, I will do my be<<s>>t to be a good whore." Then, half to $himself, $he adds in a small voice, "I can do thi<<s>>."
		<</if>>
	<<else>>
		<<if (getSlave($AS).fetishKnown == 1) && (getSlave($AS).fetishStrength > 60) && (getSlave($AS).fetish != "none")>>
			$He looks cautiously excited.
			<<switch getSlave($AS).fetish>>
			<<case "submissive">>
				$His eyes go a little unfocused before $he snaps back to attention and gestures that $he'll have to do whatever they want. $His attention wavers once more.
			<<case "masochist">>
				$He gestures if brothel whores get breaks when they get sore. Before you can tell $him no, $his eyes glow with an unhealthy light and $he expresses that $he'd like it more if it hurt.
			<<case "cumslut">>
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					$He gestures that $he heard a rumor that some ladies swing by during lunchtime for a quick eating out.
				<<else>>
					As drool starts to leak from $his mouth, it's pretty obvious $he can't wait to start sucking.
				<</if>>
			<<case "humiliation">>
				$He asks if there is a window that $he could be stationed in for all to see.
			<<case "buttslut">>
				$He shifts $his weight, $his mind obviously on $his backdoor, and gestures
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					if any girls would want to buttfuck $him.
				<<else>>
					that $he knows whores take it up the ass there and can't wait to join them.
				<</if>>
			<<case "boobs">>
				er," and $he sticks out $his chest a little,
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					"I hear from the other <<s>>lave<<s>> there'<<s>> thi<<s>> ni<<c>>e lady who goe<<s>> there every morning and pay<<s>> to have a whore <<s>>uck her nipple<<s>> for, like, an hour. I," $he licks $his lips, "could do that."
				<<else>>
					"the other <<s>>lave<<s>> tell me that whore<<s>> there get tittyfucked all the time. <<S>>ound<<s>> like fun to me."
				<</if>>
			<<case "pregnancy">>
				$He gestures
				<<if getSlave($AS).attrXX > getSlave($AS).attrXY>>
					that $he's heard that a pregnant woman has been coming every night to pay for a whore to cuddle her. $He asks if $he could be that $girl.
				<<elseif getSlave($AS).vagina == -1>>
					how much $he wishes $he could get pregnant from all the cum loads $he's going to get shot up $his rear.
				<<elseif isFertile(getSlave($AS))>>
					that $he knows all the sex is bareback. By the look in $his eyes, you can tell $he is wondering how long it will take for some guy's seed to take root in $him.
				<<elseif getSlave($AS).pregKnown == 1>>
					how sexy $he thinks pregnant whores are.
				<<elseif getSlave($AS).preg > 0>>
					that $he knows all the sex is bareback. By the look in $his eyes, you can tell $he is wondering how long it will take for some guy's seed to take root in $him.
				<<elseif getSlave($AS).ovaries == 1 && getSlave($AS).pubertyXX == 0>>
					how excited $he is for the day $he starts $his menstrual cycle. Will $he even see $his first period, or will every egg $he makes get fertilized?
				<<else>>
					that $he's heard a pregnant woman has been coming every night to pay for a whore to cuddle her. $He hopes that one day $he'll be chosen.
				<</if>>
			<<case "dom">>
				$He gestures that $he knows citizens sometimes bring their toys there just to let them get pushed around by a whore. $He'd like that to be true. A lot.
			<<case "sadist">>
				$He gestures that $he knows citizens sometimes bring their toys there for punishment. $He shivers with anticipation.
			<</switch>>
		<<elseif getSlave($AS).sexualFlaw != "none">>
			$He nods obediently before hesitating with a concerned look on $his face.
			<<switch getSlave($AS).sexualFlaw>>
			<<case "hates oral">>
				$He slowly gestures if blowjobs are popular there while swallowing nervously. $His lower lip starts to quiver, and $he does $his best not to cry in front of you.
			<<case "hates anal">>
				$He slowly gestures if anal is popular there and <<if !hasAnyArms(getSlave($AS))>>shifts uncomfortably, unconsciously trying to shield $his rear as best $he can manage without <<if isAmputee(getSlave($AS))>>limbs<<else>>hands<</if>><<else>>unconsciously reaches around behind $himself, not quite shielding $his anus with $his hand<<if hasBothArms(getSlave($AS))>>s<</if>><</if>>. $His lower lip quivers, and $he does $his best not to cry in front of you.
			<<case "hates penetration">>
				$He slowly gestures that $he understands that customers will expect to fuck $him and <<if !hasAnyArms(getSlave($AS))>>shifts uncomfortably, unconsciously trying to shield $his rear as best $he can manage without <<if isAmputee(getSlave($AS))>>limbs<<else>>hands<</if>><<elseif getSlave($AS).vagina > 0>>unconsciously lets $his hand<<if hasBothArms(getSlave($AS))>>s<</if>> fall to $his crotch, but catches $himself and doesn't quite shield $his pussy<<else>>unconsciously reaches around behind $himself, not quite shielding $his anus with $his hand<<if hasBothArms(getSlave($AS))>>s<</if>><</if>>. $His lower lip quivers, and $he does $his best not to cry in front of you.
			<<case "repressed">>
				$He shakily gestures that $he'll be a sinner, but if that's what you want, $he'll do it. $He starts to cry quietly.
			<<case "idealistic">>
				$He shakily gestures that $he'll do $his best to please any men that use $him. $He starts to cry quietly.
			<<case "shamefast">>
				$He shakily gestures that $he'll do $his best to use $his naked body to attract men and entice passersby. $He starts to cry quietly.
			<<case "apathetic">>
				$He shakily gestures that $he'll do $his best to take cock. $He starts to cry quietly.
			<<case "crude">>
				$He gestures that $his body is going to become so foul after a day's worth of fucks. $He pauses for a moment, doubtful over whether $he should have said that or not.
			<<case "judgemental">>
				$He gestures $his disappointment that only the most pathetic of losers will be fucking $him now. $He pauses for a moment, doubtful over whether $he should have said that or not.
			<</switch>>
		<<else>>
			$He puts on a brave face and gestures that $he'll do $his best. As you send $him off, you catch sight of $him trying to reassure $himself.
		<</if>>
	<</if>>

<<elseif (getSlave($AS).trust < -20)>>

	<<if canTalk(getSlave($AS))>>
		<<if getSlave($AS).sexualFlaw != "none">>
			"Yes, <<Master>>," $he says automatically. $He's badly frightened, and says in a small voice, half to $himself,
			<<switch getSlave($AS).sexualFlaw>>
			<<case "hates oral">>
				"I — I'm going to h-have to <<s>>uck a lot of dick, aren't I." $He swallows and tries to control $himself out of fear, but finally gasps out, "Oh God, I'm <<s>>cared," and bursts into tears.
			<<case "hates anal">>
				"C-cu<<s>>tomer<<s>> are really going to ream me up the butt hole, aren't they." $He <<if !hasAnyArms(getSlave($AS))>>shifts uncomfortably, unconsciously trying to shield $his rear as best $he can manage without <<if isAmputee(getSlave($AS))>>limbs<<else>>hands<</if>><<else>>unconsciously reaches around behind $himself, not quite shielding $his anus with $his hand<<if hasBothArms(getSlave($AS))>>s<</if>><</if>>. $His lower lip quivers and $he tries to control $himself out of fear, but finally gasps out, "Oh God, I'm <<s>>cared," and bursts into tears.
			<<case "hates penetration">>
				"C-cu<<s>>tomer<<s>> are really going to fuck me <<s>>ore, aren't they." $He <<if !hasAnyArms(getSlave($AS))>>shifts uncomfortably, unconsciously trying to shield $his rear as best $he can manage without <<if isAmputee(getSlave($AS))>>limbs<<else>>hands<</if>><<elseif getSlave($AS).vagina > 0>>unconsciously lets $his hand<<if hasBothArms(getSlave($AS))>>s<</if>> fall to $his crotch, but catches $himself and doesn't quite shield $his pussy<<else>>unconsciously reaches around behind $himself, not quite shielding $his anus with $his hand<<if hasBothArms(getSlave($AS))>>s<</if>><</if>>. $His lower lip quivers, and $he tries to control $himself out of fear, but finally gasps out, "Oh God, I'm <<s>>cared," and bursts into tears.
			<<case "repressed">>
				"Being a whore i<<s>> a <<s>>in," $he <<say>>s quietly, half to $himself. "I'm going t-to b-be <<s>>o dirty. I'm going to h-hell." $He starts to cry quietly. $He tries to get $himself back under control, out of fear, but finally wails, "Oh God, I'm <<s>>orry, p-plea<<s>>e forgive me God," and dissolves into sobbing.
			<<case "idealistic">>
				"I'm going to be <<s>>old for <<s>>e<<x>>," $he <<say>>s quietly, half to $himself. "Men are going to pay, and then they're g-going to <<s>>tick their dick<<s>> in me, and then they're going to leave." $He starts to cry openly. "<<S>>-<<s>>orry, <<Master>>. P-plea<<s>>e don't beat me. I'll do it."
			<<case "shamefast">>
				"I'm going to be meat in a brothel," $he <<say>>s quietly, half to $himself. "I'm going to <<s>>tand there naked with the other <<s>>lave<<s>>, and men will pick me and then u<<s>>e my body. Over and over." $He starts to cry openly. "<<S>>-<<s>>orry, <<Master>>. P-plea<<s>>e don't beat me. I'll do it."
			<<case "apathetic">>
				"I gue<<ss>> I'll lie there," $he sighs quietly, half to $himself. "A man will pay and then he'll come into my room where I'm lying on the bed, and he'll <<s>>tick his cock in me and cum and leave. And then the ne<<x>>t man will come in." $He starts to cry quietly. "<<S>>-<<s>>orry, <<Master>>. P-plea<<s>>e don't beat me. I'll let it happen."
			<<case "crude">>
				"Okay," $he <<say>>s, thinking. "My poor cornhole i<<s>> going to be <<s>>uch a <<s>>eminal <<s>>ewer." $He looks doubtful. "<<Sh>>ould I not have <<s>>aid that, <<Master>>?"
			<<case "judgemental">>
				"Gro<<ss>>," $he <<say>>s curtly. "Well, no more hand<<s>>ome boy<<s>> for me, then. Fat pathetic guy<<s>> who patroni<<z>>e whore<<s>>, all the way down. Fuck."
			<</switch>>
		<<else>>
			$He does $his best to control $himself and avoid punishment. "<<Master>>, I will." $He holds $himself together until you dismiss $him; as $he turns away to go, the tears come fast, and $he almost runs into the door frame on $his way out<<if canSee(getSlave($AS))>>, blind with weeping<</if>>.
		<</if>>
	<<else>>
		<<if getSlave($AS).sexualFlaw != "none">>
			$He automatically gestures consent. $He's badly frightened, and gingerly continues
			<<switch getSlave($AS).sexualFlaw>>
			<<case "hates oral">>
				by asking if $he'll have to suck a lot of dick. $He swallows and tries to control $himself out of fear, but finally loses composure and bursts into tears.
			<<case "hates anal">>
				by asking if $he'll be assfucked a lot. $He <<if !hasAnyArms(getSlave($AS))>>shifts uncomfortably, unconsciously trying to shield $his rear as best $he can manage without <<if isAmputee(getSlave($AS))>>limbs<<else>>hands<</if>><<else>>unconsciously reaches around behind $himself, not quite shielding $his anus with $his hand<<if hasBothArms(getSlave($AS))>>s<</if>><</if>>. $His lower lip quivers and $he tries to control $himself out of fear, but finally loses composure and bursts into tears.
			<<case "hates penetration">>
				by asking if $he's going to be constantly fucked. $He <<if !hasAnyArms(getSlave($AS))>>shifts uncomfortably, unconsciously trying to shield $his rear as best $he can manage without <<if isAmputee(getSlave($AS))>>limbs<<else>>hands<</if>><<elseif getSlave($AS).vagina > 0>>unconsciously lets $his hand<<if hasBothArms(getSlave($AS))>>s<</if>> fall to $his crotch, but catches $himself and doesn't quite shield $his pussy<<else>>unconsciously reaches around behind $himself, not quite shielding $his anus with $his hand<<if hasBothArms(getSlave($AS))>>s<</if>><</if>>. $His lower lip quivers, and $he tries to control $himself out of fear, but finally loses composure and bursts into tears.
			<<case "repressed">>
				that being a whore is a sin. $He starts to cry quietly. $He tries to get $himself back under control, out of fear, but finally wails and dissolves into prayers intermixed with sobbing.
			<<case "idealistic">>
				that sex should be with the one you love, not random men. $He starts to cry openly while begging you not to beat $him.
			<<case "shamefast">>
				that $he doesn't want to be naked in a line up for men to choose from. $He starts to cry openly while begging you not to beat $him.
			<<case "apathetic">>
				that all $he has to do is lie there and take it. $He starts to cry quietly.
			<<case "crude">>
				by asking if men enjoy fucking a thoroughly seeded hole. $He pauses for a moment, doubtful over whether $he should have said that or not.
			<<case "judgemental">>
				by expressing $his disappointment with the type of men that frequent brothels.
			<</switch>>
		<<else>>
			$He does $his best to control $himself and avoid punishment. "<<Master>>, I will." $He holds $himself together until you dismiss $him; as $he turns away to go, the tears come fast, and $he almost runs into the door frame on $his way out<<if canSee(getSlave($AS))>>, blind with weeping<</if>>.
		<</if>>
	<</if>>

<<else>>

	$He manages to
	<<if canTalk(getSlave($AS))>>
		get "Oh fuck n-" out
	<<elseif hasAnyArms(getSlave($AS))>>
		flip you an incredibly rude gesture
	<<else>>
		get an incredibly rude gesture out
	<</if>>
	before the compliance systems activate and $he's poleaxed to the ground. Anticipating this, you had <<if $MadamID != 0>>_S.Madam.slaveName <<else>>another, more obedient slave<</if>> standing by to haul $him away. It'll take a couple of hundred customers, but being sold in a brothel for rape should knock the resistance out of $him.

<</if>> /* CLOSES DEVOTION */


code:
App.Data.Facilities.brothel = {
	baseName: "brothel",
	genericName: null,
	jobs: {
		assignee: {
			position: "whore",
			assignment: Job.BROTHEL,
			publicSexUse: true,
			fuckdollAccepted: false
		},
	},
	defaultJob: "assignee",
	manager: {
		position: "madam",
		assignment: Job.MADAM,
		careers: App.Data.misc.madamCareers,
		skill: null,
		publicSexUse: true,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: true,
		shouldSee: true,
		shouldHear: true,
		shouldTalk: true,
		shouldThink: true,
		requiredDevotion: 50
	}
};

App.Entity.Facilities.BrothelJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @override
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);

		// condition is the same as for the club
		if (!App.Entity.Facilities.Job._isBrokenEnough(slave, 51, -50, -20, -50, 50)) {
			r.push(App.Entity.Facilities.Job._stdBreakageMessage(slave));
		}
		return r;
	}
};

App.Entity.Facilities.MadamJob = class extends App.Entity.Facilities.ManagingJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);
		if (slave.intelligence + slave.intelligenceImplant < -50) {
			r.push(`${slave.slaveName} is not intelligent enough to be the Madam.`);
		}
		return r;
	}
};

App.Entity.facilities.brothel = new App.Entity.Facilities.SingleJobFacility(
	App.Data.Facilities.brothel,
	{
		assignee: new App.Entity.Facilities.BrothelJob()
	},
	new App.Entity.Facilities.MadamJob()
);


code:
App.Data.Facilities.cellblock = {
	baseName: "cellblock",
	genericName: null,
	jobs: {
		assignee: {
			position: "confinee",
			assignment: Job.CELLBLOCK,
			publicSexUse: false,
			fuckdollAccepted: false
		},
	},
	defaultJob: "assignee",
	manager: {
		position: "wardeness",
		assignment: Job.WARDEN,
		careers: App.Data.misc.wardenessCareers,
		skill: "wardeness",
		publicSexUse: false,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: true,
		shouldSee: true,
		shouldHear: true,
		shouldTalk: false,
		shouldThink: false,
		requiredDevotion: 51

	}
};

App.Entity.Facilities.CellblockJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);

		if (slave.trust < -50) {
			r.push(`${slave.slaveName} is too terrified for ${this.facility.name} to have an effect.`);
		} else if ((slave.devotion > -20 || slave.trust < -20) && (slave.devotion >= -50 || slave.trust < -50)) {
			r.push(`${slave.slaveName} is not defiant enough for ${this.facility.name} to have an effect.`);
		}

		return r;
	}
};

App.Entity.facilities.cellblock = new App.Entity.Facilities.SingleJobFacility(
	App.Data.Facilities.cellblock,
	{
		assignee: new App.Entity.Facilities.CellblockJob()
	}
);


code:
App.Data.Facilities.clinic = {
	baseName: "clinic",
	genericName: null,
	jobs: {
		patient: {
			position: "patient",
			assignment: Job.CLINIC,
			publicSexUse: false,
			fuckdollAccepted: false
		}
	},
	defaultJob: "patient",
	manager: {
		position: "nurse",
		assignment: Job.NURSE,
		careers: App.Data.misc.nurseCareers,
		skill: "nurse",
		publicSexUse: false,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: true,
		shouldSee: true,
		shouldHear: true,
		shouldTalk: false,
		shouldThink: true,
		requiredDevotion: 51
	}
};

App.Entity.Facilities.ClinicPatientJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);

		if ((slave.health.illness === 0 && slave.health.shortDamage < 20 && slave.health.condition >= 40) &&
			(!S.Nurse || ((slave.chem <= 15 || this.facility.upgrade("Filters") !== 1) &&
				(V.bellyImplants !== 1 || slave.bellyImplant <= -1) &&
				(slave.pregKnown !== 1 || (this.facility.option("SpeedGestation") <= 0 && slave.pregControl !== "speed up")) &&
				(this.facility.option("ObservePregnancy") !== 1 || slave.pregAdaptation * 1000 >= slave.bellyPreg && slave.preg <= slave.pregData.normalBirth / 1.33)))) {
			r.push(`${slave.slaveName} cannot benefit from ${this.facility.name}.`);
		}

		return r;
	}
};

App.Entity.facilities.clinic = new App.Entity.Facilities.SingleJobFacility(
	App.Data.Facilities.clinic,
	{
		patient: new App.Entity.Facilities.ClinicPatientJob()
	}
);


code:
App.Data.Facilities.club = {
	baseName: "club",
	genericName: null,
	jobs: {
		slut: {
			position: "slut",
			assignment: Job.CLUB,
			publicSexUse: true,
			fuckdollAccepted: false
		},
	},
	defaultJob: "slut",
	manager: {
		position: "DJ",
		assignment: Job.DJ,
		careers: App.Data.misc.DJCareers,
		skill: "DJ",
		publicSexUse: false,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: false,
		shouldSee: false,
		shouldHear: true,
		shouldTalk: true,
		shouldThink: true,
		requiredDevotion: 51
	}
};

App.Entity.Facilities.ClubSlutJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);

		// condition is the same as for the brothel
		// TODO: consider moving this to App.Entity.Facilities.SexJob
		if (!App.Entity.Facilities.Job._isBrokenEnough(slave, 51, -50, -20, -50, 50)) {
			r.push(App.Entity.Facilities.Job._stdBreakageMessage(slave));
		}

		return r;
	}
};

App.Entity.Facilities.ClubDJJob = class extends App.Entity.Facilities.ManagingJob {
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);
		if (slave.intelligence + slave.intelligenceImplant < -50) {
			r.push(`${slave.slaveName} is not intelligent enough to DJ.`);
		}
		return r;
	}
};

App.Entity.facilities.club = new App.Entity.Facilities.SingleJobFacility(
	App.Data.Facilities.club,
	{
		slut: new App.Entity.Facilities.ClubSlutJob()
	},
	new App.Entity.Facilities.ClubDJJob()
);


code:
App.Data.Facilities.dairy = {
	baseName: "dairy",
	genericName: null,
	jobs: {
		cow: {
			position: "cow",
			assignment: Job.DAIRY,
			publicSexUse: false,
			fuckdollAccepted: false
		}
	},
	defaultJob: "cow",
	manager: {
		position: "milkmaid",
		assignment: Job.MILKMAID,
		careers: App.Data.misc.milkmaidCareers,
		skill: "milkmaid",
		publicSexUse: false,
		fuckdollAccepted: false,
		broodmotherAccepted: false,
		shouldWalk: true,
		shouldHold: true,
		shouldSee: true,
		shouldHear: true,
		shouldTalk: false,
		shouldThink: true,
		requiredDevotion: 21
	}
};

App.Entity.Facilities.DairyCowJob = class extends App.Entity.Facilities.FacilitySingleJob {
	/**
	 * @param {App.Entity.SlaveState} slave
	 * @returns {string[]}
	 */
	checkRequirements(slave) {
		let r = super.checkRequirements(slave);

		if ((slave.indentureRestrictions > 0) && (V.dairyRestraintsSetting > 1)) {
			r.push(`${slave.slaveName}'s indenture forbids extractive Dairy service.`);
		}
		if ((slave.indentureRestrictions > 1) && (V.dairyRestraintsSetting > 0)) {
			r.push(`${slave.slaveName}'s indenture allows only free range milking.`);
		}
		if (slave.breedingMark === 1 && V.propOutcome === 1 && V.eugenicsFullControl !== 1 && V.arcologies[0].FSRestart !== "unset" && V.dairyRestraintsSetting > 0) {
			r.push(`${slave.slaveName} may only be a free range cow.`);
		}
		if ((V.dairyPregSetting > 0) && ((slave.bellyImplant !== -1) || (slave.broodmother !== 0))) {
			r.push(`${slave.slaveName}'s womb cannot accommodate current machine settings.`);
		}

		if (!isAmputee(slave) && (this.facility.option("RestraintsUpgrade") !== 1) &&
			!App.Entity.Facilities.Job._isBrokenEnough(slave, 20, -50, -20, -50)) {
			r.push(`${slave.slaveName} must be obedient in order to be milked at ${this.facility.name}.`);
		}

		if ((slave.lactation === 0) && (slave.balls === 0)) {
			// the slave does not produce useful liquids now. Let's find out can the dairy make it lactate
			if ((V.dairySlimMaintainUpgrade !== 1 && V.dairySlimMaintain <= 0) && V.dairyImplantsSetting !== 1 && V.dairyImplantsSetting !== 3) {
				// dairy settings disallow any procedures
				r.push(`${slave.slaveName} is not lactating ` + ((V.seeDicks > 0) ? 'or producing semen ' : '') + `and ${this.facility.name}'s current settings forbid the automatic implantation of lactation inducing drugs or manual stimulation to induce it, and thus cannot be a cow.`);
			} else if (slave.boobs <= 300){
				r.push(`${slave.slaveName} is not lactating ` + ((V.seeDicks > 0) ? 'or producing semen ' : '') + 'and have not enough breast tissue to induce lactation.');
			}
		}
		if ((V.dairyStimulatorsSetting >= 2) && (slave.anus <= 2) && (V.dairyPrepUpgrade !== 1)) {
			r.push(`${slave.slaveName}'s anus cannot accommodate current machine settings.`);
		}
		if ((V.dairyPregSetting >= 2) && (slave.vagina <= 2) && (slave.ovaries !== 0) && (V.dairyPrepUpgrade !== 1)) {
			r.push(`${slave.slaveName}'s vagina cannot accommodate current machine settings.`);
		}

		return r;
	}

	get assignment() {
		return `be milked in ${this.facility.name}`;
	}
};

App.Entity.Facilities.Dairy = class extends App.Entity.Facilities.SingleJobFacility {
	constructor() {
		super(App.Data.Facilities.dairy,
			{
				cow: new App.Entity.Facilities.DairyCowJob()
			});
	}

	/** @override */
	get nonEmployeeOccupantsCount() {
		return V.bioreactorsXY + V.bioreactorsXX + V.bioreactorsHerm + V.bioreactorsBarren;
	}
};

App.Entity.facilities.dairy = new App.Entity.Facilities.Dairy();


code:
:: Farmer Select [nobr jump-to-safe jump-hidden jump-from-safe]

<<set $nextButton = "Back", $nextLink = "Farmyard", $encyclopedia = "Farmer">>
<<if ($FarmerID != 0)>>
	<<setLocalPronouns _S.Farmer>>
	<<= SlaveFullName(_S.Farmer)>> is serving as your Farmer.

$He will tend to your crops and animals.
<<else>>
	You have not selected a Farmer.
<</if>>

''Appoint a Farmer from your obedient slaves:''

[[None|Farmyard][removeJob(_S.Farmer, Job.FARMER)]]

<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.farmyard, "Farmyard")>>


code:
/* MOST LIKELY TEMPORARY UNTIL I FIND A BETTER SPOT */

.farmyard-intro {
	margin-bottom: 1em;
}

.farmyard-expand {
	margin-top: 1em;
	margin-bottom: 1em;
}

.farmyard-menials {
	margin-top: 1em;
	margin-bottom: 1em;
}

.farmyard-rules {
	margin-top: 1em;
	margin-bottom: 1em;
}

.farmyard-upgrades {
	margin-top: 1em;
	margin-bottom: 1em;
}

.farmyard-animals {
	margin-top: 1em;
	margin-bottom: 1em;
}

.farmyard-slaves {
	margin-top: 1em;
	margin-bottom: 1em;
}

.farmyard-rename {
	margin-top: 1em;
}