code:
:: secExpSmilingMan [nobr]

The Smiling Man

<<set $nextButton = "Continue", $nextLink = "Random Nonindividual Event">>
<<setAssistantPronouns>>
<<if $smilingManProgress == 0>>
	<<set $fcnn.push("...encryption techniques: how to protect you and your loved ones from hackers ...")>>

	During your morning routine, a peculiar report appears: it's been several weeks since your arcology was the victim of a series of cyber-crimes conducted by a mysterious figure.
	The egocentric criminal apparently took great pride in their acts, to the point of signing them with a symbol: a stylized smiling face. Your arcology was not the only one under assault by the
	machinations of the one the media quickly nicknamed //the Smiling Man//.

Despite the sheer damage this criminal did, you cannot help but admire the skill with which every misdeed was performed — the worst white collar crimes of the century, carried out with such elegance
	that they almost seemed the product of natural laws, rather than masterful manipulation of the digital market.
	While sifting through the report, $assistant.name remains strangely quiet. "I'm worried, <<= properTitle()>> — this individual seems to be able to penetrate whichever system garners his attention. I... feel vulnerable," _heA says. "It's not something I'm used to."

Fortunately you have not been hit directly by this criminal — yet. Still, the repercussions of numerous bankruptcies take their toll on your arcology, whose @@.red;prosperity suffers.@@

<<set $arcologies[0].prosperity *= random(80,90) * 0.01>>

	<<if $cash >= 10000>>
		<<link "Devote funds to the search for this dangerous criminal">>
			<<run cashX(-10000, "event")>>
			<<set $investedFunds = 1>>
			<<set $relationshipLM++>>
			<<set $smilingManProgress++>>
			<<replace "#result">>
				You devote funds to capture and neutralize the threat. You cannot help but wonder what the end game of this "smiling man" is. Money? Fame? Or is he on an ideological crusade?
			<</replace>>
		<</link>>

		<<link "Attempt to contact the mysterious figure">>
			<<run cashX(-10000, "event")>>
			<<set $investedFunds = 1>>
			<<set $relationshipLM += 2>>
			<<set $smilingManProgress++>>
			<<replace "#result">>
				You devote funds to an attempt at communicating with the smiling man. You cannot help but wonder what the end game of this "smiling man" is. Money? Fame? Or is he on an ideological crusade?
			<</replace>>
		<</link>>

		<<link "Invest funds to increase the cyber-security of the arcology">>
			<<run cashX(-10000, "event")>>
			<<set $investedFunds = 1>>
			<<set $relationshipLM += random(5,10)>>
			<<set $smilingManProgress++>>
			<<replace "#result">>
				You devote funds to the improvement of the cyber-security of your arcology. You cannot help but wonder what the end game of this "smiling man" is. Money? Fame? Or is he on an ideological crusade?
			<</replace>>
		<</link>>
	<<else>>
		Not enough funds to take further action.
	<</if>>

	<<link "Ignore the issue">>
		<<set $smilingManProgress++>>
		<<replace "#result">>
			You do not consider this individual a threat.
		<</replace>>
	<</link>>

<<elseif $smilingManProgress == 1>>
	<<set $fcnn.push("...cybersecurity market is booming thanks to a series of recent high-profile attacks...")>>

	You have just reached your penthouse when your faithful assistant appears in front of you, evidently excited.
	"<<= properTitle()>>, I have just received news of a new attack by the Smiling Man. It appears a few hours ago he infiltrated another arcology and caused a catastrophic failure of its power plant.
	Between old debts and the loss of value for his shares, the owner went bankrupt in minutes. It seems the Smiling Man managed to keep a small auxiliary generator functioning enough to project a giant holographic picture of his symbol on the arcology's walls.
	Say what you will about his actions, but you can't deny he has style... Anyways, this opens up a great opportunity to gain control of the structure for ourselves."
	It is indeed a great opportunity, one you cannot resist. You quickly organize the affair and in a few minutes a message reaches your assistant.

"Should I open it?" your assistant asks. You silently nod.

Suddenly the room flashes red, while your assistant fades for half a second. When _heA reappears, _hisA face has been replaced by a stylized smiling face.

"Hello, my dear $PC.birthName. I can call you $PC.birthName, right? I've been keeping an eye on you for so long now, it feels like we're friends! I am terribly sorry for my unannounced visit, but I wanted to meet face to face... well, face to hologram." it says, letting out a childlike giggle.
	"I'm sure you're aware of my recent activities around this rock of ours, and, well, to put it simply, it's your turn to contribute to my great project! You'll love it when you see it, I'm sure! By the way, thanks for the offer — it's so nice to see people contribute to a worthy cause so generously! Well, I've taken enough of your time, see you soon!"

The lights flicker once more and an instant later your assistant returns to _hisA usual self.

"I... I — I couldn't stop him! I'm sorry, <<= properTitle()>>."

You waste no time in rushing to the console and checking your finances. It's as you feared, @@.red;you have been robbed.@@
	<<set _lostCash = Math.clamp(50000 * Math.trunc($week / 20), 50000, 1000000)>>
	<<if $assistant.power >= 1>>

Fortunately, the computing power available to $assistant.name allowed _himA to
		<<if $assistant.power == 1>>
			<<set _lostCash -= Math.min(20000, _lostCash)>>
			somewhat
		<<elseif $assistant.power == 2>>
			<<set _lostCash -= Math.min(30000, _lostCash)>>
		<<elseif $assistant.power >= 3>>
			<<set _lostCash -= Math.min(40000, _lostCash)>>
			significantly
		<</if>>
			limit the damage.
	<</if>>
	<<if $secUpgrades.cyberBots == 1>>
		<<set _lostCash -= Math.min(30000, _lostCash)>>
		The additional cyber defenses acquired and running in the security HQ <<if _lostCash < 200000>>further<</if>> limit the damage.
	<</if>>
	<<if $investedFunds == 1>>
		<<set _lostCash -= Math.min(20000, _lostCash)>>
		The funding you dedicated to the Smiling Man case saved some of the assets that would have been otherwise lost.
	<</if>>
	<<run cashX(forceNeg(_lostCash), "event")>>

	<<link ""I want him dead. Now."">>
		<<set $relationshipLM-->>
		<<set $smilingManProgress++>>
		<<replace "#result">>
			You command your loyal operatives to double down on the search and elimination of the threat.
		<</replace>>
	<</link>>

	<<link ""I want him, dead or alive!"">>
		<<set $relationshipLM++>>
		<<set $smilingManProgress++>>
		<<replace "#result">>
			You command your loyal operatives to double down on the search and capture of the threat.
		<</replace>>
	<</link>>

	<<link ""If we don't find him soon, we will regret it."">>
		<<set $relationshipLM += 2>>
		<<set $smilingManProgress++>>
		<<replace "#result">>
			You command your loyal operatives to double down on the search and neutralization of the threat.
		<</replace>>
	<</link>>

	<<link ""He got what he wanted. Hopefully, we will be left in peace."">>
		<<set $smilingManProgress++>>
		<<set $nextButton = "Continue", $nextLink = "Random Nonindividual Event">>
		<<replace "#result">>
			You take no further action. Hopefully this ordeal is over.
		<</replace>>
	<</link>>

<<elseif $smilingManProgress == 2>>
	<<set $fcnn.push("...my money safe the old-fashioned way: I store it all underneath my mattress...")>>

	<<set $smilingManWeek = $week>>
	When $assistant.name violently wakes you up, _hisA worried expression can mean only one thing: the Smiling Man had been back. "We were anonymously sent a link to a new website: it's a very simple site, no visuals, no text; only a countdown ticking away. It will reach zero this evening." your assistant says.
	This is troubling, yet somewhat exciting. The Smiling Man never failed to cause damage, but his ego had gotten the best of him this time — having time to prepare before their attack will give you a chance to find them. For the rest of the day you do your best to plan, prepare and focus.

Evening came faster than you anticipated. Your security team was already at full alert, waiting for any signal on the horizon. The die was cast.

Suddenly all the computers in the room begin to act strangely, and then it happened. On all of the screens across the arcology the Smiling Man's icon appears, then every speaker begins broadcasting the same voice, one that you have already heard once before:

"Hello citizens of $arcologies[0].name! I am here on this special day to relay to you a very important message: we find ourselves in very peculiar times, times of strife and suffering! But these are also times of change and regeneration! Indeed, I say humanity itself is regenerating, turning into a new being for which the
	ideals of the old world no longer hold meaning. A new blank page from which humanity can begin to prosper again.

Alas, my friends, not all is good, as in this rebirth a great injustice is being perpetrated. If we truly want to ascend to this new form of humanity the old must give way to the new. If we must cleanse our mind of old ideas, our world must cleanse itself of them as well.
	It's to fix this injustice, that I worked so hard all this time! To cleanse the world of the old, we must get rid of our precious, precious data. At the end of this message every digital device will see its memory erased, every archive cleaned, every drive deleted.

It will be a true rebirth! A true new beginning! No longer will the chains of the past keep humanity anchored!"

The voice stopped for a second.

"Have a good day," it simply concluded.

Then it happened.

In little more than seconds all the data collected in the years past vanished. It's a disaster.
	The vast majority of currency is digital, so the actions of the Smiling Man have a devastating effect on the money supply.
	<<if $cash < 0>>
		Luckily for you this means that your @@.yellowgreen;debt is reduced.@@
	<<else>>
		Unfortunately this means that your @@.red;cash reserves are gutted.@@
	<</if>>
	<<run cashX(($cash * 0.2)-$cash, "event")>>
	You are not the only one affected by this however. @@.red;The economy of the entire world is severely affected@@ by the loss of vast quantities of currency. Who knows how long will it take for the global economy to recover.
	<<set $globalCrisisWeeks = random(8,16)>>
	Trade is @@.red;severely affected.@@
	<<set $SecExp.core.trade *= 0.2>>
	With the loss of so much information, most of your accomplishments are simply forgotten, so @@.red;your reputation suffers.@@
	<<run repX(($rep * 0.6)-$rep, "event")>>

	<<if $arcologies[0].ownership >= 60>>
		<<if $SecExp.core.authority <= 10000>>
			<<set _cells = $building.findCells(cell => cell.canBeSold())>>
			<<set jsEither(_cells).owner = 0>>
			Vast amount of data relative to the ownership of the arcology is lost. You lost all legal claims to one of the sectors.
		<<else>>
			Vast amount of data relative to the ownership of the arcology is lost. You would've run the risk of losing ownership of one of the sectors, but fortunately your authority is so high your citizens do not dare question your claims even in the absence of a valid legal case.
		<</if>>
	<</if>>
	<<if $secUpgrades.coldstorage > 3>>
		Your cold storage facility has ensured that the Smiling Man's destruction of the primary archives was unable to damage the security of your arcology.
	<<elseif $secUpgrades.coldstorage == 0>>
		Your security department sees its archives butchered by the Smiling Man. Almost all data on criminals, citizens, and operations are lost. The @@.red;security of the arcology is greatly reduced.@@ Criminals, on the other hand, with their past erased, cannot wait to join this new world, so @@.red;crime will inevitably increase.@@
		<<set $SecExp.security.cap = Math.clamp($SecExp.security.cap * 0.2,0,100)>>
		<<set $SecExp.core.crimeLow = Math.clamp($SecExp.core.crimeLow * 1.5, 20,100)>>
	<</if>>

A short, meek man approaches you with a weak smile. "Not all is lost, <<= properTitle()>>. We have a lead on him — he is here, in $arcologies[0].name."

Despite the bleak situation, you cannot help but smile back.

	<<link ""Eliminate the threat, once and for all."">>
		<<set $relationshipLM-->>
		<<set $smilingManProgress++>>
		<<replace "#result">>
			You command your loyal operatives to prepare for a manhunt.
		<</replace>>
	<</link>>

	<<link ""Bring him to me."">>
		<<set $relationshipLM++>>
		<<set $smilingManProgress++>>
		<<replace "#result">>
			You command your loyal operatives to prepare for a manhunt.
		<</replace>>
	<</link>>

	<<link ""Such skill on my side would be a great boon. Find him."">>
		<<set $relationshipLM += 2>>
		<<set $smilingManProgress++>>
		<<replace "#result">>
			You command your loyal operatives to prepare for a manhunt.
		<</replace>>
	<</link>>

	<<link ""He finally got what he always wanted. Let him have his victory, we have better things to do."">>
		<<set $smilingManProgress++>>
		<<set $nextButton = "Continue", $nextLink = "Random Nonindividual Event">>
		<<replace "#result">>
			You take no further action. Hopefully this ordeal is finally over.
		<</replace>>
	<</link>>

