code:
:: Club Advertisement [nobr]

	<<switch $clubDecoration>>
		<<case "Roman Revivalist">>
			$clubNameCaps is decorated like a Roman villa's entertainment rooms. There is a lot of white stone, plaster, and terracotta.
		<<case "Aztec Revivalist">>
			$clubNameCaps is decorated with obsidian figures inserted in the lime walls and giant oak pillars that give a homey feeling to the otherwise cold building.
		<<case "Egyptian Revivalist">>
			$clubNameCaps is decorated like a room in an ancient Egyptian palace. There are columns of warm stone and pools of clear water full of aquatic plants.
		<<case "Edo Revivalist">>
			$clubNameCaps is furnished as an Edo period theater. Performances of the traditional Japanese arts can be seen here, though more modern dancing happens in the evenings. In either case, geisha girls are present and willing.
		<<case "Arabian Revivalist">>
			$clubNameCaps is designed like an open plaza in an Arabian palace, with a raised stage in the center for erotic dancing. Diaphanous, flowing curtains billow across the space, dispersing the narcotic smoke billowing from a score of hookahs.
		<<case "Chinese Revivalist">>
			$clubNameCaps is furnished as an old Chinese disorderly house. It's intentionally packed in so that closeness and good cheer is obligatory here; prominent citizens share tables while their hangers-on jostle for room.
		<<case "Chattel Religionist">>
			$clubNameCaps isn't a religious establishment, but it almost looks like one. It's clean and proper, with beams of natural light that come down to highlight holy sex slaves' bodies.
		<<case "Degradationist">>
			$clubNameCaps has a perverted, debauched appearance. The décor is utilitarian so it can be cleaned easily, and the reason is obvious. Many patrons have brought their own slaves to publicly rape here.
		<<case "Repopulation Focus">>
			$clubNameCaps has a gaudy appearance. There are lots of deep soft chairs for pregnant patrons and slaves to rest in and screens showing girls with large bellies lining the walls.
		<<case "Eugenics">>
			$clubNameCaps has a gaudy appearance. There are screens lining the walls discouraging unprotected slave sex. The real action happens in the several exclusive rooms reserved for society's best.
		<<case "Asset Expansionist">>
			$clubNameCaps has a gaudy appearance. There are a lot of neon lights and there are screens everywhere, showing off big tits and plush asses.
		<<case "Transformation Fetishist">>
			$clubNameCaps has a gaudy appearance. There are a lot of neon lights and there are screens everywhere, showing off huge fake tits and plastic dick sucking lips.
		<<case "Gender Radicalist">>
			$clubNameCaps has a gaudy appearance. There are a lot of neon lights and there are screens everywhere, showing closeups of cocks fucking every imaginable orifice.
		<<case "Gender Fundamentalist">>
			$clubNameCaps has an old world appearance, a decidedly throwback atmosphere harking back to the glory days of cultures past.
		<<case "Physical Idealist">>
			$clubNameCaps isn't a gym, but it smells like one. The dancing is rough and competitive, and the drinks are rich with protein.
		<<case "Supremacist">>
			$clubNameCaps is decorated like an upper-class gentleman's club in the old countries of $arcologies[0].FSSupremacistRace people.
		<<case "Subjugationist">>
			$clubNameCaps is decorated like an upper-class gentleman's club in the old countries which favored $arcologies[0].FSSubjugationistRace slaves.
		<<case "Paternalist">>
			$clubNameCaps is handsome and well-kept, even romantic. Though the slaves here are sex slaves, every provision is made to encourage them to enjoy themselves.
		<<case "Body Purist">>
			$clubNameCaps is gorgeous, decorated and kept in the height of fashionable night establishment style. The music is cutting edge and everything and everyone is elegant.
		<<case "Slimness Enthusiast">>
			$clubNameCaps is distinctly gaudy, with lots of sugary drinks on offer. The music and décor are of a decidedly bubblegum quality.
		<<case "Pastoralist">>
			$clubNameCaps is decorated to resemble a frontier disorderly house. The drinks are pounded straight, and there's a set of swinging doors for bad men to part dramatically as they enter.
		<<case "Maturity Preferentialist">>
			$clubNameCaps is surprisingly elegant. The music consists of refined remixes of traditional dance music, offering slaves and citizens the chance to dance beautifully together.
		<<case "Youth Preferentialist">>
			$clubNameCaps is deafeningly loud. There's a bright light show running, offering staccato glimpses of the scene out on the dance floor.
		<<case "Hedonistic">>
			$clubNameCaps has a gaudy appearance. The dance floor is extra large to accommodate its extra wide dancers, though bodies grinding against each other is an inevitability. Plenty of roomy, comfortable booths encircle the room for an exhausted citizen to relax with his plush dance partner, and a wide selection of greasy food accompanies the drinks. <<if $arcologies[0].FSHedonisticDecadenceResearch == 1>>Platters of food are complementary for feeding slaves<<else>>Feeders are available in the booths to feed tired slaves<</if>> while they get fondled.
		<<case "Intellectual Dependency">>
			$clubNameCaps is distinctly gaudy and easy for slaves to move around in. The dancing is as energetic and sexual, and the drinks sugary and sweet.
		<<case "Slave Professionalism">>
			$clubNameCaps is decorated like an upper-class gentleman's club. It is where a true courtesan works their craft.
		<<case "Petite Admiration">>
			$clubNameCaps has a gaudy appearance. The dance floor is surrounded by raised platforms so even the shortest slave can be seen by the crowd.
		<<case "Statuesque Glorification">>
			$clubNameCaps has a tiered appearance. The booths and bar are positioned overlooking the dance floor so patrons may loom over the dancing slaves even when seated.
	<</switch>>

	<<if $clubAdsSpending > 0>>
		Screens outside the entrance are showing softcore music videos to advertise $clubName.
		<<if $clubAdsOld == 1>>
			The featured strippers are all MILFs.
		<<elseif $clubAdsOld == -1>>
			The featured strippers are all nice and young.
		<<elseif $clubAdsOld == -2>>
			The featured strippers are all teenagers.
		<<elseif $clubAdsOld == -3>>
			The featured strippers are all lolis.
		<<else>>
			The featured strippers vary in age.
		<</if>>
		<<if $clubAdsStacked == 1>>
			Lots of bouncing breasts and butts
		<<elseif $clubAdsStacked == -1>>
			Lots of trim breasts and shapely butts
		<<else>>
			A variety of breast and butt sizes and shapes
		<</if>>
		are on display, and
		<<if $clubAdsImplanted == 1>>
			most of these are augmented by implants.
		<<elseif $clubAdsImplanted == -1>>
			they're all natural.
		<<else>>
			some are augmented by implants.
		<</if>>
		<<if $seePreg == 1>>
			<<if $clubAdsPreg == 1>>
				Most of strippers have firm, rounded bellies.
			<<elseif $clubAdsPreg == -1>>
				Most of the strippers have firm, flat bellies.
			<<else>>
				Some of the strippers are pregnant.
			<</if>>
		<</if>>
		<<if $clubAdsModded == 1>>
			Everything is heavily pierced and tattooed.
		<<elseif $clubAdsModded == -1>>
			Everything is free of tattoos and piercings.
		<<else>>
			Some of these assets are tattooed and pierced, and some aren't.
		<</if>>
		The strippers get naked quickly, and show off
		<<if $clubAdsXX == 1>>
			their pussies and assholes.
		<<elseif $clubAdsXX == -1>>
			their assholes.
		<<else>>
			their holes.
		<</if>>
	<</if>>

	<<if $clubAdsSpending >= 5000>>
		Advertisements based on these scenes run constantly in media across $arcologies[0].name, and there's an active merchandising campaign underway to promote your club and its girls.
	<<elseif $clubAdsSpending >= 4000>>
		Advertisements based on these scenes run constantly in media across $arcologies[0].name.
	<<elseif $clubAdsSpending >= 3000>>
		Advertisements based on these scenes are run in media across $arcologies[0].name.
	<<elseif $clubAdsSpending >= 2000>>
		Advertisements based on these scenes run regularly in arcology media.
	<<elseif $clubAdsSpending >= 1000>>
		Advertisements based on these scenes run occasionally in arcology media.
	<<else>>
		$arcologies[0].name has a robust internal media that could be used to bring patrons into the club.
	<</if>>

		You are spending <<print cashFormatColor(forceNeg($clubAdsSpending))>> each week to advertise $clubName.

		<<if $clubAdsSpending > 900>>
			<<link "Decrease">><<set $clubAdsSpending -= 1000>><<goto "Club Advertisement">><</link>> |
		<<else>>
			Decrease |
		<</if>>
		<<if $clubAdsSpending < 5000>>
			<<link "Increase">><<set $clubAdsSpending += 1000>><<goto "Club Advertisement">><</link>>
		<<else>>
			Increase
		<</if>>

Design $clubNameCaps Ad Campaign

	Will replace relevant variety bonuses

	<<= App.Ads.report("club", true)>>


code:
:: Club Report [nobr]

<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.club)>>
<<set _DL = _slaves.length, _SL = $slaves.length, $clubBonuses = 0, $legendaryEntertainerID = 0, _FLsFetish = 0>>
<<set $legendaryWombID = 0>>
<<set _minBonus = 50, _maxBonus = 150>>

<<set $facility = $facility || {}, $facility.club = initFacilityStatistics($facility.club)>>

