code:
/**
 * @returns {HTMLElement}
 */
App.EndWeek.reputation = function() {
	const el = document.createElement("p");
	let r = [];
	let repLoss;

	if (V.useTabs === 0) {
		App.UI.DOM.appendNewElement("h2", el, `Reputation`);
	}
	r.push(`On formal occasions, you are announced as ${PCTitle()}.`);
	if (V.arcologies[0].FSChattelReligionist !== "unset") {
		if (V.arcologies[0].FSChattelReligionistCreed === 1) {
			r.push(`${V.arcologies[0].name} keeps the creed of the ${V.nicaea.name}. The faithful`);
			if (V.nicaea.achievement === "slaves") {
				if (V.slaves.length > 50) {
					r.push(`<span class="green">strongly approve</span> of the large`);
					FutureSocieties.Change("Chattel Religionist", 5);
				} else if (V.slaves.length > 20) {
					r.push(`<span class="green">approve</span> of the good`);
					FutureSocieties.Change("Chattel Religionist", 2);
				} else {
					r.push(`are not impressed by the`);
				}
				r.push(`number of people you're giving the honor of sexual servitude.`);
			} else if (V.nicaea.achievement === "devotion") {
				if (V.averageDevotion > 80) {
					r.push(`<span class="green">strongly approve</span> of the worshipfulness`);
					FutureSocieties.Change("Chattel Religionist", 5);
				} else if (V.averageDevotion > 50) {
					r.push(`<span class="green">approve</span> of the devotion`);
					FutureSocieties.Change("Chattel Religionist", 2);
				} else {
					r.push(`are not impressed by the devotion`);
				}
				r.push(`of your slaves.`);
			} else {
				if (V.averageTrust > 50) {
					r.push(`<span class="green">strongly approve</span> of the great trust your slaves place in you.`);
					FutureSocieties.Change("Chattel Religionist", 5);
				} else if (V.averageTrust > 20) {
					r.push(`<span class="green">approve</span> of the trust your slaves place in you.`);
					FutureSocieties.Change("Chattel Religionist", 2);
				} else {
					r.push(`are not impressed by the fear many of your slaves feel towards you.`);
				}
			}
		}
	}

	let repDecay = 0.05;
	let enduringRep = V.enduringRep;
	if (V.arcologies[0].FSChattelReligionistLaw === 1) {
		enduringRep = Math.min(enduringRep + 2000, 12000);
	}
	if (V.arcologies[0].FSRestartDecoration === 100) {
		enduringRep = Math.min(enduringRep + 2000, 13000);
		/* that 13000 is not a typo, it allows for some stacking of FSRestart and FSChattel */
	}
	if (V.rep > enduringRep) {
		if (V.arcologies[0].FSMaturityPreferentialistLaw === 1) {
			if (V.PC.actualAge >= 65) {
				r.push(`Since you're getting on in years and have an impressive list of accomplishments, and ${V.arcologies[0].name}'s society respects age, your reputation degrades quite slowly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay - 0.0125));
			} else if (V.PC.actualAge >= 50) {
				r.push(`Since you're well into middle age and have an impressive list of accomplishments, and ${V.arcologies[0].name}'s society respects age, your reputation degrades quite slowly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay - 0.0125));
			} else if (V.PC.actualAge < 35) {
				r.push(`Since you're unusually young for an arcology owner, and ${V.arcologies[0].name}'s society respects age, your reputation degrades quite quickly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay + 0.0125));
			} else {
				r.push(`Since you're only entering middle age, and ${V.arcologies[0].name}'s society respects age, your reputation degrades fairly quickly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay));
			}
		} else if (V.arcologies[0].FSYouthPreferentialistLaw === 1) {
			if (V.PC.actualAge >= 65) {
				r.push(`Since you're getting on in years and have an impressive list of accomplishments, but ${V.arcologies[0].name}'s society is coming to prefer youth to experience, so your reputation degrades fairly quickly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay + 0.0125));
			} else if (V.PC.actualAge >= 50) {
				r.push(`You're well into middle age and have an impressive list of accomplishments, but ${V.arcologies[0].name}'s society is coming to prefer youth to experience, so your reputation degrades fairly quickly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay + 0.0125));
			} else if (V.PC.actualAge < 35) {
				r.push(`You're unusually young for an arcology owner, but ${V.arcologies[0].name}'s society doesn't mind.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay));
			} else {
				r.push(`Since you're entering middle age, and ${V.arcologies[0].name}'s society respects youth, your reputation degrades fairly quickly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay + 0.0125));
			}
		} else {
			if (V.PC.actualAge >= 65) {
				r.push(`Since you're getting on in years and have an impressive list of accomplishments, and ${V.arcologies[0].name}'s society respects age, your reputation degrades quite slowly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay - 0.0125));
			} else if (V.PC.actualAge >= 50) {
				r.push(`Since you're well into middle age and have an impressive list of accomplishments, your reputation degrades fairly slowly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay - 0.0125));
			} else if (V.PC.actualAge < 35) {
				r.push(`Since you're unusually young for an arcology owner, your reputation degrades fairly quickly.`);
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay + 0.0125));
			} else {
				repLoss = Math.trunc((V.rep - enduringRep) * (repDecay));
			}
		}
		if (V.arcologies[0].FSChattelReligionistLaw === 1) {
			if (repLoss > 100) {
				repLoss -= 100;
				V.PC.degeneracy = 0;
			} else {
				repLoss = 0;
				V.PC.degeneracy = 0;
			}
			r.push(`Since you are the Prophet, your reputation degrades less.`);
		}
		if (V.arcologies[0].FSRestartDecoration === 100) {
			if (repLoss > 100) {
				repLoss -= 100;
				V.PC.degeneracy = 0;
			} else {
				repLoss = 100;
				V.PC.degeneracy = 0;
			}
			r.push(`Since you are an established member of the Societal Elite, your public reputation degrades less.`);
		}
		if (enduringRep > 8000) {
			r.push(`However, you have been a figure of renown for so long that much of your reputation has become permanent.`);
		} else if (enduringRep > 5000) {
			r.push(`However, you have been a figure of repute for enough time that part of your reputation has become permanent.`);
		} else if (enduringRep > 2000) {
			r.push(`However, you have been a figure of regard for long enough that some of your reputation has become permanent.`);
		}
		if (repLoss > 500 * (1 - (5 - V.baseDifficulty) / 10)) {
			repLoss = 500 * (1 - (5 - V.baseDifficulty) / 10);
		} else if (repLoss < 0) {
			repLoss = 0;
		}
		V.enduringRep += Math.trunc(1 + Math.pow((10000 - V.enduringRep) / 5770, 2) * repLoss * 0.1);
	} else {
		if (V.arcologies[0].FSChattelReligionistLaw === 1 || V.arcologies[0].FSRestartDecoration === 100) {
			V.PC.degeneracy = 0;
		}
		repLoss = 0;
		if (enduringRep > 8000) {
			r.push(`You have been a figure of renown for so long that your reputation does not decay past its present level.`);
		} else if (enduringRep > 5000) {
			r.push(`You have been a figure of repute for enough time that your reputation does not decay past its present level.`);
		} else if (enduringRep > 2000) {
			r.push(`You have been a figure of regard for long enough that your reputation does not decay past its present level.`);
		}
	}

	/* play games with overflow. Gains are calculated (and then sadly rounded) on previous pages but losses are calculated here, after the overflow happened. Let's borrow from the past.*/
	if (V.lastWeeksRepExpenses.overflow < 0) {
		V.rep += Math.abs(V.lastWeeksRepExpenses.overflow);
		V.lastWeeksRepExpenses.overflow = 0;
	}
	repX(forceNeg(repLoss), "multiplier");

	if (V.weatherAwareness === 0 && V.weatherCladding === 2) {
		r.push(`The public is awestruck by the beautiful weather hardening you have applied to the arcology's exterior, though they do not understand why you would waste so much money first ruining your arcology's appearance by doing this.`);
		repX(10, "architecture");
	} else if (V.weatherAwareness === 0 && V.weatherCladding === 1) {
		r.push(`The public <span class="red">disapproves</span> of the ugly weather hardening you have applied to the arcology's exterior, not understanding what you're worried about.`);
		repX(-100, "architecture");
	}

	enduringRep = V.enduringRep;
	if (V.arcologies[0].FSRestartDecoration === 100) {
		r.push(`As a member of the Societal Elite, your appearance has no bearing on your reputation.`);
	} else {
		if (V.PC.dick === 0 && V.PC.boobs >= 300 && V.PC.title === 0) {
			if (V.rep > 18000 - enduringRep) {
				r.push(`Your reputation is so well-established that society has accepted your notoriously feminine appearance despite how unusual it is for a prominent slaveowner to look like you do.`);
				if (V.arcologies[0].FSGenderRadicalist > 30) {
					r.push(`Indeed, society sees you as entirely male, since you are powerful, and <span class="green">strongly approves</span> of your nonconformity; this advances the redefinition of gender around power.`);
					FutureSocieties.Change("Gender Radicalist", 5);
				} else if (V.arcologies[0].FSGenderFundamentalist > 30) {
					r.push(`Indeed, society has been reconciled to female leadership, preferring to see you as a mother figure.`);
				}
			} else if (V.arcologies[0].FSGenderRadicalist > 40) {
				r.push(`Society accepts you as an arcology owner, since it has become open-minded about power and gender.`);
				if (V.arcologies[0].FSGenderRadicalist > 50) {
					r.push(`Indeed, society sees you as fundamentally male, since you are powerful, and <span class="green">strongly approves</span> of your audacity; this advances the redefinition of gender around power.`);
					FutureSocieties.Change("Gender Radicalist", 5);
				}
			} else {
				r.push(`Most prominent slaveowners are male, and your obviously feminine appearance makes it <span class="red">harder for you to maintain your reputation.</span>`);
				repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCappearance");
				if (V.arcologies[0].FSGenderFundamentalist > 10) {
					r.push(`Society <span class="red">strongly resents</span> your being an arcology owner; this damages the idea that women should not be in positions of responsibility.`);
					FutureSocieties.Change("Gender Fundamentalist", -5);
				}
			}
		} else if ((V.PC.boobs >= 300) || V.PC.title === 0) {
			if (V.rep > 15000 - enduringRep) {
				r.push(`Your reputation is so strong that society has accepted your feminine appearance despite how unusual it is for a prominent slaveowner to look like you do.`);
				if (V.arcologies[0].FSGenderRadicalist > 30) {
					r.push(`Indeed, society sees you as entirely male, since you are powerful, and <span class="green">strongly approves</span> of your nonconformity; this advances the redefinition of gender around power.`);
					FutureSocieties.Change("Gender Radicalist", 5);
				} else if (V.arcologies[0].FSGenderFundamentalist > 30) {
					r.push(`Indeed, society has been reconciled to your feminine appearance, seeing you as a person apart.`);
				}
			} else if (V.arcologies[0].FSGenderRadicalist > 20) {
				r.push(`Society accepts you as an arcology owner, since it has become open-minded anyone who has a cock and fucks.`);
				if (V.arcologies[0].FSGenderRadicalist > 30) {
					r.push(`Indeed, society sees you as dominant, since you fuck bitches, and <span class="green">strongly approves</span> of your nonconformity; this advances the redefinition of gender around power.`);
					FutureSocieties.Change("Gender Radicalist", 5);
				}
			} else {
				r.push(`Most prominent slaveowners are very masculine, and your feminine appearance makes it <span class="red">harder for you to maintain your reputation.</span>`);
				repX(forceNeg(Math.min((V.rep * 0.025), 250)), "PCappearance");
				if (V.arcologies[0].FSGenderFundamentalist > 30) {
					r.push(`Society <span class="red">strongly resents</span> your being an arcology owner; this damages the idea that feminine people should not be in positions of responsibility.`);
					FutureSocieties.Change("Gender Fundamentalist", -5);
				}
			}
		} else if ((V.PC.dick === 0) || (V.PC.vagina !== -1)) {
			if (V.rep > 15000 - enduringRep) {
				r.push(`Your reputation is so strong that society has accepted your unorthodox arrangement downstairs, for an arcology owner.`);
				if (V.arcologies[0].FSGenderRadicalist > 30) {
					r.push(`Indeed, society sees you as entirely male, since you are powerful, and <span class="green">strongly approves</span> of your nonconformity; this advances the redefinition of gender around power.`);
					FutureSocieties.Change("Gender Radicalist", 5);
				} else if (V.arcologies[0].FSGenderFundamentalist > 30) {
					r.push(`Indeed, society has been reconciled to your strangeness, seeing you as a person apart.`);
				}
			} else if (V.arcologies[0].FSGenderRadicalist > 20) {
				r.push(`Society accepts you as an arcology owner, since it has become open-minded about the exact genital layout of powerful people.`);
				if (V.arcologies[0].FSGenderRadicalist > 30) {
					r.push(`Indeed, society sees you as dominant, since you are powerful, and <span class="green">strongly approves</span> of your nonconformity; this advances the redefinition of gender around power.`);
					FutureSocieties.Change("Gender Radicalist", 5);
				}
			} else {
				r.push(`Most prominent slaveowners are very masculine, and though your unorthodox arrangement downstairs isn't obvious when you're clothed, the rumors are unavoidable and it's harder for you to maintain your reputation.`);
				repX(forceNeg(Math.min((V.rep * 0.025), 250)), "PCappearance");
				if (V.arcologies[0].FSGenderFundamentalist > 30) {
					r.push(`Society <span class="red">strongly resents</span> your being an arcology owner; this damages the idea that people who are not men should not be in positions of responsibility.`);
					FutureSocieties.Change("Gender Fundamentalist", -5);
				}
			}
		}
	}

	/* height block here */

	if (V.arcologies[0].FSChattelReligionistLaw === 1 || V.arcologies[0].FSRestartDecoration === 100) {
		/* already handled above */
	} else if (V.arcologies[0].FSIntellectualDependency !== "unset") {
		if (V.PC.intelligence + V.PC.intelligenceImplant < -10) {
			if (V.rep > 18000 - enduringRep) {
				r.push(`You've somehow built such a reputation for yourself that your lack of a brain is no longer a societal concern.`);
			} else {
				repX(forceNeg(Math.min((V.rep * 0.025), 100)), "PCappearance");
				r.push(`Society <span class="red">is uncomfortable</span> with just how slow you are. While they may find your mannerisms cute, it is not befitting of a leader.`);
			}
		}
	} else if (V.arcologies[0].FSSlaveProfessionalism !== "unset") {
		if (V.PC.intelligence + V.PC.intelligenceImplant < 100) {
			if (V.rep > 18000 - enduringRep) {
				r.push(`You've built such a reputation for yourself that you not being a genius is no longer a societal concern.`);
			} else {
				repX(forceNeg(Math.min((V.rep * 0.05), 750)), "PCappearance");
				r.push(`Society <span class="red">strongly despises</span> being led by someone so easily outsmarted by even the slave population.`);
				FutureSocieties.Change("Slave Professionalism", -10);
			}
		}
	} else if (V.PC.intelligence + V.PC.intelligenceImplant <= 10) {
		if (V.rep > 18000 - enduringRep) {
			r.push(`You've managed to build such a reputation for yourself that your lack of intelligence is no longer a societal concern.`);
		} else {
			repX(forceNeg(Math.min((V.rep * 0.05), 750)), "PCappearance");
			r.push(`Society <span class="red">is uncomfortable</span> being led by someone not smart. Your lack of intelligence brings your every action under scrutiny.`);
		}
	} else if (V.PC.intelligence + V.PC.intelligenceImplant <= 50) {
		if (V.rep > 12000 - enduringRep) {
			r.push(`You've built such a reputation for yourself that your lack of intelligence is no longer a societal concern.`);
		} else {
			repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCappearance");
			r.push(`Society <span class="red">is uncomfortable</span> being led by someone not very smart. Your lack of intelligence brings your every action under scrutiny.`);
		}
	}

	if (V.policies.sexualOpenness === 1) {
		if (V.arcologies[0].FSChattelReligionistLaw === 1 || V.arcologies[0].FSRestartDecoration === 100) {
			/* already handled above */
		} else {
			if (V.arcologies[0].FSGenderRadicalist !== "unset") {
				if (V.rep > 18000 - enduringRep) {
					r.push(`You are so well regarded that society has acquiesced that getting penetrated is not a sure sign of femininity.`);
				} else {
					r.push(`Society views getting fucked as sign of femininity and is <span class="red">strongly against your sexual preferences.</span>`);
					FutureSocieties.Change("Gender Radicalist", -1);
					repX(-1000, "PCactions");
				}
			} else if (V.arcologies[0].FSGenderFundamentalist !== "unset" && V.PC.vagina !== -1 && V.PC.title === 0) {
				if (V.rep > 10000 - enduringRep) {
					r.push(`Society has grown accustomed to your efforts enough to not care that you enjoy slave dick. In fact, it even strengthens traditional gender roles, even though you insist on breaking them.`);
					FutureSocieties.Change("Gender Fundamentalist", 1);
				} else {
					r.push(`Society wonders if you would be happier in a whore house getting fucked all day instead of trying to lead an arcology. Your efforts strongly support the idea that women should not be in positions of responsibility.`);
					FutureSocieties.Change("Gender Fundamentalist", -3);
					repX(-1000, "PCactions");
				}
			} else {
				if (V.rep > 15000 - enduringRep) {
					r.push(`You are so well liked that society has accepted that you enjoy taking everything a slave has to offer.`);
				} else {
					r.push(`Society finds your penchant for taking slave dick <span class="red">very distasteful</span> for a slaveowner.`);
					repX(-500, "PCactions");
				}
			}
		}
	}

	if (V.secExpEnabled > 0) {
		if (V.SecExp.smilingMan.progress === 20) {
			r.push(`The grim statue of the Smiling Man outside your arcology <span class="green">reminds the world of who managed to eliminate such a threat.</span>`);
			repX(100, "architecture");
		}

		if (V.SecExp.edicts.weaponsLaw === 3) {
			r.push(`The absence of any kind of restriction on weaponry within your arcology is <span class="green">welcomed by your citizens</span> as sign of your respect for the ideals the Free Cities stand for.`);
			repX(20, "edicts");
		}
	}

	if (V.SF.Toggle && V.SF.Active >= 1 && V.SF.UC.Assign > 0) {
		const sfArray = [];
		sfArray.push(`Assigning a`);
		if (V.SF.UC.Assign === 1) {
			sfArray.push(`small`);
		} else {
			sfArray.push(`large`);
		}
		sfArray.push(`portion of ${V.SF.Lower} to <span class="green">undercover work, slightly boosts your reputation.</span>`);
		App.Events.addNode(el, sfArray, "div");
		let value;
		if (V.SF.UC.Assign === 1) {
			value = V.SF.ArmySize * 0.05;
		} else {
			value = V.SF.ArmySize * 0.25;
		}
		repX(value, "specialForces");
	} else if (V.SF.FS.BadOutcome === "ISOLATION") {
		r.push(App.UI.DOM.makeElement("div", `Your citizens are <span class="red">very displeased</span> that you are hosting a legion of heavily armed squatters in your basement.`));
		repX(forceNeg(V.SF.ArmySize + App.SF.upgrades.total()), "specialForces");
	}

	if (V.arcologies[0].FSSupremacist !== "unset") {
		if (V.PC.race === V.arcologies[0].FSSupremacistRace) {
			r.push(`Since you are a member of the ${V.PC.race} race, society <span class="green">strongly approves</span> of your ownership of the arcology.`);
			FutureSocieties.Change("Supremacist", 5);
		}
	} else if (V.arcologies[0].FSSubjugationist !== "unset") {
		if (V.PC.race === V.arcologies[0].FSSubjugationistRace) {
			if (V.rep > 15000 - enduringRep) {
				r.push(`Your reputation is so strong that society has accepted your ${V.PC.race}ness despite you being an inferior race.`);
			} else {
				r.push(`Society <span class="red">loathes;</span> being lead by an inferior ${V.PC.race}, believing that any other race would make a far better leader than you.`);
				repX(forceNeg(200 * (V.arcologies[0].FSSubjugationist / V.FSLockinLevel)), "PCappearance");
			}
		}
	}

	if (V.arcologies[0].FSAssetExpansionist !== "unset") {
		if (V.PC.boobs >= 1400) {
			r.push(`Society loves enormous breasts and you are no exception; your`);
			if (V.PC.boobsImplant > 0) {
				r.push(`chest balloons`);
			} else {
				r.push(`cow tits`);
			}
			r.push(`<span class="green">improve</span> your public image.`);
			repX(10, "PCappearance");
		}
		if (V.PC.butt >= 5) {
			r.push(`Society loves big butts and you are no exception; your`);
			if (V.PC.buttImplant > 0) {
				r.push(`inflated ass`);
			} else {
				r.push(`fat ass`);
			}
			r.push(`<span class="green">improves</span> your public image.`);
			repX(10, "PCappearance");
		}
		if (V.PC.balls >= 9) {
			r.push(`Society loves big things and the bulge in your crotch is no exception; your swollen balls <span class="green">improve</span> your public image.`);
			repX((5 * V.PC.ballsImplant), "PCappearance");
		}
	} else if (V.arcologies[0].FSSlimnessEnthusiast !== "unset") {
		if (V.PC.boobs >= 1000) {
			r.push(`Society finds big breasts unsightly and you are no exception; your`);
			if (V.PC.boobsImplant > 0) {
				r.push(`chest balloons`);
			} else {
				r.push(`fat tits`);
			}
			r.push(`<span class="red">harm</span> your public image.`);
			repX(forceNeg((V.PC.boobs / 100) * 3), "PCappearance");
		}
		if (V.PC.butt >= 5) {
			r.push(`Society finds big butts unsightly and you are no exception; your`);
			if (V.PC.buttImplant > 0) {
				r.push(`inflated ass`);
			} else {
				r.push(`fat ass`);
			}
			r.push(`<span class="red">harms</span> your public image.`);
			repX(forceNeg(10 * V.PC.butt), "PCappearance");
		}
	}

	if (V.arcologies[0].FSTransformationFetishist !== "unset") {
		if (V.PC.boobsImplant > 0) {
			r.push(`Society loves fake breasts and yours are no exception; your breast implants <span class="green">improve</span> your public image.`);
			repX((V.PC.boobsImplant / 5), "PCappearance");
		}
		if (V.PC.buttImplant > 0) {
			r.push(`Society loves fake butts and yours are no exception; your ass implants <span class="green">improve</span> your public image.`);
			repX((7 * V.PC.buttImplant), "PCappearance");
		}
		if (V.PC.ballsImplant > 0) {
			r.push(`Society loves everything augmented and the bulge in your crotch is no exception; your swollen balls <span class="green">improve</span> your public image.`);
			repX((5 * (V.PC.ballsImplant)), "PCappearance");
		}
		if (V.arcologies[0].FSRepopulationFocus !== "unset") {
			if (V.PC.boobs >= 1000 && V.PC.boobsImplant === 0) {
				r.push(`Society approves of anything that helps the repopulation efforts. Your large breasts promise plentiful milk and <span class="green">improve</span> your public image.`);
				repX((V.PC.boobs / 50), "PCappearance");
			}
			if (V.PC.balls >= 5) {
				r.push(`Society loves anything that helps the repopulation efforts. Your huge fertile balls indicate that you're a successful breeder and <span class="green">strongly improves</span> your public image.`);
				repX((15 * V.PC.balls), "PCappearance");
			}
		}
	} else if (V.arcologies[0].FSBodyPurist !== "unset") {
		if (V.PC.boobsImplant !== 0) {
			r.push(`Society finds fake breasts repulsive and yours are no exception; your balloon-like breasts <span class="red">harm</span> your public image.`);
			repX(forceNeg(V.PC.boobsImplant / 10), "PCappearance");
		}
		if (V.PC.buttImplant > 0) {
			r.push(`Society finds fake butts unsightly and yours is no exception; your inflated ass <span class="red">harms</span> your public image.`);
			repX(forceNeg(10 * V.PC.buttImplant), "PCappearance");
		}
		if (V.PC.ballsImplant > 0) {
			r.push(`Society finds everything unnatural disgusting and the grotesque bulge in your crotch is no exception; your gel filled balls <span class="red">harm</span> your public image.`);
			repX(forceNeg(10 * V.PC.ballsImplant), "PCappearance");
		}
		if (V.arcologies[0].FSRepopulationFocus !== "unset" && V.PC.boobs >= 1000 && V.PC.boobsImplant === 0) {
			r.push(`Society approves of anything that helps the repopulation efforts. Your large breasts promise plentiful milk and <span class="green">improve</span> your public image.`);
			repX((V.PC.boobs / 50), "PCappearance");
		}
	} else if (V.arcologies[0].FSRepopulationFocus !== "unset") {
		if (V.PC.boobs >= 1000 && V.PC.boobsImplant === 0) {
			r.push(`Society approves of anything that helps the repopulation efforts. Your large breasts promise plentiful milk and <span class="green">improve</span> your public image.`);
			repX((V.PC.boobs / 50), "PCappearance");
		}
		if (V.PC.balls >= 5) {
			r.push(`Society loves anything that helps the repopulation efforts. Your huge fertile balls indicate that you're a successful breeder and <span class="green">strongly improves</span> your public image.`);
			repX((5 * (V.PC.balls)), "PCappearance");
		}
	}

	if (
		(V.PC.belly >= 1500) ||
		(V.PC.career === "escort" && V.PC.belly >= 500 && V.PC.preg > 0) // .belly? .clothing?
	) {
		if (V.arcologies[0].FSRestart !== "unset") {
			if (V.arcologies[0].FSRestartDecoration === 100) {
				if (V.PC.pregSource !== -1 && V.PC.pregSource !== -6) {
					r.push(`Most prominent female owners avoid being penetrated on`);
					if (V.policies.sexualOpenness === 1) {
						r.push(`principle, though you choose the opposite; your fecund figure suggests a slave knocked you up, a huge`);
					} else {
						r.push(`principle; your fecund figure exposes not only your willingness to be penetrated, but your`);
					}
					r.push(`breach of eugenics. Your citizens are <span class="red">livid</span> over your actions and are calling for your removal.`);
					repX(-500, "PCactions");
					if (V.eugenicsFullControl !== 1) {
						V.failedElite += 100;
					}
				} else {
					r.push(`Since it is public knowledge that you are carrying a child in the name of eugenics, society views you as a bearer of the future and <span class="green">celebrates</span> your contributions to society.`);
					repX(200, "PCappearance");
					V.failedElite -= 10;
				}
			} else {
				if (V.PC.pregSource !== -1 && V.PC.pregSource !== -6) {
					r.push(`Most prominent female owners avoid being penetrated on`);
					if (V.policies.sexualOpenness === 1) {
						r.push(`principle, though you choose the opposite; your fecund figure suggests a slave knocked you up, a huge`);
					} else {
						r.push(`principle; your fecund figure exposes not only your willingness to be penetrated, but your`);
					}
					r.push(`breach of the eugenics you are pushing for. Your citizens are <span class="red">disgusted</span> by both your body and your lack of commitment.`);
					repX(-500, "PCactions");
					if (V.eugenicsFullControl !== 1) {
						V.failedElite += 50;
					}
				} else {
					r.push(`Since it is public knowledge that you are carrying a child in the name of eugenics, society views you as a bearer of modernity and <span class="green">commends</span> your contributions to society.`);
					repX(200, "PCappearance");
					V.failedElite -= 5;
				}
			}
		} else if (V.arcologies[0].FSRepopulationFocus >= 60) {
			r.push(`Most prominent female owners avoid being penetrated on principle, but your arcology values motherhood so much that it is more pleased with your dedication than it is disappointed in your`);
			if (V.policies.sexualOpenness === 1) {
				r.push(`suspected slave baby.`);
			} else {
				r.push(`penetration.`);
			}
			repX(10, "PCappearance");
		} else if (V.rep < 20000 - enduringRep) {
			r.push(`You have carved out such a name for yourself that society has come to terms with being led by a woman with child.`);
		} else {
			r.push(`Most prominent female owners avoid being penetrated on`);
			if (V.policies.sexualOpenness === 1) {
				r.push(`principle, though you choose the opposite; your fecund figure suggests a slave knocked you up,`);
			} else {
				r.push(`principle; your fecund figure exposes your willingness to be penetrated,`);
			}
			r.push(`making it <span class="red">harder for you to maintain your reputation.</span>`);
			repX(-200, "PCactions");
		}
	}

	if ((V.PC.career === "escort" || V.PC.career === "prostitute") && V.rep < 16000 - enduringRep) {
		r.push(`Society <span class="red">frowns</span> over being run by an ex-whore.`);
		if (V.PC.career === "escort") {
			r.push(`The presence of porn of you on the net doesn't aid your reputation either.`);
		}
		repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCactions");
	} else if (V.PC.career === "escort" || V.PC.career === "prostitute") {
		r.push(`Your reputation is so strong that society has accepted your previous endeavors despite how unusual it is for a prominent slaveowner to have once nearly been a slave.`);
	}
	if (V.PC.career === "child prostitute" && V.rep < 22000 - enduringRep) {
		r.push(`Society <span class="red">is mortified</span> over being run by a sex-addled child whore.`);
		if (V.PC.visualAge < V.minimumSlaveAge) {
			r.push(`The fact that you appear underage only makes the thought worse.`);
		}
		repX(forceNeg(Math.min((V.rep * 0.06), 500)), "PCactions");
	} else if (V.PC.career === "child prostitute") {
		r.push(`Your reputation is so strong that society has finally accepted your previous life as a child whore.`);
	}
	if ((V.PC.career === "servant" || V.PC.career === "handmaiden" || V.PC.career === "child servant") && V.rep < 12000 - enduringRep) {
		r.push(`Society <span class="red">frowns</span> over being run by an ex-`);
		if (V.PC.title === 1) {
			r.push(`butler,`);
		} else {
			r.push(`maid,`);
		}
		r.push(`despite how prominent their previous owner was.`);
		repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCactions");
	} else if (V.PC.career === "servant" || V.PC.career === "handmaiden" || V.PC.career === "child servant") {
		r.push(`Your reputation is so strong that society has accepted your previous vocation despite how unusual it is for a prominent slaveowner to have once been nothing more than a lowly servant.`);
	}
	if (V.PC.career === "gang" && V.rep < 15000 - enduringRep) {
		r.push(`Society <span class="red">frowns</span> over being run by an ex-gang leader, no matter how strong they might have been.`);
		repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCactions");
	} else if (V.PC.career === "hoodlum" && V.rep < 16000 - enduringRep) {
		r.push(`Society <span class="red">dislikes</span> being run by some low-life thug, no matter how much "street cred" they may have once held.`);
		repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCactions");
	} else if (V.PC.career === "street urchin" && V.rep < 20000 - enduringRep) {
		r.push(`Society <span class="red">hates</span> being run by some homeless street rat; how you even managed to get this far baffles them.`);
		repX(forceNeg(Math.min((V.rep * 0.06), 500)), "PCactions");
	} else if (V.PC.career === "BlackHat" && V.rep < 15000 - enduringRep) {
		r.push(`Society <span class="red">dislikes</span> being run by someone so capable of dredging up secrets, especially when they used to do it for the highest bidder.`);
		repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCactions");
	} else if (V.PC.career === "hacker" && V.rep < 16000 - enduringRep) {
		r.push(`Society <span class="red">dislikes</span> being run by someone so capable of dredging up secrets, especially when they do it for fun.`);
		repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCactions");
	} else if (V.PC.career === "script kiddy" && V.rep < 18000 - enduringRep) {
		r.push(`Society <span class="red">dislikes</span> being run by someone with such a reckless and disruptive idea of fun.`);
		repX(forceNeg(Math.min((V.rep * 0.05), 500)), "PCactions");
	} else if (V.PC.career === "gang" || V.PC.career === "hoodlum" || V.PC.career === "street urchin" || V.PC.career === "BlackHat" || V.PC.career === "hacker" || V.PC.career === "script kiddy") {
		r.push(`Your reputation is strong enough that society has come to accept your background as part of your image.`);
	}

	if (V.PCSlutContacts === 2) {
		r.push(`You are actively starring in pornographic videos. While they are rather exclusive, <span class="red">some still leak out to the public,</span> harming your image.`);
		repX(-50, "PCactions");
		if (canGetPregnant(V.PC)) {
			r.push(`That's not all that leaks out of you, considering all your shoots are rubber free.`);
			knockMeUp(V.PC, 20, 0, -5);
		}
	}

	if (V.arcologies[0].FSRomanRevivalist !== "unset") {
		if (V.mercenaries > 0) {
			r.push(`Society <span class="green">approves</span> of how you are providing for the defense of the state, as should all citizens of the new Rome.`);
			FutureSocieties.Change("Roman Revivalist", V.mercenaries);
		}
		if (V.slaves.length > 20 && V.cash > 50000) {
			r.push(`Society <span class="green">strongly approves</span> of your wealth and prosperity, fit goals for the`);
			if (V.PC.customTitle) {
				r.push(`${V.PC.customTitle}`);
			} else if (V.PC.title === 1) {
				r.push(`new Roman man.`);
			} else {
				r.push(`rising Roman lady.`);
			}
			FutureSocieties.Change("Roman Revivalist", 5);
		}
		if (V.language !== App.Data.FutureSociety.records.FSRomanRevivalist.language) {
			r.push(`Continuing to use ${V.language} as the lingua franca of ${V.arcologies[0].name} rather than the storied Latin disappoints society and causes doubt about your revivalist project.`);
			FutureSocieties.Change("Roman Revivalist", -2);
		}
	} else if (V.arcologies[0].FSAztecRevivalist !== "unset") {
		if (V.PC.visualAge >= 35) {
			r.push(`Society <span class="green">approves</span> of your advancing age, which advances the ancient Aztec ideal of an experienced leader of the people.`);
			FutureSocieties.Change("Aztec Revivalist", 1);
		}
		if (V.HeadGirlID === 0) {
			r.push(`Society <span class="red">disapproves</span> of you not having a Head Girl as an advisor and assistant.`);
			FutureSocieties.Change("Aztec Revivalist", -2);
		} else {
			r.push(`Society <span class="green">approves</span> of your reliance on a Head Girl as an advisor and assistant.`);
			FutureSocieties.Change("Aztec Revivalist", 2);
		}
		if (V.PC.skill.warfare < 0) {
			r.push(`Society <span class="red">greatly disapproves</span> of your feebleness in the arts of war.`);
			FutureSocieties.Change("Aztec Revivalist", -4);
		} else if (V.PC.skill.warfare < 50) {
			r.push(`Society <span class="red">disapproves</span> of you not being properly trained in the arts of war.`);
			FutureSocieties.Change("Aztec Revivalist", -2);
		} else {
			r.push(`Society <span class="green">approves</span> of having a leader that is trained in the arts of war.`);
			FutureSocieties.Change("Aztec Revivalist", 2);
		}
		if (V.language !== App.Data.FutureSociety.records.FSAztecRevivalist.language) {
			r.push(`Continuing to use ${V.language} as the lingua franca of ${V.arcologies[0].name} rather than the revived Nahuatl disappoints society and causes doubt about your revivalist project.`);
			FutureSocieties.Change("Aztec Revivalist", -3);
		}
	} else if (V.arcologies[0].FSNeoImperialist !== "unset") {
		if (V.mercenaries > 0) {
			r.push(`Society <span class="green">approves</span> of your strong militarism and elite mercenaries, as your tradition of Imperial conquest glorifies military success above all else.`);
			FutureSocieties.Change("Neo-Imperialist", V.mercenaries);
		}
		if (V.slaves.length > 20 && V.cash > 50000) {
			r.push(`Society <span class="green">strongly approves</span> of your great wealth and prosperity, as is only fitting for an`);
			if (V.PC.customTitle) {
				r.push(`${V.PC.customTitle}.`);
			} else if (V.PC.title === 1) {
				r.push(`proper Imperial noble.`);
			} else {
				r.push(`graceful Imperial noble.`);
			}
			FutureSocieties.Change("Neo-Imperialist", 5);
		}
		if (V.cash < 1000) {
			r.push(`Society <span class="red">disapproves</span> of your poverty; it is viewed as completely unbefitting for an Imperial ruler to have so little cash on hand, and indicative of weakness in your rule.`);
			FutureSocieties.Change("Neo-Imperialist", -2);
		}
		if (V.PC.skill.warfare < 0) {
			r.push(`Society greatly disapproves of your weakness in combat. The core duty of any Imperial noble is to fight, and your failure to understand the art of war is an unacceptable weakness.`);
			FutureSocieties.Change("Neo-Imperialist", -4);
		} else if (V.PC.skill.warfare < 50) {
			r.push(`Society <span class="red">disapproves</span> of you lacking training in the art of warfare, as fighting is a core duty of any Imperial noble.`);
			FutureSocieties.Change("Neo-Imperialist", -2);
		} else {
			r.push(`Society <span class="green">approves</span> of having a leader who is a capable warrior. Your strength in battle is seen proof of your indisputable right to rule.`);
			FutureSocieties.Change("Neo-Imperialist", 2);
		}
	} else if (V.arcologies[0].FSEgyptianRevivalist !== "unset") {
		const racialVarieties = new Set(V.slaves.map((s) => s.race));
		if (racialVarieties.size > 4) {
			r.push(`Society <span class="green">strongly approves</span> of how you own a cornucopia of different races, which advances the ancient Egyptian ideal of cosmopolitan sex slavery.`);
			FutureSocieties.Change("Egyptian Revivalist", 5);
		}
		if (V.language !== App.Data.FutureSociety.records.FSEgyptianRevivalist.language) {
			r.push(`Continuing to use ${V.language} as the lingua franca of ${V.arcologies[0].name} rather than revived Ancient Egyptian disappoints society and causes doubt about your revivalist project.`);
			FutureSocieties.Change("Egyptian Revivalist", -2);
		}
	} else if (V.arcologies[0].FSEdoRevivalist !== "unset") {
		const threshold = Math.trunc(V.rep / 2000);
		if (V.slaves.filter(s => [Job.CLUB, Job.DJ, Job.PUBLIC].includes(s.assignment) || (s.assignment === Job.RECRUITER && V.recruiterTarget === "other arcologies" && V.arcologies[0].influenceTarget !== -1)).length <= threshold) {
			r.push(`Society <span class="red">disapproves</span> of your failure to provide for cultural development by offering public servants or club slaves in a number that befits your reputation.`);
			FutureSocieties.Change("Edo Revivalist", -2);
		} else {
			r.push(`Society <span class="green">approves</span> of your provision for cultural development by offering public servants and club slaves in a number that befits your reputation.`);
			FutureSocieties.Change("Edo Revivalist", 2);
		}
		if (V.language !== App.Data.FutureSociety.records.FSEdoRevivalist.language) { //
			r.push(`Continuing to use ${V.language} as the lingua franca of ${V.arcologies[0].name} rather than pure Japanese <span class="red">disappoints</span> society and causes doubt about your revivalist project.`);
			FutureSocieties.Change("Edo Revivalist", -2);
		}
	} else if (V.arcologies[0].FSArabianRevivalist !== "unset") {
		if (fuckSlavesLength() < V.rep / 3500) {
			r.push(`Society <span class="red">disapproves</span> of the small size of your harem, feeling that you do not have enough fucktoys or slaves in your master suite for your reputation.`);
			FutureSocieties.Change("Arabian Revivalist", -2);
		} else {
			r.push(`Society <span class="green">approves</span> of the size of your harem, feeling that you have a good number of fucktoys and slaves in your master suite for your reputation.`);
			FutureSocieties.Change("Arabian Revivalist", 2);
		}
		if (V.language !== App.Data.FutureSociety.records.FSArabianRevivalist.language) {
			r.push(`Continuing to use ${V.language} as the lingua franca of ${V.arcologies[0].name} rather than the Arabic in which the word of God was passed to Muhammad disappoints society and causes doubt about your revivalist project.`);
			FutureSocieties.Change("Arabian Revivalist", -2);
		}
	} else if (V.arcologies[0].FSChineseRevivalist !== "unset") {
		if (V.HeadGirlID === 0) {
			r.push(`Society <span class="red">disapproves</span> of your failure to rely on a Head Girl, as proper imperial administration requires,`);
			FutureSocieties.Change("Chinese Revivalist", -2);
		} else {
			r.push(`Society <span class="green">approves</span> of your reliance on a Head Girl, as proper imperial administration requires,`);
			FutureSocieties.Change("Chinese Revivalist", 2);
		}
		if (V.RecruiterID === 0) {
			r.push(`<span class="red">disapproves</span> of your failure to maintain a Recruiter to expand the Middle Kingdom,`);
			FutureSocieties.Change("Chinese Revivalist", -2);
		} else {
			r.push(`<span class="green">approves</span> of your maintaining a Recruiter to expand the Middle Kingdom,`);
			FutureSocieties.Change("Chinese Revivalist", 2);
		}
		if (V.BodyguardID === 0) {
			r.push(`and <span class="red">disapproves</span> of your failure to keep a Bodyguard as befits a proper imperial palace.`);
			FutureSocieties.Change("Chinese Revivalist", -2);
		} else {
			r.push(`and <span class="green">approves</span> of your keeping a Bodyguard, as befits a proper imperial palace.`);
			FutureSocieties.Change("Chinese Revivalist", 2);
		}
		if (V.language !== App.Data.FutureSociety.records.FSChineseRevivalist.language) {
			r.push(`Continuing to use ${V.language} as the lingua franca of ${V.arcologies[0].name} rather than the Chinese of the Middle Kingdom disappoints society and causes doubt about your revivalist project.`);
			FutureSocieties.Change("Chinese Revivalist", -2);
		}
	}

	let noEugenics;
	let yesEugenics;
	if (V.arcologies[0].FSRepopulationFocus !== "unset") {
		if (policies.countEugenicsSMRs() > 0) {
			r.push(`Society <span class="red">disapproves</span> of your policies sterilizing potential mothers. Your insistence on eugenics hinders adoption of your new society.`);
			noEugenics = -1 * policies.countEugenicsSMRs();
			FutureSocieties.Change("Repopulationist", noEugenics);
		}
	} else if (V.arcologies[0].FSPaternalist !== "unset") {
		if (policies.countEugenicsSMRs() > 0) {
			r.push(`Society <span class="red">disapproves</span> of your policies forcefully sterilizing slaves, especially when they snuff out the life growing within them.`);
			noEugenics = -1 * policies.countEugenicsSMRs();
			FutureSocieties.Change("Paternalist", noEugenics);
		}
	} else if ((V.arcologies[0].FSRestart !== "unset") && V.arcologies[0].FSPaternalist === "unset") {
		if (policies.countEugenicsSMRs() > 0 && V.arcologies[0].FSRestartSMR !== 1) {
			r.push(`Society <span class="green"> approves</span> of your slave eugenics policies, easing them into more thorough eugenics.`);
			yesEugenics = policies.countEugenicsSMRs();
			FutureSocieties.Change("Eugenics", yesEugenics);
			V.failedElite -= (1 * policies.countEugenicsSMRs());
		} else if (V.arcologies[0].FSRestartSMR === 1) {
			V.failedElite -= (2 * policies.countEugenicsSMRs());
		}
	}

	if (V.arcologies[0].FSRepopulationFocus !== "unset" && V.birthsTotal > 0) {
		r.push(`The number of children you've brought into the world <span class="green">pleases</span> your citizens.`);
		if (V.birthsTotal < 1000) {
			repX(V.birthsTotal, "PCactions");
		} else {
			repX(1000, "PCactions");
		}
	}

	if (V.shelterAbuse > 5) {
		if (V.arcologies[0].FSPaternalist !== "unset") {
			r.push(`You are on the Slave Shelter's public list of abusive slaveowners. Society <span class="red">disapproves</span> of your falling foul of such a well regarded charity.`);
			FutureSocieties.Change("Paternalist", -2);
		} else if (V.arcologies[0].FSDegradationist !== "unset") {
			r.push(`You are on the Slave Shelter's public list of abusive slaveowners. Your citizens find this hilarious, and <span class="green">approve</span> of your taking advantage of a pack of idiots.`);
			FutureSocieties.Change("Degradationist", 2);
		}
	}

	if (V.TCR.schoolPresent === 1) {
		if (V.arcologies[0].FSRestart !== "unset") {
			r.push(`Your Eugenics focused society disagrees with the local branch of The Cattle Ranch's views on slave breeding. Until society sees them as nothing more than mindless cattle and not human, they are in conflict with current reproduction standards.`);
			FutureSocieties.Change("Eugenics", -1);
		} else if (V.arcologies[0].FSPaternalist !== "unset") {
			r.push(`While they can't stop what happens to slaves outside of your arcology, they can disapprove and protest you allowing a branch of the mentally and physically abusive Cattle Ranch to be established in your arcology.`);
			FutureSocieties.Change("Paternalist", -2);
		}
	}

	if (V.policies.cash4Babies === 1) {
		if (V.arcologies[0].FSDegradationist !== "unset") {
			r.push(`Society <span class="green">approves</span> of your poor treatment of slave infants.`);
			repX(5 * V.FSSingleSlaveRep * (V.arcologies[0].FSDegradationist / V.FSLockinLevel), "babyTransfer");
		} else if (V.arcologies[0].FSRestart !== "unset") {
			if (V.eugenicsFullControl !== 1) {
				r.push(`The Societal Elite <span class="red">strongly disapproves</span> of your creating an economic incentive for the lower classes to breed and sell infants, holding back acceptance of your new society.`);
				V.failedElite += 5;
			} else {
				r.push(`Society <span class="red">strongly disapproves</span> of your creating an economic incentive for the lower classes to breed and sell infants, holding back acceptance of your new society.`);
			}
			V.arcologies[0].FSRestart -= V.FSSingleSlaveRep;
			repX(forceNeg((5 * V.FSSingleSlaveRep * (V.arcologies[0].FSRestart / V.FSLockinLevel)) + (V.rep / 40)), "babyTransfer");
		} else if (V.arcologies[0].FSPaternalist !== "unset") {
			r.push(`Society <span class="red">greatly despises</span> your poor treatment of slave infants.`);
			repX(forceNeg((25 * V.FSSingleSlaveRep * (V.arcologies[0].FSPaternalist / V.FSLockinLevel)) + (V.rep / 20)), "babyTransfer");
		} else if (V.arcologies[0].FSRepopulationFocus !== "unset") {
			r.push(`Society <span class="red">disapproves</span> of your poor treatment of your future population, holding back acceptance of your new society.`);
			V.arcologies[0].FSRepopulationFocus -= V.FSSingleSlaveRep;
			repX(forceNeg((5 * V.FSSingleSlaveRep * (V.arcologies[0].FSRepopulationFocus / V.FSLockinLevel)) + (V.rep / 20)), "babyTransfer");
		} else {
			r.push(`Your citizens <span class="red">disapprove</span> of your poor treatment of slave children.`);
			repX(forceNeg(V.rep / 20), "babyTransfer");
		}
	}

	if (V.policies.mixedMarriage === 1) {
		r.push(`Your citizens`);
		if (V.arcologies[0].FSPaternalist >= 80) {
			r.push(`are so paternalistic that they <span class="green">approve</span> of`);
			FutureSocieties.Change("Paternalist", 2);
		} else if (V.arcologies[0].FSPaternalist >= 40) {
			r.push(`are paternalistic enough to tolerate`);
		} else {
			r.push(`<span class="red">disapprove</span> of`);
			repX(-50, "PCactions");
		}
		r.push(`your support for marriage between citizens and slaves.`);
	}

	let care;
	if (V.citizenOrphanageTotal > 0) {
		if (V.arcologies[0].FSPaternalist !== "unset") {
			r.push(`The public <span class="green">approves</span> of the way you're providing for ${V.citizenOrphanageTotal} of your slaves' children to be raised as citizens.`);
			FutureSocieties.Change("Paternalist", V.citizenOrphanageTotal);
			if (V.privateOrphanageTotal > 0) {
				r.push(`Raising ${num(V.privateOrphanageTotal)} of your slaves' children privately is considered even more <span class="green">impressive.</span>`);
				care = V.privateOrphanageTotal * 2;
				FutureSocieties.Change("Paternalist", care);
			}
		} else if (V.arcologies[0].FSDegradationist !== "unset") {
			r.push(`The public <span class="red">disapproves</span> of the way you're providing for ${V.citizenOrphanageTotal} of your slaves' children to be raised as citizens.`);
			care = -V.citizenOrphanageTotal;
			FutureSocieties.Change("Degradationist", care);
			if (V.privateOrphanageTotal > 0) {
				r.push(`Fortunately your raising slaves' children privately is not publicly known.`);
			}
		}
	} else if (V.privateOrphanageTotal > 0) {
		if (V.arcologies[0].FSPaternalist !== "unset") {
			r.push(`Raising ${num(V.privateOrphanageTotal)} of your slaves' children privately is considered extremely <span class="green">impressive.</span>`);
			care = V.privateOrphanageTotal * 2;
			FutureSocieties.Change("Paternalist", care);
		} else if (V.arcologies[0].FSDegradationist !== "unset") {
			r.push(`Fortunately your raising slaves' children privately is not publicly known.`);
		}
	}
	if (V.breederOrphanageTotal > 0 && V.arcologies[0].FSRepopulationFocus !== "unset") {
		r.push(`The public <span class="green">approves</span> of the way you've dedicated ${num(V.breederOrphanageTotal)} of your slaves' children to be raised into future breeders.`);
		const futureBreeders = Math.round(((V.breederOrphanageTotal / 100) + 1));
		FutureSocieties.Change("Repopulationist", futureBreeders);
	}

	if (V.arcologies[0].FSNull !== "unset") {
		r.push(`Your cultural openness <span class="green">helps your reputation,</span> since few citizens have disputes with your permissive approach.`);
		repX(50 * V.FSSingleSlaveRep * (V.arcologies[0].FSNull / V.FSLockinLevel), "policies");
	}

	if (V.arcologies[0].FSRestartLaw === 1) {
		r.push(`Your laws requiring the non-elite to pay additional taxes or be sterilized agitates some of your citizens, but they don't matter. Only your pleased elite do.`);
		repX(-100, "policies");
		V.failedElite -= 1;
	}

	if (V.arcologies[0].FSHedonisticDecadenceLaw === 1) {
		r.push(`The burgeoning prosperity brought on by new business through your policies builds your reputation, since nearly every citizen has something available to satisfy their cravings.`);
		repX(100, "policies");
	}

	if (V.arcologies[0].FSIntellectualDependencyLaw === 1) {
		r.push(`The protections you have in place to protect invalids <span class="green">adds to your reputation,</span> since every citizen will eventually find themselves benefitting from it.`);
		repX(100, "policies");
	}

	if (V.policies.SMR.frigiditySMR === 1) {
		r.push(`Your market regulations regarding slave sex drives <span class="red">outrages</span> your citizens seeking sex slaves, since only slaves disinterested in sex are available.`);
		repX(-250, "policies");
	}

	if (V.PC.degeneracy > 0) {
		if (V.PC.degeneracy > 100) {
			r.push(`There are <span class="red">severe and devastating rumors</span> about you spreading across the arcology.`);
			repX(forceNeg(100 * V.PC.degeneracy), "PCactions");
			V.enduringRep = 0;
		} else if (V.PC.degeneracy > 75) {
			r.push(`There are <span class="red">severe rumors</span> about you spreading across the arcology.`);
			repX(forceNeg(20 * V.PC.degeneracy), "PCactions");
		} else if (V.PC.degeneracy > 50) {
			r.push(`There are <span class="red">bad rumors</span> about you spreading across the arcology.`);
			repX(forceNeg(10 * V.PC.degeneracy), "PCactions");
		} else if (V.PC.degeneracy > 25) {
			r.push(`There are <span class="red">rumors</span> about you spreading across the arcology.`);
			repX(forceNeg(5 * V.PC.degeneracy), "PCactions");
		} else if (V.PC.degeneracy > 10) {
			r.push(`There are <span class="red">minor rumors</span> about you spreading across the arcology.`);
			repX(forceNeg(2 * V.PC.degeneracy), "PCactions");
		} else {
			r.push(`The occasional rumor about you can be heard throughout the arcology.`);
			repX(forceNeg(1 * V.PC.degeneracy), "PCactions");
		}
	}

	if (V.FCNNstation === 1) {
		r.push(`Playing host to the Free Cities News Network brings <span class="green">approval</span> from those who still consider freedom of the press a virtue.`);
		repX(500, "policies");
	}

	if (V.secExpEnabled > 0 && V.SecExp.buildings.propHub && V.SecExp.buildings.propHub.upgrades.fakeNews > 0) {
		r.push(`The authenticity department produces and distributes copious amounts of plausible enough news and reports, <span class="green">increasing your reputation.</span>`);
		repX(10 * V.SecExp.buildings.propHub.upgrades.fakeNews, "policies");
	}

	App.Events.addParagraph(el, r);
	r = [];
	const repGain = hashSum(V.lastWeeksRepIncome);
	repLoss = hashSum(V.lastWeeksRepExpenses);
	if (repGain > repLoss) {
		r.push(App.UI.DOM.makeElement("span", `Your reputation increased this week.`, "green"));
	} else if (repGain < repLoss) {
		r.push(App.UI.DOM.makeElement("span", `Your reputation decreased this week.`, "red"));
	}

	if (isNaN(V.rep)) {
		r.push(App.UI.DOM.makeElement("p", `Error: rep is outside accepted range, please report this issue`, "red"));
	}

	if (V.rep > 20000) {
		r.push(`Your reputation is capped.`);
	} else if (V.rep - V.enduringRep > 7500) {
		r.push(`Your base rate of reputation decay is very high.`);
	} else if (V.rep - V.enduringRep > 5000) {
		r.push(`Your base rate of reputation decay is high.`);
	} else if (V.rep - V.enduringRep > 2500) {
		r.push(`Your base rate of reputation decay is moderate.`);
	} else if (V.rep - V.enduringRep > 0) {
		r.push(`Your base rate of reputation decay is low.`);
	}
	if (V.enduringRep >= 10000) {
		r.push(`Your legend is perfected, reducing reputation decay to its lowest possible level.`);
		V.enduringRep = 10000;
	}

	if (V.policies.alwaysSubsidizeRep === 1) {
		if (V.rep <= 19900) {
			repX(100, "policies");
			r.push(`Reputation subsidized as planned.`);
			if (V.PC.degeneracy > 1) {
				V.PC.degeneracy -= 1;
			}
		} else if (V.PC.degeneracy > 1) {
			V.PC.degeneracy -= 1;
			r.push(`Rumors quelled as planned.`);
		} else {
			cashX(1000, "policies");
			r.push(`Reputation subsidy reclaimed this week since your reputation is capped.`);
		}
	}

	if (V.failedElite > 1) {
		V.failedElite -= 1;
	}
	if (V.PC.degeneracy > 1) {
		V.PC.degeneracy -= 1;
	}

	if (V.arcologies[0].FSRestartDecoration === 100) {
		if (V.eugenicsFullControl !== 1) {
			if (V.failedElite > 300) {
				r.push(`The Societal Elite <span class="red">are plotting your demise.</span>`);
			} else if (V.failedElite > 250) {
				r.push(`The Societal Elite <span class="red">are openly discussing about your failures.</span> It would be in your best interests to appease them.`);
			} else if (V.failedElite > 200) {
				r.push(`The Societal Elite <span class="red">are avoiding you.</span> Getting back on their good side is a good idea, lest you want to disappear.`);
			} else if (V.failedElite > 150) {
				r.push(`The Societal Elite <span class="red">stop their conversations around you.</span> You may want to consider your actions more.`);
			} else if (V.failedElite > 100) {
				r.push(`The Societal Elite <span class="red">seem to dislike you.</span>`);
			} else if (V.failedElite > 50) {
				r.push(`The Societal Elite <span class="red">mutter about you.</span>`);
			} else if (V.failedElite > 0) {
				r.push(`The Societal Elite <span class="red">question some of your actions.</span>`);
			} else {
				r.push(`The Societal Elite hold you in high regards.`);
			}
		} else {
			r.push(`The Societal Elite can think what they want, they know better than to try and cross you again.`);
		}
	} else if (V.arcologies[0].FSRestart !== "unset") {
		if (V.eugenicsFullControl !== 1) {
			if (V.failedElite > 300) {
				r.push(`The Societal Elite <span class="red">have departed from your arcology in disgust.</span>`);
				FutureSocieties.remove("FSRestart");
				repX(forceNeg(10000), "event");
				V.eliteFail = random(30, 100);
				V.eliteFailTimer = 15;
				if (V.eliteFail > V.topClass - 20) {
					V.eliteFail = V.topClass - 20;
				}
				if (V.arcologies[0].prosperity > 50) {
					V.arcologies[0].prosperity -= random(20, 40);
				}
			} else if (V.failedElite > 250) {
				r.push(`The Societal Elite <span class="red">are openly discussing leaving.</span> It would be in your best interests to appease them.`);
			} else if (V.failedElite > 200) {
				r.push(`The Societal Elite <span class="red">are avoiding you.</span> Getting back on their good side is a good idea, lest you want to disappear.`);
			} else if (V.failedElite > 150) {
				r.push(`The Societal Elite <span class="red">stop their conversations around you.</span> You may want to consider your actions more.`);
			} else if (V.failedElite > 100) {
				r.push(`The Societal Elite <span class="red">seem to dislike you.</span>`);
			} else if (V.failedElite > 50) {
				r.push(`The Societal Elite <span class="red">mutter about you.</span>`);
			} else if (V.failedElite > 0) {
				r.push(`The Societal Elite <span class="red">question some of your actions.</span>`);
			} else {
				r.push(`The Societal Elite hold you in warm regards.`);
			}
		} else {
			r.push(`The Societal Elite can think what they want, they know better than to try and cross you again.`);
		}
	}
	App.Events.addParagraph(el, r);
	return el;
};


