code:
:: Corporation Developments [nobr]

<<if $detailedCorpControls == 1>>
<<set _Numgeneral = "ALL">>
<<set _Numslave = "ALL">>
<<set _Numentrapment = "ALL">>
<<set _Numcapture = "ALL">>
<<set _Numtraining = "ALL">>
<<set _Numsurgical = "ALL">>
<<set _Numdrug = "ALL">>
<</if>>
<<if $useTabs == 0>>__The Corporation__<</if>>

<<set _totalShares = ($personalShares+$publicShares)>>
<<set _roll = random(1,100)>>
<<set $corpPeopleEnslaved += 1>>

<<set $corpValue = $corpCash + ($generalAssets*$generalAssetPrice)+($slaveAssets*$slaveAssetPrice)+($entrapmentAssets*$entrapmentAssetPrice)+($captureAssets*$captureAssetPrice)+($trainingAssets*$trainingAssetPrice)+($surgicalAssets*$surgicalAssetPrice)+($drugAssets*$drugAssetPrice)>>
<<set $corpProfit = Math.max(0, Math.trunc( 6666666 / (1 + Math.exp(-1.4 * (Math.log($corpValue) - 18))) ) - random(666, 6666))>> /* formula caps at 6666666, reaches 6.5 million at corpValue of 900 million */
<<set $corpCash = Math.trunc($corpCash + $corpProfit)>>
Your corporation was valued at @@.yellowgreen;<<print cashFormat($corpValue)>>@@ and made a profit of @@.yellowgreen;<<print cashFormat($corpProfit)>>@@ last week.
<<set _addedSlaves = Math.ceil(Math.log($captureAssets+$entrapmentAssets))>>
<<if $mercenariesHelpCorp > 0>>
	The $mercenariesTitle assist it with difficult enslavement targets. Otherwise, it
	<<set _addedSlaves = Math.ceil(_addedSlaves * (1 + .04 * $mercenaries))>> /* increase by 12-20% ($mercenaries == 3 - 5) */
<<else>>
	It
<</if>>
<<if _roll > 90>>
	was an outstanding week for corporate enslavement;
	<<set _addedSlaves *= 5>>
<<elseif _roll > 60>>
	was a great week for enslavement;
	<<set _addedSlaves *= 4>>
<<elseif _roll > 40>>
	was a good week for enslavement;
	<<set _addedSlaves *= 3>>
<<elseif _roll > 20>>
	was a mediocre week for enslavement;
	<<set _addedSlaves *= 2>>
<<else>>
	was a bad week for enslavement;
<</if>>
<<set $corpPeopleEnslaved += _addedSlaves, $slaveAssets += 500 * _addedSlaves>>
in total, the corporation has enslaved <<print commaNum($corpPeopleEnslaved)>> people.
<<set _trainingWeight = 0.6, _surgicalWeight = 0.2, _drugWeight = 0.2>>
<<if $surgicalUpgradeCosmetics == "none" && $surgicalUpgradeImplants == "none" && $surgicalUpgradeGenitalia == "none">>
	<<set _surgicalWeight = 0, _trainingWeight += 0.2>>
<</if>>
<<if $drugUpgradeHormones == "none" && $drugUpgradeInjectionOne == "none" && $drugUpgradeInjectionTwo == "none">>
	<<set _drugWeight = 0.1, _trainingWeight += 0.1>>
<</if>>
<<set _improvementAssetsTotal = ($trainingAssets * _trainingWeight) + ($surgicalAssets * _surgicalWeight) + ($drugAssets * _drugWeight)>>
<<if _improvementAssetsTotal > $slaveAssets * 0.6>>
	The corporation has enough training and medical assets to rapidly improve its human holdings.
	<<set $slaveAssets += Math.ceil(Math.log($slaveAssets)*800)>>
<<elseif _improvementAssetsTotal > $slaveAssets * 0.4>>
	The corporation uses its training and medical assets to improve its human holdings.
	<<set $slaveAssets += Math.ceil(Math.log($slaveAssets)*400)>>
<<else>>
	The corporation has only enough training and medical assets to maintain the value of its human holdings.
<</if>>
/* model weekly corporate expenses as random 1-3% reduction in all asset types (including cash) ... except slaves, whose value is tied to $slaveCostFactor (which the corporation does not affect) */
<<set $trainingAssets = Math.max(Math.ceil($trainingAssets * random(97,99)/100), 500), $surgicalAssets = Math.max(Math.ceil($surgicalAssets * random(97,99)/100), 500), $drugAssets = Math.max(Math.ceil($drugAssets * random(97,99)/100), 500), $generalAssets = Math.max(Math.ceil($generalAssets * random(97,99)/100), 500), $entrapmentAssets = Math.max(Math.ceil($entrapmentAssets * random(97,99)/100), 500), $captureAssets = Math.max(Math.ceil($captureAssets * random(97,99)/100), 500), $corpCash = Math.ceil($corpCash * random(97,99)/100)>>
<<if $corpMarket>>
	<<if $rep > 5000>>
		<<set $slaveAssets += Math.ceil(Math.log($slaveAssets)/Math.log(10)*(($rep-5000)/15000)*200)>>
		Since the corporation has its flagship slave market in $arcologies[0].name, your
		<<if $rep > 19000>>
			worldwide renown greatly
		<<elseif $rep > 15000>>
			widespread reputation significantly
		<<elseif $rep > 10000>>
			good reputation moderately
		<<else>>
			decent reputation slightly
		<</if>>
		enhances the value of its slaves.
	<</if>>
<</if>>
<<set _dividendPerShare = 0.2 * $corpProfit / _totalShares>>
<<if _dividendPerShare > 5>>
<<set _dividendPerShare = 5 * Math.floor(0.2 * Math.log(_dividendPerShare)/Math.log(1.25))>>
	Since it is incredibly profitable, a massive dividend of @@.yellowgreen;<<print cashFormat(_dividendPerShare)>>@@/share was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat($personalShares*_dividendPerShare)>>@@.
	<<set $cash += $personalShares*_dividendPerShare, $corpCash -= _totalShares*_dividendPerShare>>
<<elseif _dividendPerShare > 3>>
	Since it is extremely profitable, a huge dividend of @@.yellowgreen;¤3@@/share was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat($personalShares*3)>>@@.
	<<set $cash += $personalShares*3, $corpCash -= _totalShares*3>>
<<elseif _dividendPerShare > 2>>
	Since it is highly profitable, a huge dividend of @@.yellowgreen;¤2@@/share was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat($personalShares*2)>>@@.
	<<set $cash += $personalShares*2, $corpCash -= _totalShares*2>>
<<elseif _dividendPerShare > 1>>
	Since it is very profitable, a large dividend of @@.yellowgreen;¤1@@/share was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat($personalShares)>>@@.
	<<set $cash += $personalShares, $corpCash -= _totalShares>>
<<elseif _dividendPerShare > 0.5>>
	Since it is quite profitable, a moderate dividend of @@.yellowgreen;¤0.5@@/share was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat($personalShares*0.5)>>@@.
	<<set $cash += Math.trunc($personalShares*0.5), $corpCash -= Math.trunc(_totalShares*0.5)>>
<<elseif _dividendPerShare > 0.3>>
	Since it is acceptably profitable, a reasonable dividend of @@.yellowgreen;¤0.3@@/share was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat($personalShares*0.3)>>@@.
	<<set $cash += Math.trunc($personalShares*0.3), $corpCash -= Math.trunc(_totalShares*0.3)>>
<<elseif _dividendPerShare > 0.2>>
	Since it is moderately profitable, a modest dividend of @@.yellowgreen;¤0.2@@/share was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat($personalShares*0.2)>>@@.
	<<set $cash += Math.trunc($personalShares*0.2), $corpCash -= (_totalShares*0.2)>>
<<elseif _dividendPerShare > 0.1>>
	Since it is modestly profitable, a small dividend of @@.yellowgreen;¤0.1@@/share was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat($personalShares*0.1)>>@@.
	<<set $cash += Math.trunc($personalShares*0.1), $corpCash -= Math.trunc(_totalShares*0.1)>>
<<elseif $corpProfit > 0>>
	Since its profits per share are low, a meager dividend was paid out to stockholders; you received @@.yellowgreen;<<print cashFormat(1+Math.ceil(($corpProfit*0.2*$personalShares)/_totalShares))>>@@.
	<<set $cash += 1+Math.ceil(($corpProfit*0.2*$personalShares)/_totalShares), $corpCash -= Math.trunc($corpProfit*0.2)>>
<</if>>

<<set _roll = random(1,100)>>

<<if $sharePrice*_totalShares < $corpValue*0.5>> /* market value is less than 50% of value of assets */
	Investors scramble to buy into your booming corporation, causing share prices to skyrocket. Your financial genius is @@.green;widely praised@@.
	<<set $sharePrice = Math.ceil($sharePrice*(110 + _roll/5))/100, $rep += 150 + Math.ceil(_roll * 3.5)>> /* 10-30% rise, +150-500 rep */
<<elseif $sharePrice*_totalShares < $corpValue*0.75>> /* market value is less than 75% of value of assets */
	The market consensus is that your corporation is undervalued, driving share prices sharply up.
	<<set $sharePrice = Math.ceil($sharePrice*random(105,108))/100>> /* 5-8% rise */
<<elseif $sharePrice*_totalShares > $corpValue*1.5>> /* market value is more than 1.5 times value of assets */
	Investors panic as the bubble around your corporation bursts. Share prices are in free fall, and many @@.red;blame you personally@@ for their losses.
	<<set $sharePrice = Math.ceil($sharePrice* (90 - _roll/3))/100, $rep -= 300 + Math.ceil(5 * _roll)>> /* 10-43% drop, -300-800 rep */
<<elseif random(1,100) < $rep/1000>> /* up to 20% chance */
	Share prices in your corporation are driven up by your reputation.
	<<set $sharePrice = Math.ceil($sharePrice*either(101,103))/100>> /* 1-3% rise */
<<elseif $sharePrice*_totalShares > $corpValue>> /* market value is more than value of assets */
	The market consensus is that your corporation is overvalued, driving share prices sharply down.
	<<set $sharePrice = Math.ceil($sharePrice*random(92,95))/100>> /* 5-8% drop */
<<elseif _roll < 20>> /* 20% chance */
	Market volatility drives share prices down.
	<<set $sharePrice = Math.ceil($sharePrice*random(97,99))/100>> /* 1-3% drop */
<<elseif _roll > 80>> /* 20% chance */
	Market volatility drives share prices up.
	<<set $sharePrice = Math.ceil($sharePrice*either(101,102))/100>> /* 1-2% rise */
<</if>>

Shares in your corporation are trading at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice))>>@@:

<<if $oldSharePrice == $sharePrice>>
	no different from last week.
<<elseif $oldSharePrice > $sharePrice>>
	down @@.yellowgreen;<<print cashFormat(Math.ceil(($oldSharePrice-$sharePrice)*100)/100)>>@@ since last week.
<<else>>
	up @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice - $oldSharePrice)*100)/100)>>@@ since last week.
<</if>>

<<set $oldSharePrice = Math.ceil($sharePrice)>>

You hold <<print commaNum($personalShares)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*$personalShares))>>@@ personally while <<print commaNum($publicShares)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*$publicShares))>>@@ are publicly held.
<<set _PrivateOwnershipPercentage = Math.trunc(($personalShares/_totalShares)*100)>>
<<set _PublicOwnershipPercentage = Math.trunc(($publicShares/_totalShares)*100)>>

<<if _PrivateOwnershipPercentage < 51>>//You cannot give up majority control.//
<<else>> /* actions that reduce private ownership percentage */