<<elseif $smilingManProgress == 3>>
	<<set $nextButton = " ">>
	<<set $fcnn.push("...sometimes high-tech problems have low-tech solutions. Back to you in the...")>>

	<<set $activeSlaveOneTimeMinAge = 16>>
	<<set $activeSlaveOneTimeMaxAge = 18>>
	<<set $one_time_age_overrides_pedo_mode = 1>>
	<<set $oneTimeDisableDisability = 1>>
	<<set $fixedRace = "asian">>
	<<set $fixedNationality = "Japanese">>
	<<if $seeDicks != 100>>
		<<set $activeSlave = GenerateNewSlave("XX")>>
		<<set $activeSlave.faceShape = "cute">>
		<<set $activeSlave.boobs = 450>>
		<<set $activeSlave.vagina = 0>>
		<<set $activeSlave.ovaries = 1>>
	<<else>>
		<<set $activeSlave = GenerateNewSlave("XY")>>
		<<set $activeSlave.boobs = 250>>
		<<set $activeSlave.faceShape = "androgynous">>
	<</if>>
	<<set $activeSlave.boobShape = "perky">>
	<<set $activeSlave.nipples = "cute">>
	<<set $activeSlave.origin = "$He was a criminal mastermind, captured shortly after completing $his master plan.">>
	<<set $activeSlave.career = "a student from a private school">>
	<<set $activeSlave.intelligence = 100>>
	<<set $activeSlave.intelligenceImplant = 30>>
	<<set $activeSlave.slaveSurname = "Yamadera">>
	<<set $activeSlave.birthSurname = "Yamadera">>
	<<set $activeSlave.origSkin = "pale">>
	<<run applyGeneticColor($activeSlave)>>
	<<set $activeSlave.devotion = 5 * $relationshipLM>>
	<<set $activeSlave.trust = 5 * $relationshipLM>>
	<<set $activeSlave.face = random(10,50)>>
	<<run setHealth($activeSlave, 70, 0, 0, 0, 0)>>
	<<set $activeSlave.teeth = "normal">>
	<<set $activeSlave.areolae = 0>>
	<<set $activeSlave.anus = 0>>
	<<set $activeSlave.butt = 3>>
	<<set $activeSlave.lips = 15>>
	<<set $activeSlave.behavioralFlaw = "odd">>
	<<set $activeSlave.skill.vaginal = 0>>
	<<set $activeSlave.skill.oral = 0>>
	<<set $activeSlave.skill.anal = 0>>
	<<set $activeSlave.skill.whoring = 0>>
	<<set $activeSlave.skill.entertainment = 0>>
	<<set $activeSlave.birthWeek = random(0,50)>>
	<<set $activeSlave.voice = 2>>
	<<set $activeSlave.weight = -20>>
	<<set $activeSlave.muscles = 0>>
	<<set $activeSlave.shoulders = -1>>
	<<set $activeSlave.hips = 0>>
	<<set $activeSlave.clit = 0>>
	<<set $activeSlave.labia = 0>>
	<<set $activeSlave.waist = 10>>
	<<set $activeSlave.preg = 0>>
	<<set $activeSlave.prestige = 3>>
	<<set $activeSlave.prestigeDesc = "$He was the famous Smiling Man.">>
	<<set $activeSlave.clothes = "a military uniform">> /*closest thing to commie/punk we have at the moment*/
	<<setLocalPronouns $activeSlave>>

	The day has come to finally put an end to this story. Your men are ready to go, waiting only on your signal. You quickly don your protective gear and proceed down the busy streets of your arcology.
	You carefully planned the day so that nothing could exit the arcology without being scanned at least three times and poked twice. The Smiling Man has no escape.

After a short walk you are in front of the criminal's lair, a rundown old apartment in a scarcely populated part of the arcology. You give the order to breach and your men rush inside without problems.
	After a couple of seconds pass without a single noise coming from the apartment, you begin to worry. Then you hear the captain

 <<link "calling you inside.">>
		<<replace "#continue">>
			/* 000-250-006 */
			<<if $seeImages == 1>>

<<= SlaveArt($activeSlave, 2, 0)>>

			<</if>>
			/* 000-250-006 */
			calling you inside.

"So it was you to find me first.
			<<if $relationshipLM > 2>>
				I was hoping you would be the one!
			<<else>>
				I expected you would be the one.
			<</if>>
			Well, I hope I'm everything you expected," you hear a voice say. Despite recognizing it, you struggle to convince yourself that the little $girl in front of you is indeed the famous criminal mastermind.

"As you can see, I have no intention of escaping. I knew my life was over the second my plan went into effect. I accepted my end a long time ago, so feel free to do your worst; my life has already ended in triumph."

You evaluate the situation: the burning desire of vengeance for all the damage that little twerp caused is hard to ignore, but equally so is the admiration for $his skill and determination. Indeed, $he would be a great addition to your court, as a free individual or not.

		<<link "Offer $him a new life">>
			<<set $smilingManFate = 0>>
			<<replace "#result">>

You decide it would be criminally wasteful to throw away such talent. You offer $him a new life at your side. $His expertise will surely guarantee safety, if not supremacy, to your arcology in cyberspace, while $he will have safety and luxury in the physical world.

				<<link "Continue">>
					<<set $smilingManProgress++>>
					<<goto "secExpSmilingMan">>
				<</link>>
			<</replace>>
		<</link>>

 <<link "Make $him pay">>
			<<set $smilingManFate = 1>>
			<<replace "#result">>

You decide to end $his pitiful life. $He has crossed the wrong master of the new world $he worked so hard to create. No mercy was asked for and no mercy will be given.

				<<link "Continue">>
					<<set $smilingManProgress++>>
					<<goto "secExpSmilingMan">>
				<</link>>
			<</replace>>
		<</link>>

 <<link "Enslave $him">>
			<<set $smilingManFate = 2>>
			<<replace "#result">>

You decide to enslave the $girl. $His skill may be great, but $his crimes are equally so, which makes it all the sweeter to turn $him into an obedient little toy to play with.

				<<link "Continue">>
					<<set $smilingManProgress++>>
					<<goto "secExpSmilingMan">>
				<</link>>
			<</replace>>
		<</link>>

		<</replace>> /* closes replace "#continue" */
	<</link>>
	 /* closes id="continue" */
<<else>>
	<<if $smilingManFate < 2>>
		/* 000-250-006 */
		<<if $seeImages == 1>>

<<= SlaveArt($activeSlave, 2, 0)>>

		<</if>>
		/* 000-250-006 */
		<<if $smilingManFate == 0>>
			The $girl asks for a few minutes to think about your offer,
			<<if $relationshipLM >= 4>>
				but $he quickly comes to terms with the situation and accepts.
			<<else>>
				and after some time $he reluctantly accepts.
			<</if>>
			In the following weeks $he will get acquainted with the security network of the arcology and work to protect $his new home in the new world $he has created.
			The world will never find out the truth of the Smiling Man and his legend will only grow with time, outliving his creator and maybe even $his new employer.

The collaboration of the ex-Smiling Man permanently increases @@.green;security and the rate of prosperity growth.@@ @@.limegreen;Cash will be also provided,@@ but you're better off not knowing the sources.
		<<elseif $smilingManFate == 1>>
			<<set $activeSlave.clothes = "no clothing">>
			For such a criminal a simple execution is not enough. You order the $girl captured and crucified outside the city, with a mask resembling $his famous symbol. Your men quickly obey. $He never once shows sign of pain or fear, remaining stoic and proud to the end.
			Once $his life ends, you order a statue erected in commemoration of the death of the Smiling Man. From this day forward the statue of the crucified criminal will adorn your arcology and his legend will be forever entangled with yours.

Having dealt with the Smiling Man will provide @@.green;a large boost to your reputation, as well as a moderate amount of reputation each week.@@
			<<run repX(10000, "architecture")>>
		<</if>>
	<<elseif $smilingManFate == 2>>
		<<set $activeSlave.clothes = "no clothing">>
		Your men move to immobilize $him. Terror flashes through $his eyes for
		<<if $relationshipLM >= 4>>
			a second, but $he quickly recovers $his usual demeanor.
		<<else>>
			a second — $he barely manages to recover $his usual demeanor.
		<</if>>

		<<set $saleDescription = 0, $applyLaw = 0>>
		<<include "Long Slave Description">>

 <<include "New Slave Intro">>
	<</if>>
<</if>>


code:
:: securityReport [nobr]

/* init */
<<if $ACitizens > $oldACitizens>>
	<<set _immigration = $ACitizens - $oldACitizens, _emigration = 0>>
<<else>>
	<<set _emigration = $oldACitizens - $ACitizens, _immigration = 0>> /*takes into account citizens leaving and those getting enslaved*/
<</if>>
<<set _secGrowth = 0>>
<<set _crimeGrowth = 0>>
<<set _recruitsMultiplier = 1>>

<<if $useTabs == 0>>
__Security__<</if>>

Security:
<<if $terrain === "oceanic">>
	Due to the @@.green;massive economic and logistical challenges@@ of attacking an oceanic arcology, your security force(s)
<<else>>
	The @@.red;easily manageable economic and logistical challenges@@ of attacking an $terrain arcology ensure that your security force(s) do not
<</if>>
 have the luxury of focusing exclusively on internal matters.

<<if $secMenials > 0>>
	<<print num($secMenials)>> slaves work to improve the security of your arcology,
	<<if $mercenaries >= 1 && $arcologyUpgrade.drones == 1>>
		while your mercenaries and security drones tirelessly patrol the streets to keep them safe.
	<<elseif $arcologyUpgrade.drones == 1>>
		while your security drones tirelessly patrol the arcology to keep it safe.
	<<else>>
		while your loyal subordinates try to keep the arcology safe to the best of their abilities.
	<</if>>
<<else>>
	<<if $mercenaries >= 1 && $arcologyUpgrade.drones == 1>>
		Your mercenaries and security drones tirelessly patrol the streets to keep them safe.
	<<elseif $arcologyUpgrade.drones == 1>>
		Your security drones tirelessly patrol the arcology to keep it safe.
	<<else>>
		Your loyal subordinates try to keep the arcology safe to the best of their abilities.
	<</if>>
<</if>>

/* security modifiers */
<<if $PC.career == "mercenary">>
	Your past life as a mercenary makes it easier to manage the security of the arcology.
	<<set _secGrowth += 1>>
<</if>>
<<if $smilingManFate == 0>>
	The ex-criminal known to the world as The Smiling Man puts their impressive skills to work, dramatically increasing the efficiency of your security measures.
	<<set _secGrowth += 2>>
<</if>>
<<if $ACitizens + $ASlaves <= 5000>>
	The small number of residents makes their job easier.
	<<set _secGrowth += 2>>
<<elseif $ACitizens + $ASlaves <= 7500>>
	The fairly low number of residents makes their job a little easier.
	<<set _secGrowth += 1>>
<<elseif $ACitizens + $ASlaves <= 10000>>
	The fairly high number of residents makes their job a little harder.
	<<set _secGrowth -= -0.5>>
<<elseif $ACitizens + $ASlaves <= 15000>>
	The high number of residents makes their job harder.
	<<set _secGrowth -= 1>>
<<else>>
	The extremely high number of residents makes their job a lot harder.
	<<set _secGrowth -= 2>>