code:
globalThis.endWeek = (function() {
	function doEndWeek() {
		// purge SugarCube's expired state cache
		State.expired.length = 0;

		// set end week flag
		V.endweekFlag = true;

		// report setup
		setupLastWeeksCash();
		setupLastWeeksRep();

		// globals setup
		resetSlaveMarkets();
		for (const s of V.slaves) {
			slavePrep(s);
		}
		setUseWeights();
		saveWeekTotals();
		if (V.secExpEnabled > 0) {
			V.SecExp.war = {foughtThisWeek: 0, type: ""};
		}

		// pass time for objects that need it
		weather();
		organs();
		growNewCat();
		prosthetics();
		nursery();
		food();
		PC();
		threaten();

		// week end is done, move on to gameover or SA reports
		resetMiscGlobals();
		advance();
	}

	function resetSlaveMarkets() {
		V.market = null;
		for (const school of App.Data.misc.schools.keys()) {
			V[school].schoolSale = 0;
		}
	}

	function slavePrep(s) {
		s.lastWeeksCashIncome = 0;
		s.lastWeeksRepIncome = 0;
		s.lastWeeksRepExpenses = 0;
	}

	function setUseWeights() {
		V.oralUseWeight = 5;
		V.vaginalUseWeight = 5;
		V.analUseWeight = 5;
		V.mammaryUseWeight = 1;
		V.penetrativeUseWeight = 1;

		if (V.policies.oralAppeal === 1) {
			V.oralUseWeight += 2;
			V.vaginalUseWeight -= 1;
			V.analUseWeight -= 1;
		} else if (V.policies.vaginalAppeal === 1) {
			V.oralUseWeight -= 1;
			V.vaginalUseWeight += 2;
			V.analUseWeight -= 1;
		} else if (V.policies.analAppeal === 1) {
			V.oralUseWeight -= 1;
			V.vaginalUseWeight -= 1;
			V.analUseWeight += 2;
		}

		if (V.policies.oralAppeal === -1) {
			V.oralUseWeight -= 2;
			V.vaginalUseWeight += 1;
			V.analUseWeight += 1;
		}
		if (V.policies.vaginalAppeal === -1) {
			V.oralUseWeight += 1;
			V.vaginalUseWeight -= 2;
			V.analUseWeight += 1;
		}
		if (V.policies.analAppeal === -1) {
			V.oralUseWeight += 1;
			V.vaginalUseWeight += 1;
			V.analUseWeight -= 2;
		}

		if (V.policies.gumjobFetishism === 1) {
			V.oralUseWeight += 2;
		}

		if (V.policies.sexualOpenness === 1) {
			V.penetrativeUseWeight += 1;
		}
	}

	function saveWeekTotals() {
		V.cashLastWeek = V.cash;
		V.repLastWeek = V.rep;
		V.foodLastWeek = V.food;
	}

	function weather() {
		if (V.weatherRemaining > 0) {
			V.weatherRemaining -= 1;
		}
	}

	function growNewCat() {
		if (V.growingNewCat > 0) {
			V.growingNewCat -= 1;
		}
	}

	function organs() {
		function advanceOrgan(o) {
			if (o.weeksToCompletion > 0) {
				if (V.organFarmUpgrade === 3) {
					o.weeksToCompletion -= 4;
				} else if (V.organFarmUpgrade === 2) {
					o.weeksToCompletion -= 2;
				} else {
					o.weeksToCompletion--;
				}
			}
		}

		for (const organ of V.organs) {
			advanceOrgan(organ);
		}

		// move completed non-incubator organs to V.completedOrgans
		V.organs = V.organs.filter(function(o) {
			if (o.weeksToCompletion <= 0) {
				V.completedOrgans.push(o);
				return false;
			}
			return true;
		});

		if (V.incubator.capacity > 0) {
			for (const organ of V.incubator.organs) {
				advanceOrgan(organ);
			}
		}

		// TODO: nurseryOrgans too, if those ever exist...
	}

	function prosthetics() {
		for (const p of V.adjustProsthetics) {
			if (p.workLeft > 0) {
				if (V.prostheticsUpgrade === 3) {
					p.workLeft -= 40;
				} else if (V.prostheticsUpgrade === 2) {
					p.workLeft -= 20;
				} else {
					p.workLeft -= 10;
				}
				if (p.workLeft <= 0) {
					V.adjustProstheticsCompleted++;
				}
			}
		}
	}

	function nursery() {
		for (const c of V.cribs) {
			c.growTime--;
			c.birthWeek++;
			if (c.birthWeek >= 52) {
				c.birthWeek = 0;
				c.actualAge++;
			}
			if (c.actualAge >= 3) {
				App.Facilities.Nursery.infantToChild(c);
			}
		}
	}

	function food() {
		function foodConsumption(s) {
			if (s.diet === "restricted") {
				return 1.8;
			} else if (s.diet === "slimming") {
				return 1.9;
			} else if (s.diet === "muscle building") {
				return 2.1;
			} else if (s.diet === "fattening") {
				return 2.2;
			} else {
				return 2;
			}
		}

		if (V.foodMarket > 0) {
			V.foodConsumption = ((V.lowerClass * V.foodRate.lower) + (V.middleClass * V.foodRate.middle) +
				(V.upperClass * V.foodRate.upper) + (V.topClass * V.foodRate.top));
			V.foodConsumption += V.slaves.reduce((acc, cur) => acc += foodConsumption(cur), 0);
			V.food -= Math.max(V.foodConsumption, V.food);
			V.foodConsumption = 0;
		}
	}

	function PC() {
		V.PC.sexualEnergy = 4;
		if (V.PCSlutContacts === 2) {
			V.PC.sexualEnergy -= 3;
		}
		if (V.personalAttention === "sex") {
			V.PC.sexualEnergy += 2;
		}
		if (V.PC.physicalAge >= 80) {
			V.PC.sexualEnergy -= 6;
		} else if (V.PC.physicalAge >= 72) {
			V.PC.sexualEnergy -= 5;
		} else if (V.PC.physicalAge >= 65) {
			V.PC.sexualEnergy -= 4;
		} else if (V.PC.physicalAge >= 58) {
			V.PC.sexualEnergy -= 3;
		} else if (V.PC.physicalAge >= 50) {
			V.PC.sexualEnergy -= 2;
		} else if (V.PC.physicalAge >= 42) {
			V.PC.sexualEnergy -= 1;
		} else if (V.PC.physicalAge >= 35) {
			V.PC.sexualEnergy += 0;
		} else if (V.PC.physicalAge >= 31) {
			V.PC.sexualEnergy += 1;
		} else if (V.PC.physicalAge >= 28) {
			V.PC.sexualEnergy += 2;
		} else if (V.PC.physicalAge >= 21) {
			V.PC.sexualEnergy += 3;
		} else if (V.PC.physicalAge >= 13) {
			V.PC.sexualEnergy += 4;
		} else if (V.PC.physicalAge === 12) {
			V.PC.sexualEnergy += 1;
		} else if (V.PC.physicalAge === 11) {
			V.PC.sexualEnergy -= 2;
		} else if (V.PC.physicalAge >= 0) {
			V.PC.sexualEnergy -= 6;
		}
		if (V.PC.balls >= 10) {
			V.PC.sexualEnergy += 2;
		} else if (V.PC.balls >= 5) {
			V.PC.sexualEnergy++;
		}
		if (V.PC.preg > 20) {
			if (V.PC.pregMood === 2) {
				V.PC.sexualEnergy += 4;
			} else {
				V.PC.sexualEnergy -= 3;
			}
		} else if (V.PC.preg > 0) {
			V.PC.sexualEnergy -= 1;
		} else {
			if (V.PC.fertDrugs === 1) {
				V.PC.sexualEnergy++;
			}
			if (V.PC.forcedFertDrugs > 0) {
				V.PC.sexualEnergy += 2;
			}
		}
		if (V.PC.staminaPills > 0) {
			V.PC.sexualEnergy += 2;
		}
		if (V.PC.preg > 0) {
			WombProgress(V.PC, 1, 1);
			WombNormalizePreg(V.PC);
			V.PC.pregWeek = V.PC.preg;
			let newBelly = WombGetVolume(V.PC);
			if (newBelly >= V.PC.belly) {
				V.PC.belly = newBelly;
			} else if (V.PC.belly > 500) {
				V.PC.belly *= 0.75;
			}
			V.PC.fertDrugs = 0;
		} else if (V.PC.belly > 0) {
			if (V.PC.belly < 100) {
				V.PC.belly = 0;
			} else {
				V.PC.belly *= 0.75;
			}
		}
		if (V.PC.pregWeek < 0) {
			V.PC.pregWeek++;
		}
	}

	function threaten() {
		V.threatened.pop();
		V.threatened.unshift([]);
	}

	function resetMiscGlobals() {
		// if a global is going to be used by the end-of-week reports, it must be reset here instead of in Next Week
		V.encyclopedia = "How to Play";
		V.StudID = 0;
	}

	function advance() {
		if (V.slaves.length < 1) {
			V.gameover = "no slaves";
			Engine.play("Gameover");
		} else if (V.arcologies[0].ownership < V.arcologies[0].minority) {
			V.gameover = "ownership";
			Engine.play("Gameover");
		} else {
			Engine.play("Slave Assignments Report");
		}
	}

	function confirmEndWeek() {
		const expiredReminders = V.reminders.filter(r => r.week <= V.week);
		if (
			(!V.sideBarOptions.confirmWeekEnd || confirm("Are you sure you want to end the week?")) &&
			(expiredReminders.length === 0 || confirm(`These reminders are due: ${toSentence(Array.from(expiredReminders, r => r.message))}. End the week anyway?`))
		) {
			App.UI.EndWeekAnim.start();
			setTimeout(doEndWeek, 0); // execute immediately, but after the event loop runs, so the loading screen gets shown
		}
	}

	return confirmEndWeek;
})();