<<if _S.DJ>>
	<<if (_S.DJ.health.condition < -80)>>
		<<run improveCondition(_S.DJ, 20)>>
	<<elseif _S.DJ.health.condition < -40>>
		<<run improveCondition(_S.DJ, 15)>>
	<<elseif _S.DJ.health.condition < 0>>
		<<run improveCondition(_S.DJ, 10)>>
	<<elseif _S.DJ.health.condition < 90>>
		<<run improveCondition(_S.DJ, 7)>>
	<</if>>
	<<if _S.DJ.devotion <= 60>>
		<<set _S.DJ.devotion += 5>>
	<</if>>
	<<if _S.DJ.trust < 60>>
		<<set _S.DJ.trust += 3>>
	<</if>>
	<<if _S.DJ.fetishStrength <= 95>>
		<<if _S.DJ.fetish != "humiliation">>
			<<if fetishChangeChance(_S.DJ) > random(0,100)>>
				<<set _FLsFetish = 1, _S.DJ.fetishKnown = 1, _S.DJ.fetish = "humiliation">>
			<</if>>
		<<elseif _S.DJ.fetishKnown == 0>>
			<<set _FLsFetish = 1, _S.DJ.fetishKnown = 1>>
		<<else>>
			<<set _FLsFetish = 2, _S.DJ.fetishStrength += 4>>
		<</if>>
	<</if>>
	<<if _S.DJ.rules.living != "luxurious">>
		<<set _S.DJ.rules.living = "luxurious">>
	<</if>>
	/% Make sure we have registered living expenses as for any other slave %/
	<<run getSlaveStatisticData(_S.DJ, $facility.club)>>
	<<setLocalPronouns _S.DJ>>
	    <<= SlaveFullName(_S.DJ)>> is performing as the DJ.
	<<if _S.DJ.relationship == -3 && _S.DJ.devotion > 50>>
		$He tries $his best to be your energetic, cheerful $wife.
	<</if>>
	<<if (_FLsFetish == 1)>>
		$He's expected to be the innovative, beautiful DJ spinning beats one minute, and come out of $his booth to grind on the floor the next; $he enjoys the interplay, and finds greater @@.lightcoral;pleasure in exhibitionism.@@
	<<elseif (_FLsFetish == 2)>>
		Every day $he gets to enjoy hundreds of stares on $his skin, and @@.lightsalmon;becomes more of an exhibitionist.@@
	<</if>>
	<<if getBestVision(_S.DJ) === 0>>
		$His lack of eyesight doesn't slow $him down; rather, it strengthens $his other senses. $His tracks have a distinct sound, since $he experiences noise as $his sight.
	<</if>>
	<<if (_S.DJ.skill.entertainment <= 10)>>
		Though _S.DJ.slaveName does $his best to lead on the club, with $his lack of skill $he can do little.
	<<elseif (_S.DJ.skill.entertainment <= 30)>>
		_S.DJ.slaveName's basic skills marginally @@.green;improve@@ the atmosphere in $clubName.
	<<elseif (_S.DJ.skill.entertainment <= 60)>>
		_S.DJ.slaveName's skills @@.green;improve@@ the atmosphere in $clubName.
	<<elseif (_S.DJ.skill.entertainment < 100)>>
		_S.DJ.slaveName's skills greatly @@.green;improve@@ the atmosphere in $clubName.
	<<elseif (_S.DJ.skill.entertainment >= 100)>>
		_S.DJ.slaveName's mastery immensely @@.green;improves@@ the atmosphere in $clubName.
	<</if>>
	<<if (_S.DJ.muscles > 5) && (_S.DJ.muscles <= 95)>>
		$His toned body helps $him lead $his fellow club sluts by letting $him dance all night.
	<</if>>
	<<if (_S.DJ.intelligence+_S.DJ.intelligenceImplant > 15)>>
		$He's smart enough to make an actual contribution to the music, greatly enhancing the entire experience.
	<</if>>
	<<if (_S.DJ.face > 95)>>
		$His great beauty is a further draw, even when $he's in $his DJ booth, but especially when $he comes out to dance.
	<</if>>
	<<if setup.DJCareers.includes(_S.DJ.career)>>
		$He has musical experience from $his life before $he was a slave, a grounding that gives $his tracks actual depth.
	<<elseif _S.DJ.skill.DJ >= $masteredXP>>
		$He has musical experience from working for you, giving $his tracks actual depth.
	<<else>>
		<<set _S.DJ.skill.DJ += random(1,Math.ceil((_S.DJ.intelligence+_S.DJ.intelligenceImplant)/15) + 8)>>
	<</if>>
	<<if (_DL + $clubSlavesGettingHelp < 10) && $DJnoSex != 1>>
		<<if ($legendaryEntertainerID == 0) && (_S.DJ.prestige == 0) && (_S.DJ.skill.entertainment >= 100) && (_S.DJ.devotion > 50)>>
			<<set $legendaryEntertainerID = _S.DJ.ID>>
		<</if>>

    Since $he doesn't have enough sluts in $clubName to make it worthwhile for $him to be on stage 24/7, $he spends $his extra time slutting it up $himself. $He has sex with _S.DJ.sexAmount citizens, @@.green;pleasing them immensely,@@ since it's more appealing to fuck the DJ than some club slut.
		<<if $showEWD != 0>>

    $He <<= App.SlaveAssignment.serveThePublic(_S.DJ)>>
		<<else>>
			<<run App.SlaveAssignment.serveThePublic(_S.DJ)>>
		<</if>>
	<</if>>
	<<if (_DL > 0)>>

<</if>>
<</if>>

<<if (_DL > 0)>>
	<<set _possibleBonuses = 0>>
	    <<if (_DL != 1)>>''The _DL slaves pleasing citizens in $clubName''<<else>>''The one slave pleasing citizens in $clubName''<</if>> worked hard to @@.green;increase your reputation@@ this week.
<</if>>

<<if _S.DJ>>
	<<set $i = $slaveIndices[$djID]>> /* apply following SA passages to facility leader */
	<<if $showEWD != 0>>

		/* 000-250-006 */
		<<if $seeImages && $seeReportImages>>

			<<= SlaveArt(_S.DJ, 0, 0)>>

		<</if>>
		/* 000-250-006 */
		<<= SlaveFullName(_S.DJ)>> is performing as the DJ in $clubName.

		<<= App.SlaveAssignment.choosesOwnClothes(_S.DJ)>>
		<<run tired(_S.DJ)>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<= App.SlaveAssignment.drugs(_S.DJ)>>
		<<= App.SlaveAssignment.relationships(_S.DJ)>>
		<<= App.SlaveAssignment.rivalries(_S.DJ)>>

    <<= App.SlaveAssignment.devotion(_S.DJ)>>
	<<else>>
		<<silently>>
		<<run App.SlaveAssignment.choosesOwnClothes(_S.DJ)>>
		<<run tired(_S.DJ)>>
		<<include "SA rules">>
		<<include "SA diet">>
		<<include "SA long term effects">>
		<<run App.SlaveAssignment.drugs(_S.DJ)>>
		<<run App.SlaveAssignment.relationships(_S.DJ)>>
		<<run App.SlaveAssignment.rivalries(_S.DJ)>>
		<<run App.SlaveAssignment.devotion(_S.DJ)>>
		<</silently>>
	<</if>>
<</if>>

<<if (_DL > 0)>>
	<<for _slave range _slaves>>
		<<set $i = $slaveIndices[_slave.ID]>>
		<<setLocalPronouns _slave>>
		<<if ($legendaryEntertainerID == 0) && (_slave.prestige == 0) && (_slave.skill.entertainment >= 100) && (_slave.devotion > 50)>>
			<<set $legendaryEntertainerID = _slave.ID>>
		<</if>>
		<<if ($legendaryWombID == 0) && (!isAmputee(_slave)) && (_slave.preg > _slave.pregData.normalBirth/1.33) && (_slave.broodmother == 0) && (_slave.eggType == "human") && (_slave.counter.births > 10) && (_slave.devotion > 50) && (_slave.prestige == 0)>>
			<<set $legendaryWombID = _slave.ID>>
		<</if>>
		<<if (_slave.devotion <= 20) && (_slave.trust >= -20)>>
			<<set _slave.devotion -= 5, _slave.trust -= 5>>
		<<elseif (_slave.devotion < 45)>>
			<<set _slave.devotion += 4>>
		<<elseif (_slave.devotion > 50)>>
			<<set _slave.devotion -= 4>>
		<</if>>

		<<if (_slave.trust < 30)>>
			<<set _slave.trust += 5>>
		<</if>>

		<<if (_slave.health.condition < -80)>>
			<<run improveCondition(_slave, 20)>>
		<<elseif (_slave.health.condition < -40)>>
			<<run improveCondition(_slave, 15)>>
		<<elseif (_slave.health.condition < 0)>>
			<<run improveCondition(_slave, 10)>>
		<<elseif (_slave.health.condition < 90)>>
			<<run improveCondition(_slave, 7)>>
		<</if>>

		<<if _slave.rules.living != "normal">>
			<<set _slave.rules.living = "normal">>
		<</if>>

		<<if $showEWD != 0>>

			/* 000-250-006 */
			<<if $seeImages && $seeReportImages>>

				<<= SlaveArt(_slave, 0, 0)>>

			<</if>>
			/* 000-250-006 */
			<<= SlaveFullName(_slave)>>
			<<if _slave.choosesOwnAssignment == 2>>
				<<= App.SlaveAssignment.choosesOwnJob(_slave)>>
			<<else>>
				is serving in $clubName.
			<</if>>

    $He <<= App.SlaveAssignment.serveThePublic(_slave)>>

			<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
			<<include "SA rules">>
			<<include "SA diet">>
			<<include "SA long term effects">>
			<<= App.SlaveAssignment.drugs(_slave)>>
			<<= App.SlaveAssignment.relationships(_slave)>>
			<<= App.SlaveAssignment.rivalries(_slave)>>

    <<= App.SlaveAssignment.devotion(_slave)>>
		<<else>>
			<<silently>>
			<<run App.SlaveAssignment.choosesOwnJob(_slave)>>
			<<run App.SlaveAssignment.serveThePublic(_slave)>>
			<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
			<<include "SA rules">>
			<<include "SA diet">>
			<<include "SA long term effects">>
			<<run App.SlaveAssignment.drugs(_slave)>>
			<<run App.SlaveAssignment.relationships(_slave)>>
			<<run App.SlaveAssignment.rivalries(_slave)>>
			<<run App.SlaveAssignment.devotion(_slave)>>
			<</silently>>
		<</if>>
	<</for>>

		<<= App.Ads.report("club")>>

	<>
	<<if $clubDecoration != "standard">>

			$clubNameCaps's customers enjoy @@.green;having sex in $clubDecoration surroundings.@@

	<</if>>

	<<includeDOM App.Facilities.Club.Stats(false)>>
	<<timed 50ms>>
		<<replace #club-stats>>
			<<includeDOM App.Facilities.Club.Stats(true)>>
		<</replace>>
	<</timed>>
<</if>>

<<if _DL > 0 || _S.DJ>>

<</if>>

repo_name: NovX/fc

license: mit


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

<<set $nextButton = "Back", $nextLink = "Master Suite", $encyclopedia = "Concubine">>
<<if ($ConcubineID != 0)>>
	<<setLocalPronouns _S.Concubine>>
	<<= SlaveFullName(_S.Concubine)>> is serving as your Concubine.

$He will take the lead in seeing to your pleasure.
<<else>>
	You have not selected a Concubine.
<</if>>

''Appoint a Concubine from your devoted slaves:''

[[None|Master Suite][removeJob(_S.Concubine, Job.CONCUBINE)]]

<<includeDOM App.UI.SlaveList.facilityManagerSelection(App.Entity.facilities.masterSuite, "Master Suite")>>