<</if>>
<<if _immigration >= 0 && _emigration == 0>>
	<<if _immigration < 50>>
		The limited number of immigrants that reached the arcology this week does not have any serious impact on the efficiency of current security measures.
		<<set _secGrowth += 0.5>>
	<<elseif _immigration < 150>>
		The number of immigrants that reached the arcology this week is high enough to complicate security protocols.
		<<set _secGrowth -= 0.2>>
	<<elseif _immigration < 300>>
		The high number of immigrants that reached the arcology this week complicates security protocols.
		<<set _secGrowth -= 0.5>>
	<<elseif _immigration < 500>>
		The high number of immigrants that reached the arcology this week severely complicates security protocols.
		<<set _secGrowth -= 1>>
	<<else>>
		The extremely high number of immigrants that reached the arcology this week severely complicates security protocols.
		<<set _secGrowth -= 2>>
	<</if>>
<</if>>
<<if $visitors < 300>>
	The limited number of visitors coming and going did not have any serious impact on the efficiency of current security measures.
	<<set _secGrowth += 0.5>>
<<elseif _immigration < 750>>
	The number of visitors coming and going somewhat complicates security protocols.
	<<set _secGrowth -= 0.2>>
<<elseif _immigration < 1500>>
	The high number of visitors coming and going complicates security protocols.
	<<set _secGrowth -= 0.5>>
<<elseif _immigration < 2500>>
	The high number of visitors coming and going greatly complicates security protocols.
	<<set _secGrowth -= 1>>
<<else>>
	The extremely high number of visitors coming and going severely complicates security protocols.
	<<set _secGrowth -= 2>>
<</if>>
<<if _emigration != 0 && _immigration == 0>>
	<<if _emigration < 100>>
		The limited reduction in citizens this week does not have any serious impact on the efficiency of current security measures.
		<<set _secGrowth += 0.5>>
	<<elseif _emigration < 300>>
		The reduction in citizens this week is high enough to complicate security protocols.
		<<set _secGrowth -= 0.2>>
	<<elseif _emigration < 600>>
		The large reduction in citizens this week complicates security protocols.
		<<set _secGrowth -= 0.5>>
	<<elseif _emigration < 1000>>
		The huge reduction in citizens this week severely complicates security protocols.
		<<set _secGrowth -= 1>>
	<<else>>
		The extreme reduction in citizens this week severely complicates security protocols.
		<<set _secGrowth -= 2>>
	<</if>>
<</if>>
<<if $SecExp.core.crimeLow < 20>>
	Crime is a distant problem in the arcology, which makes improving security easier.
	<<set _secGrowth += 1>>
<<elseif $SecExp.core.crimeLow < 40>>
	Crime is a minor problem in the arcology, not serious enough to disrupt security efforts.
<<elseif $SecExp.core.crimeLow < 60>>
	Crime is an issue in the arcology, which makes improving security harder.
	<<set _secGrowth -= 0.5>>
<<elseif $SecExp.core.crimeLow < 80>>
	Crime is an overbearing problem in the arcology, which makes improving security a lot harder.
	<<set _secGrowth -= 1>>
<<else>>
	Crime is sovereign in the arcology, which makes improving security extremely difficult.
	<<set _secGrowth -= 2>>
<</if>>
<<if $SecExp.core.authority < 5000>>
	The low authority you hold on the arcology hampers the efforts of your security department.
	<<set _secGrowth -= 1>>
<<elseif $SecExp.core.authority < 7500>>
	The limited authority you hold on the arcology hampers the efforts of your security department.
	<<set _secGrowth -= 0.5>>
<<elseif $SecExp.core.authority < 10000>>
	The authority you hold on the arcology does not significantly impact the efforts of your security department.
<<elseif $SecExp.core.authority < 15000>>
	The high authority you hold on the arcology facilitates the security department's work.
	<<set _secGrowth += 0.5>>
<<else>>
	The absolute authority you hold on the arcology makes the security department's work a lot easier.
	<<set _secGrowth += 1>>
<</if>>
<<if App.SecExp.battle.activeUnits() >= 6>>
	Your military is the size of a small army. Security is easier to maintain with such forces at your disposal.
	<<set _secGrowth += 0.5>>
<</if>>
<<if $lastAttackWeeks < 3 && $hasFoughtOnce == 1>>
	The recent attack has a negative effect on the security of the arcology.
	<<set _secGrowth -= 1>>
<<elseif $lastAttackWeeks < 5 && $hasFoughtOnce == 1>>
	While some time has passed, the last attack still has a negative effect on the security of the arcology.
	<<set _secGrowth -= 0.5>>
<<elseif $hasFoughtOnce == 1>>
	The arcology has not been attacked in a while, which has a positive effect on security.
	<<set _secGrowth += 0.5>>
<</if>>

<<if $transportHub == 1>>
	<<if $terrain != "oceanic" && $terrain != "marine">>
		<<set _secGrowth -= ($airport + $railway - $hubSecurity * 3) / 2>>
	<<else>>
		<<set _secGrowth -= ($airport + $docks - $hubSecurity * 3) / 2>>
	<</if>>
	The transport hub, for all its usefulness, is a hotspot of malicious
	<<if $airport + $docks > $hubSecurity * 3>>
		activity and hub security forces are not sufficient to keep up with all threats.
	<<else>>
		activity, but the hub security forces are up to the task.
	<</if>>
<</if>>

<<if $SecExp.buildings.propHub.blackOps > 0>>
	Your black ops team proves to be a formidable tool against anyone threatening the security of your arcology.
	<<set _secGrowth += 0.5 * random(1,2)>>
<</if>>

<<if $garrison.assistantTime > 0>>
	With the central CPU core of the assistant down, managing security is a much harder task. Inevitably some little but important details will slip past your agents.
	It will still take <<if $garrison.assistantTime> 1>>$garrison.assistantTime weeks<<else>>a week<</if>> to finish repair works.
	<<set _secGrowth-->>
	<<set _crimeGrowth++>>
	<<set $garrison.assistantTime--, IncreasePCSkills('engineering', 0.1)>>
<</if>>

<<if $SF.Toggle && $SF.Active >= 1>>
	<<if $SFSupportLevel >= 3>>
		The two squads of $SF.Lower assigned to the Security HQ provide an essential help to the security department.
	<</if>>
	<<if $SFSupportLevel >= 2>>
		The training officers of $SF.Lower assigned to the Security HQ improve its effectiveness.
	<</if>>
	<<if $SFSupportLevel >= 1>>
		Providing your Security Department with equipment from $SF.Lower slightly boosts the security of your arcology.
	<</if>>
	<<if $SFSupportLevel >= 1>>
		<<set _secGrowth *= 1+($SFSupportLevel/10)>>
	<</if>>
<</if>>

/* resting point */
<<set _secRest = App.SecExp.Check.secRestPoint() * (Math.clamp($secMenials,0,App.SecExp.Check.reqMenials()) / App.SecExp.Check.reqMenials())>>
<<if _secRest < 0>>
	<<set _secRest = 20>>
<</if>>
<<if _secRest < App.SecExp.Check.reqMenials() && $secHQ == 1>>
	The limited staff assigned to the HQ hampered the improvements to security achieved this week.
<<elseif _secRest < App.SecExp.Check.reqMenials()>>
	The limited infrastructure available slowly erodes away the security level of the arcology.
<</if>>

The security level of the arcology is
<<if $SecExp.security.cap > (_secRest + 5)>>
	over its effective resting point, limiting the achievable growth this week.
	<<set _secGrowth *= 0.5>>
<<elseif $SecExp.security.cap < (_secRest - 5)>>
	under its effective resting point, speeding up its growth.
	<<set _secGrowth *= 1.5>>
<<elseif $SecExp.security.cap == _secRest>>
	at its effective resting point, this severely limits the influence of external factors on the change achievable this week.
	<<set _secGrowth *= 0.3>>
<<else>>
	near its effective resting point, this severely limits the influence of external factors on the change achievable this week.
	<<if _secGrowth < 0>>
		<<set _secGrowth *= 0.3>>
	<</if>>
<</if>>
<<set _restGrowth = (_secRest - $SecExp.security.cap) * 0.2>>
<<set _newSec = Math.trunc($SecExp.security.cap + _secGrowth + _restGrowth)>>
<<if _newSec < $SecExp.security.cap>>
	This week @@.red;security decreased.@@
<<elseif _newSec == $SecExp.security.cap>>
	This week @@.yellow;security did not change.@@
<<else>>
	This week @@.green;security improved.@@
<</if>>
<<set $SecExp.security.cap = Math.clamp(_newSec, 0, 100)>>

Crime:
/* crime modifiers */
Due to the deterioration of the old world countries, organized crime focuses more and more on the prosperous Free Cities, yours included. This has a
<<if $week < 30>>
	small
	<<set _crimeGrowth += 0.5>>
<<elseif $week < 60>>
	noticeable
	<<set _crimeGrowth += 1>>
<<elseif $week < 90>>
	moderate
	<<set _crimeGrowth += 1.5>>
<<elseif $week < 120>>
	big
	<<set _crimeGrowth += 2>>
<<else>>
	huge
	<<set _crimeGrowth += 2.5>>
<</if>>
 impact on the growth of criminal activities in your arcology.

<<if $arcologies[0].prosperity < 50>>
	The low prosperity of the arcology facilitates criminal recruitment and organization.
	<<set _crimeGrowth += 1>>
<<elseif $arcologies[0].prosperity < 80>>
	The fairly low prosperity of the arcology facilitates criminal recruitment and organization.
	<<set _crimeGrowth += 0.5>>
<<elseif $arcologies[0].prosperity < 120>>
	The prosperity of the arcology is not high or low enough to have significant effects on criminal recruitment and organization.
<<elseif $arcologies[0].prosperity < 160>>
	The prosperity of the arcology is high enough to provide its citizens a decent life, hampering criminal recruitment and organization.
	<<set _crimeGrowth -= 0.5>>
<<elseif $arcologies[0].prosperity < 180>>
	The prosperity of the arcology is high enough to provide its citizens a decent life, significantly hampering criminal recruitment and organization.
	<<set _crimeGrowth -= 1>>
<<else>>
	The prosperity of the arcology is high enough to provide its citizens a very good life, significantly hampering criminal recruitment and organization.
	<<set _crimeGrowth -= 2>>
<</if>>
<<if $ASlaves < 1000>>
	The low number of slaves in the arcology does not hinder the activity of law enforcement, limiting crime growth.
	<<set _crimeGrowth -= 1>>
<<elseif $ASlaves < 2000>>
	The fairly low number of slaves in the arcology does not hinder significantly the activity of law enforcement, limiting crime growth.
	<<set _crimeGrowth -= 0.5>>
<<elseif $ASlaves < 3000>>
	The number of slaves in the arcology is becoming an impediment for law enforcement, facilitating crime growth.
	<<set _crimeGrowth += 1>>
<<else>>
	The number of slaves in the arcology is becoming a big issue for law enforcement, facilitating crime growth.
	<<set _crimeGrowth += 1.5>>
<</if>>
<<if $SecExp.security.cap <= 20>>
	The security measures in place are severely limited, allowing crime to grow uncontested.
<<elseif $SecExp.security.cap <= 50>>
	The security measures in place are of limited effect and use, giving only mixed results in their fight against crime.
	<<set _crimeGrowth -= 1.5>>
<<elseif $SecExp.security.cap <= 75>>
	The security measures in place are well developed and effective, making a serious dent in the profitability of criminal activity in your arcology.
	<<set _crimeGrowth -= 3>>
<<else>>
	The security measures in place are extremely well developed and very effective, posing a serious threat even to the most powerful criminal organizations in existence.
	<<set _crimeGrowth -= 5.5>>
<</if>>
<<if $SecExp.core.authority < 5000>>
	Your low authority allows crime to grow undisturbed.
	<<set _crimeGrowth += 1>>
<<elseif $SecExp.core.authority < 7500>>
	Your relatively low authority facilitates criminal activities.
	<<set _crimeGrowth += 0.5>>
<<elseif $SecExp.core.authority < 10000>>
	Your authority is not high enough to discourage criminal activity.
<<elseif $SecExp.core.authority < 15000>>
	Your high authority is an effective tool against crime.
	<<set _crimeGrowth -= 1>>
<<else>>
	Your absolute authority is an extremely effective tool against crime.
	<<set _crimeGrowth -= 2>>
