code:
:: Personal Business [nobr]

<<if $useTabs == 0>>__Personal Business__<</if>>
<br>
<<if $secExp == 1>>
	<<if $PCWounded == 1>>
		<<set $PCWoundCooldown-->>
		<<if $PCWoundCooldown > 0>>
			The injuries received in the recent battle prevents you from engaging in tiring endeavors.
		<</if>>
		<<if $PCWoundCooldown == 1>>
			You are starting to feel better. It's very likely you will be back to full working order within the next week.
		<<elseif $PCWoundCooldown == 0>>
			<<set $PCWounded = 0>>
			You have finally recovered from your injuries.
		<<else>>
			Your trusted physician believes it will still take a few weeks to fully recover.
		<</if>>
	<</if>>
<</if>>

<<if $cash < 0>>
	<<set _cashX = cashX(forceNeg(1+Math.trunc(Math.abs($cash)/100)), "personalBusiness")>>
	@@.red;You are in debt.@@ This week, interest came to <<print cashFormat(_cashX, "personalBusiness")>>.
	<<if $arcologies[0].FSRomanRevivalist != "unset">>
		Society @@.red;very strongly disapproves@@ of your being in debt; this damages the idea that you model yourself on what a Roman leader should be.
		<<= FutureSocieties.Change("RomanRevivalist", -10)>>
	<</if>>
	<<if $cash < 0 && $cash > -25000 && $arcologies[0].FSRestartDecoration == 100>>
		<<if $eugenicsFullControl != 1>>
			Money is quickly shifted to bring you out of debt, though @@.red;the Societal Elite are left doubting@@ your worth.
			<<set $cash = 0>>
			<<set $failedElite += 100>>
		<<else>>
			Money is quickly shifted to bring you out of debt, though the Societal Elite grumble all the while.
			<<set $cash = 0>>
		<</if>>
	<<elseif $cash < -9000>>
		@@.red;WARNING: you are dangerously indebted.@@ Immediately acquire more liquid assets or you will be in danger of being enslaved yourself.
		<<set $debtWarned += 1>>
		<<if $debtWarned > 1>>
			<<set $ui = "start">>
			<<set $gameover = "debt">><<goto "Gameover">>
		<</if>>
	<</if>>
<<elseif $PCWounded == 1 && $secExp == 1>>
	/* does nothing for this week */
<<elseif ($personalAttention == "whoring")>>
	<<set _income = random(2000,4500)>>
	<<if $PC.belly >= 1500>>
		<<if $arcologies[0].FSRepopulationFocus != "unset">>
			You focus on finding "dates" this week and earn @@.yellowgreen;<<print cashFormat(Math.trunc((_income*($rep/500))+($PC.belly)))>>@@ for your body, much more than usual; you guess your pregnancy-focused population wants your baby-rounded body more than ever. However, doing such things @@.red;damages your reputation.@@
			<<run cashX(Math.trunc((_income*($rep/500))+($PC.belly)), "personalBusiness")>>
			<<run repX(($rep*.95) - $rep, "personalBusiness")>>
		<<elseif $arcologies[0].FSRepopulationFocusPregPolicy == 1>>
			You focus on finding "dates" this week and earn @@.yellowgreen;<<print cashFormat(Math.trunc((_income*($rep/500))+($PC.belly/2)))>>@@ for your body, more than usual; but that's to be expected, after all, pregnancy is trendy right now. Event still, doing such things @@.red;damages your reputation.@@
			<<run cashX(Math.trunc((_income*($rep/500))+($PC.belly/2)), "personalBusiness")>>
			<<run repX(($rep*.95) - $rep, "personalBusiness")>>
		<<elseif $arcologies[0].FSRestart != "unset">>
			<<if $PC.pregSource != -1 && $PC.pregSource != -6>>
				You focus on finding "dates" this week and earn @@.yellowgreen;<<print cashFormat(25)>>,@@ barely enough to cover the abortion the john that gave it to you told you to get. Showing off your gravid body @@.red;infuriates your citizens and cripples your reputation.@@
				<<run cashX(25, "personalBusiness")>>
				<<run repX(($rep*.5) - $rep, "personalBusiness")>>
				<<if $eugenicsFullControl != 1>>
					<<set $failedElite += 25>>
				<</if>>
			<<else>>
				You focus on finding "dates" this week and earn @@.yellowgreen;<<print cashFormat(Math.trunc(_income($rep/500)))>>@@ for your body. However, doing such things @@.red;damages your reputation.@@
				<<run cashX(Math.trunc(_income*($rep/500)), "personalBusiness")>>
				<<run repX(($rep*.9) - $rep, "personalBusiness")>>
			<</if>>
		<<else>>
			<<set _income = random(5,2500)>>
			You focus on finding "dates" this week and earn @@.yellowgreen;<<print cashFormat(Math.trunc(_income*($rep/800)))>>@@ for your body, much less than usual; your pregnancy must be turning off potential clients. However, doing such things @@.red;damages your reputation.@@
			<<run cashX(Math.trunc(_income*($rep/800)), "personalBusiness")>>
			<<run repX(($rep*.9) - $rep, "personalBusiness")>>
		<</if>>
	<<else>>
		You focus on finding "dates" this week and earn @@.yellowgreen;<<print cashFormat(Math.trunc(_income*($rep/500)))>>@@ for your body. However, doing such things @@.red;damages your reputation.@@
		<<run cashX(Math.trunc(_income*($rep/500)), "personalBusiness")>>
		<<run repX(($rep*.9) - $rep, "personalBusiness")>>
		<<if isPlayerFertile($PC)>>
			<<if $arcologies[0].FSRepopulationFocus != "unset" && random(1,100) > 80>>
				A horny client offered you an extra @@.yellowgreen;<<print cashFormat(1000)>>@@ for downing some fertility drugs. You're already forgoing birth control, so what harm could an extra baby do?
				<<run cashX(1000, "personalBusiness")>>
				<<set $PC.forcedFertDrugs += 2>>
			<<elseif random(1,100) > 90>>
				<<if $PC.medicine >= 25>>
					Your client this week tried to trick you into taking fertility supplements disguised as party drugs. You still took them, of course, but made sure he @@.yellowgreen;paid extra@@ for the privilege.
					<<run cashX(1000, "personalBusiness")>>
				<<else>>
					Your client this week offered you some free pills to make sex more fun. He was right; it made bareback sex feel amazing.
				<</if>>
				<<set $PC.forcedFertDrugs += 2>>
			<</if>>
			<<= knockMeUp($PC, 20, 0, -5)>>
		<</if>>
	<</if>>
	<<set $enduringRep *= .5>>
<<elseif ($personalAttention == "upkeep")>>
	<<if $PC.belly >= 5000>>
		You spend your free time hustling around your penthouse, cleaning and making sure everything is in order. You manage to reduce your upkeep by 20%. Your pregnancy slows you down some, but you're used to working around it.
	<<else>>
		You spend your free time hustling around your penthouse, cleaning and making sure everything is in order. You manage to reduce your upkeep by 25%. <<if $PC.vagina == 1>>This is much easier to do without a big baby bump in the way.<</if>>
	<</if>>
<<elseif ($personalAttention == "proclamation")>>
	/* handled after this if chain */