code:
App.UI.Budget.Cost = function() {
	let coloredRow = true;

	// Set up object to track calculated displays
	const income = "lastWeeksCashIncome";
	const expenses = "lastWeeksCashExpenses";

	const table = document.createElement("table");
	table.classList.add("budget");

	// HEADER
	generateHeader();

	// BODY
	table.createTBody();

	// HEADER: FACILITIES
	createSectionHeader("Facilities");

	// PENTHOUSE
	addToggle(generateRowGroup("Penthouse", "PENTHOUSE"), [
		generateRowCategory("Rest", "slaveAssignmentRest"),
		generateRowCategory("RestVign", "slaveAssignmentRestVign"),
		generateRowCategory("Fucktoy", "slaveAssignmentFucktoy"),
		generateRowCategory("Classes", "slaveAssignmentClasses"),
		generateRowCategory("House", "slaveAssignmentHouse"),
		generateRowCategory("HouseVign", "slaveAssignmentHouseVign"),
		generateRowCategory("Whore", "slaveAssignmentWhore"),
		generateRowCategory("WhoreVign", "slaveAssignmentWhoreVign"),
		generateRowCategory("Public", "slaveAssignmentPublic"),
		generateRowCategory("PublicVign", "slaveAssignmentPublicVign"),
		generateRowCategory("Subordinate", "slaveAssignmentSubordinate"),
		generateRowCategory("Milked", "slaveAssignmentMilked"),
		generateRowCategory("MilkedVign", "slaveAssignmentMilkedVign"),
		generateRowCategory("ExtraMilk", "slaveAssignmentExtraMilk"),
		generateRowCategory("ExtraMilkVign", "slaveAssignmentExtraMilkVign"),
		generateRowCategory("Gloryhole", "slaveAssignmentGloryhole"),
		generateRowCategory("Confinement", "slaveAssignmentConfinement")
	]);
	// Other
	generateRowCategory("Choosing Own Assignment", "slaveAssignmentChoice");

	// LEADERSHIP ROLES

	// HEAD GIRL
	// find passage name for HGSuite
	addToggle(generateRowGroup(V.HGSuiteNameCaps, "HEADGIRLSUITE"), [
		generateRowCategory("Head Girl", "slaveAssignmentHeadgirl"),
		generateRowCategory("Head Girl Fucktoys", "slaveAssignmentHeadgirlsuite")
	]);

	// RECRUITER
	addToggle(generateRowGroup("Recruiter", "RECRUITER"), [
		generateRowCategory("Recruiter", "slaveAssignmentRecruiter")
	]);

	// BODYGUARD
	// find passage name for Armory
	addToggle(generateRowGroup("Armory", "DOJO"), [
		generateRowCategory("Bodyguard", "slaveAssignmentBodyguard")
	]);

	// CONCUBINE
	addToggle(generateRowGroup("Master Suite", "MASTERSUITE"), [
		generateRowCategory("Master Suite Operation", "masterSuite"),
		generateRowCategory("Master Suite Concubine", "slaveAssignmentConcubine"),
		generateRowCategory("Master Suite Fucktoys", "slaveAssignmentMastersuite")
	]);

	// AGENT
	addToggle(generateRowGroup("Agent", "AGENT"), [
		generateRowCategory("Agent", "slaveAssignmentAgent"),
		generateRowCategory("Agent's Partner", "slaveAssignmentAgentPartner")
	]);

	// ARCADE
	addToggle(generateRowGroup(V.arcadeNameCaps, "ARCADE"), [
		generateRowCategory("Arcade Operation", "arcade"),
		generateRowCategory("Arcade Fuckdolls", "slaveAssignmentArcade")
	]);

	// BROTHEL
	addToggle(generateRowGroup(V.brothelNameCaps, "BROTHEL"), [
		generateRowCategory("Brothel Operation", "brothel"),
		generateRowCategory("Brothel Madam", "slaveAssignmentMadam"),
		generateRowCategory("Brothel MadamVign", "slaveAssignmentMadamVign"),
		generateRowCategory("Brothel Whore", "slaveAssignmentBrothel"),
		generateRowCategory("Brothel WhoreVign", "slaveAssignmentBrothelVign"),
		generateRowCategory("Brothel Ads", "brothelAds")
	]);

	// CELLBLOCK
	addToggle(generateRowGroup(V.cellblockNameCaps, "CELLBLOCK"), [
		generateRowCategory("Cellblock Operation", "cellblock"),
		generateRowCategory("Cellblock Warden", "slaveAssignmentWarden"),
		generateRowCategory("Cellblock Slaves", "slaveAssignmentCellblock")
	]);

	// CLUB
	addToggle(generateRowGroup(V.clubNameCaps, "CLUB"), [
		generateRowCategory("Club Operation", "club"),
		generateRowCategory("Club DJ", "slaveAssignmentDj"),
		generateRowCategory("Club DJVign", "slaveAssignmentDjVign"),
		generateRowCategory("Club Public", "slaveAssignmentClub"),
		generateRowCategory("Club PublicVign", "slaveAssignmentClubVign"),
		generateRowCategory("Club Ads", "clubAds")
	]);

	// CLINIC
	addToggle(generateRowGroup(V.clinicNameCaps, "CLINIC"), [
		generateRowCategory("Clinic Operation", "clinic"),
		generateRowCategory("Clinic Nurse", "slaveAssignmentNurse"),
		generateRowCategory("Clinic Slaves", "slaveAssignmentClinic")
	]);

	// DAIRY
	addToggle(generateRowGroup(V.dairyNameCaps, "DAIRY"), [
		generateRowCategory("Dairy Operation", "dairy"),
		generateRowCategory("Dairy Milkmaid", "slaveAssignmentMilkmaid"),
		generateRowCategory("Dairy Cows", "slaveAssignmentDairy"),
		generateRowCategory("Dairy Cows", "slaveAssignmentDairyVign")
	]);

	// FARMYARD
	addToggle(generateRowGroup(V.farmyardNameCaps, "FARMYARD"), [
		generateRowCategory("Farmyard Operation", "farmyard"),
		generateRowCategory("Farmyard Farmer", "slaveAssignmentFarmer"),
		generateRowCategory("Farmyard Farmhands", "slaveAssignmentFarmyard"),
		generateRowCategory("Farmyard FarmhandsVign", "slaveAssignmentFarmyardVign")
	]);

	// INCUBATOR
	addToggle(generateRowGroup(V.incubatorNameCaps, "INCUBATOR"), [
		generateRowCategory("Incubator Operation", "incubator"),
		generateRowCategory("Incubator Babies", "incubatorSlaves")
	]);

	// NURSERY
	addToggle(generateRowGroup(V.nurseryNameCaps, "NURSERY"), [
		generateRowCategory("Nursery Operation", "nursery"),
		generateRowCategory("Nursery Matron", "slaveAssignmentMatron"),
		generateRowCategory("Nursery Nannies", "slaveAssignmentNursery"),
		generateRowCategory("Nursery NanniesVign", "slaveAssignmentNurseryVign")
	]);

	// PIT
	addToggle(generateRowGroup(V.pitNameCaps, "PIT"), [
		generateRowCategory("Pit Operation", "pit")
	]);

	// PROSTHETIC LAB
	addToggle(generateRowGroup("Prosthetic Lab", "PROSTHETICLAB"), [
		generateRowCategory("Prosthetic Lab Operation", "lab"),
		generateRowCategory("Prosthetic Lab Research", "labResearch"),
		generateRowCategory("Prosthetic Lab Scientists", "labScientists"),
		generateRowCategory("Prosthetic Lab Menials", "labMenials")
	]);

	// SCHOOLROOM
	addToggle(generateRowGroup(V.schoolroomNameCaps, "SCHOOLROOM"), [
		generateRowCategory("Schoolroom Operation", "school"),
		generateRowCategory("Schoolroom Teacher", "slaveAssignmentTeacher"),
		generateRowCategory("Schoolroom Students", "slaveAssignmentSchool")
	]);

	// SERVANTS' QUARTERS
	addToggle(generateRowGroup(V.servantsQuartersNameCaps, "SERVANTSQUARTERS"), [
		generateRowCategory("Servants' Quarters Operation", "servantsQuarters"),
		generateRowCategory("Servants' Quarters Steward", "slaveAssignmentSteward"),
		generateRowCategory("Servants' Quarters Servants", "slaveAssignmentQuarter"),
		generateRowCategory("Servants' Quarters ServantsVign", "slaveAssignmentQuarterVign")
	]);

	// SPA
	addToggle(generateRowGroup(V.spaNameCaps, "SPA"), [
		generateRowCategory("Spa Operation", "spa"),
		generateRowCategory("Spa Attendant", "slaveAssignmentAttendant"),
		generateRowCategory("Spa Slaves", "slaveAssignmentSpa")
	]);

	// HEADER: ARCOLOGY
	createSectionHeader("Arcology");

	// SLAVES
	addToggle(generateRowGroup("Miscellaneous Slave Income and Expenses", "SLAVES"), [
		generateRowCategory("Slave Porn", "porn"),
		generateRowCategory("Slave Modifications", "slaveMod"),
		generateRowCategory("Slave Surgery", "slaveSurgery"),
		generateRowCategory("Slave Birthing", "birth")
	]);

	// MENIAL LABOR
	addToggle(generateRowGroup("Menial Labor", "LABOR"), [
		generateRowCategory("Menials: Slaves", "menialTrades"),
		generateRowCategory("Menials: Fuckdolls", "fuckdolls"),
		generateRowCategory("Menials: Bioreactors", "menialBioreactors")
	]);

	// FLIPPING
	addToggle(generateRowGroup("Flipping", "FLIPPING"), [
		generateRowCategory("Slave Transfer", "slaveTransfer"),
		generateRowCategory("Menials", "menialTransfer"),
		generateRowCategory("Fuckdolls", "fuckdollsTransfer"),
		generateRowCategory("Bioreactors", "menialBioreactorsTransfer"),
		generateRowCategory("Assistant: Menials", "menialTransferA"),
		generateRowCategory("Assistant: Fuckdolls", "fuckdollsTransferA"),
		generateRowCategory("Assistant: Bioreactors", "menialBioreactorsTransferA"),
		generateRowCategory("Menial Retirement", "menialRetirement"),
		generateRowCategory("Scientist Transfer", "labScientistsTransfer"),
		generateRowCategory("Slave Babies", "babyTransfer")
	]);

	// FINANCIALS
	addToggle(generateRowGroup("Financials", "FINANCIALS"), [
		generateRowCategory("Weather", "weather"),
		generateRowCategory("Rents", "rents"),
		generateRowCategory("Fines", "fines"),
		generateRowCategory("Events", "event"),
		generateRowCategory("Capital Expenses", "capEx"),
		generateRowCategory("Future Society Shaping", "futureSocieties"),
		generateRowCategory("School Subsidy", "schoolBacking"),
		generateRowCategory("Arcology conflict", "war"),
		generateRowCategory("Cheating", "cheating")
	]);

	// POLICIES
	addToggle(generateRowGroup("Policies", "POLICIES"), [
		generateRowCategory("Policies", "policies"),
		generateRowCategory("Subsidies and Barriers", "subsidiesAndBarriers")
	]);

	// EDICTS
	addToggle(generateRowGroup("Edicts", "EDICTS"), [
		generateRowCategory("Edicts", "edicts")
	]);

	// PERSONAL FINANCE
	addToggle(generateRowGroup("Personal Finance", "PERSONALFINANCE"), [
		generateRowCategory("Personal Business", "personalBusiness"),
		generateRowCategory("Personal Living Expenses", "personalLivingExpenses"),
		generateRowCategory("Your skills", "PCSkills"),
		generateRowCategory("Your training expenses", "PCtraining"),
		generateRowCategory("Your medical expenses", "PCmedical"),
		generateRowCategory("Citizen Orphanage", "citizenOrphanage"),
		generateRowCategory("Private Orphanage", "privateOrphanage"),
		generateRowCategory("Stock dividends", "stocks"),
		generateRowCategory("Stock trading", "stocksTraded")
	]);

	// SECURITY
	addToggle(generateRowGroup("Security", "SECURITY"), [
		generateRowCategory("Mercenaries", "mercenaries"),
		generateRowCategory("Security Expansion", "securityExpansion"),
		generateRowCategory("Special Forces", "specialForces"),
		generateRowCategory("Special Forces Capital Expenses", "specialForcesCap"),
		generateRowCategory("Peacekeepers", "peacekeepers")
	]);

	// BUDGET REPORT
	generateSummary();

	return table;

	function generateHeader() {
		const header = table.createTHead();
		const row = header.insertRow();
		const cell = row.insertCell();
		let pent = document.createElement("h1");
		pent.textContent = "Budget Overview";
		cell.appendChild(pent);

		for (let column of ["Income", "Expense", "Totals"]) {
			let cell = document.createElement("th");
			cell.textContent = column;
			row.appendChild(cell);
		}
	}

	function generateSummary() {
		let row, cell;
		createSectionHeader("Budget Report");

		row = table.insertRow();
		cell = row.insertCell();
		cell.append("Tracked totals");

		cell = row.insertCell();
		V.lastWeeksCashIncome.Total = hashSum(V.lastWeeksCashIncome);
		cell.append(cashFormatColorDOM(Math.trunc(V.lastWeeksCashIncome.Total)));

		cell = row.insertCell();
		V.lastWeeksCashExpenses.Total = hashSum(V.lastWeeksCashExpenses);
		cell.append(cashFormatColorDOM(Math.trunc(V.lastWeeksCashExpenses.Total)));

		cell = row.insertCell();
		cell.append(cashFormatColorDOM(Math.trunc(V.lastWeeksCashIncome.Total + V.lastWeeksCashExpenses.Total)));
		flipColors(row);

		row = table.insertRow();
		cell = row.insertCell();
		cell.append(`Expenses budget for week ${V.week + 1}`);
		cell = row.insertCell();
		cell = row.insertCell();
		cell.append(cashFormatColorDOM(-V.costs));
		flipColors(row);

		row = table.insertRow();
		cell = row.insertCell();
		cell.append(`Last week actuals`);
		cell = row.insertCell();
		cell = row.insertCell();
		cell = row.insertCell();
		cell.append(cashFormatColorDOM(V.cash - V.cashLastWeek));
		flipColors(row);

		row = table.insertRow();
		if ((V.cash - V.cashLastWeek) === (V.lastWeeksCashIncome.Total + V.lastWeeksCashExpenses.Total)) {
			cell = row.insertCell();
			const span = document.createElement('span');
			span.className = "green";
			span.textContent = `The books are balanced, ${properTitle()}!`;
			cell.append(span);
		} else {
			cell = row.insertCell();
			cell.append("Transaction tracking off by:");
			cell = row.insertCell();
			cell = row.insertCell();
			cell = row.insertCell();
			cell.append(cashFormatColorDOM((V.cash - V.cashLastWeek) - (V.lastWeeksCashIncome.Total + V.lastWeeksCashExpenses.Total)));
		}
		flipColors(row);
	}

	function createSectionHeader(text) {
		coloredRow = true; // make sure the following section begins with color.
		const row = table.insertRow();
		const cell = row.insertCell();
		const headline = document.createElement('h2');
		headline.textContent = text;
		cell.append(headline);
	}

	function generateRowCategory(node, category) {
		if (category === "") {
			const row = table.insertRow();
			row.append(document.createElement('br'));
			row.insertCell();
			row.insertCell();
			row.insertCell();
			flipColors(row);
			return row;
		}

		if (V[income][category] || V[expenses][category] || V.showAllEntries.costsBudget) {
			const row = table.insertRow();
			let cell = row.insertCell();
			cell.append(node);
			cell = row.insertCell();
			cell.append(cashFormatColorDOM(V[income][category]));
			cell = row.insertCell();
			cell.append(cashFormatColorDOM(-Math.abs(V[expenses][category])));
			flipColors(row);
			cell = row.insertCell();
			cell.append(cashFormatColorDOM(V[income][category] + V[expenses][category]));
			return row;
		}
	}

	function generateRowGroup(title, name) {
		/** @type {string[]} */
		const members = CategoryAssociatedGroup[name];
		const groupIn = members.map((k) => V[income][k]).reduce((acc, cur) => acc + cur);
		const groupEx = members.map((k) => V[expenses][k]).reduce((acc, cur) => acc + cur);

		if (groupIn || groupEx || V.showAllEntries.costsBudget) {
			const row = table.insertRow();
			let cell = row.insertCell();
			const headline = document.createElement('h3');
			headline.textContent = title;
			cell.append(headline);
			cell = row.insertCell();
			cell.append(cashFormatColorDOM(groupIn));
			cell = row.insertCell();
			cell.append(cashFormatColorDOM(groupEx));
			cell = row.insertCell();
			cell.append(cashFormatColorDOM(groupIn + groupEx));
			return row;
		}
	}

	/**
	 * @param {HTMLTableRowElement} head
	 * @param {Array<HTMLTableRowElement>} content
	 */
	function addToggle(head, content) {
		if (!head) {
			return;
		}
		content = content.filter(e => !!e);
		if (content.length === 0) {
			return;
		}
		App.UI.DOM.elementToggle(head, content);
	}

	function cashFormatColorDOM(cash, invert = false) {
		if (invert) {
			cash = -1 * cash;
		}
		let span = document.createElement('span');
		span.textContent = cashFormat(cash);
		if (cash === 0) {
			// cash overwrites gray, so we don't use it here.
			span.classList.add("gray");
		} else {
			span.classList.add("cash");
			// Display red if the value is negative, unless invert is true
			if (cash < 0) {
				span.classList.add("dec");
				// Yellow for positive
			} else if (cash > 0) {
				span.classList.add("inc");
				// Gray for exactly zero
			}
		}
		return span;
	}

	function flipColors(row) {
		if (coloredRow) {
			row.classList.add("colored");
		}
		coloredRow = !coloredRow;
	}
};