<</if>>
<<if $cash >= 100000>>
	Your great wealth acts as a beacon for the greediest criminals, calling them to your arcology as moths to a flame.
	<<set _crimeGrowth += 0.5>>
<</if>>
<<if $SecExp.buildings.propHub.active > 0 && $SecExp.buildings.propHub.marketInfiltration > 0>>
	<<set _crimeGrowth += 0.5 * random(1,2)>>
<</if>>

/* crime cap */
<<set _crimeCap = Math.trunc(Math.clamp(App.SecExp.Check.crimeCap() + (App.SecExp.Check.crimeCap() - App.SecExp.Check.crimeCap() * ($secMenials / App.SecExp.Check.reqMenials())),0,100))>>
<<if _crimeCap > App.SecExp.Check.crimeCap() && $secHQ == 1>>
	The limited staff assigned to the HQ allows more space for criminals to act.
<</if>>
<<if $SecExp.core.authority > 12000>>
	<<if $secUpgrades.coldstorage < 6>>
		<<if $secUpgrades.coldstorage === 0>>Adding a facility<<else>>Improving the cold storage facility attached<</if>> to the SecurityHQ should allow the staff to be more efficient in dealing with crime.
	<<else>>
		The cold storage facility attached to SecurityHQ allows the staff to be more efficient in dealing with crime.
	<</if>>
<</if>>
<<set _newCrime = Math.trunc(Math.clamp($SecExp.core.crimeLow + _crimeGrowth,0,_crimeCap))>>
<<if _newCrime > $SecExp.core.crimeLow>>
	This week @@.red;crime increased.@@
<<elseif _newCrime == $SecExp.core.crimeLow>>
	This week @@.yellow;crime did not change.@@
<<else>>
	This week @@.green;crime decreased.@@
<</if>>
<<set $SecExp.core.crimeLow = Math.clamp(_newCrime,0,100)>>

<<if $militiaFounded == 1 || App.SecExp.battle.activeUnits() >= 1>>

	 Military: /* militia */
	<<if $SF.Toggle && $SF.Active >= 1 && $SF.Size > 10>>
		Having a powerful special force attracts a lot of citizens, hopeful that they may be able to fight along side it.
	<<set _recruitsMultiplier *= 1 + (random(1, (Math.round($SF.Size / 10))) / 20)>> /* not sure how high $SF.Size goes, so I hope this makes sense */
	<</if>>
	<<if $SecExp.buildings.propHub.active > 0>>
		<<if $SecExp.buildings.propHub.campaign >= 1 && $SecExp.buildings.propHub.focus == "recruitment">>
			<<if $SecExp.buildings.propHub.recuriterOffice === 0 || $Recruiter == 0>>
				<<if $propCampaignBoost == 1>>
					<<set _recruitsMultiplier *= 1.1>>
				<<else>>
					<<set _recruitsMultiplier *= 1.05>>
				<</if>>
			<<elseif $SecExp.buildings.propHub.recuriterOffice > 0 && $Recruiter > 0>>
				<<setLocalPronouns $Recruiter>>
				<<= SlaveFullName($Recruiter)>> is able to further boost your militia recruitment campaign from $his PR hub office.
				<<if $propCampaignBoost == 1>>
					<<set _recruitsMultiplier *= 1.2 + (($Recruiter.intelligence+$Recruiter.intelligenceImplant)/650)>>
				<<else>>
					<<set _recruitsMultiplier *= 1.15 + (($Recruiter.intelligence+$Recruiter.intelligenceImplant)/650)>>
				<</if>>
			<</if>>
		<</if>>
	<</if>>
	<<if $recruitVolunteers == 1>>
		Your militia accepts only volunteering citizens, ready to defend their arcology.
		<<set _recruitLimit = 0.02>>
		<<if $rep >= 10000>>
			Many citizens volunteer just to fight for someone of your renown.
			<<set _recruitLimit += 0.0025>>
		<</if>>
		<<if $SecExp.core.authority >= 10000>>
			Many citizens feel it is their duty to fight for you, boosting volunteer enrollment.
			<<set _recruitLimit += 0.0025>>
		<</if>>
		<<if $lowerRquirements == 1>>
			Your lax physical requirements to enter the militia allows for a greater number of citizens to join.
			<<set _recruitLimit += 0.0025>>
		<</if>>
	<<elseif $conscription == 1>>
		Adult citizens are required to join the militia for a period of time.
		<<set _recruitLimit = 0.05>>
		<<if $militaryExemption == 1>>
			Some citizens prefer to contribute to the arcology's defense through financial support rather than military service, making you @@.yellowgreen;a small sum.@@
			<<set _recruitLimit -= 0.005>>
			<<run cashX(250, "securityExpansion")>>
		<</if>>
		<<if $lowerRquirements == 1>>
			Your lax physical requirements to enter the militia allows for a greater number of citizens to join.
			<<set _recruitLimit += 0.005>>
		<</if>>
		<<if $noSubhumansInArmy == 1>>
			Guaranteeing the purity of your armed forces comes with a small loss of potential recruits.
			<<set _recruitLimit -= 0.005>>
		<</if>>
		<<if $pregExemption == 1>>
			Many pregnant citizens prefer to avoid military service not to endanger themselves and their children.
			<<set _recruitLimit -= 0.005>>
		<</if>>
	<<elseif $militaryService == 1>>
		Adult citizens are required to register and serve in the militia whenever necessary.
		<<set _recruitLimit = 0.1>>
		<<if $militaryExemption == 1>>
			Some citizens prefer to contribute to the arcology's defense through financial support rather than military service, making you @@.yellowgreen;a small sum.@@
			<<set _recruitLimit -= 0.01>>
			<<run cashX(250, "securityExpansion")>>
		<</if>>
		<<if $lowerRquirements == 1>>
			Your lax physical requirements to enter the militia allows for a greater number of citizens to join.
			<<set _recruitLimit += 0.01>>
		<</if>>
		<<if $noSubhumansInArmy == 1>>
			Guaranteeing the purity of your armed forces comes with a small loss of potential recruits.
			<<set _recruitLimit -= 0.01>>
		<</if>>
		<<if $pregExemption == 1>>
			Many pregnant citizens prefer to avoid military service not to endanger themselves and their children.
			<<set _recruitLimit -= 0.01>>
		<</if>>
	<<elseif $militarizedSociety == 1>>
		Every citizen is required to train and participate in the military activities of the arcology.
		<<set _recruitLimit = 0.2>>
		<<if $militaryExemption == 1>>
			Some citizens prefer to contribute to the arcology's defense through financial support rather than military service, making you @@.yellowgreen;a small sum.@@
			<<set _recruitLimit -= 0.02>>
			<<run cashX(250, "securityExpansion")>>
		<</if>>
		<<if $lowerRquirements == 1>>
			Your lax physical requirements to enter the militia allows for a greater number of citizens to join.
			<<set _recruitLimit += 0.02>>
		<</if>>
		<<if $noSubhumansInArmy == 1>>
			Guaranteeing the purity of your armed forces comes with a small loss of potential recruits.
			<<set _recruitLimit -= 0.02>>
		<</if>>
		<<if $pregExemption == 1>>
			Many pregnant citizens prefer to avoid military service not to endanger themselves and their children.
			<<set _recruitLimit -= 0.02>>
		<</if>>
	<</if>>
	<<if $militiaFounded == 1>>
		<<set _recruits = Math.trunc((_recruitLimit * $ACitizens - ($militiaTotalManpower - $militiaTotalCasualties)) / 20 * _recruitsMultiplier)>>
		<<if _recruits > 0>>
			<<set $militiaTotalManpower += _recruits>>
			<<set $militiaFreeManpower += _recruits>>
			This week <<print _recruits>> citizens joined the militia.
		<<elseif $militarizedSociety == 1>>
			No citizens joined your militia this week because your society is as militarized as it can get.
		<<elseif $recruitVolunteers == 1>>
			There are no more citizens willing to join the arcology armed forces. You'll need to enact higher recruitment edicts if you need more manpower.
		<<else>>
			No more citizens could be drafted into your militia. You'll need to enact higher recruitment edicts if you need more manpower.
		<</if>>

	<</if>>

	/* mercs */
	<<if $mercenaries >= 1>>
		<<set _newMercs = random(0,3)>>
		<<if $rep < 6000>>
			Your low reputation turns some mercenaries away, hoping to find contracts that would bring them more renown.
			<<set _newMercs -= 1>>
		<<elseif $rep < 12000>>
			Your reputation is not high enough to attract many mercenaries to your free city.
		<<else>>
			Your reputation attracts many guns for hire who would be proud to have such distinct character on their resume.
			<<set _newMercs += 1>>
		<</if>>
		<<if $arcologies[0].prosperity < 50>>
			The low prosperity of the arcology discourages new guns for hire from coming to your arcology.
			<<set _newMercs -= 1>>
		<<elseif $arcologies[0].prosperity < 80>>
			The fairly low prosperity of the arcology discourages new guns for hire from coming to your arcology.
			<<set _newMercs += 1>>
		<<elseif $arcologies[0].prosperity < 120>>
			The prosperity of the arcology attracts a few mercenaries, hopeful to find lucrative contracts within its walls.
			<<set _newMercs += random(1,2)>>
		<<elseif $arcologies[0].prosperity < 160>>
			The fairly high prosperity of the arcology attracts some mercenaries, hopeful to find lucrative contracts within its walls.
			<<set _newMercs += random(2,3)>>
		<<elseif $arcologies[0].prosperity < 180>>
			The high prosperity of the arcology is attracts some mercenaries, hopeful to find lucrative contracts within its walls.
			<<set _newMercs += random(2,4)>>
		<<else>>
			The very high prosperity of the arcology attracts a lot of mercenaries, hopeful to find lucrative contracts within its walls.
			<<set _newMercs += random(3,5)>>
		<</if>>
		<<if $SecExp.core.crimeLow > 60>>
			The powerful crime organizations that nested themselves in the arcology have an unending need for cheap guns for hire, many mercenaries flock to your free city in search of employment.
			<<set _newMercs += random(1,2)>>
		<</if>>
		<<if $SF.Toggle && $SF.Active >= 1 && $SF.Size > 10>>
			Having a powerful special force attracts a lot of mercenaries, hopeful that they may be able to fight along side it.
			<<set _newMercs += random(1,Math.round($SF.Size/10))>>
		<</if>>
		<<if $discountMercenaries > 0>>
			More mercenaries are attracted to your arcology as a result of the reduced rent.
			<<set _newMercs += random(2,4)>>
		<</if>>
		<<set _newMercs = Math.trunc(_newMercs / 2)>>
		<<if _newMercs > 0>>
			<<set $mercTotalManpower += _newMercs>>
			<<set $mercFreeManpower += _newMercs>>
			This week <<print _newMercs>> mercenaries reached the arcology.
		<<else>>
			This week no new mercenaries reached the arcology.
		<</if>>
		<<if $mercFreeManpower > 2000>>
			<<set $mercTotalManpower -= $mercFreeManpower - 2000>>
			<<set $mercFreeManpower = 2000>>
		<</if>>

	<</if>>

	<<if App.SecExp.battle.activeUnits() > 0>>
		/* loyalty and training */
		<<set _sL = $slaveUnits.length>>
		<<for _i = 0; _i < _sL; _i++>>
			<<set _loyaltyChange = 0>>

 $slaveUnits[_i].platoonName:
			<<if $SecExp.buildings.barracks.upgrades.loyaltyMod >= 1>>
				<<set _loyaltyChange += 2 * $SecExp.buildings.barracks.upgrades.loyaltyMod>>
				is periodically sent to the indoctrination facility in the barracks for thought correction therapy.
			<</if>>
			<<if $slaveUnits[_i].commissars >= 1>>
				The commissars attached to the unit carefully monitor the officers and grunts for signs of insubordination.
				<<set _loyaltyChange += 2 * $slaveUnits[_i].commissars>>
			<</if>>
			<<if $soldierWages == 2>>
				The slaves greatly appreciate the generous wage given to them for their service as soldiers. Occasions to earn money for a slave are scarce after all.
				<<set _loyaltyChange += random(5,10)>>
			<<elseif $soldierWages == 1>>
				The slaves appreciate the wage given to them for their service as soldiers, despite it being just adequate. Occasions to earn money for a slave are scarce after all.
				<<set _loyaltyChange += random(-5,5)>>
			<<else>>
				The slaves do not appreciate the low wage given to them for their service as soldiers, but occasions to earn money for a slave are scarce, so they're not too affected by it.
				<<set _loyaltyChange -= random(5,10)>>
			<</if>>
			<<if $slaveSoldierPrivilege == 1>>
				Allowing them to hold material possessions earns you their devotion and loyalty.
				<<set _loyaltyChange += random(1,2)>>
			<</if>>
			<<if _loyaltyChange > 0>>
				The loyalty of this unit @@.green;increased@@ this week.
			<<elseif _loyaltyChange == 0>>
				The loyalty of this unit @@.yellow;did not change@@ this week.
			<<else>>
				The loyalty of this unit @@.red;decreased@@ this week.
			<</if>>
			<<set $slaveUnits[_i].loyalty = Math.clamp($slaveUnits[_i].loyalty + _loyaltyChange,0,100)>>
			<<if $slaveUnits[_i].training < 100 && $SecExp.buildings.barracks.upgrades.training >= 1>>