<<elseif ($personalAttention == "smuggling")>>
	<<set $qualifiedFS = []>>
	<<if $arcologies[0].FSDegradationistDecoration >= 80>>
		<<set $qualifiedFS.push("degradationist")>>
	<</if>>
	<<if $arcologies[0].FSPaternalistDecoration >= 80>>
		<<set $qualifiedFS.push("paternalist")>>
	<</if>>
	<<if $arcologies[0].FSHedonisticDecadenceDecoration >= 80>>
		<<set $qualifiedFS.push("hedonistic")>>
	<</if>>
	<<if $arcologies[0].FSPastoralistDecoration >= 80 && $arcologies[0].FSPastoralistLaw == 1>>
		<<set $qualifiedFS.push("pastoralist")>>
	<</if>>
	<<if $arcologies[0].FSSupremacistDecoration >= 80>>
		<<set $qualifiedFS.push("supremacist")>>
	<</if>>
	<<if $arcologies[0].FSBodyPuristDecoration >= 80>>
		<<set $qualifiedFS.push("body purist")>>
	<</if>>
	<<if $arcologies[0].FSRestartDecoration >= 80>>
		<<set $qualifiedFS.push("eugenics")>>
	<</if>>
	<<if $arcologies[0].FSRepopulationFocusDecoration >= 80>>
		<<set $qualifiedFS.push("repopulation")>>
	<</if>>
	<<if $arcologies[0].FSGenderFundamentalistDecoration >= 80>>
		<<set $qualifiedFS.push("fundamentalist")>>
	<</if>>
	<<if $arcologies[0].FSSubjugationistDecoration >= 80>>
		<<set $qualifiedFS.push("subjugationist")>>
	<</if>>
	<<if $arcologies[0].FSGenderRadicalistResearch == 1>>
		<<set $qualifiedFS.push("radicalist")>>
	<</if>>
	<<if $arcologies[0].FSTransformationFetishistResearch == 1>>
		<<set $qualifiedFS.push("transformation")>>
	<</if>>
	<<if $arcologies[0].FSYouthPreferentialistDecoration >= 80>>
		<<set $qualifiedFS.push("youth")>>
	<</if>>
	<<if $arcologies[0].FSMaturityPreferentialistDecoration >= 80>>
		<<set $qualifiedFS.push("maturity")>>
	<</if>>
	<<if $arcologies[0].FSSlimnessEnthusiastDecoration >= 80>>
		<<set $qualifiedFS.push("slimness")>>
	<</if>>
	<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
		<<set $qualifiedFS.push("expansionist")>>
	<</if>>
	<<if $arcologies[0].FSPhysicalIdealistDecoration >= 80>>
		<<set $qualifiedFS.push("idealist")>>
	<</if>>
	<<if $arcologies[0].FSChattelReligionistLaw == 1>>
		<<set $qualifiedFS.push("religion")>>
	<</if>>
	<<if $arcologies[0].FSRomanRevivalistLaw == 1>>
		<<set $qualifiedFS.push("roman law")>>
	<<elseif $arcologies[0].FSRomanRevivalistDecoration >= 80>>
		<<set $qualifiedFS.push("roman")>>
	<<elseif $arcologies[0].FSEgyptianRevivalistDecoration >= 80>>
		<<set $qualifiedFS.push("egyptian")>>
	<<elseif $arcologies[0].FSAztecRevivalistLaw == 1>>
		<<set $qualifiedFS.push("aztec law")>>
	<<elseif $arcologies[0].FSAztecRevivalistDecoration >= 80>>
		<<set $qualifiedFS.push("aztec")>>
	<<elseif $arcologies[0].FSArabianRevivalistLaw == 1>>
		<<set $qualifiedFS.push("arabian law")>>
	<<elseif $arcologies[0].FSArabianRevivalistDecoration >= 80>>
		<<set $qualifiedFS.push("arabian")>>
	<<elseif $arcologies[0].FSEdoRevivalistLaw == 1>>
		<<set $qualifiedFS.push("edo law")>>
	<<elseif $arcologies[0].FSEdoRevivalistDecoration >= 80>>
		<<set $qualifiedFS.push("edo")>>
	<<elseif $arcologies[0].FSChineseRevivalistLaw == 1>>
		<<set $qualifiedFS.push("chinese law")>>
	<<elseif $arcologies[0].FSChineseRevivalistDecoration >= 80>>
		<<set $qualifiedFS.push("chinese")>>
	<</if>>
	<<set _caught = 0>>
	<<if $rep >= 18000>> /* prestigious */
		<<set _income = random(8500,9000)>>
	<<elseif $rep >= 9000>> /* well known */
		<<set _income = random(4500,5000)>>
	<<else>>
		<<set _income = random(1500,2000)>>
	<</if>>
	<<switch $qualifiedFS.random()>>
	<<case "eugenics">>
		<<set _income += random(2500,4000)>>
		<<if $eugenicsFullControl != 1>>
			You are smuggling <<if $PC.dick != 0>>your<<else>>one of the Societal Elite's<</if>> semen to allow some desperate girls to be pregnant. Anonymity is really hard to attain, and it is easy to find out what you've been doing. Even if you did manage to make @@.yellowgreen;<<print cashFormat(_income)>>,@@ the Societal Elite are @@.red;quite displeased@@ by your actions.
			<<set $failedElite += 50, _caught = 1>>
		<<else>>
			You are smuggling <<if $PC.dick != 0>>your<<else>>one of the Societal Elite's<</if>> semen to allow some desperate girls to be pregnant. Anonymity is really hard to attain, and it is easy to find out what you've been doing. Even if you did manage to make @@.yellowgreen;<<print cashFormat(_income)>>,@@ the Societal Elite are @@.red;quite displeased@@ by your actions, even though they know how little they can do about it now.
			<<set _caught = 1>>
		<</if>>
	<<case "paternalist">>
		<<set _income += random(1000,1500)>>
		You manage to find a few low-standards slavers without any problem, but when you actually try to do business, you are quickly recognized. You only manage to make @@.yellowgreen;<<print cashFormat(_income)>>@@ before you are sent away. The people of your arcology are @@.red;outraged by your lack of respect@@ for slave rights.
		<<set _caught = 1>>
	<<case "supremacist">>
		<<set _income += random(2000,3000)>>
		When it comes to smuggling in your arcology, there is no better target than $arcologies[0].FSSupremacistRace slaves, and there is a high demand for them, making you a nice @@.yellowgreen;<<print cashFormat(_income)>>.@@ Participating in this slave trade means you can control who is set. Your people do not see things in the same light though, and @@.red;your reputation takes a big hit.@@
		<<set _caught = 1>>
	<<case "degradationist">>
		<<set _income += random(2000,3000)>>
		During your free time, you make business with a few low-standards slavers and manage to buy stolen slaves and sell them at a profit. Even if people recognized you, such treatment of slaves is normal, and only a few people would really complain about it. Your dealings have made you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "repopulation">>
		<<set _income += random(1500,2500)>>
		You manage to discreetly rent out your remote surgery services for abortions. You make sure the people do not recognize your penthouse, having them come blindfolded or unconscious, should the abortion request does not come from themselves. With this, you make @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "fundamentalist">>
		<<set _income += random(1500,2500)>>
		You manage to arrange a few sex-changes and geldings in your own remote surgery for some powerful people to accommodate your arcology's sense of power, but also for people who want to transform others into females so that they lose all the power they have. This makes you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "hedonistic">>
		<<set _income += random(1500,2500)>>
		Since most of what the old world considered to be illegal is legal in your arcology, "smuggling" is quite common, and you easily find people ready to pay for your help with dealing with their competition. With this, you manage to make @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "pastoralist">>
		<<set _income += random (1500,2500)>>
		You take advantage of your own laws, making sure that animal products still come into your arcology. But you also make sure to make them as disgusting as possible so that people would rather turn to slave-produced ones instead. This allows you to make @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "body purist">>
		<<set _income += random(1500,2500)>>
		In your arcology, people are expected to be all natural, but this doesn't mean the same thing applies outside. By buying slaves, giving them implants and quickly selling them before anyone notices, you manage to make @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "subjugationist">>
		<<set _income += random(1500,2500)>>
		You manage to work with some slavers that deal exclusively in $arcologies[0].FSSubjugationistRace slaves, and you export them from the arcology at a cost, bringing in @@.yellowgreen;<<print cashFormat(_income)>>.@@ Considering most people do not care about the fate of the slaves, they are simply mildly annoyed at the short-term raise of prices due to the exportation.
	<<case "radicalist">>
		<<set _income += random(2500,4000)>>
		Anal pregnancy may be accepted in your arcology, but seeing how it goes against the laws of nature makes it a gold mine for dirty businesses; you have rich slaveowners and well-known slavers come to you with their best sissies so that you can implant them with artificial uteri. This flourishing business made you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "transformation">>
		<<set _income += random(2500,4000)>>
		Your arcology is well known for its implants, and usually, one would have to pay a fortune simply to have a clinic implant them with normal implants. You take advantage of this trend to rent your remote surgery and your knowledge of gigantic implants to slavers for a cut of their profit. This gets you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "youth">>
		<<set _income += random(1500,2500)>>
		Youth is more important than anything in your arcology, yet some people who are not really in their prime are rich and powerful, enough that renting your remote surgery to them for age lifts and total body rework is quite worth it, both for them and for you. You get paid @@.yellowgreen;<<print cashFormat(_income)>>@@ for these services.
	<<case "maturity">>
		<<set _income += random(1500,2500)>>
		In your arcology, the older the slave, the better. This also means that your arcology deals a lot in curatives and preventatives, as well as less-than-legal drugs that are supposed to extend one's lifespan. You manage to ship in a few of these drugs and sell them at a high price, making you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "slimness">>
		<<set _income += random(1500,2500)>>
		Your arcology treats chubby people quite poorly, so they are ready to spend a lot of money on surgeries and supposed "miracle" solutions. When they can't afford legal and efficient methods, they have to turn to other drugs. The sales bring you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "expansionist">>
		<<set _income += random(2500,4000)>>
		Your arcology likes its slaves nice and stacked and you have exactly the drugs for it. But you always make sure to produce just a bit more, enough to not alarm anybody who might be watching, but also enough to sell to other prominent slaveowners outside your arcology, who pay you @@.yellowgreen;<<print cashFormat(_income)>>@@ for them.
	<<case "idealist">>
		<<set _income += random(1500,2500)>>
		Your society's obsession with fit and muscular slaves has developed a particular interest in steroids and all kinds of drugs to tone one's body. As an arcology owner, you always have access to the most potent of them, but this is not the case for lower class citizens; some of them just aren't willing to pay a lot for them, so they buy experimental drugs off the black market. Participating in these activities made you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "religion">>
		<<set _income += random(2000,3000)>>
		The best smugglers know how to use the law to its advantage, and not only are you a really good smuggler, you're also the law itself. You have word spread that some company has done something blasphemous, and have them pray and pay for forgiveness. Panicked at the word of their Prophet, the higher-ups of the company give you @@.yellowgreen;<<print cashFormat(_income)>>@@ for salvation.
	<<case "roman law">>
		<<set _income += random(2000,3000)>>
		Every citizen of your arcology is trained in the art of war and supposed to defend its arcology when the time comes. This, of course, also means that people are supposed to be able to defend themselves. By arranging with the best fighters around, you manage to make some citizens face outrageous losses; so bad, in fact, that they are forced to pay @@.yellowgreen;<<print cashFormat(_income)>>@@ for you to forget the shame they've put on your arcology.
	<<case "roman">>
		<<set _income += random(1500,2500)>>
		Slaveowners from all around your arcology are rushing to the pit, eager to show their most recent training. Some of them, having more cunning than experience, are ready to sway the fight in their direction, no matter what it takes. You make sure to catch such people, and only agree to let them do their dirty tricks if they pay you. By the times the bribes and betting are done, you have made @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "egyptian">>
		<<set _income += random(1500,2500)>>
		Having a society that likes incest often means that people are ready to go to great lengths to get their hands on people related to their slaves. In the smuggling business, this means that kidnapped relatives are common, and as an arcology owner with access to data on most of the slaves, you are able to control this trade a bit in exchange for @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "aztec law">>
		<<set _income += random(2000,3000)>>
		People that inherit trades are sometimes too lazy to take classes in an academy, but at the same time, they fear what might happen were they to go against you. To solve both problems, you arrange a trade of fake diplomas, making sure that there is always a small detail to recognize them, so that they will get exposed in due time. This has made you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "aztec">>
		<<set _income += random(1500,2500)>>
		There are a lot of slaveowners in your arcology that tend to grow quickly attached to the slaves they planned on sacrificing to sate the blood thirst of other important citizens, and such owners often come to you, begging you to swap two of their slaves' appearance. You accept, but not for free. After the surgery, this has made you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "arabian law">>
		<<set _income += random(2000,3000)>>
		You have a lot of persons scared of the consequences of not being a part of your society; even if they pay the Jizya, other citizens are not forced to accept them. So if they were to get mugged in some dark alley, people would not get outraged, and there probably wouldn't be any investigations. After buying everyone's silence, you still had @@.yellowgreen;<<print cashFormat(_income)>>@@ to put in your pockets.
	<<case "arabian">>
		<<set _income += random(1500,2500)>>
		People in your arcology are supposed to keep a myriad of slaves as their personal harem, and failure to do so is considered to be highly dishonorable. This opens up some opportunities for smuggling, as people are ready to go to great length to get an edge against their competitors. Becoming a part for this business has made you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "edo law">>
		<<set _income += random(2000,3000)>>
		Outside culture is banned in your arcology. Your citizens do not need anything other than what you have inside. But this doesn't help with their curiosity — they always want to discover what the outside world is like. So you let some news and a few books from other cultures slip in, but not before you made sure they would disgust your citizens and reinforce their love for the Edo culture. The sales brought you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<case "edo">>
		<<set _income += random(1500,2500)>>
		During important meetings with higher society, it is wise to have a lot of slaves to put at the disposition of others. But some slaveowners grow really attached to their slaves, and so they'd much rather rent out unknown slaves from an anonymous owner's stock than use their own. This is a good opportunity to make some money, as shown by the @@.yellowgreen;<<print cashFormat(_income)>>@@ you managed to make.
	<<case "chinese law">>
		<<set _income += random(2000,3000)>>
		<<setLocalPronouns $HeadGirl>>
		This time, you have a good idea that will also make use of your Head Girl. You coax $him into thinking $he should accept bribes for the time being, making up a good reason on the spot, and $he ends up bringing back @@.yellowgreen;<<print cashFormat(_income)>>@@ from all the bribes people gave for $him to turn the other way.
	<<case "chinese">>
		<<set _income += random(1500,2500)>>
		Being under what people call the Mandate of Heaven means you have a crucial importance in society, and some desperate people are willing to pay just for you to throw a word or small gesture in their direction, such as simply acknowledging a child or a slave, thinking that such things will make sure the Heavens smile upon them. For these services, you get @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<default>>
		<<set _income += random(500,2000)>>
		You use former contacts to get you some opportunities in your arcology and deal with them. You make little money, only @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<</switch>>
	/* reputation effects */
	<<if $rep >= 18000>> /* prestigious */
		Your strong reputation makes it both really easy to find opportunities to gain quite a bit of money, but at the same time, it makes it hard to do so anonymously.
		<<if _caught || random(1,100) >= 25>>
			Even with your attempts at discretion, people somehow manage to recognize you, and @@.red;rumors that you're back in the gang business@@ are spreading through your arcology like wildfire.
			<<run repX(($rep*.8) - $rep, "personalBusiness")>>
			<<set $enduringRep *= .5>>
		<<elseif random(1,100) >= 50>>
			You are as discreet as possible, but yet some people seem to have doubts about who you are, and for quite some time, you can hear whispers @@.red;that you may be helping the shadier businesses in your arcology.@@
			<<run repX(($rep*.9) - $rep, "personalBusiness")>>
			<<set $enduringRep *= .75>>
		<<else>>
			You fool almost everyone with your <<if ($PC.actualAge >= 30)>>experience and <</if>>cunning, but the sole fact that smugglers are in your arcology @@.red;damages your reputation.@@
			<<run repX(($rep*.95) - $rep, "personalBusiness")>>
			<<set $enduringRep *= .9>>
		<</if>>
	<<elseif $rep >= 9000>> /* well known */
		Your reputation helps you find opportunities that need people who have proved discreet. But even when taking precautions, nothing guarantees you can stay anonymous.
		<<if _caught || random(1,100) >= 40>>
			Try as you might, people notice who you are, and the next day, @@.red;rumors about your business affairs@@ are already spreading everywhere in your arcology.
			<<run repX(($rep*.9) - $rep, "personalBusiness")>>
			<<set $enduringRep *= .65>>
		<<elseif random(1,100) >= 50>>
			You manage to fool some people, but not everyone, and soon enough, people are @@.red;discussing whether you're smuggling or not.@@
			<<run repX(($rep*.95) - $rep, "personalBusiness")>>
			<<set $enduringRep *= .9>>
		<<else>>
			You somehow manage to hide your identity for all but the most cunning of people, so the only thing that really @@.red;damages your reputation@@ is the fact that people associate you with gangs all the time.
			<<run repX(($rep*.98) - $rep, "personalBusiness")>>
		<</if>>
	<<else>> /* low reputation */
		<<if !_caught && random(1,100) >= 90>>
			You work efficiently, not spending any time talking to people more than you need. Your efficiency even managed to earn you @@.green;quite a few good words@@ from some people who were leading double lives like you were, and they made sure to get a word in about you in their business conversations.
			<<run repX(($rep*1.05) - $rep, "personalBusiness")>>
		<<elseif !_caught && random(1,100) >= 50>>
			You get a few curious glances from some people here and there, but most people do not care about who you are, or maybe they don't know, and it's better this way. Though your regular absences have @@.red;not gone unnoticed@@ and some baseless rumors are spreading.
			<<run repX(($rep*.95) - $rep, "personalBusiness")>>
			<<set $enduringRep *= .95>>
		<<else>>
			Some people whisper when you pass by them. They seem to know who you are, and you know that @@.red;after a bit of alcohol, their tongue will come loose,@@ and you can't afford to shut them up right here, right now.
			<<run repX(($rep*.9) - $rep, "personalBusiness")>>
			<<set $enduringRep *= .8>>
		<</if>>
	<</if>>
	<<set _income += Math.trunc(Math.min(3000 * Math.log($cash+1), $cash * 0.07))>>
	This week, your illicit and legitimate business dealings earned you a combined total of @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<run cashX(_income, "personalBusiness")>>