code:
:: Costs Budget [nobr jump-to-safe jump-from-safe]

<<set $nextButton = "Back to Main", $nextLink = "Main", _arcologyCosts = 0>>

<<if def $lastWeeksCashIncome>>
	<<set $lastWeeksCashIncome.Total = 0>>
	<<set $lastWeeksCashExpenses.Total = 0>>
<</if>>

<<if ndef $showAllEntries>>
	<<set $showAllEntries = {costsBudget: 0, repBudget: 0}>>
<</if>>

	Here you can view many of the financial details of your arcology, <<= properTitle()>>. The detailed list of slaves and their costs (food, hormones) that you may remember can now be found in the "Slave maintenance" link. Other links will allow you to directly control areas of your arcology to adjust spending to suit your tastes.

<<if $lineSeparations == 0>>
<<else>>
<</if>>

<<if $difficultySwitch == 1>>

		The Local Economy score effects some prices in your ecology. The lower the score, the higher the prices. The base score is ''100''.

			Global Economy

	| <<print $economy>>

	<<if ($cheatMode) && ($cheatModeM)>>
		<<set _tEconomy = $economy>>
		<<textbox "_tEconomy" _tEconomy>>
		<<link "Apply">>
		<<set $economy = Math.trunc(Number(_tEconomy)) || $economy, $cheater = 1>>
		<<replace "#economy">>

			Global Economy

		| <<print $economy>>
		<</replace>>
		<</link>>
	<</if>>

			Local Economy

	| <<print $localEcon>>

	<<if ($cheatMode) && ($cheatModeM)>>
		<<set _tLocalEcon = $localEcon>>
		<<textbox "_tLocalEcon" _tLocalEcon>>
		<<link "Apply">>
		<<set $localEcon = Math.trunc(Number(_tLocalEcon)) || $localEcon, $cheater = 1>>
		<<replace "#localEcon">>

			Local Economy

		| <<print $localEcon>>
		<</replace>>
		<</link>>
	<</if>>

 The current score is
	<<if $localEcon > 100>>
		<<set _econPercent = Math.trunc(1000-100000/$localEcon)/10>>
		reducing prices by ''<<print _econPercent>>%.''
	<<elseif $localEcon == 100>>
		equal to the base score. There are no price modifications.
	<<else>>
		<<set _econPercent = Math.trunc(100000/$localEcon-1000)/10>>
		increasing prices by ''<<print _econPercent>>%.''
	<</if>>

<<if $lineSeparations == 0>>

<<else>>
<</if>>
<</if>>

Your weekly costs are as follows:
<<set _options = new App.UI.OptionsGroup()>>
<<run _options.addOption("", "costsBudget", $showAllEntries)
.addValue("Normal", 0).on().addValue("Show Empty Entries", 1).neutral()>>
<<includeDOM _options.render()>>

/* Table of Totals */

	<<if ndef $lastWeeksCashIncome>>
		Financial data currently unavailable.
	<<else>>
		<<includeDOM App.UI.Budget.Cost()>>
	<</if>>

<<if ndef $lastWeeksCashErrors>>
	<<set $lastWeeksCashErrors = "Errors: ">>
<</if>>

<<if $lastWeeksCashErrors !== "Errors: ">>
	<<link "Reset">>
		<<set $lastWeeksCashErrors = "Errors: ">>
	<</link>>

	@@.red;<<print $lastWeeksCashErrors>>@@
<</if>>


code:
:: Costs Report [nobr]

<<set $nextButton = "Back to Main", $nextLink = "Main">>

<<set _SL = $slaves.length>>
<<for $i = 0; $i < _SL; $i++>>
	<<capture $i>>

<<if $lineSeparations == 0>>
<<else>>
<</if>>
		[[$slaves[$i].slaveName|Slave Interact][$activeSlave = $slaves[$i]]] will $slaves[$i].assignment.
		<<includeDOM slaveExpenses($slaves[$i])>>
	<</capture>>
<</for>>