The unit is able to make use of the training facilities to better prepare its soldiers, slowly increasing their experience level.
				<<set $slaveUnits[_i].training += random(2,4) * 1.5 * $SecExp.buildings.barracks.upgrades.training>>
			<</if>>
		<</for>>
		<<set _mL = $militiaUnits.length>>
		<<for _i = 0; _i < _mL; _i++>>

$militiaUnits[_i].platoonName:
			<<set _loyaltyChange = 0>>
			<<if $SecExp.buildings.barracks.upgrades.loyaltyMod >= 1>>
				<<set _loyaltyChange += 2 * $SecExp.buildings.barracks.upgrades.loyaltyMod>>
				is periodically sent to the indoctrination facility in the barracks for thought correction therapy.
			<</if>>
			<<if $militiaUnits[_i].commissars >= 1>>
				The commissars attached to the unit carefully monitor the officers and grunts for signs of insubordination.
				<<set _loyaltyChange += 2 * $militiaUnits[_i].commissars>>
			<</if>>
			<<if $soldierWages == 2>>
				The soldiers greatly appreciate the generous wage given to them for their service. They are proud to defend their homes while making a small fortune out of it.
				<<set _loyaltyChange += random(5,10)>>
			<<elseif $soldierWages == 1>>
				The soldiers appreciate the wage given to them for their service, despite it being just adequate. They are proud to defend their homes, though at the cost of possible financial gains.
				<<set _loyaltyChange += random(-5,5)>>
			<<else>>
				The soldiers do not appreciate the low wage given to them for their service. Their sense of duty keeps them proud of their role as defenders of the arcology, but many do feel its financial weight.
				<<set _loyaltyChange -= random(5,10)>>
			<</if>>
			<<if $militiaSoldierPrivilege == 1>>
				Allowing them to avoid rent payment for their military service earns you their happiness and loyalty.
				<<set _loyaltyChange += random(1,2)>>
			<</if>>
			<<if _loyaltyChange > 0>>
				The loyalty of this unit @@.green;increased@@ this week.
			<<elseif _loyaltyChange == 0>>
				The loyalty of this unit @@.yellow;did not change@@ this week.
			<<else>>
				The loyalty of this unit @@.red;decreased@@ this week.
			<</if>>
			<<set $militiaUnits[_i].loyalty = Math.clamp($militiaUnits[_i].loyalty + _loyaltyChange,0,100)>>
			<<if $militiaUnits[_i].training < 100 && $SecExp.buildings.barracks.upgrades.training >= 1>>

The unit is able to make use of the training facilities to better prepare its soldiers, slowly increasing their experience level.
				<<set $militiaUnits[_i].training += random(2,4) * 1.5 * $SecExp.buildings.barracks.upgrades.training>>
			<</if>>
		<</for>>
		<<set _meL = $mercUnits.length, _loyaltyTotal = 0>>
		<<for _i = 0; _i < _meL; _i++>>

$mercUnits[_i].platoonName:
			<<set _loyaltyChange = 0>>
			<<if $SecExp.buildings.barracks.upgrades.loyaltyMod >= 1>>
				<<set _loyaltyChange += 2 * $SecExp.buildings.barracks.upgrades.loyaltyMod>>
				is periodically sent to the indoctrination facility in the barracks for thought correction therapy.
			<</if>>
			<<if $mercUnits[_i].commissars >= 1>>
				The commissars attached to the unit carefully monitor the officers and grunts for signs of insubordination.
				<<set _loyaltyChange += 2 * $mercUnits[_i].commissars>>
			<</if>>
			<<if $soldierWages == 2>>
				The mercenaries greatly appreciate the generous wage given to them for their service. After all coin is the fastest way to reach their hearts.
				<<set _loyaltyChange += random(5,10)>>
			<<elseif $soldierWages == 1>>
				The mercenaries do not appreciate the barely adequate wage given to them for their service. Still their professionalism keeps them determined to finish their contract.
				<<set _loyaltyChange += random(-5,5)>>
			<<else>>
				The mercenaries do not appreciate the low wage given to them for their service. Their skill would be better served by a better contract and this world does not lack demand for guns for hire.
				<<set _loyaltyChange -= random(5,10)>>
			<</if>>
			<<if $mercSoldierPrivilege == 1>>
				Allowing them to keep part of the loot gained from your enemies earns you their trust and loyalty.
				<<set _loyaltyChange += random(1,2)>>
			<</if>>
			<<if _loyaltyChange > 0>>
				The loyalty of this unit @@.green;increased@@ this week.
			<<elseif _loyaltyChange == 0>>
				The loyalty of this unit @@.yellow;did not change@@ this week.
			<<else>>
				The loyalty of this unit @@.red;decreased@@ this week.
			<</if>>
			<<set $mercUnits[_i].loyalty = Math.clamp($mercUnits[_i].loyalty + _loyaltyChange,0,100)>>
			<<set _loyaltyTotal += $mercUnits[_i].loyalty>>
			<<if $mercUnits[_i].training < 100 && $SecExp.buildings.barracks.upgrades.training >= 1>>

The unit is able to make use of the training facilities to better prepare its soldiers, slowly increasing their experience level.
				<<set $mercUnits[_i].training += random(2,4) * 1.5 * $SecExp.buildings.barracks.upgrades.training>>
			<</if>>
		<</for>>
		<<if _meL > 0>>
			<<set $mercLoyalty = (_loyaltyTotal/_meL)>>
		<</if>>
	<</if>>
<</if>>

<<if $brainImplantProject > 0 && $brainImplant < 106>>

	<<set $brainImplant += $brainImplantProject>>
	<<if 100 - $brainImplant <= 0>>
		The project has been completed!
		<<set $brainImplant = 106>>
	<<else>>
		The great brain implant project is proceeding steadily. This week we made
		<<if $brainImplantProject <= 2>>
			some small
		<<elseif $brainImplantProject <= 4>>
			some
		<<else>>
			good
		<</if>>
		progress.
	<</if>>
<</if>>

<<if $currentUpgrade.time > 0>>

	In the research lab, <<print $currentUpgrade.name>>
	<<switch $currentUpgrade.name>>
	<<case "adaptive armored frames" "advanced synthetic alloys" "ceramo-metallic alloys" "rapid action stimulants" "universal cyber enhancements" "remote neural links" "combined training regimens with the special force">>
		are
	<<default>>
		is
	<</switch>>
	being developed, with the objective to enhance
	<<if $currentUpgrade.type == "attack">>
		attack power
	<<elseif $currentUpgrade.type == "defense">>
		defense capabilities
	<<elseif $currentUpgrade.type == "hp">>
		survivability
	<<elseif $currentUpgrade.type == "morale">>
		standing power
	<<elseif $currentUpgrade.type == "attackAndDefense">>
		offensive and defensive effectiveness
	<<elseif $currentUpgrade.type == "hpAndMorale">>
		morale and survivability
	<<elseif $currentUpgrade.type == "all">>
		offensive,defensive effectiveness in addition to morale and survivability
	<</if>>
	for <<if $currentUpgrade.unit == 0>> the security drones<<else>> our human troops<</if>>.

	<<set $currentUpgrade.time-->>
	<<if $currentUpgrade.time <= 0>>
		Reports indicate it is ready for deployment and will be issued to
		<<if $currentUpgrade.unit == 0>>
			the security drones
			<<if $currentUpgrade.type == "attack">>
				<<set $droneUpgrades.attack++>>
			<<elseif $currentUpgrade.type == "defense">>
				<<set $droneUpgrades.defense++>>
			<<elseif $currentUpgrade.type == "hp">>
				<<set $droneUpgrades.hp++>>
			<</if>>
		<<else>>
			all human troops
			<<if $currentUpgrade.type == "attack">>
				<<set $humanUpgrade.attack++>>
			<<elseif $currentUpgrade.type == "defense">>
				<<set $humanUpgrade.defense++>>
			<<elseif $currentUpgrade.type == "hp">>
				<<set $humanUpgrade.hp++>>
			<<elseif $currentUpgrade.type == "morale">>
				<<set $humanUpgrade.morale += 10>>
			<<elseif $currentUpgrade.type == "attackAndDefense">>
				<<set $humanUpgrade.attack++>>
				<<set $humanUpgrade.defense++>>
			<<elseif $currentUpgrade.type == "hpAndMorale">>
				<<set $humanUpgrade.hp++>>
				<<set $humanUpgrade.morale += 10>>
			<<elseif $currentUpgrade.type == "all">>
				<<set $humanUpgrade.attack++>>
				<<set $humanUpgrade.defense++>>
				<<set $humanUpgrade.hp++>>
				<<set $humanUpgrade.morale += 10>>
			<</if>>
		<</if>>
		<<set $currentUpgrade.name = " ">>
		<<set $currentUpgrade.type = " ">>
		<<set $currentUpgrade.unit = -1>>
		<<set $currentUpgrade.time = 0>>
		in the following days.
		<<recalcBaseStats>>
		<<set $completedUpgrades.push($currentUpgrade.ID)>>
	<<else>>
		It will be finished in <<if $currentUpgrade.time == 1>> one week.<<else>><<print $currentUpgrade.time>> weeks.<</if>>
	<</if>>
<</if>>

repo_name: KnightBoulegard/fc

license: mit


code:
:: seeUnit [nobr]

<<if $attackThisWeek == 1>>
	<<set $nextButton = "Back", $nextLink = "attackOptions", $returnTo = "secBarracks">>
<<else>>
	<<set $nextButton = "Back", $nextLink = "secBarracks", $returnTo = "secBarracks">>
<</if>>

<<if $targetUnit == "secBots">>
	<<= App.SecExp.unit.dec($secBots, "Bots")>>
	<<if $secBots.maxTroops > $secBots.troops>>

		<<link "Replenish the unit" "seeUnit">>
			<<run cashX(forceNeg(($secBots.maxTroops - $secBots.troops) * $secBotsCost), "securityExpansion")>>
			<<set $secBots.troops = $secBots.maxTroops>>
		<</link>>
	<</if>>

	<<if $secBots.maxTroops < 80>>

		<<link "Improve the digital control matrix" "seeUnit">>
			<<set $secBots.maxTroops += 10>>
			<<run cashX(-5000, "securityExpansion")>>
		<</link>>
		Invest in the development of more refined controls for your drones to increase the maximum number of drones in the unit.

//Costs <<print cashFormat(5000)>> per upgrade and each will increase the max by 10//
	<<elseif $SF.Toggle && $SF.Active >= 1 && $secBots.maxTroops < 100 && $SFSupportLevel >= 1>>

		<<link "Refine the drone network with $SF.Lower assistance" "seeUnit">>
		<<set $secBots.maxTroops += 10>>
			<<run cashX(forceNeg(5000 + 10 * $secBotsUpgradeCost * $secBots.equip), "securityExpansion")>>
		<</link>>
		Utilize the technological developments made by $SF.Lower to further improve the control matrix of the security drones.