<<elseif ($cash > 1000) && ($personalAttention == "business")>>
	<<if $PC.belly >= 1500>>
		<<set _income = random(500,1000)>>
	<<else>>
		<<set _income = random(1000,1500)>>
	<</if>>
	<<if $PC.trading >= 100>>
		You focus on business and leverage your @@.springgreen;venture capital experience@@ to make good money:
		<<set _income += random(5000,10000) + Math.trunc(Math.min(4000 * Math.log($cash), $cash * 0.07))>>
	<<elseif $PC.career == "arcology owner">>
		You focus on business and leverage your @@.springgreen;Free Cities experience@@ to make good money:
		<<set _income += random(5000,10000) + Math.trunc(Math.min(4000 * Math.log($cash), $cash * 0.07))>>
	<<else>>
		You focus on business this week and make some money:
		<<set _income += Math.trunc(Math.min(3500 * Math.log($cash), $cash * 0.07))>>
	<</if>>
	@@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<run cashX(_income, "personalBusiness")>>
	<<if $arcologies[0].FSRomanRevivalist != "unset">>
		Society @@.green;approves@@ of your close attention to your own affairs; this advances your image as a <<if $PC.title == 1>>well-rounded Roman man<<else>>responsible Roman lady<</if>>.
		<<= FutureSocieties.Change("RomanRevivalist", 2)>>
	<</if>>