repo_name: CloudyCoffee/fc

license: mit


code:
App.UI.EndWeekAnim = (function() {
	let loadLockID = -1;
	let infoDiv = null;

	function makeInfoDiv() {
		infoDiv = $(`

Processing week ${V.week}...

${V.arcologies[0].name} | ${V.slaves.length} slaves

		`);
	}

	function start() {
		if (loadLockID === -1) {
			makeInfoDiv();
			$("#init-screen").append(infoDiv);
			loadLockID = LoadScreen.lock();
		}
	}

	function end() {
		if (loadLockID !== -1) {
			setTimeout(() => {
				LoadScreen.unlock(loadLockID);
				infoDiv.remove();
				infoDiv = null;
				loadLockID = -1;
			}, 0);
		}
	}

	return {
		start,
		end
	};
})();


code:
/**
 * Sets slave's fetish
 * @param {App.Entity.SlaveState|FC.ReportSlave} slave
 * @param {FC.Fetish} fetish
 * @param {number} strength
 */
globalThis.fetishChange = function(slave, fetish, strength = 65) {
	slave.fetish = fetish;
	slave.fetishStrength = strength;
	slave.fetishKnown = 1;
	if ('fetishChanged' in slave) {
		slave.fetishChanged = 1;
	}
};

/**
 * Make a report slave proxy. This binds extra temporary data to a specific slave as she runs through all the SA reports.
 * Use the {FC.ReportSlave} type to denote that your function requires this temporary proxy data.
 * @param {App.Entity.SlaveState} slave
 * @returns {FC.ReportSlave}
 */