//Costs <<print cashFormat(5000 + 10 * $secBotsUpgradeCost * $secBots.equip)>> and will increase the max by 10//
	<<elseif $SF.Toggle && $SF.Active >= 1 && $SFSupportLevel < 1>>
		There's little left to improve in the matrix. However support from $SF.Lower might give some more room from improvement.
	<<else>>
		There's little left to improve in the matrix. Your control systems are at top capacity and won't be able to handle a bigger drone unit.
	<</if>>
	<<if $secBots.equip < 3>>

		<<link "Improve drone weaponry and armor" "seeUnit">>
			<<set $secBots.equip += 1>>
			<<run cashX(forceNeg(($secBotsUpgradeCost * $secBots.maxTroops) + 1000), "securityExpansion")>>
		<</link>>
		Invest in better equipment for your drones to increase their battle effectiveness.

//Costs <<print cashFormat(($secBotsUpgradeCost * $secBots.maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
	<<else>>

		Your drones are equipped with top tier weaponry and armor.
	<</if>>
	<<if $SecExp.settings.showStats == 1>>

Security drones base attack: $secBotsBaseAttack <<if $droneUpgrades.attack > 0>> + 1 <</if>>(<<print Math.round($secBotsBaseAttack + $secBotsBaseAttack * $secBots.equip * 0.15)>>)

Security drones base defense: $secBotsBaseDefense <<if $droneUpgrades.defense > 0>> + 1 <</if>>(<<print Math.round($secBotsBaseDefense + $secBotsBaseDefense * $secBots.equip * 0.15)>>)

Equipment bonus: + <<print $secBots.equip * 15>>%

Security drones base hp: $secBotsBaseHp <<if $droneUpgrades.hp > 0>> + 1 <</if>>

Security drones base morale: $secBotsMorale
	<</if>>
<<elseif $targetUnit == "militiaUnits">>
	<<= App.SecExp.unit.dec($militiaUnits[$targetIndex], "Militia")>>

	Rename unit <<textbox "$militiaUnits[$targetIndex].platoonName" $militiaUnits[$targetIndex].platoonName "seeUnit">>
	<<if $militiaUnits[$targetIndex].maxTroops > $militiaUnits[$targetIndex].troops && $militiaFreeManpower > 0>>

		<<link "Replenish unit" "seeUnit">>
			<<if $militiaFreeManpower >= $militiaUnits[$targetIndex].maxTroops - $militiaUnits[$targetIndex].troops>>
				<<set $militiaFreeManpower -= $militiaUnits[$targetIndex].maxTroops - $militiaUnits[$targetIndex].troops>>
				<<set $militiaEmployedManpower += $militiaUnits[$targetIndex].maxTroops - $militiaUnits[$targetIndex].troops>>
				<<set _expLoss = ($militiaUnits[$targetIndex].maxTroops - $militiaUnits[$targetIndex].troops) / $militiaUnits[$targetIndex].troops>>
				<<set $militiaUnits[$targetIndex].training -= $militiaUnits[$targetIndex].training * _expLoss>>
				<<set $militiaUnits[$targetIndex].troops = $militiaUnits[$targetIndex].maxTroops>>
			<<else>>
				<<set $militiaEmployedManpower += $militiaFreeManpower>>
				<<set _expLoss = $militiaFreeManpower / $militiaUnits[$targetIndex].troops>>
				<<set $militiaUnits[$targetIndex].training -= $militiaUnits[$targetIndex].training * _expLoss>>
				<<set $militiaUnits[$targetIndex].troops += $militiaFreeManpower>>
				<<set $militiaFreeManpower = 0>>
			<</if>>
		<</link>>
	<</if>>

	<<if $militiaUnits[$targetIndex].maxTroops < 50>>

		<<link "Intensive officers training" "seeUnit">>
			<<set $militiaUnits[$targetIndex].maxTroops += 10>>
			<<run cashX(forceNeg(5000 + 10 * $equipUpgradeCost * ($militiaUnits[$targetIndex].equip + $militiaUnits[$targetIndex].commissars + $militiaUnits[$targetIndex].cyber + $militiaUnits[$targetIndex].SF)), "securityExpansion")>>
		<</link>>
		Invest in the training of your officers to increase the maximum number of soldiers in the unit.

//Costs <<print cashFormat(5000 + 10 * $equipUpgradeCost * ($militiaUnits[$targetIndex].equip + $militiaUnits[$targetIndex].commissars + $militiaUnits[$targetIndex].cyber + $militiaUnits[$targetIndex].SF))>> and will increase the max by 10//
	<<else>>

		Your officers reached their peak. Further training will have little impact on the number of troops they can effectively lead.
	<</if>>
	<<if $militiaUnits[$targetIndex].equip < 3>>

		<<link "Improve weaponry and equipment" "seeUnit">>
			<<set $militiaUnits[$targetIndex].equip += 1>>
			<<run cashX(forceNeg(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000), "securityExpansion")>>
		<</link>>
		Invest in better equipment for your soldiers to increase their battle effectiveness.

//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
	<<else>>

		The unit is equipped with state of the art weaponry and equipment.
	<</if>>
	<<if $militiaUnits[$targetIndex].commissars == 0>>

		<<link "Attach commissars to the unit" "seeUnit">>
			<<set $militiaUnits[$targetIndex].commissars = 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
		<</link>>
		Attach a small squad of commissars to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000)>> and will slowly increase the loyalty of the unit.//
	<<elseif $militiaUnits[$targetIndex].commissars < 2>>

		<<link "Intensive loyalty training" "seeUnit">>
			<<set $militiaUnits[$targetIndex].commissars += 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
		<</link>>
		Provide special training for the officers and the commissars of the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000)>> and will increase the loyalty of the unit faster.//
	<<elseif $militiaUnits[$targetIndex].commissars == 1>>

The unit has a commissar detachment, keeping under control the ambitions of the unit's officers.
	<<else>>

The unit has a perfectly trained and loyal commissar detachment, keeping under control the ambitions of the unit's officers.
	<</if>>
	<<if $prostheticsUpgrade >= 2 || $researchLab.advCombatPLimb == 1>>
		<<if $militiaUnits[$targetIndex].cyber == 0>>

			<<link "Provide enhanced cybernetic enhancements" "seeUnit">>
				<<set $militiaUnits[$targetIndex].cyber += 1>>
				<<run cashX(forceNeg($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops + 2000), "securityExpansion")>>
			<</link>>
			Will augment all soldiers of the unit with high tech cyber enhancements.

//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 2000)>> and will increase attack, defense and base hp values of the unit.//
		<<else>>

The unit is equipped with advanced cybernetic enhancements.
		<</if>>
	<</if>>
	<<if $militiaUnits[$targetIndex].medics == 0>>

		<<link "Attach trained medics to the unit" "seeUnit">>
			<<set $militiaUnits[$targetIndex].medics = 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
		<</link>>
		Attach a small squad of trained medics to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000)>> and will decrease the number of casualties suffered during battle.//
	<<else>>

The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers.
	<</if>>
	<<if $SF.Toggle && $SF.Active >= 1>>
		<<if $militiaUnits[$targetIndex].SF == 0>>

			<<link "Attach Special Force advisors" "seeUnit">>
				<<set $militiaUnits[$targetIndex].SF = 1>>
				<<run cashX(forceNeg(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 5000), "securityExpansion")>>
			<</link>>
			Attach $SF.Lower advisors to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 5000)>> and will slightly increase the base stats of the unit.//
		<<else>>

The unit has attached advisors from $SF.Lower that will help the squad remain tactically aware and active.
		<</if>>
	<</if>>

	<<if $SecExp.settings.showStats == 1>>
		<<if $militiaUnits[$targetIndex].training <= 10>>
			<<set _expBonus = 0>>
		<<elseif $militiaUnits[$targetIndex].training <= 33>>
			<<set _expBonus = 10>>
		<<elseif $militiaUnits[$targetIndex].training <= 66>>
			<<set _expBonus = 25>>
		<<else>>
			<<set _expBonus = 50>>
		<</if>>
		<<if $militiaUnits[$targetIndex].loyalty <= 10>>
			<<set _loyaltyBonus = 0>>
		<<elseif $militiaUnits[$targetIndex].loyalty <= 33>>
			<<set _loyaltyBonus = 10>>
		<<elseif $militiaUnits[$targetIndex].loyalty <= 66>>
			<<set _loyaltyBonus = 20>>
		<<else>>
			<<set _loyaltyBonus = 30>>
		<</if>>

Militia base attack: $militiaBaseAttack <<if $humanUpgrade.attack > 0>> + $humanUpgrade.attack <</if>>(<<print Math.round($militiaBaseAttack + $militiaUnits[$targetIndex].cyber + $militiaBaseAttack * $militiaUnits[$targetIndex].equip * $equipMod + $militiaBaseAttack * _expBonus * 0.01 + $militiaBaseAttack * _loyaltyBonus * 0.01 + $militiaBaseAttack * $militiaUnits[$targetIndex].SF * 0.20)>>)

Militia base defense: $militiaBaseDefense <<if $humanUpgrade.defense > 0>> + $humanUpgrade.defense <</if>>(<<print Math.round($militiaBaseDefense + $militiaUnits[$targetIndex].cyber + $militiaBaseDefense * $militiaUnits[$targetIndex].equip * $equipMod + $militiaBaseDefense * _expBonus * 0.01 + $militiaBaseDefense * _loyaltyBonus * 0.01 + $militiaBaseDefense * $militiaUnits[$targetIndex].SF * 0.20)>>)
		<<if $militiaUnits[$targetIndex].equip > 0>>

Equipment bonus: + <<print $militiaUnits[$targetIndex].equip * 15>>%
		<</if>>
		<<if $militiaUnits[$targetIndex].cyber > 0>>

Cyber enhancements bonus: + 1
		<</if>>
		<<if _expBonus > 0>>

Experience bonus: +<<print _expBonus>>%
		<</if>>
		<<if _loyaltyBonus > 0>>

Loyalty bonus: +<<print _loyaltyBonus>>%
		<</if>>
		<<if $militiaUnits[$targetIndex].SF > 0>>

Special Force advisors bonus: +20%
		<</if>>

Militia base morale: $militiaBaseMorale <<if $humanUpgrade.morale > 0>> + $humanUpgrade.morale <</if>>(<<print Math.round($militiaBaseMorale + $militiaBaseMorale * $SecExp.buildings.barracks.upgrades.luxury * 0.05)>>)
		<<if $SecExp.buildings.barracks.upgrades.luxury > 0>>

Barracks bonus: + <<print $SecExp.buildings.barracks.upgrades.luxury * 5>>%
		<</if>>

Militia base hp: $militiaBaseHp <<if $humanUpgrade.hp > 0>> + $humanUpgrade.hp <</if>>(<<print Math.round($militiaBaseHp + $militiaUnits[$targetIndex].cyber + $militiaBaseHp * $militiaUnits[$targetIndex].medics * 0.25)>>)
		<<if $militiaUnits[$targetIndex].medics > 0>>

Medics detachment bonus: +25%
		<</if>>
	<</if>>
<<elseif $targetUnit == "slaveUnits">>
	<<= App.SecExp.unit.dec($slaveUnits[$targetIndex], "Slaves")>>

	Rename unit <<textbox "$slaveUnits[$targetIndex].platoonName" $slaveUnits[$targetIndex].platoonName "seeUnit">>
	<<if $slaveUnits[$targetIndex].maxTroops > $slaveUnits[$targetIndex].troops && $menials > 0>>

		<<link "Replenish unit" "seeUnit">>
			<<if $menials >= $slaveUnits[$targetIndex].maxTroops - $slaveUnits[$targetIndex].troops>>
				<<set $menials -= $slaveUnits[$targetIndex].maxTroops - $slaveUnits[$targetIndex].troops>>
				<<set $slavesEmployedManpower += $slaveUnits[$targetIndex].maxTroops - $slaveUnits[$targetIndex].troops>>
				<<set _expLoss = ($slaveUnits[$targetIndex].maxTroops - $slaveUnits[$targetIndex].troops) / $slaveUnits[$targetIndex].troops>>
				<<set $slaveUnits[$targetIndex].training -= $slaveUnits[$targetIndex].training * _expLoss>>
				<<set $slaveUnits[$targetIndex].troops = $slaveUnits[$targetIndex].maxTroops>>
			<<else>>
				<<set $slavesEmployedManpower += $menials>>
				<<set _expLoss = $menials / $slaveUnits[$targetIndex].troops>>
				<<set $slaveUnits[$targetIndex].training -= $slaveUnits[$targetIndex].training * _expLoss>>
				<<set $slaveUnits[$targetIndex].troops += $menials>>
				<<set $menials = 0>>
			<</if>>
		<</link>>
	<</if>>

	<<if $slaveUnits[$targetIndex].maxTroops < 50>>

		<<link "Intensive officers training" "seeUnit">>
			<<set $slaveUnits[$targetIndex].maxTroops += 10>>
			<<run cashX(forceNeg(5000 + 10 * $equipUpgradeCost * ($slaveUnits[$targetIndex].equip + $slaveUnits[$targetIndex].commissars + $slaveUnits[$targetIndex].cyber + $slaveUnits[$targetIndex].SF)), "securityExpansion")>>
		<</link>>
		Invest in the training of your officers to increase the maximum number of soldiers in the unit.