<<elseif ($cash > 1000)>>
	<<set _income = Math.trunc(Math.min(3000 * Math.log($cash), $cash * 0.07))>>
	This week, your business endeavors made you @@.yellowgreen;<<print cashFormat(_income)>>.@@
	<<run cashX(_income, "personalBusiness")>>
<<else>>
	You have enough cash to manage your affairs, but not enough to do much business.
<</if>>

<<if ($personalAttention == "proclamation")>>
	After several days of preparation you are ready to issue the proclamation. You announce to the arcology your plans and in short order you use <<if $proclamationCurrency == "authority">>control over the arcology<<elseif $proclamationCurrency == "reputation">>great influence<<elseif $proclamationCurrency == "cash">> vast financial means<</if>> to
	<<if $proclamationType == "security">>
		gather crucial information for your security department. In just a few many hours holes are plugged and most moles are eliminated. @@.green;Your security greatly increased.@@
		<<set $security = Math.clamp($security + 25,0,100)>>
		<<if $proclamationCurrency == "authority">>
			<<set $authority = Math.clamp($authority - 2000,0,20000)>>
		<<elseif $proclamationCurrency == "reputation">>
			<<run repX((Math.clamp($rep - 2000,0,20000)) - $rep, "personalBusiness")>>
		<<else>>
			<<run cashX(-8000, "personalBusiness")>>
		<</if>>
	<<elseif $proclamationType == "crime">>
		force the arrest of many suspected citizens. Their personal power allowed them to avoid justice for a long time, but this day is their end. @@.green;Your crime greatly decreased.@@
		<<set $crime = Math.clamp($crime - 25,0,100)>>
		<<if $proclamationCurrency == "authority">>
			<<set $authority = Math.clamp($authority - 2000,0,20000)>>
		<<elseif $proclamationCurrency == "reputation">>
			<<run repX(Math.clamp($rep - 2000,0,20000), "personalBusiness")>>
		<<else>>
			<<run cashX(-8000, "personalBusiness")>>
		<</if>>
	<</if>>
	<<set $proclamationsCooldown = 4, $personalAttention = "business">>
<</if>>

<<if $PC.actualAge >= $IsInPrimePC && $PC.actualAge < $IsPastPrimePC>>
	<<set _Cal = Math.ceil(random($AgeTrainingLowerBoundPC,$AgeTrainingUpperBoundPC)*$AgeEffectOnTrainerEffectivenessPC)>>
	<<set _X = 1>>
<</if>>
/* <<if $PC.actualAge >= $IsPastPrimePC>> */
	/* <<set _Cal = Math.ceil(random($AgeTrainingLowerBoundPC,$AgeTrainingUpperBoundPC)*$AgeEffectOnTrainerEffectivenessPC)>> */
	/* <<set _X = 0>> */
/* <</if>> */