/*
EVERYTHING BELOW THIS LINE IS IGNORED BY THE GAME AND IS FOR REFERENCE/ARCHIVE PURPOSES ONLY

<<set _arcologyCosts = 0>>
<<set _total = 0>>
//Your weekly costs are as follows.//

Since you are
<<if $PC.rules.living == "luxurious">>
	accustomed to luxury,
	<<set _ownerExpense = 3>>
<<elseif $PC.rules.living == "normal">>
	used to living well,
	<<set _ownerExpense = 2>>
<<else>>
	used to a fairly normal life,
	<<set _ownerExpense = 1>>
<</if>>
your personal living expenses are @@.yellowgreen;<<print cashFormat(Math.trunc(_ownerExpense*(250+(50000/$localEcon))))>>.@@
<<set _arcologyCosts += Math.trunc(_ownerExpense*(250+(50000/$localEcon)))>>

<<if $arcologies[0].FSRepopulationFocusLaw == 1 && $PC.pregKnown == 1>>

Rent promotion for being a pregnant citizen under ''Universal Pregnancy Subsidy:'' @@.yellowgreen;<<print cashFormat(500)>>@@
	<<set _arcologyCosts += 500>>
<</if>>

<<if $PC.preg == -1>>

Your contraceptives expenses: @@.yellowgreen;<<print cashFormat(25)>>@@
	<<set _arcologyCosts += 25>>
<<elseif $PC.fertDrugs == 1>>

Your fertility regimen: @@.yellowgreen;<<print cashFormat(50)>>@@
	<<set _arcologyCosts += 50>>
<<elseif $PC.preg >= 16>>

Increased living expenses due to being pregnant: @@.yellowgreen;<<print cashFormat(100)>>@@
	<<set _arcologyCosts += 100>>
<</if>>
<<if $PC.staminaPills == 1>>

Your stamina pills: @@.yellowgreen;<<print cashFormat(50)>>@@
	<<set _arcologyCosts += 50>>
<</if>>

<<if $PC.actualAge >= $IsInPrimePC && $PC.actualAge < $IsPastPrimePC>>
	<<if ($personalAttention == "trading") || ($personalAttention == "warfare") || ($personalAttention == "slaving") || ($personalAttention == "engineering") || ($personalAttention == "medicine") || ($personalAttention == "hacking")>>

		<<set _cost = 10000*$AgeEffectOnTrainerPricingPC,_arcologyCosts += _cost>>
		<<switch $personalAttention>>
			<<case trading>>
				__Trading__
			<<case warfare>>
				__Warfare__
			<<case slaving>>
				__Slaving__
			<<case engineering>>
				__Engineering__
			<<case medicine>>
				__Medicine__
			<<case hacking>>
				__Hacking__
		<</switch>>
		Trainer Fees: @@.yellowgreen;<<print cashFormat(_cost)>>@@
	<</if>>
<</if>>

<<if $breederOrphanageTotal > 0>><<set _breederTuition = 50>><<else>><<set _breederTuition = 0>><</if>>
<<if $citizenOrphanageTotal+$privateOrphanageTotal+$breederOrphanageTotal > 0>>

 __Orphanage__ fee: @@.yellowgreen;<<print cashFormat($citizenOrphanageTotal*100+$privateOrphanageTotal*500+_breederTuition)>>@@
	<<set _arcologyCosts += $citizenOrphanageTotal*100+$privateOrphanageTotal*500+_breederTuition>>
	<<if $citizenOrphanageTotal > 0>>

    Citizen: @@.yellowgreen;<<print cashFormat(100)>>@@ per child. Currently <<print num($citizenOrphanageTotal)>> are being taught, bringing the total to @@.yellowgreen;<<print cashFormat($citizenOrphanageTotal*100)>>.@@
	<</if>>
	<<if $privateOrphanageTotal > 0>>

    Private: @@.yellowgreen;<<print cashFormat(500)>>@@ per child. Currently <<print num($privateOrphanageTotal)>> are being taught, bringing the total to @@.yellowgreen;<<print cashFormat($privateOrphanageTotal*500)>>.@@
	<</if>>
	<<if $breederOrphanageTotal > 0>>

    Since <<print num($breederOrphanageTotal)>> of your slaves' children are being raised into productive members of society in a society funded school, you pay a flat @@.yellowgreen;<<print cashFormat(50)>>@@ usage fee.
	<</if>>
<</if>>

<<if $peacekeepers != 0 && $peacekeepers.undermining != 0>>

 <<print cashFormat($peacekeepers.undermining)>> to undermine political support for the nearby old world peacekeeping mission.
	<<set _arcologyCosts += $peacekeepers.undermining>>
<</if>>

<<if $SF.Toggle && $SF.Active >= 1 && $SF.Subsidy > 0>> <<= App.SF.Count()>>

__Financially supporting $SF.Lower until self sufficiency:__ <<print cashFormat(Math.ceil(_SFSubsidy))>>
	<<set _arcologyCosts += Math.ceil(_SFSubsidy)>>
<</if>>
<<if $mercenaries > 0>>
	<<set _mercCosts = $mercenaries*2000>>
	<<if $barracks>><<set _mercCosts *= 0.5>><</if>>
	<<if ($PC.skill.warfare >= 100) || ($PC.career == "arcology owner")>><<set _mercCosts *= 0.5>><</if>>

__Mercenary Expenses__: @@.yellowgreen;<<print cashFormat(_mercCosts)>>@@
	<<if $barracks>><<else>>//@@.red;Increased by the lack of a barracks.@@//<</if>>
	<<if ($PC.skill.warfare >= 100) || ($PC.career == "arcology owner")>>//Reduced by your @@.springgreen;mercenary contacts.@@//<</if>>
	<<set _arcologyCosts += _mercCosts>>
<</if>>

<<if $policies.retirement.menial2Citizen == 1>>

__Menial Slave Retirement Premiums__:
	<<if $policies.retirement.fate == "citizen">>
		<<set _citizenRetirementMenialsCost = $menials * 2>>
	<<else>>
		<<set _citizenRetirementMenialsCost = ($menials + $slaves.length) * 2>>
	<</if>>
	<<set _arcologyCosts += _citizenRetirementMenialsCost>>
	@@.yellowgreen;<<print cashFormat(_citizenRetirementMenialsCost)>>@@
<</if>>

<<if $rations > 0>>
	<<set _rationsPrice = ($rations*1000)>> /* this number may need tweaking *//*

__Rations__:
	@@.yellowgreen;<<print cashFormat(_rationsPrice)>>@@
<</if>>

<<if $brothel > 0 || $club > 0 || $arcade > 0 || $dairy > 0 || $farmyard > 0>>

__Arcology Building Maintenance__:
	<<if $brothel > 0>>
		<<set _advertising = 0>>
		<<if $brothelAdsSpending > 0>>
			<<set _advertising = $brothelAdsSpending>>
		<</if>>

		Brothel: @@.yellowgreen;<<print cashFormat(($brothel*$facilityCost)+(0.1*$brothelUpgradeDrugs*$brothel*$facilityCost)+_advertising)>>@@
		<<set _arcologyCosts += ($brothel*$facilityCost)+(0.1*$brothelUpgradeDrugs*$brothel*$facilityCost)+_advertising>>
	<</if>>
	<<if $club > 0>>
		<<set _advertising= 0>>
		<<if $clubAdsSpending > 0>>
			<<set _advertising = $clubAdsSpending>>
		<</if>>

		Club: @@.yellowgreen;<<print cashFormat(($club*$facilityCost)+(0.2*$clubUpgradePDAs*$club*$facilityCost)+_advertising)>>@@
		<<set _arcologyCosts += ($club*$facilityCost)+(0.2*$clubUpgradePDAs*$club*$facilityCost)+_advertising>>
	<</if>>
	<<if $arcade > 0>>

		Arcade: @@.yellowgreen;<<print cashFormat((0.5*$arcade*$facilityCost)+(0.2*$arcadeUpgradeInjectors*$arcade*$facilityCost)+(0.2*$arcadeUpgradeCollectors*$arcade*$facilityCost))>>@@
		<<set _arcologyCosts += (0.5*$arcade*$facilityCost)+(0.2*$arcadeUpgradeInjectors*$arcade*$facilityCost)+(0.2*$arcadeUpgradeCollectors*$arcade*$facilityCost)>>
	<</if>>
	<<if $dairy > 0>>

		Dairy: @@.yellowgreen;<<print cashFormat(($dairy*$facilityCost)+(0.2*$dairyFeedersUpgrade*$dairy*$facilityCost)+(0.1*$dairyPregUpgrade*$dairy*$facilityCost))>>@@
		<<set _arcologyCosts += ($dairy*$facilityCost)+(0.2*$dairyFeedersUpgrade*$dairy*$facilityCost)+(0.1*$dairyPregUpgrade*$dairy*$facilityCost)>>
		<<if $bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren > 0>>

			Additional maintenance for milking machines upgraded with biological components: @@.yellowgreen;<<print cashFormat(($bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren)*100)>>@@
			<<set _arcologyCosts += ($bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren)*100>>
		<</if>>
	<</if>>
	<<if $farmyard > 0>> /*TODO: this will also need to be expanded */
		/*

		Farmyard: @@.yellowgreen;<<print cashFormat($farmyard*$facilityCost)>>@@
		<<set _arcologyCosts += $farmyard*$facilityCost>>
	<</if>>
<</if>>

<<if ($servantsQuarters > 0 && $servantsQuartersUpgradeMonitoring > 0) ||
$nursery > 0 || $masterSuiteUpgradePregnancy > 0 || $incubator > 0 ||
$researchLab.level > 0>>

__Penthouse Facility Maintenance__:
	<<if ($servantsQuarters > 0) && ($servantsQuartersUpgradeMonitoring > 0)>>

		Servants' Quarters: @@.yellowgreen;<<print cashFormat((0.2*$servantsQuartersUpgradeMonitoring*$servantsQuarters*$facilityCost))>>@@
		<<set _arcologyCosts += 0.2*$servantsQuartersUpgradeMonitoring*$servantsQuarters*$facilityCost>>
	<</if>>
	<<if $nursery > 0>> /*TODO: this will definitely need to be expanded to take into account the number of children and other factors */
		/*

		Nursery: @@.yellowgreen;<<print cashFormat($nursery*$facilityCost)>>@@
		<<set _arcologyCosts += $nursery*$facilityCost>>
	<</if>>
	<<if ($masterSuiteUpgradePregnancy > 0)>>

		Master Suite: @@.yellowgreen;<<print cashFormat(((500*$masterSuiteUpgradePregnancy) + (1000*$masterSuitePregnancyFertilitySupplements)))>>@@
		<<set _arcologyCosts += ((500*$masterSuiteUpgradePregnancy) + (1000*$masterSuitePregnancyFertilitySupplements))>>
	<</if>>
	<<if $incubator > 0>>

		Incubation Facility: @@.yellowgreen;<<print cashFormat((10*$incubator*$facilityCost)+(0.2*$incubatorUpgradeWeight*$incubator*$facilityCost)+(0.2*$incubatorUpgradeMuscles*$incubator*$facilityCost)+(0.2*$incubatorUpgradeReproduction*$incubator*$facilityCost)+(0.2*$incubatorUpgradeGrowthStims*$incubator*$facilityCost)+(0.5*$incubatorUpgradeSpeed*$incubator*$facilityCost))>>@@
		<<set _arcologyCosts += (10*$incubator*$facilityCost)+(0.2*$incubatorUpgradeWeight*$incubator*$facilityCost)+(0.2*$incubatorUpgradeMuscles*$incubator*$facilityCost)+(0.2*$incubatorUpgradeReproduction*$incubator*$facilityCost)+(0.2*$incubatorUpgradeGrowthStims*$incubator*$facilityCost)+(0.5*$incubatorUpgradeSpeed*$incubator*$facilityCost)>>
		<<if $incubatorWeightSetting+$incubatorMusclesSetting+$incubatorReproductionSetting > 0>>

    Additional monitoring and maintenance costs for growing children: @@.yellowgreen;<<print cashFormat((($incubatorWeightSetting+$incubatorMusclesSetting+$incubatorReproductionSetting+$incubatorGrowthStimsSetting)*500))>>@@
			<<set _arcologyCosts += (($incubatorWeightSetting+$incubatorMusclesSetting+$incubatorReproductionSetting+$incubatorGrowthStimsSetting)*500)>>
		<</if>>
	<</if>>
	<<if $researchLab.level > 0>>

		Prosthetic Lab: @@.yellowgreen;<<print cashFormat((100*$researchLab.maxSpace))>>@@
		<<set _arcologyCosts += 100*$researchLab.maxSpace>>
		<<if $researchLab.hired != 0>>
    Scientists: @@.yellowgreen;<<print cashFormat((300*$researchLab.hired))>>@@
		<<set _arcologyCosts += 300*$researchLab.hired>> <</if>>
		<<if $researchLab.menials != 0>>
>    Menial Slaves: @@.yellowgreen;<<print cashFormat((100*$researchLab.menials))>>@@
		<<set _arcologyCosts += 100*$researchLab.menials>> <</if>>
	<</if>>
<</if>>

/* security expansion */
/*<<if $secExp > 0>>

	<<if $edictsUpkeep + $SFSupportUpkeep > 0>>
		__Edicts Upkeep__: @@.yellowgreen;<<print cashFormat($edictsUpkeep + $SFSupportUpkeep)>>@@
		<<set _arcologyCosts += ($edictsUpkeep + $SFSupportUpkeep)>>
	<</if>>
	<<if $propHub != 0 || $secHQ != 0 || $secBarracks != 0 || $riotCenter != 0>>

__Security Apparatus Maintenance Costs__:
		<<if $propHub != 0>>

			Propaganda Hub: @@.yellowgreen;<<print cashFormat($propHubUpkeep)>>@@
			<<set _arcologyCosts += $propHubUpkeep>>
		<</if>>
		<<if $secHQ != 0>>

			Security Headquarters: @@.yellowgreen;<<print cashFormat(($secHQUpkeep)+(20*$secMenials))>>@@
			<<set _arcologyCosts += ($secHQUpkeep)+(20*$secMenials)>>
		<</if>>
		<<if $secBarracks != 0>>

			Barracks: @@.yellowgreen;<<print cashFormat($secBarracksUpkeep)>>@@
			<<set _arcologyCosts += $secBarracksUpkeep>>
		<</if>>
		<<if $riotCenter != 0>>

			Riot Control Center: @@.yellowgreen;<<print cashFormat($riotUpkeep)>>@@
			<<set _arcologyCosts += $riotUpkeep>>
		<</if>>
	<</if>>

	<<if $SecExp.edicts.defense.soldierWages == 0>>
		<<set _soldierMod = 1>>
	<<elseif $SecExp.edicts.defense.soldierWages == 1>>
		<<set _soldierMod = 1.5>>
	<<else>>
		<<set _soldierMod = 2>>
	<</if>>
	<<set _milTotal = 0, _slaveTotal = 0, _mercTotal = 0, _numItems = 0>>
	<<if $militiaUnits.length > 0>>

__Militia Platoons Upkeep__:
		<<for _i = 0; _i < $militiaUnits.length; _i++>>

			 <<print ordinalSuffix($militiaUnits.length-[_i])>>: @@.yellowgreen;<<print cashFormat($militiaUnits[_i].troops*$soldierUpkeep * _soldierMod)>>@@
			<<set _milTotal += $militiaUnits[_i].troops*$soldierUpkeep * _soldierMod>>
			<<set _numItems += 1>>
		<</for>>

    ''Total: @@.yellowgreen;<<print cashFormat(_milTotal)>>@@''
	<</if>>
	<<if $slaveUnits.length > 0>>

__Slave Platoons Upkeep__:
		<<for _i = 0; _i < $slaveUnits.length; _i++>>

			 <<print ordinalSuffix($slaveUnits.length-[_i])>>: @@.yellowgreen;<<print cashFormat($slaveUnits[_i].troops*$soldierUpkeep * 0.5 * _soldierMod)>>@@
			<<set _slaveTotal += $slaveUnits[_i].troops*$soldierUpkeep * 0.5 * _soldierMod>>
		<</for>>

    ''Total: @@.yellowgreen;<<print cashFormat(_slaveTotal)>>@@''
	<</if>>
	<<if $mercUnits.length > 0>>

__Mercenary Platoons Upkeep__:
		<<for _i = 0; _i < $mercUnits.length; _i++>>

			 <<print ordinalSuffix($mercUnits.length-[_i])>>: @@.yellowgreen;<<print cashFormat($mercUnits[_i].troops*$soldierUpkeep * 1.5 * _soldierMod)>>@@
			<<set _mercTotal += $mercUnits[_i].troops*$soldierUpkeep * 1.5 * _soldierMod>>
		<</for>>

    ''Total: @@.yellowgreen;<<print cashFormat(_mercTotal)>>@@''
		<<if (_milTotal+_slaveTotal+_mercTotal) > 0>>

__Total Defense Force Upkeep__: @@.yellowgreen;<<print cashFormat(_milTotal+_slaveTotal+_mercTotal)>>@@
			<<set _arcologyCosts += (_milTotal+_slaveTotal+_mercTotal)>>
		<</if>>
	<</if>>
<</if>>

<<if $econWeatherDamage && $disasterResponse > 0>>
	<<set _DRUUpkeep = Math.trunc($disasterResponse * 200000 / $localEcon)>>

__Disaster Response Unit Expenses__: @@.yellowgreen;<<print cashFormat(_DRUUpkeep)>>@@
	<<set _arcologyCosts += _DRUUpkeep>>
<</if>>
<<if $antiWeatherFreeze > 0>>
	<<set _AWFUpkeep = Math.trunc($antiWeatherFreeze * 200000 / $localEcon)>>

__Passenger Upgrades Expenses__: @@.yellowgreen;<<print cashFormat(_AWFUpkeep)>>@@
	<<set _arcologyCosts += _AWFUpkeep>>
<</if>>
<<if $FSSpending != 0>>

__Society Shaping Expenses__: @@.yellowgreen;<<print cashFormat($FSSpending)>>@@
	<<set _arcologyCosts += $FSSpending>>
<</if>>
<<if $RecruiterID != 0>>

__Recruiting Expenses__: @@.yellowgreen;<<print cashFormat(250)>>@@
	<<set _arcologyCosts += 250>>
<</if>>

<<set _schoolPresent = 0, _schoolSubsidy = 0>>
<<if ($TSS.schoolPresent > 0)>>
	<<set _school = "The Slavegirl School">>
	<<set _schoolPresent = 1>>
	<<if $TSS.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($TUO.schoolPresent > 0)>>
	<<set _school = "The Utopian Orphanage">>
	<<set _schoolPresent = 1>>
	<<if $TUO.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($GRI.schoolPresent > 0)>>
	<<set _school = "Growth Research Institute">>
	<<set _schoolPresent = 1>>
	<<if $GRI.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($SCP.schoolPresent > 0)>>
	<<set _school = "St. Claver Preparatory">>
	<<set _schoolPresent = 1>>
	<<if $SCP.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($LDE.schoolPresent > 0)>>
	<<set _school = "L'École des Enculées">>
	<<set _schoolPresent = 1>>
	<<if $LDE.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($TGA.schoolPresent > 0)>>
	<<set _school = "The Gymnasium-Academy">>
	<<set _schoolPresent = 1>>
	<<if $TGA.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($HA.schoolPresent > 0)>>
	<<set _school = "The Hippolyta Academy">>
	<<set _schoolPresent = 1>>
	<<if $HA.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($TCR.schoolPresent > 0)>>
	<<set _school = "The Cattle Ranch">>
	<<set _schoolPresent = 1>>
	<<if $TCR.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($TFS.schoolPresent > 0)>>
	<<set _school = "The Futanari Sisters">>
	<<set _schoolPresent = 1>>
	<<if $TFS.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>
<<if ($NUL.schoolPresent > 0)>>
	<<set _school = "Nueva Universidad de Libertad">>
	<<set _schoolPresent = 1>>
	<<if $NUL.subsidize != 0>>
		<<set _schoolSubsidy = 1>>
	<</if>>
<</if>>

<<if _schoolPresent > 0>>
	<<if _school == "Growth Research Institute">>

		__<<print _school>> Subsidiary Lab Upkeep__: @@.yellowgreen;<<print cashFormat(1000)>>@@
		<<set _arcologyCosts += 1000>>
		<<if _schoolSubsidy > 0>>

			__<<print _school>> Subsidiary Lab Influence__: @@.yellowgreen;<<print cashFormat(1000)>>@@
		<</if>>
	<<elseif _school == "The Cattle Ranch">>

		__<<print _school>> Local Pasture Upkeep__: @@.yellowgreen;<<print cashFormat(1000)>>@@
		<<set _arcologyCosts += 1000>>
		<<if _schoolSubsidy > 0>>

			__<<print _school>> Local Pasture Influence__: @@.yellowgreen;<<print cashFormat(1000)>>@@
		<</if>>
	<<elseif _school == "The Futanari Sisters">>

		__<<print _school>> Community Upkeep__: @@.yellowgreen;<<print cashFormat(1000)>>@@
		<<set _arcologyCosts += 1000>>
		<<if _schoolSubsidy > 0>>

			__<<print _school>> Community Influence__: @@.yellowgreen;<<print cashFormat(1000)>>@@
		<</if>>
	<<else>>

		__<<print _school>> Branch Campus Upkeep__: @@.yellowgreen;<<print cashFormat(1000)>>@@
		<<set _arcologyCosts += 1000>>
		<<if _schoolSubsidy > 0>>

			__<<print _school>> Branch Campus Influence__: @@.yellowgreen;<<print cashFormat(1000)>>@@
		<</if>>
	<</if>>
<</if>>

<<if $policies.alwaysSubsidizeGrowth > 0 || $policies.alwaysSubsidizeRep > 0 || $policies.regularParties > 0>>

__Weekly Costs__:
	<<if $policies.alwaysSubsidizeGrowth > 0>>

    Arcology Growth Subsidy: @@.yellowgreen;<<print cashFormat(policies.cost())>>@@
		<<set _arcologyCosts += policies.cost()>>
	<</if>>
	<<if $policies.alwaysSubsidizeRep > 0>>

    Self-promotion Budget: @@.yellowgreen;<<print cashFormat(policies.cost())>>@@
		<<set _arcologyCosts += policies.cost()>>
	<</if>>
	<<if $policies.regularParties > 0>>

    Social Gatherings: @@.yellowgreen;<<print cashFormat(policies.cost())>>@@
		<<set _arcologyCosts += policies.cost()>>
	<</if>>
<</if>>

<<if $policies.immigrationCash == 1>>

    Pro-immigration Promotion Budget: @@.yellowgreen;<<print cashFormat(policies.cost())>>@@
	<<set _arcologyCosts += policies.cost()>>
<</if>>
<<if $policies.enslavementCash == -1>>

    Anti-enslavement Charity Budget: @@.yellowgreen;<<print cashFormat(policies.cost())>>@@
	<<set _arcologyCosts += policies.cost()>>
<</if>>

<<if $policies.coursingAssociation == 1>>

    Coursing Association Membership: @@.yellowgreen;<<print cashFormat(1000)>>@@
	<<set _arcologyCosts += 1000>>
<</if>>

''Overall Arcology Costs:'' @@.yellowgreen;<<print cashFormat(_arcologyCosts)>>@@

<<set _total = 0>> <<set _SL = $slaves.length>>
<<for $i = 0; $i < _SL; $i++>>
	<<set _individualCosts = 0>>
	''$slaves[$i].slaveName'':
	<<switch $slaves[$i].assignment>>
		<<case "be confined in the arcade">>
			<<set _livingExpense = ($rulesCost*.75)>>
		<<case "work in the dairy">>
			<<if $dairyRestraintsSetting >= 2>>
				<<set _livingExpense = ($rulesCost*.75)>>
			<<elseif $slaves[$i].rules.living == "normal">>
				<<set _livingExpense = ($rulesCost*1.5)>>
			<<elseif $dairyDecoration == "Degradationist">>
				<<set _livingExpense = ($rulesCost*.9)>>
			<<else>>
				<<set _livingExpense = $rulesCost>>
			<</if>>
		<<case "work as a farmhand">>
			<<if $slaves[$i].rules.living == "luxurious">>
				<<set _livingExpense = ($rulesCost)>>
			<<elseif $slaves[$i].rules.living == "normal">>
				<<set _livingExpense = ($rulesCost*2)>>
			<<else>>
				<<set _livingExpense = ($rulesCost*.9)>>
			<</if>>
		<<case "work in the brothel">>
			<<if $slaves[$i].rules.living == "normal">>
				<<set _livingExpense = ($rulesCost*1.5)>>
			<<else>>
				<<set _livingExpense = $rulesCost>>
			<</if>>
		<<case "serve in the club" "learn in the schoolroom">>
			<<set _livingExpense = ($rulesCost*1.5)>>
		<<case "get treatment in the clinic">>
			<<if $slaves[$i].rules.living == "luxurious">>
				<<set _livingExpense = ($rulesCost*2)>>
			<<elseif $slaves[$i].rules.living == "normal">>
				<<set _livingExpense = ($rulesCost*1.5)>>
			<<else>>
				<<set _livingExpense = $rulesCost>>
			<</if>>
		<<case "rest in the spa" "work as a nanny">>
			<<if $slaves[$i].rules.living == "luxurious">>
				<<set _livingExpense = ($rulesCost*1.75)>>
			<<elseif $slaves[$i].rules.living == "normal">>
				<<set _livingExpense = ($rulesCost*1.5)>>
			<<else>>
				<<set _livingExpense = $rulesCost>>
			<</if>>
		<<case "be a servant">>
			<<if $slaves[$i].rules.living == "normal">>
				<<set _livingExpense = ($rulesCost*1.5)>>
			<<else>>
				<<if $servantsQuartersDecoration == "Degradationist">>
					<<set _livingExpense = ($rulesCost*.9)>>
				<<else>>
					<<set _livingExpense = $rulesCost>>
				<</if>>
			<</if>>
		<<case "be confined in the cellblock">>
			<<if $slaves[$i].rules.living == "normal">>
				<<set _livingExpense = ($rulesCost*1.25)>>
			<<else>>
				<<set _livingExpense = ($rulesCost*.9)>>
			<</if>>
		<<case "be the Madam" "be the DJ" "be the Nurse" "be the Wardeness" "be the Attendant" "be the Matron" "be the Schoolteacher" "be the Stewardess" "be the Milkmaid" "be the Farmer">>
			<<set _livingExpense = ($rulesCost*2)>>
		<<default>>
			<<if $slaves[$i].rules.living == "luxurious">>
				<<if $slaves[$i].relationship >= 4>>
					<<set _livingExpense = ($rulesCost*3)>>
				<<else>>
					<<set _livingExpense = ($rulesCost*4)>>
				<</if>>
			<<elseif $slaves[$i].rules.living == "normal">>
				<<set _livingExpense = ($rulesCost*2)>>
			<<else>>
				<<set _livingExpense = $rulesCost>>
			<</if>>
	<</switch>>

    Living expenses: @@.yellowgreen;<<print cashFormat(_livingExpense)>>@@
	<<set _individualCosts += _livingExpense>>

    Basic slave food cost: @@.yellowgreen;<<print cashFormat($foodCost*4)>>@@
	<<set _individualCosts += $foodCost*4>>
	<<switch $slaves[$i].diet>>
		<<case "fattening" "muscle building">>

    Heavy diet: @@.yellowgreen;<<print cashFormat($foodCost)>>@@
			<<set _individualCosts += $foodCost>>
		<<case "restricted" "slimming">>

    Light diet: //reduced by// @@.yellowgreen;<<print cashFormat($foodCost)>>@@
			<<set _individualCosts -= $foodCost>>
	<</switch>>
	<<if $slaves[$i].weight > 130 || $slaves[$i].weight > 50 || $slaves[$i].weight < -50>>

    Caloric adjustment for
		<<if $slaves[$i].weight > 130>>
			heavy weight: @@.yellowgreen;<<print cashFormat($foodCost*2)>>@@
			<<set _individualCosts += $foodCost*2>>
		<<elseif $slaves[$i].weight > 50>>
			high weight: @@.yellowgreen;<<print cashFormat($foodCost)>>@@
			<<set _individualCosts += $foodCost>>
		<<elseif $slaves[$i].weight < -50>>
			light weight: //reduced by// @@.yellowgreen;<<print cashFormat($foodCost)>>@@
			<<set _individualCosts -= $foodCost>>
		<</if>>
	<</if>>
	<<if ($slaves[$i].geneticQuirks.fertility == 2 && $slaves[$i].geneticQuirks.hyperFertility == 2 && $slaves[$i].preg == 0 && ($slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1))>>

		<<if $geneticMappingUpgrade >= 1>>
			Additional dietary supplements due to genetic hyper-fertility: @@.yellowgreen;<<print cashFormat($foodCost/2)>>@@
		<<else>>
			Adjustment for unusual dietary deficiencies: @@.yellowgreen;<<print cashFormat($foodCost/2)>>@@
		<</if>>
		<<set _individualCosts += $foodCost/2>>
	<</if>>
	<<if ($slaves[$i].geneticQuirks.macromastia == 2)>>

		<<if $geneticMappingUpgrade >= 1>>
			Additional dietary supplements due to macromastia: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<<else>>
			Adjustment for unusual dietary deficiencies: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<</if>>
		<<set _individualCosts += $foodCost/5>>
	<</if>>
	<<if ($slaves[$i].geneticQuirks.gigantomastia == 2)>>

		<<if $geneticMappingUpgrade >= 1>>
			Additional dietary supplements due to gigantomastia: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<<else>>
			Adjustment for unusual dietary deficiencies: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<</if>>
		<<set _individualCosts += $foodCost/5>>
	<</if>>
	<<if ($slaves[$i].geneticQuirks.rearLipedema == 2)>>

		<<if $geneticMappingUpgrade >= 1>>
			Additional dietary supplements due to lipedema: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<<else>>
			Adjustment for unusual dietary deficiencies: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<</if>>
		<<set _individualCosts += $foodCost/5>>
	<</if>>
	<<if ($slaves[$i].geneticQuirks.mGain == 2 && $slaves[$i].geneticQuirks.mLoss != 2)>>

		<<if $geneticMappingUpgrade >= 1>>
			Additional dietary supplements due to myotonic hypertrophy: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<<else>>
			Adjustment for unusual dietary deficiencies: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<</if>>
		<<set _individualCosts += $foodCost/5>>
	<</if>>
	<<if ($slaves[$i].geneticQuirks.wGain == 2 && $slaves[$i].geneticQuirks.wLoss != 2)>>

		<<if $geneticMappingUpgrade >= 1>>
			Additional dietary supplements due to hyperleptinemia: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<<else>>
			Adjustment for unusual dietary deficiencies: @@.yellowgreen;<<print cashFormat($foodCost/5)>>@@
		<</if>>
		<<set _individualCosts += $foodCost/5>>
	<</if>>
	<<if $slaves[$i].drugs == "appetite suppressors">>

    Food saved via suppressed appetite: //reduced by// @@.yellowgreen;<<print cashFormat($foodCost)>>@@
		<<set _individualCosts -= $foodCost>>
	<</if>>
	<<if $slaves[$i].lactation > 0>>

    Food to support
		<<if $slaves[$i].lactation > 1>>heavy<<else>>natural<</if>> lactation from
		<<if Math.trunc($slaves[$i].boobs/10000) > 2>>absurd udders<<elseif Math.trunc($slaves[$i].boobs/10000) > 1>>enormous boobs<<else>>reasonable breasts<</if>>:
		@@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].lactation*(1+Math.trunc($slaves[$i].boobs/10000)))>>@@
		<<set _individualCosts += $foodCost*$slaves[$i].lactation*(1+Math.trunc($slaves[$i].boobs/10000))>>
	<</if>>
	<<if $slaves[$i].preg > $slaves[$i].pregData.normalBirth/8>>
		<<if $slaves[$i].assignment == "work in the dairy" && $dairyFeedersSetting > 0>>

    Extra feeding costs to support pregnancy are covered by dairy feeders.
		<<elseif ($slaves[$i].assignment == "serve in the master suite" || $slaves[$i].assignment == "be your concubine") && $masterSuiteUpgradePregnancy == 1>>

    Extra feeding costs to support pregnancy are covered by $masterSuiteName luxuries.
		<<else>>
			<<set _pAccMult = 1>>

    Extra feeding to support <<if $slaves[$i].pregControl == "speed up">>accelerated <<set _pAccMult = 3>><</if>>pregnancy:
			@@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].pregType*_pAccMult)>>@@
			<<set _individualCosts += $foodCost*$slaves[$i].pregType*_pAccMult>>
			<<if $slaves[$i].pregType >= 10>>

    Specialized food blend to support multiples:
				@@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].pregType*2*_pAccMult)>>@@
				<<set _individualCosts += $foodCost*$slaves[$i].pregType*_pAccMult>>
			<<elseif $slaves[$i].pregType >= 30>>

    Concentrated, quick to digest food blend to support extreme multiples: @@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].pregType*_pAccMult)>>@@
				<<set _individualCosts += $foodCost*2*$slaves[$i].pregType*_pAccMult>>
			<<elseif $slaves[$i].pregType >= 50>>

    Specialized dietary adjustments and concentrated, quick to digest food required to support absurd multiples: <<print cashFormat($foodCost*$slaves[$i].pregType*3*_pAccMult)>>
				<<set _individualCosts += $foodCost*$slaves[$i].pregType*3*_pAccMult>>
			<<elseif $slaves[$i].pregType >= 100>>

    Specialized dietary requirements and feeding methods to support absurd multiples:
				@@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].pregType*5*_pAccMult)>>@@
				<<set _individualCosts += $foodCost*$slaves[$i].pregType*5*_pAccMult>>
			<</if>>
		<</if>>
	<</if>>
	<<switch $slaves[$i].diet>>
		<<case "XX" "XY">>

    Hormone enriched diet:
			@@.yellowgreen;<<print cashFormat(25)>>@@
			<<set _individualCosts += 25>>
		<<case "XXY">>

    Specialized hermaphrodite diet:
			@@.yellowgreen;<<print cashFormat(75)>>@@
			<<set _individualCosts += 75>>
		<<case "cleansing">>

    Chemical cleansing diet:
			@@.yellowgreen;<<print cashFormat(50)>>@@
			<<set _individualCosts += 50>>
		<<case "fertility">>

    Specialized fertility diet:
			@@.yellowgreen;<<print cashFormat(25)>>@@
			<<set _individualCosts += 50>>
	<</switch>>
	<<if $boobAccessibility != 1>>
		<<if ($slaves[$i].boobs > 20000)>>
			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>

    Increased living expenses due to inconveniently huge boobs:
				@@.yellowgreen;<<print cashFormat(50)>>@@
				<<set _individualCosts += 50>>
			<</if>>
		<</if>>
	<</if>>
	<<if $pregAccessibility != 1>>
		<<if ($slaves[$i].belly >= 60000)>>
			<<if ($slaves[$i].assignment != "labor in the production line") && ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>

    Increased living expenses due to an inconveniently huge belly:
				@@.yellowgreen;<<print cashFormat(100)>>@@
				<<set _individualCosts += 100>>
			<</if>>
		<</if>>
	<</if>>
	<<if $dickAccessibility != 1>>
		<<if ($slaves[$i].dick > 45)>>
			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>

    Increased living expenses due to an inconveniently huge penis:
				@@.yellowgreen;<<print cashFormat(50)>>@@
				<<set _individualCosts += 50>>
			<</if>>
		<</if>>
	<</if>>
	<<if $ballsAccessibility != 1>>
		<<if ($slaves[$i].balls > 90)>>
			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>

    Increased living expenses due to inconveniently huge balls:
				@@.yellowgreen;<<print cashFormat(50)>>@@
				<<set _individualCosts += 50>>
			<</if>>
		<</if>>
	<</if>>
	<<if $buttAccessibility != 1>>
		<<if ($slaves[$i].butt > 15)>>
			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>

    Increased living expenses due to an inconveniently huge butt:
				@@.yellowgreen;<<print cashFormat(50)>>@@
				<<set _individualCosts += 50>>
			<</if>>
		<</if>>
	<</if>>
	<<if !canSee($slaves[$i]) && ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>

    Increased living expenses due to lack of sight:
		@@.yellowgreen;<<print cashFormat(50)>>@@
		<<set _individualCosts += 50>>
	<<elseif $slaves[$i].eyes <= -1 && $slaves[$i].eyewear != "corrective glasses" && $slaves[$i].eyewear != "corrective contacts">>

    Increased living expenses due to poor vision:
		@@.yellowgreen;<<print cashFormat(25)>>@@
		<<set _individualCosts += 25>>
	<<elseif ($slaves[$i].eyewear == "blurring glasses") || ($slaves[$i].eyewear == "blurring contacts")>>

    Increased living expenses due to blurred vision:
		@@.yellowgreen;<<print cashFormat(25)>>@@
		<<set _individualCosts += 25>>
	<</if>>
	<<if !canHear($slaves[$i]) && ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>

    Increased living expenses due to lack of hearing:
		@@.yellowgreen;<<print cashFormat(20)>>@@
		<<set _individualCosts += 20>>
	<<elseif $slaves[$i].hears <= -1 && $slaves[$i].earwear != "hearing aids">>

    Increased living expenses due to poor hearing:
		@@.yellowgreen;<<print cashFormat(5)>>@@
		<<set _individualCosts += 5>>
	<<elseif ($slaves[$i].earwear == "muffling ear plugs")>>

    Increased living expenses due to muffled hearing:
		@@.yellowgreen;<<print cashFormat(5)>>@@
		<<set _individualCosts += 5>>
	<</if>>
	<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
		<<if (!hasAllNaturalLimbs($slaves[$i]))>>
			<<if (isAmputee($slaves[$i]))>>

    Increased living expenses due to limblessness:
				@@.yellowgreen;<<print cashFormat($rulesCost)>>@@
				<<set _individualCosts += $rulesCost>>
			<<else>>

    Increased living expenses due to prosthetics:
				@@.yellowgreen;<<print cashFormat($rulesCost/2)>>@@
				<<set _individualCosts += $rulesCost/2>>
			<</if>>
		<<elseif !canWalk($slaves[$i])>>

    Increased living expenses due to immobility:
			@@.yellowgreen;<<print cashFormat($rulesCost)>>@@
			<<set _individualCosts += $rulesCost>>
		<</if>>
	<</if>>
	<<if $slaves[$i].boobsImplant > 10000>>
		<<if $slaves[$i].boobsImplantType == "string">>

    Maintenance cost for oversized string implants:
			@@.yellowgreen;<<print cashFormat(50)>>@@
			<<set _individualCosts += 50>>
		<</if>>
	<</if>>
	<<if $slaves[$i].buttImplant > 5>>
		<<if $slaves[$i].buttImplantType == "string">>

    Maintenance cost for oversized string implants:
			@@.yellowgreen;<<print cashFormat(50)>>@@
			<<set _individualCosts += 50>>
		<</if>>
	<</if>>
	<<if $slaves[$i].preg > $slaves[$i].pregData.minLiveBirth>>
		<<if $universalRulesBirthing == 1>>
			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2)>>

    Coverage cost for daily pregnancy scanning:
				@@.yellowgreen;<<print cashFormat(50)>>@@
				<<set _individualCosts += 50>>
			<</if>>
		<</if>>
	<</if>>
	<<if $policies.retirement.fate == "citizen">>

    Retirement account payments:
		@@.yellowgreen;<<print cashFormat(250)>>@@
		<<set _individualCosts += 250>>
	<</if>>
	<<if ($slaves[$i].inflation == 3)>>
		<<switch $slaves[$i].inflationType>>
		<<case "water">>

    Costs of specially formulated water for enemas; 2 gallons:
			@@.yellowgreen;<<print cashFormat(100)>>@@
			<<set _individualCosts += 100>>
		<<case "food">>

    Costs of filler food for slave stuffing; 2 gallons:
			@@.yellowgreen;<<print cashFormat(($foodCost*4))>>@@
			<<set _individualCosts += ($foodCost*4)>>
		<<case "curative" "aphrodisiac" "tightener">>

    Costs of specially formulated drug mixtures for enemas; 2 gallons:
			@@.yellowgreen;<<print cashFormat((100+($drugsCost*2)))>>@@
			<<set _individualCosts += (100+($drugsCost*2))>>
		<</switch>>
	<<elseif ($slaves[$i].inflation == 2)>>
		<<switch $slaves[$i].inflationType>>
		<<case "water">>

    Costs of specially formulated water for enemas; 1 gallon:
			@@.yellowgreen;<<print cashFormat(50)>>@@
			<<set _individualCosts += 50>>
		<<case "food">>

    Costs of filler food for slave stuffing; 1 gallon:
			@@.yellowgreen;<<print cashFormat(($foodCost*2))>>@@
			<<set _individualCosts += ($foodCost*4)>>
		<<case "curative" "aphrodisiac" "tightener">>

    Costs of specially formulated drug mixtures for enemas; 1 gallon:
			@@.yellowgreen;<<print cashFormat((50+($drugsCost*2)))>>@@
			<<set _individualCosts += (50+($drugsCost*2))>>
		<</switch>>
	<<elseif ($slaves[$i].inflation == 1)>>
		<<switch $slaves[$i].inflationType>>
		<<case "water">>

    Costs of specially formulated water for enemas; 2 liters:
			@@.yellowgreen;<<print cashFormat(25)>>@@
			<<set _individualCosts += 25>>
		<<case "food">>

    Costs of filler food for slave stuffing; 2 liters:
			<<print cashFormat($foodCost)>>
			<<set _individualCosts += ($foodCost)>>
		<<case "curative" "aphrodisiac" "tightener">>

    Costs of specially formulated drug mixtures for enemas; 2 liters:
			@@.yellowgreen;<<print cashFormat((25+($drugsCost*2)))>>@@
			<<set _individualCosts += (25+($drugsCost*2))>>
		<</switch>>
	<</if>>
	<<switch $slaves[$i].drugs>>
	<<case "anti-aging cream">>

    Anti-aging creams:
		<<print cashFormat(($drugsCost*10))>>
		<<set _individualCosts += ($drugsCost*10)>>
	<<case "female hormone injections" "male hormone injections">>

    Hormonal injections:
		@@.yellowgreen;<<print cashFormat(($drugsCost*5))>>@@
		<<set _individualCosts += ($drugsCost*5)>>
	<<case "growth stimulants">>

    Growth stimulants:
		@@.yellowgreen;<<print cashFormat(($drugsCost*5))>>@@
		<<set _individualCosts += ($drugsCost*5)>>
	<<case "psychostimulants">>

    Mental stimulants:
		@@.yellowgreen;<<print cashFormat(($drugsCost*5))>>@@
		<<set _individualCosts += ($drugsCost*5)>>
	<<case "intensive breast injections" "intensive butt injections" "intensive penis enhancement" "intensive testicle enhancement" "intensive lip injections" "hyper breast injections" "hyper butt injections" "hyper penis enhancement" "hyper testicle enhancement" "hyper lip injections">>

    Intensive drugs:
		@@.yellowgreen;<<print cashFormat($drugsCost*5)>>@@
		<<set _individualCosts += $drugsCost*5>>
	<<case "sag-B-gone">>

    Questionable infomercial creams:
		@@.yellowgreen;<<print cashFormat(Math.trunc($drugsCost/10))>>@@
		<<set _individualCosts += ($drugsCost/10)>>
	<<case "no drugs" "none">>
	<<default>>

    Standard drugs:
		@@.yellowgreen;<<print cashFormat(($drugsCost*2))>>@@
		<<set _individualCosts += ($drugsCost*2)>>
	<</switch>>
	<<if $slaves[$i].curatives == 1 && !assignmentVisible($slaves[$i])>>
	<<elseif $slaves[$i].curatives > 0>>

    Health drugs:
		@@.yellowgreen;<<print cashFormat($drugsCost+($slaves[$i].curatives*$drugsCost))>>@@
		<<set _individualCosts += $drugsCost+($slaves[$i].curatives*$drugsCost)>>
	<</if>>
	<<if ($slaves[$i].aphrodisiacs !== 0)>>

    Aphrodisiacs/Anaphrodisiacs:
		@@.yellowgreen;<<print cashFormat(Math.trunc($drugsCost*Math.abs($slaves[$i].aphrodisiacs)))>>@@
		<<set _individualCosts += $drugsCost*Math.abs($slaves[$i].aphrodisiacs)>>
	<</if>>
	<<if ($slaves[$i].hormones != 0)>>

    Hormones:
		@@.yellowgreen;<<print cashFormat((Math.trunc($drugsCost*Math.abs($slaves[$i].hormones)*0.5)))>>@@
		<<set _individualCosts += Math.trunc($drugsCost*Math.abs($slaves[$i].hormones)*0.5)>>
	<</if>>
	<<if ($slaves[$i].bodySwap > 0)>>

    JS-Suppressants:
		@@.yellowgreen;<<print cashFormat(($drugsCost*10*$slaves[$i].bodySwap))>>@@
		<<set _individualCosts += Math.trunc($drugsCost*10*$slaves[$i].bodySwap)>>
	<</if>>
	<<if ($slaves[$i].preg == -1) && isFertile($slaves[$i])>>

    Contraceptives:
		@@.yellowgreen;<<print cashFormat((Math.trunc($drugsCost*0.5)))>>@@
		<<set _individualCosts += Math.trunc($drugsCost*0.5)>>
	<</if>>
	<<if ($studio == 1)>>
		<<if ($slaves[$i].porn.spending > 0)>>

    Publicity:
			@@.yellowgreen;<<print cashFormat($slaves[$i].porn.spending/$PCSlutContacts)>>@@
			<<set _individualCosts += ($slaves[$i].porn.spending/$PCSlutContacts)>>
		<</if>>
	<</if>>
	<<if (($slaves[$i].assignment == "be your Concubine" ||$slaves[$i].relationship == -3) && $arcologies[0].FSPetiteAdmirationLaw == 1)>>

    Big & Small Subsidy:
		@@.yellowgreen;<<print cashFormat(-200)>>@@
		<<set _individualCosts -= 200>>
	<</if>>
	<<set _total += Math.trunc(_individualCosts)>>

        __Total__:
	@@.yellowgreen;<<print cashFormat(Math.trunc(_individualCosts))>>@@

<</for>>

Overall slave costs: @@.yellowgreen;<<print cashFormat(_total)>>@@

This brings the overall total to ''@@.yellowgreen;<<print cashFormat(_arcologyCosts+_total)>>@@'' before reductions.

<<if $PC.career == "servant">>

Using your prior experience, you managed to lower your home's upkeep by @@.green;<<if $personalAttention == "upkeep">><<if $PC.belly >= 5000>>20%<<else>>25%<</if>><<else>>10%<</if>>.@@
<</if>>

<<if $secExp == 1>>

	<<if $terrain == "oceanic" || $terrain == "marine">>
		<<if $docks > 0>>

The infrastructure you've built eases the transportation and safe handling of the supplies required by the arcology. @@.green;Upkeep is lowered by <<print $docks * 5>>%.@@
		<</if>>
	<<else>>
		<<if $railway > 0>>

The infrastructure you've built eases the transportation and safe handling of the supplies required by the arcology. @@.green;Upkeep is lowered by <<print $railway * 5>>%.@@
		<</if>>
	<</if>>
<</if>>
*/