//Costs <<print cashFormat(5000 + 10 * $equipUpgradeCost * ($slaveUnits[$targetIndex].equip + $slaveUnits[$targetIndex].commissars + $slaveUnits[$targetIndex].cyber + $slaveUnits[$targetIndex].SF))>> and will increase the max by 10//
	<<else>>

Your officers reached their peak. Further training will have little impact on the number of troops they can effectively lead.
	<</if>>
	<<if $slaveUnits[$targetIndex].equip < 3>>

		<<link "Improve weaponry and equipment">>
			<<set $slaveUnits[$targetIndex].equip += 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
			<<goto "seeUnit">>
		<</link>>
		Invest in better equipment for your soldiers to increase their battle effectiveness.

//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
	<<else>>

The unit is equipped with state of the art weaponry and equipment.
	<</if>>
	<<if $slaveUnits[$targetIndex].commissars == 0>>

		<<link "Attach commissars to the unit" "seeUnit">>
			<<set $slaveUnits[$targetIndex].commissars = 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
		<</link>>
		Attach a small squad of commissars to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000)>> and will slowly increase the loyalty of the unit.//
	<<elseif $slaveUnits[$targetIndex].commissars < 2>>

		<<link "Intensive loyalty training" "seeUnit">>
			<<set $slaveUnits[$targetIndex].commissars += 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
		<</link>>
		Provide special training for the officers and the commissars of the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000)>> and will increase the loyalty of the unit faster.//
	<<elseif $slaveUnits[$targetIndex].commissars == 1>>

The unit has a commissar detachment, keeping under control the ambitions of the unit's officers.
	<<else>>

The unit has a perfectly trained and loyal commissar detachment, keeping under control the ambitions of the unit's officers.
	<</if>>
	<<if $prostheticsUpgrade >= 2 || $researchLab.advCombatPLimb == 1>>
		<<if $slaveUnits[$targetIndex].cyber == 0>>

			<<link "Provide enhanced cybernetic enhancements" "seeUnit">>
				<<set $slaveUnits[$targetIndex].cyber += 1>>
				<<run cashX(forceNeg($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops + 2000), "securityExpansion")>>
			<</link>>
			Will augment all soldiers of the unit with high tech cyber enhancements.

//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 2000)>> and will increase attack, defense and base hp values of the unit.//
		<<else>>

The unit is equipped with advanced cybernetic enhancements.
		<</if>>
	<</if>>
	<<if $slaveUnits[$targetIndex].medics == 0>>

		<<link "Attach trained medics to the unit" "seeUnit">>
			<<set $slaveUnits[$targetIndex].medics = 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
		<</link>>
		Attach a small squad of trained medics to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000)>> and will decrease the number of casualties suffered during battle.//
	<<else>>

The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers.
	<</if>>
	<<if $SF.Toggle && $SF.Active >= 1>>
		<<if $slaveUnits[$targetIndex].SF == 0>>

			<<link "Attach Special Force advisors" "seeUnit">>
				<<set $slaveUnits[$targetIndex].SF = 1>>
				<<run cashX(forceNeg(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 5000), "securityExpansion")>>
			<</link>>
			Attach $SF.Lower advisors to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 5000)>> and will slightly increase the base stats of the unit.//
		<<else>>

The unit has attached advisors from $SF.Lower that will help the squad remain tactically aware and active.
		<</if>>
	<</if>>
	<<if $SecExp.settings.showStats == 1>>
		<<if $slaveUnits[$targetIndex].training <= 10>>
			<<set _expBonus = 0>>
		<<elseif $slaveUnits[$targetIndex].training <= 33>>
			<<set _expBonus = 10>>
		<<elseif $slaveUnits[$targetIndex].training <= 66>>
			<<set _expBonus = 25>>
		<<else>>
			<<set _expBonus = 50>>
		<</if>>
		<<if $slaveUnits[$targetIndex].loyalty <= 10>>
			<<set _loyaltyBonus = 0>>
		<<elseif $slaveUnits[$targetIndex].loyalty <= 33>>
			<<set _loyaltyBonus = 10>>
		<<elseif $slaveUnits[$targetIndex].loyalty <= 66>>
			<<set _loyaltyBonus = 20>>
		<<else>>
			<<set _loyaltyBonus = 30>>
		<</if>>

Slaves base attack: $slaveBaseAttack <<if $humanUpgrade.attack > 0>> + $humanUpgrade.attack <</if>>(<<print Math.round($slaveBaseAttack + $slaveUnits[$targetIndex].cyber + $slaveBaseAttack * $slaveUnits[$targetIndex].equip * $equipMod + $slaveBaseAttack * _expBonus * 0.01 + $slaveBaseAttack * _loyaltyBonus * 0.01 + $slaveBaseAttack * $slaveUnits[$targetIndex].SF * 0.20)>>)

Slaves base defense: $slaveBaseDefense <<if $humanUpgrade.defense > 0>> + $humanUpgrade.defense <</if>>(<<print Math.round($slaveBaseDefense + $slaveUnits[$targetIndex].cyber + $slaveBaseDefense * $slaveUnits[$targetIndex].equip * $equipMod + $slaveBaseDefense * _expBonus * 0.01 + $slaveBaseDefense * _loyaltyBonus * 0.01 + $slaveBaseDefense * $slaveUnits[$targetIndex].SF * 0.20)>>)
		<<if $slaveUnits[$targetIndex].equip > 0>>

Equipment bonus: + <<print $slaveUnits[$targetIndex].equip * 15>>%
		<</if>>
		<<if $slaveUnits[$targetIndex].cyber > 0>>

Cyber enhancements bonus: + 1
		<</if>>
		<<if _expBonus > 0>>

Experience bonus: +<<print _expBonus>>%
		<</if>>
		<<if _loyaltyBonus > 0>>

Loyalty bonus: +<<print _loyaltyBonus>>%
		<</if>>
		<<if $slaveUnits[$targetIndex].SF > 0>>

Special Force advisors bonus: +20%
		<</if>>

Slaves base morale: $slaveBaseMorale <<if $humanUpgrade.morale > 0>> + $humanUpgrade.morale <</if>>(<<print Math.round($slaveBaseMorale + $slaveBaseMorale * $SecExp.buildings.barracks.upgrades.luxury * 0.05)>>)
		<<if $SecExp.buildings.barracks.upgrades.luxury > 0>>

Barracks bonus: + <<print $SecExp.buildings.barracks.upgrades.luxury * 5>>%
		<</if>>

Slaves base hp: $slaveBaseHp <<if $humanUpgrade.hp > 0>> + $humanUpgrade.hp <</if>>(<<print Math.round($slaveBaseHp + $slaveUnits[$targetIndex].cyber + $slaveBaseHp * $slaveUnits[$targetIndex].medics * 0.25)>>)
		<<if $slaveUnits[$targetIndex].medics > 0>>

Medics detachment bonus: +25%
		<</if>>
	<</if>>
<<elseif $targetUnit == "mercUnits">>
	<<= App.SecExp.unit.dec($mercUnits[$targetIndex], "Mercs")>>

	Rename unit <<textbox "$mercUnits[$targetIndex].platoonName" $mercUnits[$targetIndex].platoonName "seeUnit">>
	<<if $mercUnits[$targetIndex].troops < $mercUnits[$targetIndex].maxTroops && $mercFreeManpower > 0>>

		<<link "Replenish unit" "seeUnit">>
			<<if $mercFreeManpower >= $mercUnits[$targetIndex].maxTroops - $mercUnits[$targetIndex].troops>>
				<<set $mercFreeManpower -= $mercUnits[$targetIndex].maxTroops - $mercUnits[$targetIndex].troops>>
				<<set $mercEmployedManpower += $mercUnits[$targetIndex].maxTroops - $mercUnits[$targetIndex].troops>>
				<<set _expLoss = ($mercUnits[$targetIndex].maxTroops - $mercUnits[$targetIndex].troops) / $mercUnits[$targetIndex].troops>>
				<<set $mercUnits[$targetIndex].training -= $mercUnits[$targetIndex].training * _expLoss>>
				<<set $mercUnits[$targetIndex].troops = $mercUnits[$targetIndex].maxTroops>>
			<<else>>
				<<set $mercEmployedManpower += $mercFreeManpower>>
				<<set _expLoss = $mercFreeManpower / $mercUnits[$targetIndex].troops>>
				<<set $mercUnits[$targetIndex].training -= $mercUnits[$targetIndex].training * _expLoss>>
				<<set $mercUnits[$targetIndex].troops += $mercFreeManpower>>
				<<set $mercFreeManpower = 0>>
			<</if>>
		<</link>>
	<</if>>

	<<if $mercUnits[$targetIndex].maxTroops < 50>>

		<<link "Intensive officers training" "seeUnit">>
			<<set $mercUnits[$targetIndex].maxTroops += 10>>
			<<run cashX(forceNeg(5000 + 10 * $equipUpgradeCost * ($mercUnits[$targetIndex].equip + $mercUnits[$targetIndex].commissars + $mercUnits[$targetIndex].cyber + $mercUnits[$targetIndex].SF)), "securityExpansion")>>
		<</link>>
		Invest in the training of your officers to increase the maximum number of soldiers in the unit.

//Costs <<print cashFormat(5000 + 10 * $equipUpgradeCost * ($mercUnits[$targetIndex].equip + $mercUnits[$targetIndex].commissars + $mercUnits[$targetIndex].cyber + $mercUnits[$targetIndex].SF))>> and will increase the max by 10//
	<<else>>

Your officers reached their peak. Further training will have little impact on the number of troops they can effectively lead.
	<</if>>
	<<if $mercUnits[$targetIndex].equip < 3>>

		<<link "Improve weaponry and equipment" "seeUnit">>
			<<set $mercUnits[$targetIndex].equip += 1>>
			<<run cashX(forceNeg(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000), "securityExpansion")>>
		<</link>>
		Invest in better equipment for your soldiers to increase their battle effectiveness.

//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
	<<else>>

The unit is equipped with state of the art weaponry and equipment.
	<</if>>
	<<if $mercUnits[$targetIndex].commissars == 0>>

		<<link "Attach commissars to the unit" "seeUnit">>
			<<set $mercUnits[$targetIndex].commissars = 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
		<</link>>
		Attach a small squad of commissars to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000)>> and will slowly increase the loyalty of the unit.//
	<<elseif $mercUnits[$targetIndex].commissars < 2>>

		<<link "Intensive loyalty training" "seeUnit">>
			<<set $mercUnits[$targetIndex].commissars += 1>>
			<<run cashX(forceNeg($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops + 1000), "securityExpansion")>>
		<</link>>
		Provide special training for the officers and the commissars of the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000)>> and will increase the loyalty of the unit faster.//
	<<elseif $mercUnits[$targetIndex].commissars == 1>>

The unit has a commissar detachment, keeping under control the ambitions of the unit's officers.
	<<else>>