<<if $PCWounded != 1>>
<<switch $personalAttention>>
<<case "trading">>
	<<set _oldSkill = $PC.trading>>
	<<if _X == 1>>
		<<set $PC.trading += _Cal>>
	<<else>>
		<<set $PC.trading -= _Cal>>
	<</if>>
	<<if _oldSkill <= 10>>
		<<if $PC.trading > 10>>
			You now have @@.green;basic knowledge@@ about how to be a venture capitalist.
		<<else>>
			You have made progress towards a basic knowledge of venture capitalism.
		<</if>>
	<<elseif _oldSkill <= 30>>
		<<if $PC.trading > 30>>
			You now have @@.green;some skill@@ as a venture capitalist.
		<<else>>
			You have made progress towards being skilled in venture capitalism.
		<</if>>
	<<elseif _oldSkill <= 60>>
		<<if $PC.trading > 60>>
			You are now an @@.green;expert venture capitalist.@@
		<<else>>
			You have made progress towards being an expert in venture capitalism.
		<</if>>
	<<else>>
		<<if $PC.trading >= 100>>
			<<set $personalAttention = "sex">>
			You are now a @@.green;master venture capitalist.@@
		<<else>>
			You have made progress towards mastering venture capitalism.
		<</if>>
	<</if>>

<<case "warfare">>
	<<set _oldSkill = $PC.warfare>>
	<<if _X == 1>>
		<<set $PC.warfare += _Cal>>
	<<else>>
		<<set $PC.warfare -= _Cal>>
	<</if>>
	<<if _oldSkill <= 10>>
		<<if $PC.warfare > 10>>
			You now have @@.green;basic knowledge@@ about how to be a mercenary.
		<<else>>
			You have made progress towards a basic knowledge of mercenary work.
		<</if>>
	<<elseif _oldSkill <= 30>>
		<<if $PC.warfare > 30>>
			You now have @@.green;some skill@@ as a mercenary.
		<<else>>
			You have made progress towards being skilled in mercenary work.
		<</if>>
	<<elseif _oldSkill <= 60>>
		<<if $PC.warfare > 60>>
			You are now an @@.green;expert mercenary.@@
		<<else>>
			You have made progress towards being an expert in mercenary work.
		<</if>>
	<<else>>
		<<if $PC.warfare >= 100>>
			<<set $personalAttention = "sex">>
			You are now a @@.green;master mercenary.@@
		<<else>>
			You have made progress towards mastering mercenary work.
		<</if>>
	<</if>>

<<case "slaving">>
	<<set _oldSkill = $PC.slaving>>
	<<if _X == 1>>
		<<set $PC.slaving += _Cal>>
	<<else>>
		<<set $PC.slaving -= _Cal>>
	<</if>>
	<<if _oldSkill <= 10>>
		<<if $PC.slaving > 10>>
			You now have @@.green;basic knowledge@@ about how to be a slaver.
		<<else>>
			You have made progress towards a basic knowledge of slaving.
		<</if>>
	<<elseif _oldSkill <= 30>>
		<<if $PC.slaving > 30>>
			You now have @@.green;some skill@@ as a slaver.
		<<else>>
			You have made progress towards being skilled in slaving.
		<</if>>
	<<elseif _oldSkill <= 60>>
		<<if $PC.slaving > 60>>
			You are now an @@.green;expert slaver.@@
		<<else>>
			You have made progress towards being an expert in slaving.
		<</if>>
	<<else>>
		<<if $PC.slaving >= 100>>
			<<set $personalAttention = "sex">>
			You are now a @@.green;master slaver.@@
		<<else>>
			You have made progress towards mastering slaving.
		<</if>>
	<</if>>

<<case "engineering">>
	<<set _oldSkill = $PC.engineering>>
	<<if _X == 1>>
		<<set $PC.engineering += _Cal>>
	<<else>>
		<<set $PC.engineering -= _Cal>>
	<</if>>
	<<if _oldSkill <= 10>>
		<<if $PC.engineering > 10>>
			You now have @@.green;basic knowledge@@ about how to be an arcology engineer.
		<<else>>
			You have made progress towards a basic knowledge of arcology engineering.
		<</if>>
	<<elseif _oldSkill <= 30>>
		<<if $PC.engineering > 30>>
			You now have @@.green;some skill@@ as an arcology engineer.
		<<else>>
			You have made progress towards being skilled in arcology engineering.
		<</if>>
	<<elseif _oldSkill <= 60>>
		<<if $PC.engineering > 60>>
			You are now an @@.green;expert arcology engineer.@@
		<<else>>
			You have made progress towards being an expert in arcology engineering.
		<</if>>
	<<else>>
		<<if $PC.engineering >= 100>>
			<<set $personalAttention = "sex">>
			You are now a @@.green;master arcology engineer.@@
		<<else>>
			You have made progress towards mastering arcology engineering.
		<</if>>
	<</if>>

<<case "medicine">>
	<<set _oldSkill = $PC.medicine>>
	<<if _X == 1>>
		<<set $PC.medicine += _Cal>>
	<<else>>
		<<set $PC.medicine -= _Cal>>
	<</if>>
	<<if _oldSkill <= 10>>
		<<if $PC.medicine > 10>>
			You now have @@.green;basic knowledge@@ about how to be a slave surgeon.
		<<else>>
			You have made progress towards a basic knowledge of slave surgery.
		<</if>>
	<<elseif _oldSkill <= 30>>
		<<if $PC.medicine > 30>>
			You now have @@.green;some skill@@ as a slave surgeon.
		<<else>>
			You have made progress towards being skilled in slave surgery.
		<</if>>
	<<elseif _oldSkill <= 60>>
		<<if $PC.medicine > 60>>
			You are now an @@.green;expert slave surgeon.@@
		<<else>>
			You have made progress towards being an expert in slave surgery.
		<</if>>
	<<else>>
		<<if $PC.medicine >= 100>>
			<<set $personalAttention = "sex">>
			You are now a @@.green;master slave surgeon.@@
		<<else>>
			You have made progress towards mastering slave surgery.
		<</if>>
	<</if>>

<<case "hacking">>
	<<set _oldSkill = $PC.hacking>>
	<<if _X == 1>>
		<<set $PC.hacking += _Cal>>
	<<else>>
		<<set $PC.hacking -= _Cal>>
	<</if>>
	<<if _oldSkill <= 10>>
		<<if $PC.hacking > 10>>
			You now have @@.green;basic knowledge@@ about how to hack and manipulate data.
		<<else>>
			You have made progress towards a basic knowledge of hacking and data manipulation.
		<</if>>
	<<elseif _oldSkill <= 30>>
		<<if $PC.hacking > 30>>
			You now have @@.green;some skill@@ as a hacker.
		<<else>>
			You have made progress towards being skilled in hacking and data manipulation.
		<</if>>
	<<elseif _oldSkill <= 60>>
		<<if $PC.hacking > 60>>
			You are now an @@.green;expert hacker.@@
		<<else>>
			You have made progress towards being an expert in hacking and data manipulation.
		<</if>>
	<<else>>
		<<if $PC.hacking >= 100>>
			<<set $personalAttention = "sex">>
			You are now a @@.green;master hacker.@@
		<<else>>
			You have made progress towards mastering hacking and data manipulation.
		<</if>>
	<</if>>