App.SlaveAssignment.reportSlave = function(slave) {
	const proxyProperties = {
		/** Is this slave's paraphilia satisfied? (1: satisfied, 0: no paraphilia; -1: unsatisfied) */
		paraphiliaSatisfied: 0,
		/** A slave with a lot of porn viewers will have a stronger effect on societal norms. This is her multiplier for those effects. */
		pornFameBonus: 1,
		/** Used to condense all the possible galactorrhea lactation start points to a single line of text in saLongTermPhysicalEffects. */
		inappropriateLactation: 0,
		/** Used limit a slave to a single fetish change per week. */
		fetishChanged: 0,
		/** Is the slave resting this week? */
		slaveUsedRest: 0,
	};

	/** effectively merge the proxy properties onto the slave
	 * @type {ProxyHandler<App.Entity.SlaveState>}
	 */
	const handler = {
		get(target, key) {
			if (key in proxyProperties) {
				return proxyProperties[key];
			}
			return target[key];
		},
		set(target, key, value) {
			if (key in proxyProperties) {
				proxyProperties[key] = value;
			}
			target[key] = value;
			return true;
		},
		has(target, key) {
			return (key in proxyProperties) || (key in target);
		}
	};

	return /** @type {FC.ReportSlave} */ (new Proxy(slave, handler));
};