The unit has a perfectly trained and loyal commissar detachment, keeping under control the ambitions of the unit's officers.
	<</if>>
	<<if $prostheticsUpgrade >= 2 || $researchLab.advCombatPLimb == 1>>
		<<if $mercUnits[$targetIndex].cyber == 0>>

			<<link "Provide enhanced cybernetic enhancements" "seeUnit">>
				<<set $mercUnits[$targetIndex].cyber += 1>>
				<<run cashX(forceNeg($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops + 2000), "securityExpansion")>>
			<</link>>Will augment all soldiers of the unit with high tech cyber enhancements.

//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 2000)>> and will increase attack, defense and base hp values of the unit.//
		<<else>>

The unit is equipped with advanced cybernetic enhancements.
		<</if>>
	<</if>>
	<<if $mercUnits[$targetIndex].medics == 0>>

		<<link "Attach trained medics to the unit" "seeUnit">>
			<<set $mercUnits[$targetIndex].medics = 1>>
			<<run cashX(forceNeg(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 5000), "securityExpansion")>>
		<</link>>
		Attach a small squad of trained medics to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 5000)>> and will decrease the number of casualties suffered during battle.//
	<<else>>

The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers.
	<</if>>
	<<if $SF.Toggle && $SF.Active >= 1>>
		<<if $mercUnits[$targetIndex].SF == 0>>

			<<link "Attach Special Force advisors" "seeUnit">>
				<<set $mercUnits[$targetIndex].SF = 1>>
				<<run cashX(forceNeg(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 5000), "securityExpansion")>>
			<</link>>
			Attach $SF.Lower advisors to the unit.

//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 5000)>> and will slightly increase the base stats of the unit.//
		<<else>>

The unit has attached advisors from $SF.Lower that will help the squad remain tactically aware and active.
		<</if>>
	<</if>>
	<<if $SecExp.settings.showStats == 1>>
		<<if $mercUnits[$targetIndex].training <= 10>>
			<<set _expBonus = 0>>
		<<elseif $mercUnits[$targetIndex].training <= 33>>
			<<set _expBonus = 10>>
		<<elseif $mercUnits[$targetIndex].training <= 66>>
			<<set _expBonus = 25>>
		<<else>>
			<<set _expBonus = 50>>
		<</if>>
		<<if $mercUnits[$targetIndex].loyalty <= 10>>
			<<set _loyaltyBonus = 0>>
		<<elseif $mercUnits[$targetIndex].loyalty <= 33>>
			<<set _loyaltyBonus = 10>>
		<<elseif $mercUnits[$targetIndex].loyalty <= 66>>
			<<set _loyaltyBonus = 20>>
		<<else>>
			<<set _loyaltyBonus = 30>>
		<</if>>

Mercenaries base attack: $mercBaseAttack <<if $humanUpgrade.attack > 0>> + $humanUpgrade.attack <</if>>(<<print Math.round($mercBaseAttack + $mercBaseAttack * $mercUnits[$targetIndex].equip * $equipMod + $mercBaseAttack * _expBonus * 0.01 + $mercBaseAttack * _loyaltyBonus * 0.01 + $mercBaseAttack * $mercUnits[$targetIndex].SF * 0.20 + $mercUnits[$targetIndex].cyber)>>)

Mercenaries base defense: $mercBaseDefense <<if $humanUpgrade.defense > 0>> + $humanUpgrade.defense <</if>>(<<print Math.round($mercBaseDefense + $mercBaseDefense * $mercUnits[$targetIndex].equip * $equipMod + $mercBaseDefense * _expBonus * 0.01 + $mercBaseDefense * _loyaltyBonus * 0.01 + $mercBaseDefense * $mercUnits[$targetIndex].SF * 0.20 + $mercUnits[$targetIndex].cyber)>>)
		<<if $mercUnits[$targetIndex].equip > 0>>

Equipment bonus: + <<print $mercUnits[$targetIndex].equip * 15>>%
		<</if>>
		<<if $mercUnits[$targetIndex].cyber > 0>>

Cyber enhancements bonus: + 1
		<</if>>
		<<if _expBonus > 0>>

Experience bonus: +<<print _expBonus>>%
		<</if>>
		<<if _loyaltyBonus > 0>>

Loyalty bonus: +<<print _loyaltyBonus>>%
		<</if>>
		<<if $mercUnits[$targetIndex].SF > 0>>

Special Force advisors bonus: +20%
		<</if>>

Mercenaries base morale: $mercBaseMorale <<if $humanUpgrade.morale > 0>> + $humanUpgrade.morale <</if>>(<<print Math.round($mercBaseMorale + $mercBaseMorale * $SecExp.buildings.barracks.upgrades.luxury * 0.05)>>)
		<<if $SecExp.buildings.barracks.upgrades.luxury > 0>>

Barracks bonus: + <<print $SecExp.buildings.barracks.upgrades.luxury * 5>>%
		<</if>>

Mercenaries base hp: $mercBaseHp <<if $humanUpgrade.hp > 0>> + $humanUpgrade.hp <</if>>(<<print Math.round($mercBaseHp + $mercBaseHp * $mercUnits[$targetIndex].medics * 0.25 + $mercUnits[$targetIndex].cyber)>>)
		<<if $mercUnits[$targetIndex].medics > 0>>

Medics detachment bonus: +25%
		<</if>>
	<</if>>
<</if>>


code:
:: tradeReport [nobr]

<<if $week < 30>>
	The world economy is in good enough shape to sustain economic growth. Trade flows liberally in all the globe.
	<<set _tradeChange += 1>>
<<elseif $week < 60>>
	The world economy is deteriorating, but still in good enough shape to sustain economic growth.
	<<set _tradeChange += 0.5>>
<<elseif $week < 90>>
	The world economy is deteriorating, but still in decent enough shape to sustain economic growth.
<<elseif $week < 120>>
	The world economy is deteriorating and the slowing down of global growth is starting to have some effect on trade flow.
	<<set _tradeChange -= 1>>
<<else>>
	The world economy is heavily deteriorated. The slowing down of global growth has a great negative effect on trade flow.
	<<set _tradeChange -= 2>>
<</if>>

<<set _tradeChange = 0>>
<<if $lastAttackWeeks < 2 && $hasFoughtOnce == 1>>
	The recent attack has a negative effect on the trade of the arcology.
	<<set _tradeChange -= 1>>
<<elseif $lastAttackWeeks < 4 && $hasFoughtOnce == 1>>
	While some time has passed, the last attack still has a negative effect on the commercial activity of the arcology.
	<<set _tradeChange -= 0.5>>
<</if>>
<<if $lastRebellionWeeks < 2 && $hasRebelledOnce == 1>>
	The recent rebellion has a negative effect on the trade of the arcology.
	<<set _tradeChange -= 1>>
<<elseif $lastRebellionWeeks < 4 && $hasRebelledOnce == 1>>
	While some time has passed, the last rebellion still has a negative effect on the commercial activity of the arcology.
	<<set _tradeChange -= 0.5>>
<</if>>

<<if $terrain == "urban">>
	Since your arcology is located in the heart of an urban area, its commerce is naturally vibrant.
	<<set _tradeChange++>>
<</if>>
<<if $terrain == "ravine">>
	Since your arcology is located in the heart of a ravine, its commerce is hindered by a lack of accessibility.
	<<set _tradeChange -= 0.5>>
<</if>>

<<if $PC.career == "wealth" || $PC.career == "capitalist" || $PC.career == "celebrity" || $PC.career == "BlackHat">>
	<<set _tradeChange += 1>>
<<elseif $PC.career == "escort" || $PC.career == "servant" || $PC.career == "gang">>
	<<set _tradeChange -= 0.5>>
<</if>>

<<if $rep > 18000>>
	Your extremely high reputation attracts trade from all over the world.
<<elseif $rep > 12000>>
	Your high reputation attracts trade from all over the world.
<</if>>

<<setAssistantPronouns>>
<<if $assistant.power == 1>>
	Thanks to the computing power available to _himA, $assistant.name is able to guide the commercial development of the arcology to greater levels.
	<<set _tradeChange++>>
<<elseif $assistant.power >= 2>>
	Thanks to the incredible computing power available to _himA, $assistant.name is able to guide the commercial development of the arcology to greater levels.
	<<set _tradeChange += 2>>
<</if>>

<<if $tradeLegalAid == 1>>
	Your support in legal matters for new businesses helps improve the economic dynamicity of your arcology, boosting commercial activities.
	<<set _tradeChange += 1>>
<</if>>

<<if $taxTrade == 1>>
	The fees imposed on transitioning goods do little to earn you the favor of the companies making use of your arcology.
	<<set _tradeChange -= 1>>
<</if>>

<<if $weapManu == 1>>
	The weapons manufacturing facility of the arcology attracts a significant amount of trade.
	<<set _tradeChange += 0.5 * ($weapProductivity + $weapLab)>>
<</if>>
<<if $transportHub == 1>>
	<<if $airport == 1>>
		The airport, while small, helps facilitate the commercial development of the arcology.
		<<set _tradeChange += 1>>
	<<elseif $airport == 2>>
		The airport, while fairly small, helps facilitate the commercial development of the arcology.
		<<set _tradeChange += 1.5>>
	<<elseif $airport == 3>>
		The airport helps facilitate the commercial development of the arcology.
		<<set _tradeChange += 2>>
	<<elseif $airport == 4>>
		The airport is a great boon to the commercial development of the arcology.
		<<set _tradeChange += 2.5>>
	<<else>>
		The airport is an incredible boon to the commercial development of the arcology.
		<<set _tradeChange += 3>>
	<</if>>

	<<if $terrain != "oceanic" && $terrain != "marine">>
		<<if $railway == 1>>
			The railway network's age and limited extension limit commercial activity.
		<<elseif $railway == 2>>
			The railway network is a great help to the commercial development of the arcology, but its limited extension hampers its potential.
			<<set _tradeChange += 1>>
		<<elseif $railway == 3>>
			The railway network is a great help to the commercial development of the arcology.
			<<set _tradeChange += 1.5>>
		<<else>>
			The railway network is a huge help to the commercial development of the arcology. Few in the world can boast such a modern and efficient transport system.
			<<set _tradeChange += 2>>
		<</if>>
	<<else>>
		<<if $docks == 1>>
			The docks' age and limited size limit commercial activity.
		<<elseif $docks == 2>>
			The docks are a great help to the commercial development of the arcology, but their limited size hampers its potential.
			<<set _tradeChange += 1>>
		<<elseif $docks == 3>>
			The docks are a great help to the commercial development of the arcology.
			<<set _tradeChange += 1.5>>
		<<else>>
			The docks are a huge help to the commercial development of the arcology. Few in the world can boast such a modern and efficient transport system.
			<<set _tradeChange += 2>>
		<</if>>
	<</if>>
<</if>>

<<if $SF.Toggle && $SF.Active >= 1 && $SF.Size > 10>>
	Having a powerful special force increases trade security.
	<<set _tradeChange += $SF.Size/10>>
<</if>>

<<if _tradeChange > 0>>
	This week @@.green;trade improved.@@
<<elseif _tradeChange == 0>>
	This week @@.yellow;trade did not change.@@
<<else>>
	This week @@.red;trade diminished.@@
<</if>>

<<if $SecExp.core.trade <= 20>>
	The almost non-existent trade crossing the arcology @@.yellow;does little to promote growth.@@
<<elseif $SecExp.core.trade <= 40>>
	The low level of trade crossing the arcology promotes a @@.green;slow yet steady growth@@ of its economy.
	<<set _AWeekGrowth += 1.5>>
<<elseif $SecExp.core.trade <= 60>>
	With trade at positive levels, the @@.green;prosperity of the arcology grows more powerful.@@
	<<set _AWeekGrowth += 2.5>>
<<elseif $SecExp.core.trade <= 80>>
	With trade at high levels, the @@.green;prosperity of the arcology grows quickly and violently.@@
	<<set _AWeekGrowth += 3.5>>
<<else>>
	With trade at extremely high levels, the @@.green;prosperity of the arcology grows with unprecedented speed.@@
	<<set _AWeekGrowth += 4.5>>
<</if>>

<<set $SecExp.core.trade = Math.clamp($SecExp.core.trade + _tradeChange,0,100)>>