<<case "technical accidents">> /* needs work */
	<<set _windfall = (150*$PC.hacking)+random(100,2500), _X = 0>>
	<<if $PC.hacking == -100>>
		<<set _Catchtchance = 10>>
	<<elseif $PC.hacking <= -75>>
		<<set _Catchtchance = 30>>
	<<elseif $PC.hacking <= -50>>
		<<set _Catchtchance = 40>>
	<<elseif $PC.hacking <= -25>>
		<<set _Catchtchance = 45>>
	<<elseif $PC.hacking == 0>>
		<<set _Catchtchance = 50>>
	<<elseif $PC.hacking <= 25>>
		<<set _Catchtchance = 60>>
	<<elseif $PC.hacking <= 50>>
		<<set _Catchtchance = 70>>
	<<elseif $PC.hacking <= 75>>
		<<set _Catchtchance = 85>>
	<<elseif $PC.hacking >= 100>>
		<<set _Catchtchance = 100>>
	<</if>>
	This week your services to the highest bidder earned you @@.yellowgreen;<<print cashFormat(_windfall)>>.@@
	<<if random(0,100) >= _Catchtchance>>
		However, since the source of the attack was traced back to your arcology, your
		<<if $secExp == 1>> <<set _X = 1>>
			@@.red;authority,@@ <<set $authority -= random(100,500)>> @@.red;crime rate@@ <<set $crime += random(10,25)>> and
		<</if>>
		@@.red;reputation@@ <<run repX(forceNeg(random(50,500)), "event")>>
		<<if _X != 1>>
			has
		<<else>>
			have all
		<</if>>
		been negatively affected.
	<</if>>
	<<if $PC.hacking < 100>>
		<<= IncreasePCSkills('hacking', 0.5)>>
	<</if>>
	<<run cashX(_windfall, "personalBusiness")>>

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

<<if $CashForRep == 1>>
	<<if $cash > 1000>>
		This week you gave up business opportunities worth <<print cashFormat($policyCost)>> to help deserving citizens, @@.green;burnishing your reputation.@@
		<<run repX(1000, "personalBusiness")>>
		<<run cashX(forceNeg($policyCost), "policies")>>
		<<if $PC.degeneracy > 1>>
			This also helps @@.green;offset any rumors@@ about your private actions.
			<<set $PC.degeneracy -= 1>>
		<</if>>
	<<else>>
		Money was too tight this week to risk giving up any business opportunities.
	<</if>>
<</if>>
<<if $goodImageCampaign == 1>>
	<<if $cash > 5000>>
		This week you paid <<print cashFormat($policyCost)>> to have positive rumors spread about you, @@.green;making you look good<<if $PC.degeneracy > 1>> and weakening existing undesirable rumors<<set $PC.degeneracy -= 2>><</if>>.@@
		<<run repX(500, "personalBusiness")>>
		<<run cashX(forceNeg($policyCost), "policies")>>
	<<else>>
		You lacked enough extra ¤ to pay people to spread positive rumors about you this week.
	<</if>>
<</if>>
<<if $rep > 20>>
	<<if $RepForCash == 1>>
		This week you used your position to secure business opportunities worth <<print cashFormat($policyCost)>> at the expense of citizens, @@.red;damaging your reputation.@@
		<<run repX(-20, "personalBusiness")>>
		<<run cashX($policyCost, "personalBusiness")>>
	<</if>>
<</if>>
<<if $rep <= 18000>>
	<<if $RegularParties != 1>>
		<<if $rep > 3000>>
			Your @@.red;reputation is damaged@@ by your not hosting regular social events for your leading citizens.
			<<run repX(-50, "personalBusiness")>>
		<<else>>
			Though you are not hosting regular social events for your leading citizens, your lack of renown prevents this from damaging your reputation; they don't expect someone so relatively unknown to be throwing parties.
		<</if>>
	<</if>>
<</if>>

<<if $secExp == 1>>
	<<if $smilingManFate == 0 && random(1,100) >= 85>>
		This week one of the offside adventures of The Smiling Man produced a copious amount of money, of which @@.yellowgreen;you receive your share.@@
		<<run cashX(random(10,20) * 1000, "personalBusiness")>>
	<</if>>

	<<if $sellData == 1>>
		<<set _upgradeCount = 0>>
		<<if $secUpgrades.nanoCams == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $secUpgrades.cyberBots == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $secUpgrades.eyeScan == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $secUpgrades.cryptoAnalyzer == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $crimeUpgrades.autoTrial == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $crimeUpgrades.autoArchive == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $crimeUpgrades.worldProfiler == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $crimeUpgrades.advForensic == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $intelUpgrades.sensors == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $intelUpgrades.radar == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<if $intelUpgrades.signalIntercept == 1>>
			<<set _upgradeCount += 1>>
		<</if>>
		<<set _dataGain = _upgradeCount * 200>>
		<<if !Number.isInteger(_dataGain)>>
			<br>@@.red;Error, dataGain is NaN@@
		<<else>>
			You are selling the data collected by your security department, which earns a discreet sum of @@.yellowgreen;<<print cashFormat(_dataGain)>>.@@
			<<run cashX(_dataGain, "personalBusiness")>>
			Many of your citizens are not enthusiastic of this however, @@.red;damaging your authority.@@
			<<set $authority -= 50>>
		<</if>>
	<</if>>

	<<if $marketInfiltration == 1>>
		<<set _blackMarket = random(7000,8000)>>
		Your secret service makes use of black markets and illegal streams of goods to make a profit, making you @@.yellowgreen;<<print cashFormat(_blackMarket)>>.@@ This however allows @@.red;crime to flourish@@ in the underbelly of the arcology.
		<<set $crime += random(1,3)>>
	<</if>>

	<<if $arcRepairTime > 0>>
		The recent rebellion left the arcology wounded and it falls to its owner to fix it. It will still take <<if $arcRepairTime > 1>>$arcRepairTime weeks<<else>>a week<</if>> to finish repair works.
		<<run cashX(-5000, "personalBusiness")>>
		<<set $arcRepairTime--, IncreasePCSkills('engineering', 0.1)>>
	<</if>>
<</if>>

Routine upkeep of your demesne costs @@.yellow;<<print cashFormat($costs)>>.@@
<<if $plot == 1>>
	<<if $week > 10>>
		<<if $weatherToday.severity-$weatherCladding > 2>>
			<<set $weatherAwareness = 1>>
			<<if $weatherCladding == 1>>
				<<set _weatherRepairCost = Math.trunc((($weatherToday.severity-3)*($arcologies[0].prosperity*random(50,100)))+random(1,100)), IncreasePCSkills('engineering', 0.1)>>
				$arcologies[0].name's hardened exterior only partially resisted the extreme weather this week, and it requires repairs costing @@.yellow;<<print cashFormat(_weatherRepairCost)>>.@@ Your citizens are @@.green;grateful@@ to you for upgrading $arcologies[0].name to provide a safe haven from the terrible climate.
				<<run repX(500, "architecture")>>
			<<elseif $weatherCladding == 2>>
				<<set _weatherRepairCost to Math.trunc((($weatherToday.severity-4)*($arcologies[0].prosperity*random(50,100)))+random(1,100)), IncreasePCSkills('engineering', 0.1)>>
				$arcologies[0].name's hardened exterior only partially resisted the extreme weather this week, and it requires repairs costing @@.yellow;<<print cashFormat(_weatherRepairCost)>>.@@ Your citizens are @@.green;grateful@@ to you for upgrading $arcologies[0].name to provide a safe haven from the terrible climate.
				<<run repX(500, "architecture")>>
			<<else>>
				<<set _weatherRepairCost = Math.trunc((($weatherToday.severity-2)*($arcologies[0].prosperity*random(50,100)))+random(1,100)), IncreasePCSkills('engineering', 0.1)>>
				Severe weather damaged the arcology this week, requiring repairs costing @@.yellow;<<print cashFormat(_weatherRepairCost)>>.@@ Your citizens are @@.red;unhappy@@ that the arcology has proven vulnerable to the terrible climate.
				<<run repX(-50, "architecture")>>
			<</if>>
			<<if $cash > 0>>
				<<run cashX(_weatherRepairCost, "weather")>>
			<<elseif $arcologies[0].FSRestartDecoration == 100>>
				Since you lack the resources to effect prompt repairs yourself, the Societal Elite cover for you. The arcology's prosperity is @@.red;is damaged,@@ but your public reputation is left intact.
				<<if $eugenicsFullControl != 1>>
					The Societal Elite @@.red;are troubled by your failure.@@
					<<set $failedElite += 100>>
				<</if>>
				<<if $arcologies[0].prosperity > 50>>
					<<set $arcologies[0].prosperity -= random(5,10), IncreasePCSkills('engineering', 0.1)>>
				<</if>>
				<<run cashX(forceNeg(Math.trunc(_weatherRepairCost/4)), "weather")>>
			<<else>>
				Since you lack the resources to effect prompt repairs yourself, prominent citizens step in to repair their own parts of the arcology. This is @@.red;terrible for your reputation,@@ and it also @@.red;severely reduces the arcology's prosperity.@@
				<<if $arcologies[0].prosperity > 50>>
					<<set $arcologies[0].prosperity -= random(5,10), IncreasePCSkills('engineering', 0.1)>>
				<</if>>
				<<run repX((Math.trunc($rep*0.9)) - $rep, "weather")>>
				<<= IncreasePCSkills('engineering', 0.1)>>
				<<run cashX(forceNeg(Math.trunc(_weatherRepairCost/4)), "weather")>>
			<</if>>
		<<elseif $weatherToday.severity-$weatherCladding <= 2>>
			<<if $weatherToday.severity > 2>>
				<<set $weatherAwareness = 1>>
				The arcology's hardened exterior resisted severe weather this week. Your citizens are @@.green;grateful@@ to you for maintaining the arcology as a safe haven from the terrible climate.
				<<run repX(500, "architecture")>>
			<</if>>
		<</if>>
	<</if>>