/**
 * Iterable which gets prepared slaves via App.SlaveAssignment.reportSlave
 * @param {App.Entity.SlaveState[]} slaves
 * @yields {FC.ReportSlave}
 */
App.SlaveAssignment.reportSlaves = function*(slaves) {
	let iterationCount = 0;
	for (const slave of slaves) {
		iterationCount++;
		yield App.SlaveAssignment.reportSlave(slave);
	}
	return iterationCount;
};


code:
/**
 *
 * @param {App.Entity.SlaveState} slave
 * @param {"oldAge"|"overdosed"|"lowHealth"} deathType
 */
globalThis.planDeath = function(slave, deathType) {
	V.slaveDeath.set(slave.ID, deathType);
};

App.Events.SEDeath = class SEDeath extends App.Events.BaseEvent {
	constructor(actors, params) {
		super(actors, params);
	}

	/** Custom casting: interpret V.slaveDeath as the actor collection for this event (do not use this.actors). */
	castActors() {
		return V.slaveDeath.size > 0;
	}

	execute(node) {
		const artRenderer = V.seeImages && V.seeReportImages ? new App.Art.SlaveArtBatch(V.slaveDeath.keys(), 0, 0) : null;
		if (artRenderer) {
			node.append(artRenderer.writePreamble());
		}

		for (const [id, deathType] of V.slaveDeath) {
			const deceased = getSlave(id);
			if (deceased) {
				App.UI.DOM.appendNewElement("p", node, death(deceased, deathType));
				node.append(sectionBreak());
				removeSlave(deceased);
			}
		}

		V.slaveDeath = new Map();

		function sectionBreak() {
			const hr = document.createElement("hr");
			hr.style.margin = "0";
			return hr;
		}

		/**
		 *
		 * @param {App.Entity.SlaveState} slave
		 * @param {"oldAge"|"overdosed"|"lowHealth"} deathType
		 */
		function death(slave, deathType) {
			const el = new DocumentFragment();
			const r = [];
			const {
				He, His,
				he, his
			} = getPronouns(slave);
			if (artRenderer) {
				App.UI.DOM.appendNewElement("div", el, artRenderer.render(slave), ["imageRef", "tinyImg"]);
			}

			switch (deathType) {
				case "oldAge": {
					if (slave.assignment === "be confined in the arcade") {
						r.push(`You are notified by ${V.arcadeName} staff that one of the cabinets has broken down and will need to be replaced. It would seem ${slave.slaveName}, the fucktoy encased in it, died`);
						if (slave.physicalAge >= 70) {
							r.push(`naturally of old age despite`);
						} else {
							r.push(`suddenly, unrelated to`);
						}
						r.push(`${his} living conditions. ${He} was a good unit; logs show ${he} was taking dick up until the very end.`);
					} else if (slave.assignment === "work in the dairy" && V.dairyRestraintsSetting > 1) {
						r.push(`You are notified by ${V.dairyName} staff that one of the occupied milkers has ceased producing. Upon inspection, it would seem ${slave.slaveName}, the cow restrained in it, died`);
						if (slave.physicalAge >= 70) {
							r.push(`naturally of old age despite`);
						} else {
							r.push(`suddenly, unrelated to`);
						}
						r.push(`${his} living conditions. ${He} was a good cow; ${he} gave milk up until ${his} death.`);
					} else if (slave.fuckdoll > 0) {
						r.push(`One of your Fuckdolls' monitoring systems alerts you that the slave contained within has died. It would seem <span class="pink bold">${slave.slaveName}</span> has died`);
						if (slave.physicalAge >= 70) {
							r.push(`naturally of old age despite`);
						} else {
							r.push(`suddenly, unrelated to`);
						}
						r.push(`${his} living conditions. Thankfully the suit notifies its owner of such things; especially with the rumors of earlier models and necrophilia you hear occasionally.`);
					} else {
						r.push(`<span class="pink bold">${slave.slaveName}</span> failed to report in for a routine inspection, something that rarely occurs under your watch. It doesn't take long to track down the wayward slave.`);
						const deathSeed = random(1, 100);
						if (deathSeed > 75) {
							r.push(`${He} is found dead in ${his} bed, having died sometime during the previous night.`);
						} else if (deathSeed > 50) {
							r.push(`${He} is found dead in a stairwell, having had a heart attack while trying to climb it.`);
						} else if (deathSeed > 25) {
							r.push(`${He} is found dead in the showers, having slipped sometime earlier.`);
						} else {
							if (App.Utils.hasNonassignmentSex(slave)) {
								r.push(`${He} is found dead in the bed of another slave, having died during intercourse. ${His} lover is not taking it well.`);
							} else {
								r.push(`${He} is found dead in the cafeteria, having died during breakfast; ${he} ruined the day for a number of your slaves.`);
							}
						}
						r.push(`${slave.slaveName} died at the age of ${slave.actualAge};`);
						if (slave.actualAge < 10) {
							r.push(`${he} lived a tragically short life.`);
						} else if (slave.actualAge < 20) {
							r.push(`${he} died far too young.`);
						} else if (slave.actualAge < 30) {
							r.push(`${he} died in what would be a sex slave's prime.`);
						} else if (slave.actualAge < 50) {
							r.push(`${he} died in ${his} prime.`);
						} else if (slave.actualAge < 65) {
							r.push(`${he} lived a fair life, good or bad.`);
						} else if (slave.actualAge < 90) {
							r.push(`${he} lived a long life and experienced much during it.`);
						} else {
							r.push(`${he} lived a very long life that few get to see.`);
						}
					}
					break;
				}

				case "overdosed": {
					if (slave.assignment === "be confined in the arcade") {
						r.push(`You are notified by ${V.arcadeName} staff that one of the cabinets has broken down and will need to be replaced. It would seem ${slave.slaveName}, the fucktoy encased in it, died of an aphrodisiac overdose from the constant aphrodisiac injections. ${He} was a good unit; logs show ${he} was taking dick up until the very end.`);
					} else if (slave.assignment === "work in the dairy" && V.dairyRestraintsSetting > 1) {
						r.push(`You are notified by ${V.dairyName} staff that one of the occupied milkers has ceased producing. Upon inspection, it would seem ${slave.slaveName}, the cow restrained in it, died of an aphrodisiac overdose. How ${he} managed to get them is unknown, but ${he} was a good cow; ${he} gave milk up until ${his} death.`);
					} else if (slave.fuckdoll > 0) {
						r.push(`One of your Fuckdolls' monitoring systems alerts you that the slave contained within has died. It would seem ${slave.slaveName} has died of an aphrodisiac overdose. Thankfully the suit notifies its owner of such things; especially with the rumors of earlier models and necrophilia you hear occasionally. It does little to deal with the resulting mess of the orgasm ${he} died during, however.`);
					} else {
						r.push(`<span class="pink bold">${slave.slaveName}</span> failed to report in for a routine inspection, something that rarely occurs under your watch. It doesn't take long to track down the wayward slave.`);
						r.push(`${He} is found dead in ${his} bed, having died sometime earlier. Judging by the mess and the expression on ${his} face, ${he} died of a heart attack during a particularly intense orgasm bought about by the massive amount of aphrodisiacs in ${his} system. ${slave.slaveName} died at the age of ${slave.actualAge};`);
						if (slave.actualAge < 10) {
							r.push(`${he} lived a tragically short life.`);
						} else if (slave.actualAge < 20) {
							r.push(`${he} died far too young.`);
						} else if (slave.actualAge < 30) {
							r.push(`${he} died in what would be a sex slave's prime.`);
						} else if (slave.actualAge < 50) {
							r.push(`${he} died in ${his} prime.`);
						} else if (slave.actualAge < 65) {
							r.push(`${he} lived a fair life, good or bad.`);
						} else if (slave.actualAge < 90) {
							r.push(`${he} lived a long life and experienced much during it.`);
						} else {
							r.push(`${he} lived a very long life that few get to see.`);
						}
					}
					break;
				}

				case "lowHealth": {
					if (slave.assignment === "be confined in the arcade") {
						r.push(`You are notified by ${V.arcadeName} staff that one of the cabinets has broken down and will need to be replaced. It would seem ${slave.slaveName}, the fucktoy encased in it, died to poor health caused by ${his} living conditions. ${He} was a good unit; logs show ${he} was taking dick up until the very end.`);
					} else if (slave.assignment === "work in the dairy" && V.dairyRestraintsSetting > 1) {
						r.push(`You are notified by ${V.dairyName} staff that one of the occupied milkers has ceased producing. Upon inspection, it would seem ${slave.slaveName}, the cow restrained in it, died to poor health caused by ${his} living conditions. ${He} was a good cow; ${he} gave milk up until ${his} death.`);
					} else if (slave.fuckdoll > 0) {
						r.push(`One of your Fuckdolls' monitoring systems alerts you that the slave contained within has died. It would seem ${slave.slaveName} has died of general poor health. Thankfully the suit notifies its owner of such things; especially with the rumors of earlier models and necrophilia you hear occasionally. Clean up is easy enough, however.`);
					} else {
						r.push(`<span class="pink bold">${slave.slaveName}</span> failed to report in for a routine inspection, something that rarely occurs under your watch. It doesn't take long to track down the wayward slave.`);
						r.push(`${He} is found dead in ${his} bed, having died sometime during the night. ${He} has been in very poor health lately, so you knew this was a possibility. ${slave.slaveName} died at the age of ${slave.actualAge};`);
						if (slave.actualAge < 10) {
							r.push(`${he} lived a tragically short life.`);
						} else if (slave.actualAge < 20) {
							r.push(`${he} died far too young.`);
						} else if (slave.actualAge < 30) {
							r.push(`${he} died in what would be a sex slave's prime.`);
						} else if (slave.actualAge < 50) {
							r.push(`${he} died in ${his} prime.`);
						} else if (slave.actualAge < 65) {
							r.push(`${he} lived a fair life, good or bad.`);
						} else if (slave.actualAge < 90) {
							r.push(`${he} lived a long life and experienced much during it.`);
						} else {
							r.push(`${he} lived a very long life that few get to see.`);
						}
						if (V.arcologies[0].FSPaternalist !== "unset" && slave.actualAge < 75) {
							r.push(`Allowing a slave to die under your care <span class="red">severely damages</span> your image as a caring slaveowner and <span class="red">calls into question</span> your paternalistic resolve.`);
							FutureSocieties.Change("Paternalist", -10);
						}
					}
					break;
				}
			}
			App.Events.addNode(el, r);

			return el;
		}
	}
};