code:
:: Costs Report Slaves [nobr]

<<set _arcologyCosts = 0>>
<<if $PCSlutContacts == 0>><<set $PCSlutContacts = 1>><</if>>

<<set _total = 0>> <<set _SL = $slaves.length>>
<<for $i = 0; $i < _SL; $i++>>
	<<capture $i>>

<<if $lineSeparations == 0>>
<<else>>
<</if>>
	[[$slaves[$i].slaveName|Slave Interact][$activeSlave = $slaves[$i]]] will $slaves[$i].assignment.
	<<includeDOM slaveExpenses($slaves[$i])>>
	<</capture>>
<</for>>


code:
:: Coursing Association [nobr]

<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Coursing Association">>

You are a member of $arcologies[0].name's Coursing Association. Coursing is a Free Cities revival of the old sport of hunting rabbits and hares with sighthounds, with the typically Free Cities amendments that the hares are replaced by newly enslaved people, the sighthounds are replaced by trained slaves, and the killing of the hare is replaced by rape. Truly, a sport of gentlemen.

The chasing slaves are known as lurchers, the term once used for the sighthounds. They require speed most of all, but must also be able to tackle their quarry; lurchers with the ability and willingness to make a spectacle of molesting the hares can improve their owners' reputations.

<<if $LurcherID != 0>>
	<<= SlaveFullName(slaveStateById($LurcherID))>> is assigned to compete as your lurcher.
<<else>>
	You have not selected a lurcher, meaning that you will not participate in coursing events.
<</if>>

//
<<= properTitle()>>, slaves assigned here can continue their usual duties.//

<<if $LurcherID != 0>>

''Fire your Lurcher:''
	<<includeDOM App.UI.SlaveList.render([$LurcherID], new Array(),
		(slave) => App.UI.DOM.passageLink(SlaveFullName(slave), 'Coursing Association', () => removeJob(slave, Job.LURCHER)))>>
<</if>>

''Select a slave to course as a Lurcher:''

<<includeDOM App.UI.SlaveList.slaveSelectionList(
		s => $LurcherID !== s.ID && canWalk(s) && canHold(s) && (canSee(s) || canHear(s)) && s.fuckdoll === 0 && isSlaveAvailable(s),
		(slave) => App.UI.DOM.link(SlaveFullName(slave), () => assignmentTransition(slave, Job.LURCHER, "Coursing Association"))
	)>>