<</if>>
<<set $costs = Math.trunc(Math.abs(calculateCosts.bill()) * 100)/100>> /*overwrite the prediction and actually pay the bill. GetCost should return a negative. Round to two decimal places.*/
<<if isNaN($costs)>>
	<br>@@.red;Error, costs is NaN@@
<</if>>

<<if $secExp == 1>>
	<<if $weapManu == 1>>
		<br><br>
		The weapons manufacturing complex produces armaments
		<<if $weapProductivity <= 2>>
			at a steady pace.
		<<else>>
			with great efficiency.
		<</if>>
		<<set _income = 0>>
		<<set _price = Math.trunc(Math.clamp(random(1,2) + ($arcologies[0].prosperity / 15) - ($week / 30), 2, 8))>>
		<<set _factoryMod = Math.round(1 + ($weapProductivity + $weapLab) / 2 + ($weapMenials / 100))>>
		<<if $sellTo.citizen == 1>>
			<<if $weaponsLaw == 3>>
				Your lax regulations regarding weapons allows your citizens to buy much of what you are capable of producing.
				<<set _income += Math.round(($ACitizens * 0.1) * _price * _factoryMod)>>
			<<elseif $weaponsLaw >= 1>>
				Your policies allow your citizen to buy your weaponry and they buy much of what you are capable of producing.
				<<set _income += Math.round((($ACitizens * 0.1) * _price * _factoryMod) / (3 - $weaponsLaw))>>
			<<else>>
				Your policies do allow your citizen to buy weaponry, meaning all your income will come from exports.
			<</if>>
		<</if>>
		<<if $sellTo.raiders == 1>>
			Some weapons are sold to the various raider gangs infesting the wastelands.
			<<set _income += Math.round($week / 3 * (_price / 2) * 10 * _factoryMod)>>
		<</if>>
		<<if $sellTo.oldWorld == 1>>
			Part of our production is sold to some old world nations.
			<<set _income += Math.round($week / 3 * _price * 10 * _factoryMod)>>
		<</if>>
		<<if $sellTo.raiders == 1>>
			A share of our weapons production is sold to other free cities.
			<<set _income += Math.round($week / 3 * _price * 10 * _factoryMod)>>
		<</if>>
		<<if $peacekeepers.strength >= 50>>
			The peacekeeping force is always in need of new armaments and is happy to be supplied by their ally.
			<<set _income += Math.round($peacekeepers.strength * _price * 10 * _factoryMod)>>
		<</if>>
		<<set _income = Math.trunc(_income * 0.5)>>
		This week we made @@.yellowgreen;<<print cashFormat(_income)>>.@@
		<<if !Number.isInteger(_income)>>
			<br>@@.red;Error failed to calculate income@@
		<<else>>
			<<run cashX(_income, "personalBusiness")>>
		<</if>>
	<</if>>

	<<if $taxTrade == 1>> <<set _tradeTax = Math.ceil($trade * random(80,120))>>
		<br>Fees on transitioning goods this week made @@.yellowgreen;<<print cashFormat(_tradeTax)>>.@@
		<<run cashX(Math.ceil(_tradeTax), "personalBusiness")>>
	<</if>>
	<br>
<</if>>

/*Adding random changes to slave demand and supply*/
/*Without events triggering and a relatively average supply/demand situation, the best case scenario is an increase/decrease in the price of slaves of 10 in one week. Chance of these conditions happening are 1/25. For demand or supply to go from average to their maximum will take 25 weeks if rolling highest growth each time a roll is made and all other luck is average. Because of the properties of the market and how it develops the likely prices one will encounter are distributed in a bell-shaped fashion, centered around 1000. Minimum possible price is 750, maximum 1250. At +/- 35000 chances of supply or demand getting even more extreme are reduced.*/
<<set _demandSlaveVar = random(-10,10)*10>>
<<set _supplySlaveVar = random(-10,10)*10>>
<<set $slaveCostRandom = random(-3,3)>>
<<if $menialDemandFactor <= -50000>>
	<<set $deltaDemand = random(1,3) * 1000>>
	<<set $demandTimer = random(7,12)>>
	<<set $elapsedDemandTimer = 1>>
	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
<<elseif $menialDemandFactor >= 50000>>
	<<set $deltaDemand = random(-3,-1) * 1000>>
	<<set $demandTimer = random(7,12)>>
	<<set $elapsedDemandTimer = 1>>
	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
<<elseif $demandTimer - $elapsedDemandTimer <= 0>>
	<<set $demandTimer = random(7,12)>>
	<<set $elapsedDemandTimer = 1>>
	<<if $menialDemandFactor > 35000>>
		<<set $deltaDemand = random(-3,1) * 1000>>
	<<elseif $menialDemandFactor < -35000>>
		<<set $deltaDemand = random(-1,3) * 1000>>
	<<else>>
		<<set $deltaDemand = random(-2,2) * 1000>>
	<</if>>
	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
	<<if $menialDemandFactor <= -35000>>
		<br>Demand for slaves is approaching a @@.red;''historic low'',@@ forecasts predict
		<<if $deltaDemand > 0>>
			the market will turn and @@.green;''demand will rise''.@@
		<<elseif $deltaDemand < 0>>
			@@.red;''demand will continue to weaken'',@@ but warn the bottom is in sight.
		<<else>>
			the current demand will @@.yellow;''remain stable''@@ for the coming months.
		<</if>>
	<<elseif $menialDemandFactor <= 20000>>
		<br>Demand for slaves is @@.red;''very low'',@@ forecasts predict
		<<if $deltaDemand > 0>>
			the market will turn and @@.green;''demand will rise''.@@
		<<elseif $deltaDemand < 0>>
			@@.red;''demand will continue to weaken''.@@
		<<else>>
			the current demand will @@.yellow;''remain stable''@@ for the coming months.
		<</if>>
	<<elseif $menialDemandFactor >= 35000>>
		<br>Demand for slaves is approaching a @@.green;''historic high'',@@ forecasts predict
		<<if $deltaDemand > 0>>
			@@.green;''demand will continue to rise'',@@ but warn the peak is in sight.
		<<elseif $deltaDemand < 0>>
			the market will turn and @@.red;''demand will weaken''.@@
		<<else>>
			the current demand will @@.yellow;''remain stable''@@ for the coming months.
		<</if>>
	<<elseif $menialDemandFactor >= 20000>>
		<br>Demand for slaves is @@.green;''very high'',@@ forecasts predict
		<<if $deltaDemand > 0>>
			@@.green;''demand will continue to rise''.@@
		<<elseif $deltaDemand < 0>>
			the market will turn and @@.red;''demand will weaken''.@@
		<<else>>
			the current demand will @@.yellow;''remain stable''@@ for the coming months.
		<</if>>
	<<else>>
		<br>Demand for slaves is @@.yellow;''average'',@@ forecasts predict
		<<if $deltaDemand > 0>>
			the market will see @@.green;''rising demand''.@@
		<<elseif $deltaDemand < 0>>
			the market will see @@.red;''weakening demand''.@@
		<<else>>
			@@.yellow;''no change''@@ for the coming months.
		<</if>>
	<</if>>