code:
App.Events.SEExpiration = class SEExpiration extends App.Events.BaseEvent {
	constructor(actors, params) {
		super(actors, params);
	}

	/** Custom casting: all expiring slaves are cast automatically. If no slaves are cast, casting fails and the event does not run. */
	castActors() {
		this.actors = V.slaves.filter(s => s.indenture === 0).map(s => s.ID);
		return this.actors.length > 0;
	}

	execute(node) {
		V.encyclopedia = "Indentured Servants";
		const that = this;
		const artRenderer = V.seeImages && V.seeReportImages ? new App.Art.SlaveArtBatch(that.actors, 0, 0) : null;
		if (artRenderer) {
			node.append(artRenderer.writePreamble());
		}

		for (const id of that.actors) {
			const slave = getSlave(id);
			if (slave) {
				App.UI.DOM.appendNewElement("div", node, expire(slave));
				node.append(sectionBreak());
			}
		}
		V.passageSwitchHandler = () => {
			for (const slaveID of that.actors) {
				if (getSlave(slaveID)) {
					removeSlave(getSlave(slaveID));
				}
			}
		};

		function sectionBreak() {
			const hr = document.createElement("hr");
			hr.style.margin = "0";
			return hr;
		}

		/**
		 *
		 * @param {App.Entity.SlaveState} slave
		 */
		function expire(slave) {
			const el = new DocumentFragment();
			const r = [];
			const {
				He, His,
				he, his, him, himself, woman
			} = getPronouns(slave);
			const {title: Master} = getEnunciation(slave);
			if (artRenderer) {
				App.UI.DOM.appendNewElement("div", el, artRenderer.render(slave), ["imageRef", "tinyImg"]);
			}

			r.push(`${slave.slaveName}'s indentured servitude is ending this week, meaning that your arcology is gaining a citizen.`);
			V.lowerClass += 1;

			let seed = 0;
			for (let seeXp = 0; seeXp < V.slaves.length; seeXp++) {
				if (V.slaves[seeXp].devotion <= 20) {
					seed = 1;
					V.slaves[seeXp].devotion -= 1;
				}
			}
			if (seed === 1) {
				r.push(`Those of your slaves who are unhappy with their lives under you are <span class="mediumorchid">envious or angry</span> to see ${him} become free, according to their individual natures.`);
			}

			const desc = App.UI.DOM.appendNewElement("div", el);
			const result = App.UI.DOM.appendNewElement("div", el);

			slave.indenture = 52;
			let cost = slaveCost(slave);

			if (slave.fetish === "mindbroken") {
				r.push(`Since ${he} is mindbroken, there is precisely no chance that ${he} will be able to look after ${himself}. ${He}`);
				if (hasAnyLegs(slave)) {
					r.push(`stands`);
				} else {
					r.push(`sits`);
				}
				r.push(`before you dumbly, betraying no reaction to the prospect of becoming free from sexual slavery. In situations like this, it is perfectly acceptable to subject ${him} to another indenture for ${his} own good.`);

				if (V.cash > 1000) {
					App.UI.DOM.appendNewElement("div", result, App.UI.DOM.link(
						`Plead necessity and reactivate ${his} indenture`,
						() => {
							keepSlave(-1000);
							r.push(`You plead necessity and place ${him} under another indenture, paying the trivial fees left over once ${he} has been charged for ${his} own forecasted upkeep. Naturally, ${he} offers no response at all to any of this.`);
						},
						[],
						"",
						`This costs ${cashFormat(1000)}`
					));
				} else {
					App.UI.DOM.appendNewElement("div", result, `You cannot afford to do this`, "note");
				}
			} else if ((slave.relationship < -1) && (slave.devotion > 95) && (slave.trust > 95)) {
				r.push(`${He} has been trying desperately hard not to think about this trying situation, but when ${he} comes before you on the day of ${his} indenture's expiration, ${he} can ignore it no longer. ${He}`);
				if (!hasAnyArms(slave)) {
					r.push(`wriggles disconsolately, probably wishing ${he} could throw ${himself} at your feet or cling to your knees.`);
				} else {
					r.push(`throws ${himself} at your feet and clings to your knees, bursting into tears.`);
				}
				if (!canTalk(slave)) {
					r.push(`${He} does ${his} best to communicate an earnest desire to stay, and repeats over and over that ${he} loves you. ${He} begins to indicate a willingness to accept true, unlimited slavery, if that's what it takes to stay.`);
				} else {
					r.push(Spoken(slave, `"Please, don't send me away,"`));
					r.push(`${he} sobs.`);
					r.push(Spoken(slave, `"I love you! I'll d-do anything — I'll be your slave! Please, enslave me. I l-love you..."`));
					r.push(`${he} moans, trailing off into convulsive blubbering.`);
				}

				if (V.cash > 1000) {
					App.UI.DOM.appendNewElement("div", result, App.UI.DOM.link(
						`Enslave ${him}`,
						() => {
							const el = new DocumentFragment();
							const r = [];
							r.push(`${He}'s beside ${himself} with joy when you accept ${his} plea and enslave ${him}. ${He}'s given you the finest proof of loyalty a slave possibly can, having tasted a moment of freedom under the law, and thrown it away with utter contempt.`);
							if (hasAnyEyes(slave)) {
								r.push(`${His} ${App.Desc.eyesColor(slave)}`);
								if (hasBothEyes(slave)) {
									if (canSee(slave)) {
										r.push(`watch you`);
									} else {
										r.push(`are wide`);
									}
								} else {
									if (canSee(slave)) {
										r.push(`watches you`);
									} else {
										r.push(`is wide`);
									}
								}
								r.push(`with`);
							} else {
								r.push(`${His} face shows`);
							}
							r.push(`eager anticipation, radiating gladness that the prospect of separation from you has gone.`);
							App.Events.addNode(el, r);
							slave.indenture = -1;
							slave.indentureRestrictions = 0;
							keepSlave(-1000);
							jQuery(result).empty().append(el);
						},
						[],
						"",
						`This costs ${cashFormat(1000)}`
					));
				} else {
					App.UI.DOM.appendNewElement("div", result, `You cannot afford to do this`, "note");
				}
			} else if ((slave.devotion > 50) && (slave.trust > 50)) {
				cost = Math.trunc((cost * 0.5) / 500) * 500;
				cost = Math.clamp(cost, minimumSlaveCost(), 100000);

				r.push(`${His} feelings on this are quite mixed, since ${he} has come to feel that ${he} has a place under you.`);
				if (!hasAnyLegs(slave)) {
					r.push(`Propped up`);
				} else {
					r.push(`Standing before you`);
				}
				r.push(`at the moment of ${his} scheduled emancipation, ${he} seems to be struggling to express ${himself}.`);
				if (!canTalk(slave)) {
					r.push(`${He} does ${his} best to communicate a willingness to remain your slave, indicating that ${he} wouldn't press too hard about the price if you offered ${him} another indenture.`);
				} else {
					r.push(Spoken(slave, `"${Master}, um,"`));
					r.push(`${he} says hesitantly.`);
					r.push(Spoken(slave, `"I don't mind being your slave. Could I — would you please give me another indenture? I'm, um, not too worried about the price."`));
				}

				if (V.cash > cost) {
					App.UI.DOM.appendNewElement("div", result, App.UI.DOM.link(
						`Offer ${him} a one year supplementary indenture`,
						() => {
							keepSlave(cost);
							jQuery(result).empty().append(`${He} smiles almost shyly when you offer ${him} a one year supplementary indenture. The price is reasonable, but definitely favorable to you. ${He} accepts it anyway, and you transfer the money into an escrow account to be held for ${him} until ${his} new indenture is done. Your sex slave once again, ${he} awaits your pleasure without a hint of fear.`);
						},
						[],
						"",
						`This costs ${cashFormat(cost)}`
					));
				} else {
					App.UI.DOM.appendNewElement("div", result, `You cannot afford to do this`, "note");
				}
			} else if ((slave.devotion >= -20) && (slave.trust > 20)) {
				r.push(`${He} approaches the moment with calculation, since ${he} has found more of a place in slavery than ${he} probably expected when ${he} became an indentured servant.`);
				if (!hasAnyLegs(slave)) {
					r.push(`Propped up`);
				} else {
					r.push(`Standing before you`);
				}
				r.push(`at the moment of ${his} scheduled emancipation, ${he} seems willing to consider a short term continuation of service.`);

				if (V.cash > cost) {
					App.UI.DOM.appendNewElement("div", result, App.UI.DOM.link(
						`Offer ${him} a one year supplementary indenture`,
						() => {
							keepSlave(cost);
							jQuery(result).empty().append(`${He} looks pensive when you offer ${him} a one year supplementary indenture. The price reflects the market, and is a reasonable compensation for a year of sexual slavery. ${He} accepts it after some consideration, and you transfer the money into an escrow account to be held for ${him} until ${his} new indenture is done. Your sex slave once again, ${he} awaits orders with complacency.`);
						},
						[],
						"",
						`This costs ${cashFormat(cost)}`
					));
				} else {
					App.UI.DOM.appendNewElement("div", result, `You cannot afford to do this`, "note");
				}
			} else {
				r.push(`${He} makes no effort at all to conceal ${his} joy at being a free ${woman} again.`);
				if (slave.origin === "$He put $himself up as collateral at a poker game, and lost.") {
					r.push(`A bet is a bet, but that was a lonnng year. There's still room for ${him} in your ${V.mercenariesTitle}, but many of them have come to see ${him} in a new, more... intimate way. As a free ${woman}, ${he}'ll have to decide if it's worth the risk and the sex to stay here and fight for you who ${he} loathes... or else take up arms elsewhere in an ever more uncertain world.`);
					if (slave.addict > 5) {
						r.push(`They'll need to make money fast as they remain addicted to your aphrodisiacs.`);
					}
				} else {
					r.push(`It seems very unlikely that ${he}'ll stay in the arcology; ${he}'ll probably take what remains of ${his} indenture payment, held in escrow for this day, and be off to wherever it is that ${he} came from in the first place.`);
				}
			}
			App.Events.addNode(desc, r);
			App.UI.DOM.appendNewElement("h3", el, `Final notes?`);
			const note = App.UI.DOM.appendNewElement("div", el, null, "note");
			App.UI.DOM.appendNewElement("div", note, `${His} most recent task was to ${(V.assignmentRecords[slave]) ? `${slave.assignment}, and before that to ${V.assignmentRecords[slave]}` : slave.assignment}.`, "indent");
			note.append(slaveImpactLongTerm(slave));

			return el;

			function keepSlave(cost) {
				cashX(forceNeg(cost), "slaveTransfer", slave);
				that.actors.delete(slave.ID);
				V.lowerClass -= 1;
			}
		}
	}
};