Sell personal shares:
	<<if $personalShares-1000 > $publicShares>>
		<<link "<<print commaNum(1000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@">>
			<<set $personalShares -= 1000>>
			<<set $publicShares += 1000>>
			<<set $cash += 1000*$sharePrice>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
			<<replace "#CorpAction">>

You sold <<print commaNum(1000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@ for @@.yellowgreen;<<print cashFormat(Math.ceil(1000*$sharePrice))>>@@" driving the share price down slightly.
			<</replace>>
		<</link>>
		<<if $personalShares-5000 > $publicShares>>
			| <<link "<<print commaNum(5000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@">>
				<<set $personalShares -= 5000>>
				<<set $publicShares += 5000>>
				<<set $cash += 5000*$sharePrice>>
				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
				<<replace "#CorpAction">>

You sold <<print commaNum(5000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@ for @@.yellowgreen;<<print cashFormat(Math.ceil(1000*$sharePrice))>>@@" driving the share price down slightly.
				<</replace>>
			<</link>>
		<</if>>
		<<if $personalShares-10000 > $publicShares>>
			| <<link "<<print commaNum(10000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@">> <<set $personalShares -= 10000>>
				<<set $publicShares += 10000>>
				<<set $cash += 10000*$sharePrice>>
				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
				<<replace "#CorpAction">>

You sold <<print commaNum(10000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@ for @@.yellowgreen;<<print cashFormat(Math.ceil(10000*$sharePrice))>>@@" driving the share price down slightly.
				<</replace>>
			<</link>>
		<</if>>
		<<if $personalShares-15000 > $publicShares>>
			| <<link "<<print commaNum(15000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@">>
				<<set $personalShares -= 15000>>
				<<set $publicShares += 15000>>
				<<set $cash += 15000*$sharePrice>>
				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
				<<replace "#CorpAction">>

You sold <<print commaNum(15000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@ driving the share price down somewhat.
				<</replace>>
			<</link>>
		<</if>>
		<<if $personalShares-20000 > $publicShares>>
			| <<link "<<print commaNum(20000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@">>
				<<set $personalShares -= 20000>>
				<<set $publicShares += 20000>>
				<<set $cash += 20000*$sharePrice>>
				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
				<<replace "#CorpAction">>

You sold <<print commaNum(20000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@ driving the share price down significantly.
				<</replace>>
			<</link>>
		<</if>>
	<<else>>
		//You cannot give up majority control.//
	<</if>>

Issue new public shares:
	<<if $personalShares-1000 > $publicShares>>
		<<link "<<print commaNum(1000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@">>
			<<set $publicShares += 1000>>
			<<set $corpCash += 1000*Math.ceil($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
			<<replace "#CorpAction">>

The corporation issued <<print commaNum(1000)>> new shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@ for @@.yellowgreen;<<print cashFormat(Math.ceil(1000*$sharePrice))>>@@" driving the share price down slightly.
			<</replace>>
		<</link>>
		<<if $personalShares-5000 > $publicShares>>
			| <<link "<<print commaNum(5000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@">>
				<<set $publicShares += 5000>>
				<<set $corpCash += 5000*Math.ceil($sharePrice)>>
				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
				<<replace "#CorpAction">>

The corporation issued <<print commaNum(5000)>> new shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@ for @@.yellowgreen;<<print cashFormat(Math.ceil(1000*$sharePrice))>>@@" driving the share price down slightly.
				<</replace>>
			<</link>>
		<</if>>
		<<if $personalShares-10000 > $publicShares>>
			| <<link "<<print commaNum(10000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@">>
				<<set $publicShares += 10000>>
				<<set $corpCash += 10000*Math.ceil($sharePrice)>>
				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
				<<replace "#CorpAction">>

The corporation issued <<print commaNum(10000)>> new shares for @@.yellowgreen;<<print cashFormat(Math.ceil(1000*$sharePrice))>>@@ driving the share price down slightly.
				<</replace>>
			<</link>>
		<</if>>
		<<if $personalShares-15000 > $publicShares>>
			| <<link "<<print commaNum(15000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@">>
				<<set $publicShares += 15000>>
				<<set $corpCash += 15000*Math.ceil($sharePrice)>>
				<<set $sharePrice = (Math.trunc($sharePrice*random(96,98)))/100>>
				<<replace "#CorpAction">>

The corporation issued <<print commaNum(15000)>> new shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@ driving the share price down somewhat.
				<</replace>>
			<</link>>
		<</if>>
		<<if $personalShares-20000 > $publicShares>>
			| <<link "<<print commaNum(20000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@">> <<set $publicShares += 15000>>
				<<set $corpCash += 20000*Math.ceil($sharePrice)>>
				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
				<<replace "#CorpAction">>

The corporation issued <<print commaNum(20000)>> new shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@ driving the share price down significantly.
				<</replace>>
			<</link>>
		<</if>>
	<<else>>
		//You cannot give up majority control.//
	<</if>>

<</if>>/* closes actions that reduce private ownership percentage */

<<if _PublicOwnershipPercentage <= 5>>
//You cannot make the corporation privately held.//
<<else>> /* actions that reduce public ownership percentage */

Purchase shares from corporation:
	<<if $cash > 1000*$sharePrice>>
		<<link "<<print commaNum(1000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@">>
			<<set $personalShares += 1000>>
			<<set $cash -= 1000*$sharePrice>>
			<<set $corpCash += 1000*Math.floor($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
			<<replace "#CorpAction">>

You purchased <<print commaNum(1000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@, from the corporation driving the share price down slightly.
			<</replace>>
		<</link>>
		<<if $cash > 5000*$sharePrice>>
			| <<link "<<print commaNum(5000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@">>
			<<set $personalShares += 5000>>
			<<set $cash -= 5000*$sharePrice>>
			<<set $corpCash += 5000*Math.floor($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
			<<replace "#CorpAction">>

You purchased <<print commaNum(5000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@, from the corporation driving the share price down slightly.
			<</replace>>
			<</link>>
		<</if>>
		<<if $cash > 10000*$sharePrice>>
			| <<link "<<print commaNum(10000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@">>
			<<set $personalShares += 10000>>
			<<set $cash -= 10000*$sharePrice>>
			<<set $corpCash += 10000*Math.floor($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
			<<replace "#CorpAction">>

You purchased <<print commaNum(10000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@, from the corporation driving the share price down slightly.
			<</replace>>
			<</link>>
		<</if>>
		<<if $cash > 15000*$sharePrice>>
			| <<link "<<print commaNum(15000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@">>
			<<set $personalShares += 15000>>
			<<set $cash -= 15000*$sharePrice>>
			<<set $corpCash += 15000*Math.floor($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
			<<replace "#CorpAction">>

You purchased <<print commaNum(15000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@, from the corporation driving the share price down somewhat.
			<</replace>>
			<</link>>
		<</if>>
		<<if $cash > 20000*$sharePrice>>
			| <<link "<<print commaNum(20000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@">>
			<<set $personalShares += 20000>>
			<<set $cash -= 20000*$sharePrice>>
			<<set $corpCash += 20000*Math.floor($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(98,99)))/100>>
			<<replace "#CorpAction">>

You purchased <<print commaNum(20000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@, from the corporation driving the share price down significantly.
			<</replace>>
			<</link>>
		<</if>>
	<<else>>
		//You are unable to purchase <<print commaNum(1000)>> shares at the current share price, valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@.//
	<</if>>

Buy publicly held shares:
	<<if $cash > 1000*$sharePrice && $publicShares > 1000>>
		<<link "<<print commaNum(1000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@">>
			<<set $personalShares += 1000>>
			<<set $publicShares -= 1000>>
			<<set $cash -= 1000*$sharePrice>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>>
			<<replace "#CorpAction">>

You bought <<print commaNum(1000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@, driving the share price up slightly.
			<</replace>>
		<</link>>
		<<if $publicShares > 5000 && $cash >= 5000*$sharePrice>>
			| <<link "<<print commaNum(5000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@">> <<set $personalShares += 1000>>
			<<set $publicShares -= 5000>>
			<<set $cash -= 5000*$sharePrice>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>>
			<<replace "#CorpAction">>

You bought <<print commaNum(5000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@, driving the share price up slightly.
			<</replace>>
			<</link>>
		<</if>>
		<<if $publicShares > 10000 && $cash >= 10000*$sharePrice>>
			| <<link "<<print commaNum(10000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@">> <<set $personalShares += 10000>>
			<<set $publicShares -= 10000>>
			<<set $cash -= 10000*$sharePrice>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>>
			<<replace "#CorpAction">>

You bought <<print commaNum(10000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@, driving the share price up slightly.
			<</replace>>
			<</link>>
		<</if>>
		<<if $publicShares > 15000 && $cash >= 15000*$sharePrice>>
			| <<link "<<print commaNum(15000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@">> <<set $personalShares += 15000>>
			<<set $publicShares -= 15000>>
			<<set $cash -= 15000*$sharePrice>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>>
			<<replace "#CorpAction">>

You bought <<print commaNum(15000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@, driving the share price up somewhat.
			<</replace>>
			<</link>>
		<</if>>
		<<if $publicShares > 20000 && $cash >= 20000*$sharePrice>>
			| <<link "<<print commaNum(20000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@">> <<set $personalShares += 20000>>
			<<set $publicShares -= 20000>>
			<<set $cash -= 20000*$sharePrice>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102,$PC.trading >= 100 ? 101 : 102)))/100>>
			<<replace "#CorpAction">>

You bought <<print commaNum(20000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@, driving the share price up significantly.
			<</replace>>
			<</link>>
		<</if>>
	<<elseif $publicShares > 1000>>
		//You are unable to purchase <<print commaNum(1000)>> shares at the current share price, valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@.//
	<<else>>
		//You cannot make the corporation privately held.//
	<</if>>

Direct the corporation to buy back publicly held shares:
	<<if $corpCash > 1000*$sharePrice && $publicShares > 1000>>
		<<link "<<print commaNum(1000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@">>
		<<set $publicShares -= 1000>>
		<<set $corpCash -= 1000*Math.ceil($sharePrice)>>
		<<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>>
		<<replace "#CorpAction">>

The corporation bought back <<print commaNum(1000)>> public shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@, driving the share price up slightly.
		<</replace>>
		<</link>>
		<<if $publicShares > 5000 && $corpCash >= 5000*$sharePrice>>
			| <<link "<<print commaNum(5000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@">>
			<<set $publicShares -= 5000>>
			<<set $corpCash -= 5000*Math.ceil($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>>
			<<replace "#CorpAction">>

The corporation bought back <<print commaNum(5000)>> public shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*5000))>>@@, driving the share price up slightly.
			<</replace>>
			<</link>>
		<</if>>
		<<if $publicShares > 10000 && $corpCash >= 10000*$sharePrice>>
			| <<link "<<print commaNum(10000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@">>
			<<set $publicShares -= 10000>>
			<<set $corpCash -= 10000*Math.ceil($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>>
			<<replace "#CorpAction">>

The corporation bought back <<print commaNum(10000)>> public shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*10000))>>@@, driving the share price up slightly.
			<</replace>>
			<</link>>
		<</if>>
		<<if $publicShares > 15000 && $corpCash >= 15000*$sharePrice>>
			| <<link "<<print commaNum(15000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@">>
			<<set $publicShares -= 15000>>
			<<set $corpCash -= 15000*Math.ceil($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>>
			<<replace "#CorpAction">>

The corporation bought back <<print commaNum(15000)>> public shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*15000))>>@@, driving the share price up somewhat.
			<</replace>>
			<</link>>
		<</if>>
		<<if $publicShares > 20000 && $corpCash >= 20000*$sharePrice>>
			| <<link "<<print commaNum(20000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@">>
			<<set $publicShares -= 20000>>
			<<set $corpCash -= 20000*Math.ceil($sharePrice)>>
			<<set $sharePrice = (Math.trunc($sharePrice*either(101,102)))/100>>
			<<replace "#CorpAction">>

The corporation bought back <<print commaNum(20000)>> public shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*20000))>>@@, driving the share price up significantly.
			<</replace>>
			<</link>>
		<</if>>
	<<elseif $publicShares > 1000>>
		//The corporation is unable to purchase <<print commaNum(1000)>> shares at the current share price, valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@.//
	<<else>>
		//You cannot make the corporation privately held.//
	<</if>>

<</if>> /* closes actions that reduce public ownership percentage */

@@.yellowgreen;<<print cashFormat($corpCash)>>@@ in cash on hand.

<<if $generalAssetPrice > 10>>
	<<if random(1,100) > 50>>
	<<set $generalAssetPrice -= 1>>
	<<elseif random(1,100) > 50>>
	<<set $generalAssetPrice += 1>>
	<</if>>
<<elseif $generalAssetPrice < 4>>
	<<set $generalAssetPrice = 5>>
<<elseif $generalAssetPrice < 10>>
	<<if random(1,100) > 50>>
	<<set $generalAssetPrice += 1>>
	<<elseif random(1,100) > 50>>
	<<set $generalAssetPrice -= 1>>
	<</if>>
<<else>>
	<<if random(1,100) > 50>>
	<<set $generalAssetPrice += 1>>
	<<else>>
	<<set $generalAssetPrice -= 1>>
	<</if>>
<</if>>

<<if $detailedCorpControls != 1>>
	@@.yellowgreen;<<print cashFormat(Math.ceil($generalAssetPrice*$generalAssets))>>@@ in general assets.
	General asset prices are
	<<if $generalAssetPrice > 12>>@@.yellowgreen;very high@@<<elseif $generalAssetPrice > 10>>@@.yellowgreen;high@@<<elseif $generalAssetPrice == 10>>average<<elseif $generalAssetPrice >= 8>>@@.gold;low@@<<else>>@@.gold;very low@@<</if>>.
	| <<link "Buy">>
		<<if $generalAssetPrice*500 < $corpCash>>
			<<set $generalAssets += 500>>
			<<set $corpCash -= 500*$generalAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#genAssets">>
				<<print cashFormat($generalAssetPrice*$generalAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
		<<replace "#update">>
			There are insufficient funds for additional purchases.
		<</replace>>
		<</if>>
	<</link>>
	| <<link "Invest Half">>
		 <<if $generalAssetPrice*1000 < $corpCash>>
			<<set $generalAssets += (Math.trunc($corpCash/($generalAssetPrice*1000)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($generalAssetPrice*1000)))*($generalAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#genAssets">>
				<<print cashFormat($generalAssetPrice*$generalAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
		<<replace "#update">>
			There are insufficient funds for additional purchases.
		<</replace>>
		<</if>>
	<</link>>
	| <<link "Massive investment">>
		 <<if $generalAssetPrice*1000 < $corpCash>>
			<<set $generalAssets += (Math.trunc($corpCash/($generalAssetPrice*500)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($generalAssetPrice*500)))*($generalAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#genAssets">>
				<<print cashFormat($generalAssetPrice*$generalAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
		<<replace "#update">>
			There are insufficient funds for additional purchases.
		<</replace>>
		<</if>>
	<</link>>
	| <<link "Sell">>
		<<if $generalAssets >= 1000>>
			<<set $generalAssets -= 500>>
			<<set $corpCash += 500*$generalAssetPrice>>
			<<replace "#cashOnHand">>
				@@.yellowgreen;<<print cashFormat($corpCash)>>@@
			<</replace>>
			<<replace "#genAssets">>
				@@.yellowgreen;<<print cashFormat($generalAssetPrice*$generalAssets)>>@@
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You cannot sell any more assets.
			<</replace>>
		<</if>>
	<</link>>
	/* Divest Half command rounds down. This means that on odd numbers a fraction of the asset is lost.
	I can't be arsed to care. At this point that amount of money is insignificant.*/
	| <<link "Divest Half">>
		<<if $generalAssets >= 100000>>
			<<set $generalAssets = Math.trunc($generalAssets/2)>>
			<<set $corpCash += $generalAssets*$generalAssetPrice>>
			<<replace "#cashOnHand">>
				@@.yellowgreen;<<print cashFormat($corpCash)>>@@
			<</replace>>
			<<replace "#genAssets">>
				@@.yellowgreen;<<print cashFormat($generalAssetPrice*$generalAssets)>>@@
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You don't have enough assets to justify bulk divestment.
			<</replace>>
		<</if>>
	<</link>>
<<else>>
	<<print cashFormat($generalAssetPrice*$generalAssets)>> (<<print commaNum(Math.ceil($generalAssets/500))>> unit<<if Math.ceil($generalAssets/500) != 1>>s<</if>>) in general assets.
	Prices are
	<<if $generalAssetPrice > 10>>
		@@.yellowgreen;<<print cashFormat($generalAssetPrice*500)>>ea@@.
	<<elseif $generalAssetPrice < 10>>
		@@.gold;<<print cashFormat($generalAssetPrice*500)>>ea@@.
	<<else>>
		<<print cashFormat($generalAssetPrice*500)>>ea.
	<</if>>
	<<CorpDevBuySell "general" "Numgeneral">>
<</if>>

<<set $slaveAssetPrice = Math.trunc(10*$slaveCostFactor)>>

<<if $detailedCorpControls != 1>>
	<<print cashFormat(Math.ceil($slaveAssetPrice*$slaveAssets))>> in slaves.
	Slave prices are
	<<if $slaveAssetPrice > 12>>@@.yellowgreen;very high@@<<elseif $slaveAssetPrice > 10>>@@.yellowgreen;high@@<<elseif $slaveAssetPrice == 10>>average<<elseif $slaveAssetPrice >= 8>>@@.gold;low@@<<else>>@@.gold;very low@@<</if>>.
	| <<link "Buy">>
		 <<if $slaveAssetPrice*500 < $corpCash>>
			<<set $slaveAssets += 500>>
			<<set $corpCash -= 500*$slaveAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#slavAssets">>
				<<print cashFormat($slaveAssetPrice*$slaveAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
		<<replace "#update">>
			There are insufficient funds for additional purchases.
		<</replace>>
		<</if>>
	<</link>>
	| <<link "Invest Half">>
		<<if $slaveAssetPrice*1000 < $corpCash>>
			<<set $slaveAssets += (Math.trunc($corpCash/($slaveAssetPrice*1000)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($slaveAssetPrice*1000)))*($slaveAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#slavAssets">>
				<<print cashFormat($slaveAssetPrice*$slaveAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Massive investment">>
		<<if $slaveAssetPrice*1000 < $corpCash>>
			<<set $slaveAssets += (Math.trunc($corpCash/($slaveAssetPrice*500)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($slaveAssetPrice*500)))*($slaveAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#slavAssets">>
				<<print cashFormat($slaveAssetPrice*$slaveAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Sell">>
		<<if $slaveAssets >= 1000>>
			<<set $slaveAssets -= 500>>
			<<set $corpCash += 500*$slaveAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#slavAssets">>
				<<print cashFormat($slaveAssetPrice*$slaveAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You cannot sell any more assets.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Divest Half">>
		<<if $slaveAssets >= 100000>>
			<<set $slaveAssets = Math.trunc($slaveAssets/2)>>
			<<set $corpCash += $slaveAssets*$slaveAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#slavAssets">>
				<<print cashFormat($slaveAssetPrice*$slaveAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You don't have enough assets to justify bulk divestment.
			<</replace>>
		<</if>>
	<</link>>
<<else>>
	<<print cashFormat(Math.ceil($slaveAssetPrice*$slaveAssets))>> (<<print commaNum(Math.ceil($slaveAssets/500))>> unit<<if Math.ceil($slaveAssets/500) != 1>>s<</if>>) in slaves.
	Prices are
	<<if $slaveAssetPrice > 10>>
		@@.yellowgreen;<<print cashFormat($slaveAssetPrice*500)>>ea@@
	<<elseif $slaveAssetPrice < 10>>
		@@.gold;<<print cashFormat($slaveAssetPrice*500)>>ea@@
	<<else>>
		<<print cashFormat($slaveAssetPrice*500)>>ea
	<</if>>
	<<CorpDevBuySell "slave" "Numslave">>
<</if>>

<<if $entrapmentAssetPrice > 10>>
	<<if random(1,100) > 50>>
	<<set $entrapmentAssetPrice -= 1>>
	<<elseif random(1,100) > 50>>
	<<set $entrapmentAssetPrice += 1>>
	<</if>>
<<elseif $entrapmentAssetPrice < 4>>
	<<set $entrapmentAssetPrice = 5>>
<<elseif $entrapmentAssetPrice < 10>>
	<<if random(1,100) > 50>>
	<<set $entrapmentAssetPrice += 1>>
	<<elseif random(1,100) > 50>>
	<<set $entrapmentAssetPrice -= 1>>
	<</if>>
<<elseif $entrapmentAssetPrice == 10>>
	<<if random(1,100) > 50>>
	<<set $entrapmentAssetPrice += 1>>
	<<else>>
	<<set $entrapmentAssetPrice -= 1>>
	<</if>>
<<else>>
	<<set $entrapmentAssetPrice = 5>>
<</if>>

<<if $detailedCorpControls != 1>>
	<<print cashFormat(Math.ceil($entrapmentAssetPrice*$entrapmentAssets))>> in legal enslavement assets.
	Legal enslavement asset prices are
	<<if $entrapmentAssetPrice > 12>>@@.yellowgreen;very high@@<<elseif $entrapmentAssetPrice > 10>>@@.yellowgreen;high@@<<elseif $entrapmentAssetPrice == 10>>average<<elseif $entrapmentAssetPrice >= 8>>@@.gold;low@@<<else>>@@.gold;very low@@<</if>>.
	| <<link "Buy">>
		<<if $entrapmentAssetPrice*500 < $corpCash>>
			<<set $entrapmentAssets += 500>>
			<<set $corpCash -= 500*$entrapmentAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trapAssets">>
				<<print cashFormat($entrapmentAssetPrice*$entrapmentAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Invest Half">>
		<<if $entrapmentAssetPrice*1000 < $corpCash>>
			<<set $entrapmentAssets += (Math.trunc($corpCash/($entrapmentAssetPrice*1000)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($entrapmentAssetPrice*1000)))*($entrapmentAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trapAssets">>
				<<print cashFormat($entrapmentAssetPrice*$entrapmentAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Massive investment">>
		<<if $entrapmentAssetPrice*1000 < $corpCash>>
			<<set $entrapmentAssets += (Math.trunc($corpCash/($entrapmentAssetPrice*500)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($entrapmentAssetPrice*500)))*($entrapmentAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trapAssets">>
				<<print cashFormat($entrapmentAssetPrice*$entrapmentAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Sell">>
		<<if $entrapmentAssets >= 1000>>
			<<set $entrapmentAssets -= 500>>
			<<set $corpCash += 500*$entrapmentAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trapAssets">>
				<<print cashFormat($entrapmentAssetPrice*$entrapmentAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You cannot sell any more assets.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Divest Half">>
		<<if $entrapmentAssets >= 100000>>
			<<set $entrapmentAssets = Math.trunc($entrapmentAssets/2)>>
			<<set $corpCash += $entrapmentAssets*$entrapmentAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trapAssets">>
				<<print cashFormat($entrapmentAssetPrice*$entrapmentAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You don't have enough assets to justify bulk divestment.
			<</replace>>
		<</if>>
	<</link>>
<<else>>
	<<print cashFormat($entrapmentAssetPrice*$entrapmentAssets)>> (<<print commaNum(Math.floor($entrapmentAssets/500))>> unit<<if Math.floor($entrapmentAssets/500) != 1>>s<</if>>) in legal enslavement assets.
	Prices are
	<<if $entrapmentAssetPrice > 10>>
		@@.yellowgreen;<<print cashFormat($entrapmentAssetPrice*500)>>ea@@
	<<elseif $entrapmentAssetPrice < 10>>
		@@.gold;<<print cashFormat($entrapmentAssetPrice*500)>>ea@@
	<<else>>
		<<print cashFormat($entrapmentAssetPrice*500)>>ea
	<</if>>
	<<CorpDevBuySell "entrapment" "Numentrapment">>
<</if>>

<<if $captureAssetPrice > 10>>
	<<if random(1,100) > 50>>
	<<set $captureAssetPrice -= 1>>
	<<elseif random(1,100) > 50>>
	<<set $captureAssetPrice += 1>>
	<</if>>
<<elseif $captureAssetPrice < 4>>
	<<set $captureAssetPrice = 5>>
<<elseif $captureAssetPrice < 10>>
	<<if random(1,100) > 50>>
	<<set $captureAssetPrice += 1>>
	<<elseif random(1,100) > 50>>
	<<set $captureAssetPrice -= 1>>
	<</if>>
<<elseif $captureAssetPrice == 10>>
	<<if random(1,100) > 50>>
	<<set $captureAssetPrice += 1>>
	<<else>>
	<<set $captureAssetPrice -= 1>>
	<</if>>
<<else>>
	<<set $captureAssetPrice = 5>>
<</if>>

<<if $detailedCorpControls != 1>>
	<<print cashFormat(Math.ceil($captureAssetPrice*$captureAssets))>> in conflict zone enslavement assets.
	Extralegal enslavement asset prices are
	<<if $captureAssetPrice > 12>>@@.yellowgreen;very high@@<<elseif $captureAssetPrice > 10>>@@.yellowgreen;high@@<<elseif $captureAssetPrice == 10>>average<<elseif $captureAssetPrice >= 8>>@@.gold;low@@<<else>>@@.gold;very low@@<</if>>.
	| <<link "Buy">>
		<<if $captureAssetPrice*500 < $corpCash>>
			<<set $captureAssets += 500>>
			<<set $corpCash -= 500*$captureAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#capAssets">>
				<<print cashFormat($captureAssetPrice*$captureAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Invest Half">>
		<<if $captureAssetPrice*1000 < $corpCash>>
			<<set $captureAssets += (Math.trunc($corpCash/($captureAssetPrice*1000)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($captureAssetPrice*1000)))*($captureAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#capAssets">>
				<<print cashFormat($captureAssetPrice*$captureAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Massive investment">>
		<<if $captureAssetPrice*1000 < $corpCash>>
			<<set $captureAssets += (Math.trunc($corpCash/($captureAssetPrice*500)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($captureAssetPrice*500)))*($captureAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#capAssets">>
				<<print cashFormat($captureAssetPrice*$captureAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Sell">>
		<<if $captureAssets >= 1000>>
			<<set $captureAssets -= 500>>
			<<set $corpCash += 500*$captureAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#capAssets">>
				<<print cashFormat($captureAssetPrice*$captureAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You cannot sell any more assets.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Divest Half">>
		<<if $captureAssets >= 100000>>
			<<set $captureAssets = Math.trunc($captureAssets/2)>>
			<<set $corpCash += $captureAssets*$captureAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#capAssets">>
				<<print cashFormat($captureAssetPrice*$captureAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You don't have enough assets to justify bulk divestment.
			<</replace>>
		<</if>>
	<</link>>
<<else>>
	<<print cashFormat($captureAssetPrice*$captureAssets)>> (<<print commaNum(Math.floor($captureAssets/500))>> unit<<if Math.floor($captureAssets/500) != 1>>s<</if>>) in conflict zone enslavement assets.
	Prices are
	<<if $captureAssetPrice > 10>>
		@@.yellowgreen;<<print cashFormat($captureAssetPrice*500)>>ea@@
	<<elseif $captureAssetPrice < 10>>
		@@.gold;<<print cashFormat($captureAssetPrice*500)>>ea@@
	<<else>>
		<<print cashFormat($captureAssetPrice*500)>>ea
	<</if>>
	<<CorpDevBuySell "capture" "Numcapture">>
<</if>>

<<if $trainingAssetPrice > 10>>
	<<if random(1,100) > 50>>
	<<set $trainingAssetPrice -= 1>>
	<<elseif random(1,100) > 50>>
	<<set $trainingAssetPrice += 1>>
	<</if>>
<<elseif $trainingAssetPrice < 4>>
	<<set $trainingAssetPrice = 5>>
<<elseif $trainingAssetPrice < 10>>
	<<if random(1,100) > 50>>
	<<set $trainingAssetPrice += 1>>
	<<elseif random(1,100) > 50>>
	<<set $trainingAssetPrice -= 1>>
	<</if>>
<<elseif $trainingAssetPrice > 5>>
	<<if random(1,100) > 50>>
	<<set $trainingAssetPrice += 1>>
	<<else>>
	<<set $trainingAssetPrice -= 1>>
	<</if>>
<<else>>
	<<set $trainingAssetPrice = 5>>
<</if>>

<<if $detailedCorpControls != 1>>
	<<print cashFormat(Math.ceil($trainingAssetPrice*$trainingAssets))>> in slave training assets.
	Slave training asset prices are
	<<if $trainingAssetPrice > 12>>@@.yellowgreen;very high@@<<elseif $trainingAssetPrice > 10>>@@.yellowgreen;high@@<<elseif $trainingAssetPrice == 10>>average<<elseif $trainingAssetPrice >= 8>>@@.gold;low@@<<else>>@@.gold;very low@@<</if>>.
	| <<link "Buy">>
		<<if $trainingAssetPrice*500 < $corpCash>>
			<<set $trainingAssets += 500>>
			<<set $corpCash -= 500*$trainingAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trainAssets">>
				<<print cashFormat($trainingAssetPrice*$trainingAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Invest Half">>
		<<if $trainingAssetPrice*1000 < $corpCash>>
			<<set $trainingAssets += (Math.trunc($corpCash/($trainingAssetPrice*1000)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($trainingAssetPrice*1000)))*($trainingAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trainAssets">>
				<<print cashFormat($trainingAssetPrice*$trainingAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Massive investment">>
		<<if $trainingAssetPrice*1000 < $corpCash>>
			<<set $trainingAssets += (Math.trunc($corpCash/($trainingAssetPrice*500)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($trainingAssetPrice*500)))*($trainingAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trainAssets">>
				<<print cashFormat($trainingAssetPrice*$trainingAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Sell">>
		<<if $trainingAssets >= 1000>>
			<<set $trainingAssets -= 500>>
			<<set $corpCash += 500*$trainingAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trainAssets">>
				<<print cashFormat($trainingAssetPrice*$trainingAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You cannot sell any more assets.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Divest Half">>
		<<if $trainingAssets >= 100000>>
			<<set $trainingAssets = Math.trunc($trainingAssets/2)>>
			<<set $corpCash += $trainingAssets*$trainingAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#trainAssets">>
				<<print cashFormat($trainingAssetPrice*$trainingAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You don't have enough assets to justify bulk divestment.
			<</replace>>
		<</if>>
	<</link>>
<<else>>
	<<print cashFormat($trainingAssetPrice*$trainingAssets)>> (<<print commaNum(Math.floor($trainingAssets/500))>> unit<<if Math.floor($trainingAssets/500) != 1>>s<</if>>) of slave training assets.
	Prices are
	<<if $trainingAssetPrice > 10>>
		@@.yellowgreen;<<print cashFormat($trainingAssetPrice*500)>>ea@@
	<<elseif $trainingAssetPrice < 10>>
		@@.gold;<<print cashFormat($trainingAssetPrice*500)>>ea@@
	<<else>>
		<<print cashFormat($trainingAssetPrice*500)>>ea
	<</if>>
	<<CorpDevBuySell "training" "Numtraining">>
<</if>>

<<if $surgicalAssetPrice > 10>>
	<<if random(1,100) > 50>>
	<<set $surgicalAssetPrice -= 1>>
	<<elseif random(1,100) > 50>>
	<<set $surgicalAssetPrice += 1>>
	<</if>>
<<elseif $surgicalAssetPrice < 4>>
	<<set $surgicalAssetPrice = 5>>
<<elseif $surgicalAssetPrice < 10>>
	<<if random(1,100) > 50>>
	<<set $surgicalAssetPrice += 1>>
	<<elseif random(1,100) > 50>>
	<<set $surgicalAssetPrice -= 1>>
	<</if>>
<<elseif $surgicalAssetPrice == 10>>
	<<if random(1,100) > 50>>
	<<set $surgicalAssetPrice += 1>>
	<<else>>
	<<set $surgicalAssetPrice -= 1>>
	<</if>>
<<else>>
	<<set $surgicalAssetPrice = 5>>
<</if>>

<<if $detailedCorpControls != 1>>
	<<print cashFormat(Math.ceil($surgicalAssetPrice*$surgicalAssets))>> in surgical assets.
	Surgical asset prices are
	<<if $surgicalAssetPrice > 12>>@@.yellowgreen;very high@@<<elseif $surgicalAssetPrice > 10>>@@.yellowgreen;high@@<<elseif $surgicalAssetPrice == 10>>average<<elseif $surgicalAssetPrice >= 8>>@@.gold;low@@<<else>>@@.gold;very low@@<</if>>.
	| <<link "Buy">>
		<<if $surgicalAssetPrice*500 < $corpCash>>
			<<set $surgicalAssets += 500>>
			<<set $corpCash -= 500*$surgicalAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#surgAssets">>
				<<print cashFormat($surgicalAssetPrice*$surgicalAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Invest Half">>
		<<if $surgicalAssetPrice*1000 < $corpCash>>
			<<set $surgicalAssets += (Math.trunc($corpCash/($surgicalAssetPrice*1000)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($surgicalAssetPrice*1000)))*($surgicalAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#surgAssets">>
				<<print cashFormat($surgicalAssetPrice*$surgicalAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Massive investment">>
		<<if $surgicalAssetPrice*1000 < $corpCash>>
			<<set $surgicalAssets += (Math.trunc($corpCash/($surgicalAssetPrice*500)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($surgicalAssetPrice*500)))*($surgicalAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#surgAssets">>
				<<print cashFormat($surgicalAssetPrice*$surgicalAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Sell">>
		<<if $surgicalAssets >= 1000>>
			<<set $surgicalAssets -= 500>>
			<<set $corpCash += 500*$surgicalAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#surgAssets">>
				<<print cashFormat($surgicalAssetPrice*$surgicalAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You cannot sell any more assets.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Divest Half">>
		<<if $surgicalAssets >= 100000>>
			<<set $surgicalAssets = Math.trunc($surgicalAssets/2)>>
			<<set $corpCash += $surgicalAssets*$surgicalAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#surgAssets">>
				<<print cashFormat($surgicalAssetPrice*$surgicalAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You don't have enough assets to justify bulk divestment.
			<</replace>>
		<</if>>
	<</link>>
<<else>>
	<<print cashFormat($surgicalAssetPrice*$surgicalAssets)>> (<<print commaNum(Math.floor($surgicalAssets/500))>> unit<<if Math.floor($surgicalAssets/500) != 1>>s<</if>>) in surgical assets.
	Prices are
	<<if $surgicalAssetPrice > 10>>
		@@.yellowgreen;<<print cashFormat($surgicalAssetPrice*500)>>ea@@
	<<elseif $surgicalAssetPrice < 10>>
		@@.gold;<<print cashFormat($surgicalAssetPrice*500)>>ea@@
	<<else>>
		<<print cashFormat($surgicalAssetPrice*500)>>ea
	<</if>>
	<<CorpDevBuySell "surgical" "Numsurgical">>
<</if>>

<<if $drugAssetPrice > 10>>
	<<if random(1,100) > 50>>
	<<set $drugAssetPrice -= 1>>
	<<elseif random(1,100) > 50>>
	<<set $drugAssetPrice += 1>>
	<</if>>
<<elseif $drugAssetPrice < 4>>
	<<set $drugAssetPrice = 5>>
<<elseif $drugAssetPrice < 10>>
	<<if random(1,100) > 50>>
	<<set $drugAssetPrice += 1>>
	<<elseif random(1,100) > 50>>
	<<set $drugAssetPrice -= 1>>
	<</if>>
<<elseif $drugAssetPrice == 10>>
	<<if random(1,100) > 50>>
	<<set $drugAssetPrice += 1>>
	<<else>>
	<<set $drugAssetPrice -= 1>>
	<</if>>
<<else>>
	<<set $drugAssetPrice = 5>>
<</if>>

<<if $detailedCorpControls != 1>>
	<<print cashFormat(Math.ceil($drugAssetPrice*$drugAssets))>> in pharmaceutical assets.
	Drug asset prices are
	<<if $drugAssetPrice > 12>>@@.yellowgreen;very high@@<<elseif $drugAssetPrice > 10>>@@.yellowgreen;high@@<<elseif $drugAssetPrice == 10>>average<<elseif $drugAssetPrice >= 8>>@@.gold;low@@<<else>>@@.gold;very low@@<</if>>.
	| <<link "Buy">>
		<<if $drugAssetPrice*500 < $corpCash>>
			<<set $drugAssets += 500>>
			<<set $corpCash -= 500*$drugAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#drAssets">>
				<<print cashFormat($drugAssetPrice*$drugAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Invest Half">>
		<<if $drugAssetPrice*1000 < $corpCash>>
			<<set $drugAssets += (Math.trunc($corpCash/($drugAssetPrice*1000)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($drugAssetPrice*1000)))*($drugAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#drAssets">>
				<<print cashFormat($drugAssetPrice*$drugAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Massive investment">>
		<<if $drugAssetPrice*1000 < $corpCash>>
			<<set $drugAssets += (Math.trunc($corpCash/($drugAssetPrice*500)))*500>>
			<<set $corpCash -= (Math.trunc($corpCash/($drugAssetPrice*500)))*($drugAssetPrice*500)>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#drAssets">>
				<<print cashFormat($drugAssetPrice*$drugAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				There are insufficient funds for additional purchases.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Sell">>
		<<if $drugAssets >= 1000>>
			<<set $drugAssets -= 500>>
			<<set $corpCash += 500*$drugAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#drAssets">>
				<<print cashFormat($drugAssetPrice*$drugAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You cannot sell any more assets.
			<</replace>>
		<</if>>
	<</link>>
	| <<link "Divest Half">>
		<<if $drugAssets >= 100000>>
			<<set $drugAssets = Math.trunc($drugAssets/2)>>
			<<set $corpCash += $drugAssets*$drugAssetPrice>>
			<<replace "#cashOnHand">>
				<<print cashFormat($corpCash)>>
			<</replace>>
			<<replace "#drAssets">>
				<<print cashFormat($drugAssetPrice*$drugAssets)>>
			<</replace>>
			<<replace "#update">>
			<</replace>>
		<<else>>
			<<replace "#update">>
				You don't have enough assets to justify bulk divestment.
			<</replace>>
		<</if>>
	<</link>>
<<else>>
	<<print cashFormat($drugAssetPrice*$drugAssets)>> (<<print commaNum(Math.floor($drugAssets/500))>> unit<<if Math.floor($drugAssets/500) != 1>>s<</if>>) in pharmaceutical assets.
	Prices are
	<<if $drugAssetPrice > 10>>
		@@.yellowgreen;<<print cashFormat($drugAssetPrice*500)>>ea@@
	<<elseif $drugAssetPrice < 10>>
		@@.gold;<<print cashFormat($drugAssetPrice*500)>>ea@@
	<<else>>
		<<print cashFormat($drugAssetPrice*500)>>ea
	<</if>>
	<<CorpDevBuySell "drug" "Numdrug">>
<</if>>

<<if $generalAssets >= 2000>>
	<<if $generalUpgradeBreaking == "unselected">>

The corporation has enough general expertise to specialize. Focus on breaking slaves with
		<<link "Brutality">><<set $generalUpgradeBreaking = "brutality">><<replace "#direction">>
<<print "You directed the corporation to train slaves with brutal force.">><</replace>><</link>>
		| <<link "Care">><<set $generalUpgradeBreaking = "care">><<replace "#direction">>
<<print "You directed the corporation to train slaves with loving care.">><</replace>><</link>>
		| <<link "No focus">><<set $generalUpgradeBreaking = "none">><<replace "#direction">>
<<print "You directed the corporation to focus on whatever training methods work best.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $generalUpgradeBreaking != "unselected">>

	<<if $generalUpgradeBreaking == "brutality">>The corporation does not hesitate from using brutality to break slaves.
		<<elseif $generalUpgradeBreaking == "care">>The corporation uses care in training their slaves.
		<<else>>The corporation uses both care and brutality when training their slaves.
	<</if>>
	<<link "Refocus">><<set $generalUpgradeBreaking = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $generalAssets >= 5000>>
	<<if $generalUpgradeWeight == "unselected">>

The corporation has enough general expertise to specialize. Manage slaves' diets to an
		<<link "Attractive weight">><<set $generalUpgradeWeight = "attractive">><<replace "#direction">>
<<print "You directed the corporation to slim fat slaves and feed thin ones.">><</replace>><</link>>
		| <<link "No dieting">><<set $generalUpgradeWeight = "none">><<replace "#direction">>
<<print "You directed the corporation not to focus on slaves' weight.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $generalUpgradeWeight != "unselected">>

	<<if $generalUpgradeWeight == "attractive">>The corporation manages the slaves' diets to ensure they aren't too thin or too fat.
		<<else>>The corporation does not try to change the slaves' weights.
	<</if>>
	<<link "Refocus">><<set $generalUpgradeWeight = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $generalAssets >= 10000>>
	<<if $generalUpgradeMuscle == "unselected">>

The corporation has enough general expertise to specialize. Train slaves until their muscles are
		<<link "Toned">><<set $generalUpgradeMuscle = "toned">><<replace "#direction">>
<<print "You directed the corporation to train slaves until they're toned.">><</replace>><</link>>
		| <<link "Ripped">><<set $generalUpgradeMuscle = "ripped">><<replace "#direction">>
<<print "You directed the corporation to train slaves until they're ripped.">><</replace>><</link>>
		| <<link "No training">><<set $generalUpgradeMuscle = "none">><<replace "#direction">>
<<print "You directed the corporation not to focus on slaves' fitness.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $generalUpgradeMuscle != "unselected">>

	<<if $generalUpgradeMuscle == "toned">>The corporation's slaves are made to exercise until they are toned.
		<<elseif $generalUpgradeMuscle == "ripped">>The corporation's slaves are made to exercise until they are ripped.
		<<else>>The corporation does not try to manage their slaves' fitness.
	<</if>>
	<<link "Refocus">><<set $generalUpgradeMuscle = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $entrapmentAssets >= 2000>>
	<<if $entrapmentUpgradeDevotionOne == "unselected">>

The corporation is entrapping enough slaves to specialize. Focus on slaves with
		<<link "Obedience">><<set $entrapmentUpgradeDevotionOne = "obedience">><<replace "#direction">>
<<print "You directed the corporation to retain obedient slaves.">><</replace>><</link>>
		| <<link "No focus">><<set $entrapmentUpgradeDevotionOne = "none">><<replace "#direction">>
<<print "You directed the corporation to train slaves regardless of obedience.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $entrapmentAssets >= 5000>>
	<<if $entrapmentUpgradeDevotionTwo == "unselected">>

The corporation is entrapping enough slaves to specialize. Focus on slaves with
		<<link "Devotion">><<set $entrapmentUpgradeDevotionTwo = "devotion">><<replace "#direction">>
<<print "You directed the corporation to retain devoted slaves.">><</replace>><</link>>
		| <<link "No focus">><<set $entrapmentUpgradeDevotionTwo = "none">><<replace "#direction">>
<<print "You directed the corporation to train slaves regardless of devotion.">><</replace>><</link>>
	<</if>>
<</if>>

	<<if $entrapmentUpgradeDevotionOne == "obedience">>The corporation selects slaves who are predisposed to obedience.
		<<else>>The corporation trains slaves regardless of obedience.<</if>>
	<<link "Refocus">><<set $entrapmentUpgradeDevotionOne = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>

	<<if $entrapmentUpgradeDevotionTwo == "devotion">>The corporation selects slaves who are predisposed to devotion.
		<<else>>The corporation trains slaves regardless of devotion.<</if>>
	<<link "Refocus">><<set $entrapmentUpgradeDevotionTwo = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<<if $entrapmentAssets >= 10000>>
	<<if $entrapmentUpgradeIntelligence == "unselected">>

The corporation is entrapping enough slaves to specialize. Focus on slaves who are
		<<link "Intelligent">><<set $entrapmentUpgradeIntelligence = "intelligent">><<replace "#direction">>
<<print "You directed the corporation to retain intelligent slaves.">><</replace>><</link>>
		| <<link "Stupid">><<set $entrapmentUpgradeIntelligence = "stupid">><<replace "#direction">>
<<print "You directed the corporation to retain stupid slaves.">><</replace>><</link>>
		| <<link "No focus">><<set $entrapmentUpgradeIntelligence = "none">><<replace "#direction">>
<<print "You directed the corporation to train slaves regardless of intelligence.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $entrapmentUpgradeIntelligence != "unselected">>

	<<if $entrapmentUpgradeIntelligence == "intelligent">>The corporation only retains smart slaves.
		<<elseif $entrapmentUpgradeIntelligence == "stupid">>The corporation only retains stupid slaves.
		<<else>>The corporation does not care how smart/stupid a slave is.
	<</if>>
	<<link "Refocus">><<set $entrapmentUpgradeIntelligence = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $captureAssets >= 2000>>
	<<if $seeDicks != 0>>
	<<if $captureUpgradeGender == "unselected">>

The corporation captures enough slaves to specialize. Focus on training slaves with
		<<link "Pussies">><<set $captureUpgradeGender = "XX">><<replace "#direction">>
<<print "You directed the corporation to retain slaves with pussies for training.">><</replace>><</link>>
		| <<link "Dicks">><<set $captureUpgradeGender = "XY">><<replace "#direction">>
<<print "You directed the corporation to retain slaves with dicks for training.">><</replace>><</link>>
		| <<link "No focus">><<set $captureUpgradeGender = "none">><<replace "#direction">>
<<print "You directed the corporation to retain any promising slave for training.">><</replace>><</link>>
	<</if>>
	<</if>>
<</if>>
<<if $captureUpgradeGender != "unselected">>

	<<if $captureUpgradeGender == "XX">>The corporation only retains slaves with pussies.
		<<elseif $captureUpgradeGender == "XY">>The corporation only retains slaves with dicks.
		<<else>>The corporation retains any promising slave regardless of whether she has a dick or a pussy.
	<</if>>
	<<link "Refocus">><<set $captureUpgradeGender = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $captureAssets >= 5000>>
	<<if $captureUpgradeAge == "unselected">>

The corporation captures enough slaves to specialize. Focus on training slaves who are
		<<link "Younger">><<set $captureUpgradeAge = "young">><<replace "#direction">>
<<print "You directed the corporation to retain younger slaves for training.">><</replace>><</link>>
		| <<link "Older">><<set $captureUpgradeAge = "old">><<replace "#direction">>
<<print "You directed the corporation to retain older slaves for training.">><</replace>><</link>>
		| <<link "No focus">><<set $captureUpgradeAge = "none">><<replace "#direction">>
<<print "You directed the corporation to retain any promising slave for training.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $captureUpgradeAge != "unselected">>

	<<if $captureUpgradeAge == "young">>The corporation is focusing on capturing younger slaves.
		<<elseif $captureUpgradeAge == "old">>The corporation is focusing on capturing older slaves.
		<<else>>The corporation is not focusing on capturing slaves of any particular age.
	<</if>>
	<<link "Refocus">><<set $captureUpgradeAge = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $captureAssets >= 10000>>
	<<if $captureUpgradeRace == "unselected">>

The corporation captures enough slaves to specialize. Focus on training slaves who are
		<<link "White">><<set $captureUpgradeRace = "white">><<replace "#direction">>
<<print "You directed the corporation to retain white slaves for training.">><</replace>><</link>>
		| <<link "Asian">><<set $captureUpgradeRace = "asian">><<replace "#direction">>
<<print "You directed the corporation to retain asian slaves for training.">><</replace>><</link>>
		| <<link "Indo-aryan">><<set $captureUpgradeRace = "indo-aryan">><<replace "#direction">>
<<print "You directed the corporation to retain indo-aryan slaves for training.">><</replace>><</link>>
		| <<link "Latina">><<set $captureUpgradeRace = "latina">><<replace "#direction">>
<<print "You directed the corporation to retain latina slaves for training.">><</replace>><</link>>
		| <<link "middle eastern">><<set $captureUpgradeRace = "middle eastern">><<replace "#direction">>
<<print "You directed the corporation to retain Middle Eastern slaves for training.">><</replace>><</link>>
		| <<link "Black">><<set $captureUpgradeRace = "black">><<replace "#direction">>
<<print "You directed the corporation to retain black slaves for training.">><</replace>><</link>>
		| <<link "Pacific Islander">><<set $captureUpgradeRace = "pacific islander">><<replace "#direction">>
<<print "You directed the corporation to retain pacific islander slaves for training.">><</replace>><</link>>
		| <<link "Malay">><<set $captureUpgradeRace = "malay">><<replace "#direction">>
<<print "You directed the corporation to retain malay slaves for training.">><</replace>><</link>>
		| <<link "Amerindian">><<set $captureUpgradeRace = "amerindian">><<replace "#direction">>
<<print "You directed the corporation to retain amerindian slaves for training.">><</replace>><</link>>
		| <<link "Semitic">><<set $captureUpgradeRace = "semitic">><<replace "#direction">>
<<print "You directed the corporation to retain semitic slaves for training.">><</replace>><</link>>
		| <<link "Southern European">><<set $captureUpgradeRace = "southern european">><<replace "#direction">>
<<print "You directed the corporation to retain southern european slaves for training.">><</replace>><</link>>
		| <<link "Mixed Race">><<set $captureUpgradeRace = "mixed race">><<replace "#direction">>
<<print "You directed the corporation to retain mixed race slaves for training.">><</replace>><</link>>
		| <<link "No focus">><<set $captureUpgradeRace = "none">><<replace "#direction">>
<<print "You directed the corporation to retain any promising slave for training.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $captureUpgradeRace != "unselected">>

	<<if $captureUpgradeRace == "none">>The corporation retains any promising slave regardless of race.
		<<else>>The corporation retains only $captureUpgradeRace slaves.
	<</if>>
	<<link "Refocus">><<set $captureUpgradeRace = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $trainingAssets >= 2000>>
	<<if $trainingUpgradeAccent == "unselected">>

The corporation has enough training expertise to specialize. Focus on linguistic training to
		<<link "Teach language">><<set $trainingUpgradeAccent = "accents">><<replace "#direction">>
<<print "You directed the corporation to teach slaves the lingua franca.">><</replace>><</link>>
		| <<link "Eliminate accents">><<set $trainingUpgradeAccent = "eliminate">><<replace "#direction">>
<<print "You directed the corporation to teach slaves perfect, unaccented language.">><</replace>><</link>>
		| <<link "No training">><<set $trainingUpgradeAccent = "none">><<replace "#direction">>
<<print "You directed the corporation not to focus on linguistic training.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $trainingUpgradeAccent != "unselected">>

	<<if $trainingUpgradeAccent == "accents">>Slaves are taught the lingua franca but are allowed to retain their accents.
		<<elseif $trainingUpgradeAccent == "eliminate">>Slaves are taught the lingua franca until they can speak it without accent.
		<<else>>The corporation does not expend any special effort teaching language.
	<</if>>
	<<link "Refocus">><<set $trainingUpgradeAccent = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $trainingAssets >= 5000>>
	<<if $trainingUpgradeEducation == "unselected">>

The corporation has enough training expertise to specialize. Train slaves with
		<<link "Basic educations">><<set $trainingUpgradeEducation = "basic">><<replace "#direction">>
<<print "You directed the corporation to focus on ensuring slaves are properly educated.">><</replace>><</link>>
		| <<link "No training">><<set $trainingUpgradeEducation = "none">><<replace "#direction">>
<<print "You directed the corporation to focus on getting slaves broken, not educated.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $trainingUpgradeEducation != "unselected">>

	<<if $trainingUpgradeEducation == "basic">>Slaves are given basic slave education.
		<<else>>The corporation does not waste money with slave education.
	<</if>>
	<<link "Refocus">><<set $trainingUpgradeEducation = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $trainingAssets >= 10000>>
	<<if $trainingUpgradeSexEd == "unselected">>

The corporation has enough training expertise to specialize. Train slaves' sexual knowledge to
		<<link "Competence">><<set $trainingUpgradeSexEd = "competence">><<replace "#direction">>
<<print "You directed the corporation to ensure slaves know basic sexual skills.">><</replace>><</link>>
		| <<link "Highly Skilled">><<set $trainingUpgradeSexEd = "highly skilled">><<replace "#direction">>
<<print "You directed the corporation to ensure slaves are sexually proficient.">><</replace>><</link>>
		| <<link "No training">><<set $trainingUpgradeSexEd = "none">><<replace "#direction">>
<<print "You directed the corporation to focus on getting slaves trained rather than skilled.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $trainingUpgradeSexEd != "unselected">>

	<<if $trainingUpgradeSexEd == "competence">>Slaves are taught basic sexual skills.
		<<elseif $trainingUpgradeSexEd == "highly skilled">>The corporation makes sure the slaves are sexually skilled.
		<<else>>The corporation does not spend any effort in teaching the slaves sexual skills.
	<</if>>
	<<link "Refocus">><<set $trainingUpgradeSexEd = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $surgicalAssets >= 2000>>
	<<if $surgicalUpgradeCosmetics == "unselected">>

The corporation has enough surgical expertise to specialize. Straightforward cosmetic procedures should be
		<<link "Applied">><<set $surgicalUpgradeCosmetics = "applied">><<replace "#direction">>
<<print "You directed the corporation to give slaves straightforward cosmetic surgeries.">><</replace>><</link>>
		| <<link "Not applied">><<set $surgicalUpgradeCosmetics = "none">><<replace "#direction">>
<<print "You directed the corporation to leave slaves surgically unaltered.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $surgicalUpgradeCosmetics != "unselected">>

	<<if $surgicalUpgradeCosmetics == "applied">>Slaves are given straightforward cosmetic surgeries before being marketed.
		<<else>>The corporation does not bother with straightforward cosmetic surgery for slaves.
	<</if>>
	<<link "Refocus">><<set $surgicalUpgradeCosmetics = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $surgicalAssets >= 5000>>
	<<if $surgicalUpgradeImplants == "unselected">>

The corporation has enough surgical expertise to specialize. Implants should be
		<<link "Applied">><<set $surgicalUpgradeImplants = "applied">><<replace "#direction">>
<<print "You directed the corporation to give slaves basic implants.">><</replace>><</link>>
		| <<link "Absurd">><<set $surgicalUpgradeImplants = "absurd">><<replace "#direction">>
<<print "You directed the corporation to give slaves absurd implants.">><</replace>><</link>>
		| <<link "Not applied">><<set $surgicalUpgradeImplants = "none">><<replace "#direction">>
<<print "You directed the corporation to leave slaves without implants.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $surgicalUpgradeImplants != "unselected">>

	<<if $surgicalUpgradeImplants == "applied">>Slaves are given basic implants before being marketed.
		<<elseif $surgicalUpgradeImplants == "applied">>Slaves are given absurd-sized implants before being marketed.
		<<else>>The corporation does not bother with installing implants in slaves.
	<</if>>
	<<link "Refocus">><<set $surgicalUpgradeImplants = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $surgicalAssets >= 10000>>
	<<if $seeDicks != 0>>
	<<if $surgicalUpgradeGenitalia == "unselected">>

The corporation has enough surgical expertise to specialize. Slaves' genitals should be reconfigured to
		<<link "Futanari">><<set $surgicalUpgradeGenitalia = "futanari">><<replace "#direction">>
<<print "You directed the corporation to create futanari.">><</replace>><</link>>
		<<if $seeExtreme != 0>>
			| <<link "Remove balls">><<set $surgicalUpgradeGenitalia = "gelded">><<replace "#direction">>
<<print "You directed the corporation to remove slaves' balls.">><</replace>><</link>>
			| <<link "Mindbreak and remove limbs">><<set $surgicalUpgradeGenitalia = "fucknugget", $generalUpgradeBreaking = "none", $entrapmentUpgradeDevotionOne = "none", $entrapmentUpgradeDevotionTwo = "none", $trainingUpgradeAccent = "none", $trainingUpgradeEducation = "none", $trainingUpgradeSexEd = "none">><<replace "#direction">>
<<print "You directed the corporation to produce limbless, mindless slaves.">><</replace>><</link>>
		<</if>>
		| <<link "None">><<set $surgicalUpgradeGenitalia = "none">><<replace "#direction">>
<<print "You directed the corporation to leave slaves without major genital reconfiguration.">><</replace>><</link>>
	<</if>>
	<</if>>
<</if>>
<<if $surgicalUpgradeGenitalia != "unselected">>

	<<if $surgicalUpgradeGenitalia == "futanari">>Slaves are turned into futanari prior to market.
		<<elseif $surgicalUpgradeGenitalia == "gelded">>Slaves are gelded prior to market.
		<<elseif $surgicalUpgradeGenitalia == "fucknugget">>The corporation sells only mindbroken fuckdolls.
		<<else>>The corporation leaves the slaves' genitals alone.
	<</if>>
	<<link "Refocus">><<set $surgicalUpgradeGenitalia = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $drugAssets >= 2000>>
	<<if $drugUpgradeHormones == "unselected">>

The corporation has surplus pharmaceutical fabrication to specialize. Hormones should be applied to
		<<link "Feminize">><<set $drugUpgradeHormones = "XX">><<replace "#direction">>
<<print "You directed the corporation to treat slaves with female hormones.">><</replace>><</link>>
		| <<link "Masculinize">><<set $drugUpgradeHormones = "XY">><<replace "#direction">>
<<print "You directed the corporation to treat slaves with male hormones.">><</replace>><</link>>
		| <<link "Not applied">><<set $drugUpgradeHormones = "none">><<replace "#direction">>
<<print "You directed the corporation not to apply hormones.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $drugUpgradeHormones != "unselected">>

	<<if $drugUpgradeHormones == "XX">>Slaves are given female hormones.
		<<elseif $drugUpgradeHormones == "XY">>Slaves are given male hormones.
		<<else>>The corporation does not apply any hormones to the slaves.
	<</if>>
	<<link "Refocus">><<set $drugUpgradeHormones = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $drugAssets >= 5000>>
	<<if $drugUpgradeInjectionOne == "unselected">>

The corporation has surplus pharmaceutical fabrication to specialize. Growth injections should be applied until T&A are grown to a
		<<link "Tasteful size">><<set $drugUpgradeInjectionOne = "tasteful">><<replace "#direction">>
<<print "You directed the corporation to grow slaves' assets to a moderate size.">><</replace>><</link>>
		| <<link "Huge size">><<set $drugUpgradeInjectionOne = "huge">><<replace "#direction">>
<<print "You directed the corporation to grow slaves' assets to a huge size.">><</replace>><</link>>
		| <<link "Not applied">><<set $drugUpgradeInjectionOne = "none">><<replace "#direction">>
<<print "You directed the corporation not to apply growth injections.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $drugUpgradeInjectionOne != "unselected">>

	<<if $drugUpgradeInjectionOne == "tasteful">>Growth injections are applied until slaves' assets are moderate-sized..
		<<elseif $drugUpgradeInjectionOne == "huge">>Growth injections are applied until slaves' assets are huge.
		<<else>>The corporation does not give the slaves any growth injections.
	<</if>>
	<<link "Refocus">><<set $drugUpgradeInjectionOne = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>
<<if $drugAssets >= 10000>>
	<<if $drugUpgradeInjectionTwo == "unselected">>

The corporation has surplus pharmaceutical fabrication to specialize. Advanced growth injections should be
		<<link "Supermassive">><<set $drugUpgradeInjectionTwo = "supermassive">><<replace "#direction">>
<<print "You directed the corporation to apply supermassive growth injections.">><</replace>><</link>>
		| <<link "Pastoral">><<set $drugUpgradeInjectionTwo = "pastoral">><<replace "#direction">>
<<print "You directed the corporation to apply growth injections focused on milk<<if $seeDicks > 0>> and cum<</if>> production.">><</replace>><</link>>
		| <<link "Not applied">><<set $drugUpgradeInjectionTwo = "none">><<replace "#direction">>
<<print "You directed the corporation not to apply advanced growth injections.">><</replace>><</link>>
	<</if>>
<</if>>
<<if $drugUpgradeInjectionTwo != "unselected">>

	<<if $drugUpgradeInjectionTwo == "supermassive">>The corporation uses advanced growth injections to make the slaves' assets supermassive.
		<<elseif $drugUpgradeInjectionTwo == "pastoral">>The corporation uses advanced growth injections to make the slaves' assets very productive.
		<<else>>The corporation does not give the slaves advanced growth injections.
	<</if>>
	<<link "Refocus">><<set $drugUpgradeInjectionTwo = "unselected">><<replace "#direction">>
<<print "You direct the corporation to halt the current focus and prepare for a change in direction.">><</replace>><</link>>
<</if>>


code:
:: Costs [nobr]

<<set $costs = ($brothel*$facilityCost)+($arcade*$facilityCost*0.5)+($club*$facilityCost)+($dairy*$facilityCost)+($incubator*$facilityCost*10)>>

<<set $costs += (0.1*$brothelUpgradeDrugs*$brothel*$facilityCost)+(0.2*$arcadeUpgradeInjectors*$arcade*$facilityCost)+(0.2*$arcadeUpgradeCollectors*$arcade*$facilityCost)+(0.2*$clubUpgradePDAs*$club*$facilityCost)+(0.2*$dairyFeedersUpgrade*$dairy*$facilityCost)+(0.1*$dairyPregUpgrade*$dairy*$facilityCost)+(0.2*$dairyStimulatorsUpgrade*$facilityCost)+(0.2*$servantsQuartersUpgradeMonitoring*$servantsQuarters*$facilityCost)+(0.2*$incubatorUpgradeWeight*$incubator*$facilityCost)+(0.2*$incubatorUpgradeMuscles*$incubator*$facilityCost)+(0.2*$incubatorUpgradeReproduction*$incubator*$facilityCost)+(0.2*$incubatorUpgradeGrowthStims*$incubator*$facilityCost)+(0.5*$incubatorUpgradeSpeed*$incubator*$facilityCost)>>

<<if $dairy > 0>>
	<<set $costs += ($bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren)*100>>
<</if>>

<<if $brothel > 0>>
	<<set $costs += $brothelAdsSpending>>
<</if>>
<<if $club > 0>>
	<<set $costs += $clubAdsSpending>>
<</if>>

<<if $incubator > 0>>
	<<set $costs += ($incubatorWeightSetting+$incubatorMusclesSetting+$incubatorReproductionSetting+$incubatorGrowthStimsSetting)*500>>
<</if>>

<<if ($masterSuitePregnancySlaveLuxuries == 1)>>
	<<set $costs += 500>>
<</if>>
<<if ($masterSuitePregnancyFertilitySupplements == 1)>>
	<<set $costs += 1000>>
<</if>>

<<set $costs += ($girls*(250+($economy*500)))>>

<<if $arcologies[0].FSRepopulationFocusLaw == 1 && $PC.pregKnown == 1>>
	<<set $costs -= 500>>
<</if>>

/* security expansion */
<<if $secExp == 1>>
	<<set $costs += ($edictsUpkeep + $SFSupportUpkeep)>>

	<<if $propHub != 0>>
		<<set $costs += $propHubUpkeep>>
	<</if>>
	<<if $secHQ != 0>>
		<<set $costs += ($secHQUpkeep)+(20*$secHelots)>>
	<</if>>
	<<if $secBarracks != 0>>
		<<set $costs += $secBarracksUpkeep>>
	<</if>>
	<<if $riotCenter != 0>>
		<<set $costs += $riotUpkeep>>
	<</if>>

	<<if $soldierWages == 0>>
		<<set _soldierMod = 1>>
	<<elseif $soldierWages == 1>>
		<<set _soldierMod = 1.5>>
	<<else>>
		<<set _soldierMod = 2>>
	<</if>>

	<<set _mL = $militiaUnits.length>>
	<<for _i = 0; _i < _mL; _i++>>
		<<set $costs += $militiaUnits[_i].troops*$soldierUpkeep * _soldierMod>>
	<</for>>
	<<set _sL = $slaveUnits.length>>
	<<for _i = 0; _i < _sL; _i++>>
		<<set $costs += $militiaUnits[_i].troops*$soldierUpkeep * 0.5 * _soldierMod>>
	<</for>>
	<<set _meL = $mercUnits.length>>
	<<for _i = 0; _i < _meL; _i++>>
		<<set $costs += $militiaUnits[_i].troops*$soldierUpkeep * 1.5 * _soldierMod>>
	<</for>>
<</if>>

<<set $costs += $citizenOrphanageTotal*100>>
<<set $costs += $privateOrphanageTotal*500>>
<<if $breederOrphanageTotal > 0>>
	<<set $costs += 50>>
<</if>>

<<if $peacekeepers != 0>>
	<<if $peacekeepers.undermining != 0>>
		<<set $costs += $peacekeepers.undermining>>
	<</if>>
<</if>>

<<if $mercenaries > 0>>
	<<set _mercCosts = $mercenaries*2000>>
	<<if $barracks>><<set _mercCosts *= 0.5>><</if>>
	<<if ($PC.warfare >= 100) || ($PC.career == "arcology owner")>><<set _mercCosts *= 0.5>><</if>>
	<<set $costs += _mercCosts>>
<</if>>

<<set $costs += $FSSpending>>

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

<<switch $slaves[$i].assignment>>
<<case "be confined in the arcade">>
	<<set $costs += ($rulesCost*.75)>>
<<case "work in the dairy">>
	<<if $dairyRestraintsSetting >= 2>>
		<<set $costs += ($rulesCost*.75)>>
	<<elseif $slaves[$i].livingRules == "normal">>
		<<set $costs += ($rulesCost*1.5)>>
	<<elseif $dairyDecoration == "Degradationist">>
		<<set $costs += ($rulesCost*.9)>>
	<<else>>
		<<set $costs += $rulesCost>>
	<</if>>
<<case "work in the brothel">>
	<<if $slaves[$i].livingRules == "normal">>
		<<set $costs += ($rulesCost*1.5)>>
	<<else>>
		<<set $costs += $rulesCost>>
	<</if>>
<<case "serve in the club" "learn in the schoolroom">>
	<<set $costs += ($rulesCost*1.5)>>
<<case "get treatment in the clinic">>
	<<if $slaves[$i].livingRules == "luxurious">>
		<<set $costs += ($rulesCost*2)>>
	<<elseif $slaves[$i].livingRules == "normal">>
		<<set $costs += ($rulesCost*1.5)>>
	<<else>>
		<<set $costs += $rulesCost>>
	<</if>>
<<case "rest in the spa">>
	<<if $slaves[$i].livingRules == "luxurious">>
		<<set $costs += ($rulesCost*1.75)>>
	<<elseif $slaves[$i].livingRules == "normal">>
		<<set $costs += ($rulesCost*1.5)>>
	<<else>>
		<<set $costs += $rulesCost>>
	<</if>>
<<case "be a servant">>
	<<if $slaves[$i].livingRules == "normal">>
		<<set $costs += ($rulesCost*1.5)>>
	<<else>>
		<<if $servantsQuartersDecoration == "Degradationist">>
			<<set $costs += ($rulesCost*.9)>>
		<<else>>
			<<set $costs += $rulesCost>>
		<</if>>
	<</if>>
<<case "be confined in the cellblock">>
	<<if $slaves[$i].livingRules == "normal">>
		<<set $costs += ($rulesCost*1.25)>>
	<<else>>
		<<set $costs += ($rulesCost*.9)>>
	<</if>>
<<case "be the Madam" "be the DJ" "be the Nurse" "be the Wardeness" "be the Attendant" "be the Schoolteacher" "be the Stewardess" "be the Milkmaid">>
	<<set $costs += ($rulesCost*2)>>
<<default>>
	<<if $slaves[$i].livingRules == "luxurious">>
		<<if $slaves[$i].relationship >= 4>>
			<<set $costs += ($rulesCost*3)>>
		<<else>>
			<<set $costs += ($rulesCost*4)>>
		<</if>>
	<<elseif $slaves[$i].livingRules == "normal">>
		<<set $costs += ($rulesCost*2)>>
	<<else>>
		<<set $costs += $rulesCost>>
	<</if>>
<</switch>>

<<set $costs += $foodCost*4>>
<<switch $slaves[$i].diet>>
<<case "fattening" "muscle building">>
	<<set $costs += $foodCost>>
<<case "restricted" "slimming">>
	<<set $costs -= $foodCost>>
<</switch>>
<<if $slaves[$i].weight > 130>>
	<<set $costs += $foodCost*2>>
<<elseif $slaves[$i].weight > 50>>
	<<set $costs += $foodCost>>
<<elseif $slaves[$i].weight < -50>>
	<<set $costs -= $foodCost>>
<</if>>
<<if $slaves[$i].drugs == "appetite suppressors">>
	<<set $costs -= $foodCost>>
<</if>>
<<if $slaves[$i].lactation > 0>>
	<<set $costs += $foodCost*$slaves[$i].lactation*(1+Math.trunc($slaves[$i].boobs/10000))>>
<</if>>
<<if $slaves[$i].preg > 5>>
	<<if $slaves[$i].assignment == "work in the dairy" && $dairyFeedersSetting > 0>>
	<<elseif ($slaves[$i].assignment == "serve in the master suite" || $slaves[$i].assignment == "be your concubine") && $masterSuiteUpgradePregnancy == 1>>
	<<else>>
		<<if $slaves[$i].pregControl == "speed up">>
			<<set $costs += $foodCost*$slaves[$i].pregType*3>>
		<<else>>
			<<set $costs += $foodCost*$slaves[$i].pregType>>
		<</if>>
	<</if>>
<</if>>

<<switch $slaves[$i].diet>>
<<case "XX" "XY" "fertility">>
	<<set $costs += 25>>
<<case "cleansing">>
	<<set $costs += 50>>
<<case "XXY">>
	<<set $costs += 75>>
<</switch>>

<<if $boobAccessibility != 1>>
	<<if ($slaves[$i].boobs > 20000)>>
	<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
	<<set $costs += 50>>
	<</if>>
	<</if>>
<</if>>

<<if $pregAccessibility != 1>>
	<<if ($slaves[$i].belly >= 60000)>>
	<<if ($slaves[$i].assignment != "labor in the production line") && ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
	<<set $costs += 100>>
	<</if>>
	<</if>>
<</if>>

<<if $dickAccessibility != 1>>
	<<if ($slaves[$i].dick > 45)>>
	<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
	<<set $costs += 50>>
	<</if>>
	<</if>>
<</if>>

<<if $ballsAccessibility != 1>>
	<<if ($slaves[$i].balls > 90)>>
	<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
	<<set $costs += 50>>
	<</if>>
	<</if>>
<</if>>

<<if $buttAccessibility != 1>>
	<<if ($slaves[$i].butt > 15)>>
	<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
	<<set $costs += 50>>
	<</if>>
	<</if>>
<</if>>

<<if $slaves[$i].boobs > 10000>>
<<if $slaves[$i].boobsImplantType == 1>>
	<<set $costs += 50>>
<</if>>
<</if>>
<<if $slaves[$i].butt > 10>>
<<if $slaves[$i].buttImplantType == 1>>
	<<set $costs += 50>>
<</if>>
<</if>>

<<if $slaves[$i].preg > 35>>
<<if $slaves[$i].universalRulesBirthing == 1>>
<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2)>>
	<<set $costs += 50>>
<</if>>
<</if>>
<</if>>

<<if $CitizenRetirement == 1>>
	<<set $costs += 250>>
<</if>>

<<if ($slaves[$i].assignment == "be a servant") || ($slaves[$i].assignment == "work as a servant")>>
	<<if $slaves[$i].trust < -20>>
		<<set $costs -= ($rulesCost*4)>>
	<<elseif $slaves[$i].devotion < -20>>
		<<set $costs -= ($rulesCost*2)>>
	<<elseif $slaves[$i].devotion <= 20>>
		<<set $costs -= ($rulesCost*3)>>
	<<elseif $slaves[$i].devotion <= 50>>
		<<set $costs -= ($rulesCost*4)>>
	<<else>>
		<<set $costs -= ($rulesCost*5)>>
	<</if>>
	<<if ($slaves[$i].fetish == "submissive")>>
		<<set $costs -= ($rulesCost)>>
	<<elseif ($slaves[$i].fetish == "dom")>>
		<<set $costs += ($rulesCost)>>
	<</if>>
	<<if ($slaves[$i].relationship < -1)>>
		<<set $costs -= ($rulesCost)>>
	<</if>>
	<<if ($slaves[$i].energy < 20)>>
		<<set $costs -= ($rulesCost)>>
	<<elseif ($slaves[$i].energy < 40)>>
		<<set $costs -= ($rulesCost/2)>>
	<</if>>
	<<if ($slaves[$i].lactation > 0)>>
		<<set $costs -= 25>>
	<</if>>
	<<if ($slaves[$i].assignment == "be a servant")>>
		<<set $costs -= ($rulesCost)>>
	<</if>>
	<<if setup.servantCareers.includes($slaves[$i].career) || $slaves[$i].skillS >= $masteredXP>>
		<<set $costs -= ($rulesCost)>>
	<</if>>
<</if>>

<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
<<if ($slaves[$i].amp != 0)>>
  <<if ($slaves[$i].amp == 1)>>
	<<set $costs += $rulesCost>>
  <<else>>
	<<set $costs += $rulesCost/2>>
  <</if>>
<<elseif !canWalk($slaves[$i])>>
  <<set $costs += $rulesCost>>
<</if>>
<</if>>

<<if !canSee($slaves[$i]) && ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
	<<set $costs += 50>>
<<elseif $slaves[$i].eyes <= -1>>
	<<if $slaves[$i].eyewear != "corrective glasses">>
	<<if $slaves[$i].eyewear != "corrective contacts">>
	<<set $costs += 25>>
	<</if>>
	<</if>>
<<elseif ($slaves[$i].eyewear == "blurring glasses") || ($slaves[$i].eyewear == "blurring contacts")>>
	<<set $costs += 25>>
<</if>>

<<if ($servantsQuartersUpgradeMonitoring == 1)>>
	<<if ($slaves[$i].assignment == "work as a servant")>>
	<<set $costs -= ($rulesCost)>>
	<</if>>
<</if>>

<<if ($slaves[$i].inflation == 3)>>
	<<switch $slaves[$i].inflationType>>
	<<case "water">>
		<<set $costs += 100>>
	<<case "food">>
		<<set $costs += ($foodCost*4)>>
	<<case "curative" "aphrodisiac" "tightener">>
		<<set $costs += (100+($drugsCost*2))>>
	<</switch>>
<<elseif ($slaves[$i].inflation == 2)>>
	<<switch $slaves[$i].inflationType>>
	<<case "water">>
		<<set $costs += 50>>
	<<case "food">>
		<<set $costs += ($foodCost*2)>>
	<<case "curative" "aphrodisiac" "tightener">>
		<<set $costs += (50+($drugsCost*2))>>
	<</switch>>
<<elseif ($slaves[$i].inflation == 1)>>
	<<switch $slaves[$i].inflationType>>
	<<case "water">>
		<<set $costs += 25>>
	<<case "food">>
		<<set $costs += $foodCost>>
	<<case "curative" "aphrodisiac" "tightener">>
		<<set $costs += (25+($drugsCost*2))>>
	<</switch>>
<</if>>

<<if ($slaves[$i].drugs == "female hormone injections") || ($slaves[$i].drugs == "male hormone injections")>>
	<<set $costs += ($drugsCost*5)>>
<<elseif ($slaves[$i].drugs == "anti-aging cream")>>
	<<set $costs += ($drugsCost*10)>>
<<elseif ($slaves[$i].drugs == "sag-B-gone")>>
	<<set $costs += ($drugsCost/10)>>
<<elseif ($slaves[$i].drugs != "no drugs")>>
	<<if $slaves[$i].drugs == "intensive breast injections" || $slaves[$i].drugs == "intensive butt injections" || $slaves[$i].drugs == "intensive penis enhancement" || $slaves[$i].drugs == "intensive testicle enhancement" || $slaves[$i].drugs == "growth stimulants">>
		<<set $costs += $drugsCost*5>>
	<<else>>
		<<set $costs += $drugsCost*2>>
	<</if>>
<</if>>
<<if $slaves[$i].curatives == 1 && $slaves[$i].assignmentVisible != 1>>
<<elseif $slaves[$i].curatives > 0>>
	<<set $costs += $drugsCost+($slaves[$i].curatives*$drugsCost)>>
<<elseif ndef $slaves[$i].curatives>>
	<<set $slaves[$i].curatives = 0>>
<</if>>
<<if ($slaves[$i].aphrodisiacs > 0)>>
	<<set $costs += $drugsCost*Math.abs($slaves[$i].aphrodisiacs)>>
<<elseif ndef $slaves[$i].aphrodisiacs>>
	<<set $slaves[$i].aphrodisiacs = 0>>
<</if>>

<<set $costs += $drugsCost*Math.abs($slaves[$i].hormones)*0.5>>

<<if $slaves[$i].bodySwap > 0>>
	<<set $costs += $drugsCost*10*$slaves[$i].bodySwap>>
<</if>>

<<if ($slaves[$i].preg == -1) && isFertile($slaves[$i])>>
	<<set $costs += $drugsCost*0.5>>
<</if>>

<<if ($studio == 1)>>
	<<set $costs += $slaves[$i].pornFameSpending>>
<</if>>

<</for>>

<<if $Recruiter != 0>>
	<<set $costs += 250>>
<</if>>
<<if $TSS.schoolPresent == 1>>
	<<set $costs += 1000>>
<</if>>
<<if $GRI.schoolPresent == 1>>
	<<set $costs += 1000>>
<</if>>
<<if $SCP.schoolPresent == 1>>
	<<set $costs += 1000>>
<</if>>
<<if $LDE.schoolPresent == 1>>
	<<set $costs += 1000>>
<</if>>
<<if $TGA.schoolPresent == 1>>
	<<set $costs += 1000>>
<</if>>
<<if $TCR.schoolPresent == 1>>
	<<set $costs += 1000>>
<</if>>
<<if ($TFS.schoolPresent == 1) && (($PC.dick == 0) || ($PC.vagina == 0) || ($PC.boobs == 0))>>
	<<set $costs += 1000>>
<</if>>
<<if $TSS.subsidize != 0>>
	<<set $costs += 1000>>
<</if>>
<<if $GRI.subsidize != 0>>
	<<set $costs += 1000>>
<</if>>
<<if $SCP.subsidize != 0>>
	<<set $costs += 1000>>
<</if>>
<<if $LDE.subsidize != 0>>
	<<set $costs += 1000>>
<</if>>
<<if $TGA.subsidize != 0>>
	<<set $costs += 1000>>
<</if>>
<<if $HA.subsidize != 0>>
	<<set $costs += 1000>>
<</if>>
<<if $TCR.subsidize != 0>>
	<<set $costs += 1000>>
<</if>>
<<if $TFS.subsidize != 0>>
	<<set $costs += 1000>>
<</if>>

<<if $alwaysSubsidizeGrowth == 1>>
	<<set $costs += $policyCost>>
<</if>>
<<if $alwaysSubsidizeRep == 1>>
	<<set $costs += $policyCost>>
<</if>>
<<if $RegularParties == 1>>
	<<set $costs += $policyCost>>
<</if>>

<<if $ProImmigrationCash == 1>>
	<<set $costs += $policyCost>>
<</if>>
<<if $AntiEnslavementCash == 1>>
	<<set $costs += $policyCost>>
<</if>>

<<if $CoursingAssociation == 1>>
	<<set $costs += 1000>>
<</if>>

<<if $PC.actualAge >= $IsInPrimePC && $PC.actualAge < $IsPastPrimePC>>
<<set _cost = 10000*$AgeEffectOnTrainerPricingPC>>
<<if ($personalAttention == "trading") || ($personalAttention == "warfare") || ($personalAttention == "slaving") || ($personalAttention == "engineering") || ($personalAttention == "medicine") || ($personalAttention == "hacking")>>
	<<set $costs += _cost>>
<</if>>
<</if>>

<<if $cyberMod != 0 && $researchLab.built == "true">>
	<<set $costs += ((100*$researchLab.maxSpace)+(300*$researchLab.hired)+(100*$researchLab.hired))>>
<</if>>

<<if $PC.preg == -1>>
	<<set $costs += 25>>
<<elseif $PC.fertDrugs == 1>>
	<<set $costs += 50>>
<<elseif $PC.preg >= 16>>
	<<set $costs += 100>>
<</if>>
<<if $PC.staminaPills == 1>>
	<<set $costs += 50>>
<</if>>

<<if $PC.career == "servant">>
	<<if $personalAttention == "upkeep">>
		<<if $PC.belly >= 5000>>
			<<set $costs = ($costs*0.80)>>
		<<else>>
			<<set $costs = ($costs*0.75)>>
		<</if>>
	<<else>>
	<<set $costs = ($costs*0.90)>>
	<</if>>
<</if>>

<<if $secExp == 1>>
	<<if $terrain == "oceanic" || $terrain == "marine">>
		<<if $docks > 0>>
			<<set $costs *= 1 - $docks * 0.05>>
		<</if>>
	<<else>>
		<<if $railway > 0>>
			<<set $costs *= 1 - $railway * 0.05>>
		<</if>>
	<</if>>
<</if>>

<<if $costs < 0>>
	<<set $costs = 0>>
<<else>>
	<<set $costs = Math.trunc($costs)>>
<</if>>

repo_name: drakeashordcataclysm/fc