<<else>>
	<<set $elapsedDemandTimer += 1>>
	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
	<<set $menialDemandFactor = Math.clamp($menialDemandFactor,-50000,50000)>>
<</if>>

<<if $menialSupplyFactor <= -50000>>
	<<set $deltaSupply = random(1,3) * 1000>>
	<<set $supplyTimer = random(7,12)>>
	<<set $elapsedSupplyTimer = 1>>
	<<set $menialSupplyFactor += $deltaSupply + _demandSlaveVar>>
<<elseif $menialSupplyFactor >= 50000>>
	<<set $deltaSupply = random(-3,-1) * 1000>>
	<<set $supplyTimer = random(7,12)>>
	<<set $elapsedSupplyTimer = 1>>
	<<set $menialSupplyFactor += $deltaSupply + _demandSlaveVar>>
<<elseif $supplyTimer - $elapsedSupplyTimer <= 0>>
	<<set $supplyTimer = random(7,12)>>
	<<set $elapsedSupplyTimer = 1>>
	<<if $menialSupplyFactor > 35000>>
		<<set $deltaSupply = random(-3,1) * 1000>>
	<<elseif $menialSupplyFactor < -35000>>
		<<set $deltaSupply = random(-1,3) * 1000>>
	<<else>>
		<<set $deltaSupply = random(-2,2) * 1000>>
	<</if>>
	<<set $menialSupplyFactor += $deltaSupply + _supplySlaveVar>>
	<<if $menialSupplyFactor <= -35000>>
		<br>Supply of slaves is approaching a @@.green;''historic low'',@@ forecasts predict
		<<if $deltaSupply > 0>>
			the market will turn and @@.red;''supply will rise''.@@
		<<elseif $deltaSupply < 0>>
			@@.green;''supply will continue to weaken'',@@ but warn the bottom is in sight.
		<<else>>
			the current supply will @@.yellow;''remain stable''@@ for the coming months.
		<</if>>
	<<elseif $menialSupplyFactor <= 20000>>
		<br>Supply for slaves is @@.green;''very low'',@@ forecasts predict
		<<if $deltaSupply > 0>>
			the market will turn and @@.red;''supply will rise''.@@
		<<elseif $deltaSupply < 0>>
			@@.green;''supply will continue to weaken''.@@
		<<else>>
			the current supply will @@.yellow;''remain stable''@@ for the coming months.
		<</if>>
	<<elseif $menialSupplyFactor >= 35000>>
		<br>Supply for slaves is approaching a @@.red;''historic high'',@@ forecasts predict
		<<if $deltaSupply > 0>>
			@@.red;''supply will continue to rise'',@@ but warn the peak is in sight.
		<<elseif $deltaSupply < 0>>
			the market will turn and @@.green;''supply will weaken''.@@
		<<else>>
			the current supply will @@.yellow;''remain stable''@@ for the coming months.
		<</if>>
	<<elseif $menialSupplyFactor >= 20000>>
		<br>Supply for slaves is @@.red;''very high'',@@ forecasts predict
		<<if $deltaSupply > 0>>
			@@.red;''supply will continue to rise''.@@
		<<elseif $deltaSupply < 0>>
			the market will turn and @@.green;''supply will weaken''.@@
		<<else>>
			the current supply will @@.yellow;''remain stable''@@ for the coming months.
		<</if>>
	<<else>>
		<br>Supply for slaves is @@.yellow;''average'',@@ forecasts predict
		<<if $deltaSupply > 0>>
			the market will see @@.red;''rising supply''.@@
		<<elseif $deltaSupply < 0>>
			the market will see @@.green;''weakening supply''.@@
		<<else>>
			@@.yellow;''no change''@@ for the coming months.
		<</if>>
	<</if>>
<<else>>
	<<set $elapsedSupplyTimer += 1>>
	<<set $menialSupplyFactor += $deltaSupply + _supplySlaveVar>>
	<<set $menialSupplyFactor = Math.clamp($menialSupplyFactor,-50000,50000)>>
<</if>>

/* Menial and regular slave markets are part of the same market, e.a. if (menial)slave supply goes up, all slave prices fall.
The RomanFS may need further tweaking (it probably got weaker). Could increase the slave supply cap if this FS is chosen to fix. */

<<set $slaveCostFactor = menialSlaveCost()/1000>>
<<if $arcologies[0].FSRomanRevivalist > random(1,150)>>
	<<if $slaveCostFactor > 0.8>>
		<br><br>@@.yellow;Your Roman Revivalism is having an effect on the slave market and has driven local prices down@@ by convincing slave traders that this is a staunchly pro-slavery area.<br>
		<<set $menialSupplyFactor += 2000>>
	<<else>>
		<br><br>@@.yellow;Your Roman Revivalism is having an effect on the slave market and is holding local prices down@@ by convincing slave traders that this is a staunchly pro-slavery area.<br>
	<</if>>
<</if>>

<<if $difficultySwitch == 1>>
	<<if $econWeatherDamage > 0>>
		<<set _repairSeed = random(1,3)>>
		<<if $disasterResponse == 0>>
			<<if _repairSeed == 3>>
				<<set $econWeatherDamage -= 1>>
				<<set $localEcon += 1>>
			<</if>>
		<<elseif $disasterResponse == 1>>
			<<if _repairSeed > 1>>
				<<set $econWeatherDamage -= 1>>
				<<set $localEcon += 1>>
			<</if>>
		<<else>>
			<<if _repairSeed == 3>>
				<<if $econWeatherDamage > 1>>
					<<set $econWeatherDamage -= 2>>
					<<set $localEcon += 2>>
				<<else>>
					<<set $econWeatherDamage -= 1>>
					<<set $localEcon += 1>>
				<</if>>
			<<else>>
				<<set $econWeatherDamage -= 1>>
				<<set $localEcon += 1>>
			<</if>>
		<</if>>
	<</if>>
	<<if $terrain != "oceanic">>
		<<if $weatherToday.severity == 3>>
			<<set $localEcon -= 1>>
			<<set $econWeatherDamage += 1>>
			<br><br>This week's terrible weather did a number on the region, @@.red;hurting the local economy.@@ <<if $disasterResponse == 0>>//Investing in a disaster response unit will speed up recovery//<</if>>
		<<elseif $weatherToday.severity > 3>>
			<<set $localEcon -= 3>>
			<<set $econWeatherDamage += 3>>
			<br><br>This week's extreme weather ravaged the region, @@.red;the local economy is seriously disrupted.@@ <<if $disasterResponse == 0>>//Investing in a disaster response unit will speed up recovery//<</if>>
		<</if>>
	<</if>>
<</if>>

<<if $SF.Toggle && $SF.Active >= 1>> <<= App.SF.AAR()>> <</if>>
<br>