:: secBarracks [nobr]

<<set $nextButton = "Back to Arcology Management", $nextLink = "Manage Arcology", $returnTo = "Manage Arcology">>

The Barracks
<hr>
__Upgrades__
<br>
While for many a sore sight in a free city, the barracks stand proud before you.
<<if $secBarracksUpgrades.size == 0>>
	The building is relatively small and able to house a limited number of units.
<<elseif $secBarracksUpgrades.size == 1>>
	The building has been expanded and can now house more units comfortably.
<<elseif $secBarracksUpgrades.size == 2>>
	The building has been greatly expanded and can now house a small army.
<</if>>
<<if $secBarracksUpgrades.luxury == 0>>
	The barracks are a spartan building, with little to make the day to day lives of your soldiers pleasant.
<<elseif $secBarracksUpgrades.luxury == 1>>
	The barracks have been made more comfortable by installing high tech furniture.
<<elseif $secBarracksUpgrades.luxury == 2>>
	The barracks have been made more comfortable by installing high tech furniture and advanced kitchen facilities.
<<elseif $secBarracksUpgrades.luxury == 3>>
	The barracks have been made more comfortable by installing high tech furniture and advanced kitchen facilities. It also provides free access to any digital media.
<<else>>
	The barracks have been made more comfortable by installing high tech furniture and advanced kitchen facilities. It also provides free access to any digital media. A small limited access brothel has been added to the structure.
<</if>>
<<if $secBarracksUpgrades.training == 0>>
	The building lacks the space and the equipment to train your units.
<<elseif $secBarracksUpgrades.training == 1>>
	A training facility has been set up, allowing your units to better their skills with time.
<<else>>
	The training facility has been filled with specialized equipment and skilled trainers.
<</if>>
<br>
<br>
<<if $secBarracksUpgrades.size < 2>>
	<<link "Increase the size of the barracks">>
		<<set $secBarracksUpgrades.size += 1>>
		<<set $maxUnits += 2>>
		<<set $cash -= 10000>>
		<<set $secBarracksUpkeep += $upgradeUpkeep>>
		<<goto "secBarracks">>
	<</link>>
	<br>//Costs ¤10000 and will increase the maximum number of units by 2.//
<<else>>
	You've expanded the barracks to their maximum.
<</if>>
<br>
<<if $secBarracksUpgrades.luxury == 0>>
	<<link "Increase the quality of life of your soldiers by installing high tech furniture and appliances.">>
		<<set $secBarracksUpgrades.luxury += 1>>
		<<set $cash -= 5000>>
		<<set $secBarracksUpkeep += $upgradeUpkeep>>
		<<goto "secBarracks">>
	<</link>>
	<br>//Costs ¤5000 and will provide a 5% bonus to morale.//
<<elseif $secBarracksUpgrades.luxury == 1>>
	<<link "Further increase the quality of life of your soldiers by installing advanced kitchen equipment and hiring skilled chefs.">>
		<<set $secBarracksUpgrades.luxury += 1>>
		<<set $cash -= 10000>>
		<<set $secBarracksUpkeep += $upgradeUpkeep>>
		<<goto "secBarracks">>
	<</link>>
	<br>//Costs ¤10000 and will provide a 5% bonus to morale, for a total of +10%.//
<<elseif $secBarracksUpgrades.luxury == 2>>
	<<link "Further increase the quality of life of your soldiers by providing high speed, free access to digital media">>
		<<set $secBarracksUpgrades.luxury += 1>>
		<<set $cash -= 10000>>
		<<set $secBarracksUpkeep += $upgradeUpkeep>>
		<<goto "secBarracks">>
	<</link>>
	<br>//Costs ¤10000 and will provide a 5% bonus to morale, for a total of +15%.//
<<elseif $secBarracksUpgrades.luxury == 3>>
	<<link "Further increase the quality of life of your soldiers by adding and staffing an exclusive brothel to the structure">>
		<<set $secBarracksUpgrades.luxury += 1>>
		<<set $cash -= 15000>>
		<<set $secBarracksUpkeep += $upgradeUpkeep>>
		<<goto "secBarracks">>
	<</link>>
	<br>//Costs ¤15000 and will provide a 5% bonus to morale, for a total of +20%.//
<<else>>
	You've made life in your barracks as good as it can get.
<</if>>
<br>
<<if $secBarracksUpgrades.training == 0>>
	<<link "Add a training facility to the barracks">>
		<<set $secBarracksUpgrades.training += 1>>
		<<set $cash -= 10000>>
		<<set $secBarracksUpkeep += $upgradeUpkeep>>
		<<goto "secBarracks">>
	<</link>>
	<br>//Costs ¤10000 and will allow units to accumulate some experience each week.//
<<elseif $secBarracksUpgrades.training == 1>>
	<<link "Improve the training facility with modern equipment and skilled personnel">>
		<<set $secBarracksUpgrades.training += 1>>
		<<set $cash -= 20000>>
		<<set $secBarracksUpkeep += $upgradeUpkeep>>
		<<goto "secBarracks">>
	<</link>>
	<br>//Costs ¤20000 and will allow units to accumulate experience each week.//
<<else>>
	You have improved the training facility to the limit.
<</if>>

<hr>
__Units__
<br>
Your maximum number of units is <<print $maxUnits>>, currently you have <<print $activeUnits>>. <<if $secBarracksUpgrades.luxury > 0>>The barracks provide <<print $secBarracksUpgrades.luxury * 5>>% bonus morale in case of a battle.<</if>><<if $secBarracksUpgrades.training > 0>> The training facility will increase the effectiveness of your units with time.<</if>>
<<if $arcologies[0].FSRomanRevivalist != "unset" || $arcologies[0].FSChineseRevivalist != "unset" || $arcologies[0].FSArabianRevivalist != "unset" || $arcologies[0].FSEdoRevivalist != "unset" || $arcologies[0].FSEgyptianRevivalist != "unset" || $arcologies[0].FSAztecRevivalist != "unset">>
<</if>>
<br>
<br>
__Security Drones__
/* drones */
<<if $secBots.active == 1>>
	<br>
	<<secBotsDescription>>
	<br>
	<<link "Review Equipment and upgrades">>
		<<set $targetUnit = "secBots">>
		<<goto "seeUnit">>
	<</link>>
	<<if $secBots.troops < $secBots.maxTroops>>
	|
		<<link "Replenish the unit">>
			<<set $cash -= ($secBots.maxTroops - $secBots.troops) * $secBotsCost>>
			<<set $secBots.troops = $secBots.maxTroops>>
			<<goto "secBarracks">>
		<</link>>
	<</if>>
<<else>>
	You have lost too many security drones to be able to field them again.
	<<link "Reform the unit">>
			<<set $cash -= ($secBots.maxTroops - $secBots.troops) * $secBotsCost>>
			<<set $secBots.troops = $secBots.maxTroops>>
			<<set $secBots.active = 1>>
			<<goto "secBarracks">>
		<<goto "secBarracks">>
	<</link>>
<</if>>

<br>
<br>

__Slaves__
<br>/* slaves */
You are free to organize your menial slaves into fighting units. Currently you have <<print $helots>> slaves available, while <<print $slavesEmployedManpower>> are already employed as soldiers. During all your battles you lost a total of <<print $slavesTotalCasualties>>.
<<set _menialPrice = Math.trunc(($slaveCostFactor*1000)/100)*100>>
<<set _menialPrice = Math.clamp(_menialPrice, 500, 1500)>>
<<if $PopCap > $helots+$fuckdolls+$menialBioreactors>>
	<br>
	[[Buy|secBarracks][$helots+=1,$menialDemandFactor+=1,$cash-=_menialPrice]]
	<<if $cash > _menialPrice*10>>
		[[(x10)|secBarracks][$helots+=10,$menialDemandFactor+=10,$cash-=_menialPrice*10]]
	<</if>>
	<<if $cash > _menialPrice*100>>
		[[(x100)|secBarracks][$helots+=100,$menialDemandFactor+=100,$cash-=_menialPrice*100]]
	<</if>>
	<<if $cash > _menialPrice*2>>
		[[(max)|secBarracks][$helots+=Math.trunc($cash/(_menialPrice)),$menialDemandFactor+=Math.trunc($cash/(_menialPrice)),$cash-=Math.trunc($cash/(_menialPrice))*(_menialPrice)]]
	<</if>>
<</if>>
<br>
<<set _sL = $slaveUnits.length>>
<<if $helots > 0 && $activeUnits < $maxUnits>>
	<br>
	<<link "Form a new unit">>
		<<if $createdSlavesUnits == 0>>
			<<set _name = (1+$createdSlavesUnits) + "st slave platoon">>
		<<elseif $createdSlavesUnits == 1>>
			<<set _name = (1+$createdSlavesUnits) + "nd slave platoon">>
		<<elseif $createdSlavesUnits == 2>>
			<<set _name = (1+$createdSlavesUnits) + "rd slave platoon">>
		<<else>>
			<<set _name = (1+$createdSlavesUnits) + "th slave platoon">>
		<</if>>
		<<if $helots >= $maxTroops>>
			<<set _newUnit = {
			platoonName: _name,
			active: 1,
			isDeployed: 0,
			troops: $maxTroops,
			maxTroops: $maxTroops,
			equip: 0,
			training: 0,
			loyalty: 7,
			medics: 0,
			SF: 0,
			battlesFought: 0}>>
			<<set $slaveUnits.push(_newUnit)>>
			<<set $helots -= 30>>
			<<set $slavesEmployedManpower += 30>>
			<<set $createdSlavesUnits++>>
		<<else>>
			<<set _newUnit = {
			platoonName: _name,
			active: 1,
			isDeployed: 0,
			troops: $helots,
			maxTroops: $maxTroops,
			equip: 0,
			training: 0,
			loyalty: 0,
			medics: 0,
			SF: 0,
			battlesFought: 0}>>
			<<set $slaveUnits.push(_newUnit)>>
			<<set $slavesEmployedManpower += _newUnit.troops>>
			<<set $helots = 0>>
			<<set $createdSlavesUnits++>>
		<</if>>
		<<set $activeUnits++>>
		<<goto "secBarracks">>
	<</link>>
<<elseif $helots > 0>>
	You have reached the maximum number of units. You'll have to disband one or enlarge the barracks before forming a new unit.
<<elseif $activeUnits < $maxUnits>>
	You don't have any free menial slave with which to form a new unit.
<</if>>
<<for _i = 0; _i < _sL; _i++>>
	<<capture _i>>
	<<if $slaveUnits[_i].active == 1>>
		<br>
		<br>
		<<slaveUnitsDescription $slaveUnits[_i]>>
		<br>
		<<link "Disband the unit">>
			<<set $helots += $slaveUnits[_i].troops>>
			<<set $slavesEmployedManpower -= $slaveUnits[_i].troops>>
			<<set _elimUnit = $slaveUnits[_i]>>
			<<set _newSlaveUnits = []>>
			<<for _y = 0; _y < _sL; _y++>>
				<<if $slaveUnits[_y] != _elimUnit>>
					<<set _newSlaveUnits.push($slaveUnits[_y])>>
				<</if>>
			<</for>>
			<<set $slaveUnits = _newSlaveUnits>>
			<<set $activeUnits-->>
			<<goto "secBarracks">>
		<</link>>
		|
		<<link "Review Equipment and upgrades">>
			<<set $targetUnit = "slaveUnits">>
			<<set $targetIndex = _i>>
			<<goto "seeUnit">>
		<</link>>
		|
		<<if $slaveUnits[_i].troops < $slaveUnits[_i].maxTroops && $helots > 0>>
			<<link "Replenish unit">>
				<<if $helots >= $slaveUnits[_i].maxTroops - $slaveUnits[_i].troops>>
					<<set $helots -= $slaveUnits[_i].maxTroops - $slaveUnits[_i].troops>>
					<<set $slavesEmployedManpower += $slaveUnits[_i].maxTroops - $slaveUnits[_i].troops>>
					<<set _expLoss = ($slaveUnits[_i].maxTroops - $slaveUnits[_i].troops) / $slaveUnits[_i].troops>>
					<<set $slaveUnits[_i].training -= $slaveUnits[_i].training * _expLoss>>
					<<set $slaveUnits[_i].troops = $slaveUnits[_i].maxTroops>>
				<<else>>
					<<set $slavesEmployedManpower += $helots>>
					<<set _expLoss = $helots / $slaveUnits[_i].troops>>
					<<set $slaveUnits[_i].training -= $slaveUnits[_i].training * _expLoss>>
					<<set $slaveUnits[_i].troops += $helots>>
					<<set $helots = 0>>
				<</if>>
				<<goto "secBarracks">>
			<</link>>
		<</if>>
		
	<<else>>
		<br>
		<br>
		$slaveUnits[_i].platoonName lost too many operatives to be considered active.
		<br>
		<<link "Disband the unit">>
			<<set _elimUnit = $slaveUnits[_i]>>
			<<set _newSlaveUnits = []>>
			<<for _y = 0; _y < _sL; _y++>>
				<<if $slaveUnits[_y] != _elimUnit>>
					<<set _newSlaveUnits.push($slaveUnits[_y])>>
				<</if>>
			<</for>>
			<<set $slaveUnits = _newSlaveUnits>>
			<<set $activeUnits-->>
			<<goto "secBarracks">>
		<</link>>
		|
		<<if $helots > 0>>
			<<link "Reform the unit">>
				<<if $helots >= $slaveUnits[_i].maxTroops>>
					<<set $slavesEmployedManpower += $slaveUnits[_i].maxTroops>>
					<<set $helots -= $slaveUnits[_i].maxTroops>>
					<<set $slaveUnits[_i].troops = $slaveUnits[_i].maxTroops>>
					<<set $slaveUnits[_i].training = 0>>
				<<else>>
					<<set $slavesEmployedManpower += $helots>>
					<<set $slaveUnits[_i].troops += $helots>>
					<<set $helots = 0>>
					<<set $slaveUnits[_i].training = 0>>
				<</if>>
				<<set $slaveUnits[_i].active = 1>>
				<<goto "secBarracks">>
			<</link>>
		<</if>>
	<</if>>
	<</capture>>
<</for>>

<<if $militiaFounded == 1>>
<br>
<br>
__Militia__
<br>/* militia */
	You founded the $arcologies[0].name free militia. You are now able to organize your citizens in fighting units.
	<<if $militiaRecruitment == 0>>
		The militia is composed entirely of volunteers, your manpower is approximately 1.5% of the citizens population of your arcology.
	<<elseif $militiaRecruitment == 1>>
		With the establishment of conscription, your available manpower has increased to now approximately 3% of the arcology's citizens population.
	<<elseif $militiaRecruitment == 2>>
		By establishing obligatory military service to obtain citizenship you have enlarged your manpower pool to be approximately 5% of the arcology's citizens population.
	<</if>>	
	Your current total manpower is <<print $militiaTotalManpower>>, of which <<print $militiaEmployedManpower>> is in active duty. You lost in total <<print $militiaTotalCasualties>> citizens, leaving you with <<print $militiaFreeManpower>> available citizens. 
	<br>
	<<set _mL = $militiaUnits.length>>
	<<if $militiaFreeManpower > 0 && $activeUnits < $maxUnits>>
		<br>
		<<link "Form a new unit">>
			<<if $createdMilitiaUnits == 0>>
				<<set _name = (1+$createdMilitiaUnits) + "st citizens' platoon">>
			<<elseif $createdMilitiaUnits == 1>>
				<<set _name = (1+$createdMilitiaUnits) + "nd citizens' platoon">>
			<<elseif $createdMilitiaUnits == 2>>
				<<set _name = (1+$createdMilitiaUnits) + "rd citizens' platoon">>
			<<else>>
				<<set _name = (1+$createdMilitiaUnits) + "th citizens' platoon">>
			<</if>>
			<<if $militiaFreeManpower >= $maxTroops>>
				<<set _newUnit = {
				platoonName: _name,
				active: 1,
				isDeployed: 0,
				troops: $maxTroops,
				maxTroops: $maxTroops,
				equip: 0,
				training: 0,
				loyalty: 7,
				medics: 0,
				SF: 0,
				battlesFought: 0}>>
				<<set $militiaUnits.push(_newUnit)>>
				<<set $militiaFreeManpower -= 30>>
				<<set $militiaEmployedManpower += 30>>
				<<set $createdMilitiaUnits++>>
			<<else>>
				<<set _newUnit = {
				platoonName: _name,
				active: 1,
				isDeployed: 0,
				troops: $militiaFreeManpower,
				maxTroops: $maxTroops,
				equip: 0,
				training: 0,
				loyalty: 0,
				medics: 0,
				SF: 0,
				battlesFought: 0}>>
				<<set $militiaUnits.push(_newUnit)>>
				<<set $militiaEmployedManpower += _newUnit.troops>>
				<<set $militiaFreeManpower = 0>>
				<<set $createdMilitiaUnits++>>
			<</if>>
			<<set $activeUnits++>>
			<<goto "secBarracks">>
		<</link>>
	<<elseif $militiaFreeManpower > 0>>
		You have reached the maximum number of units. You'll have to disband one or enlarge the barracks before forming a new unit.
	<<elseif $activeUnits < $maxUnits>>
		You don't have any free recruits with which to form a new unit.
	<</if>>
	<br>
	<<for _i = 0; _i < _mL; _i++>>
		<<capture _i>>
		<<if $militiaUnits[_i].active == 1>>
			<br>
			<br>
			<<militiaUnitsDescription $militiaUnits[_i]>>
			<br>
			<<link "Disband the unit">>
				<<set $militiaFreeManpower += $militiaUnits[_i].troops>>
				<<set $militiaEmployedManpower -= $militiaUnits[_i].troops>>
				<<set _elimUnit = $militiaUnits[_i]>>
				<<set _newMilitiaUnits = []>>
				<<for _y = 0; _y < _sL; _y++>>
					<<if $slaveUnits[_y] != _elimUnit>>
						<<set _newMilitiaUnits.push($militiaUnits[_y])>>
					<</if>>
				<</for>>
				<<set $militiaUnits = _newMilitiaUnits>>
				<<set $activeUnits-->>
				<<goto "secBarracks">>
			<</link>>
			|
			<<link "Review Equipment and upgrades">>
				<<set $targetUnit = "militiaUnits">>
				<<set $targetIndex = _i>>
				<<goto "seeUnit">>
			<</link>>
			|
			<<if $militiaUnits[_i].troops < $militiaUnits[_i].maxTroops && $militiaFreeManpower > 0>>
				<<link "Replenish unit">>
					<<if $militiaFreeManpower >= $militiaUnits[_i].maxTroops - $militiaUnits[_i].troops>>
						<<set $militiaFreeManpower -= $militiaUnits[_i].maxTroops - $militiaUnits[_i].troops>>
						<<set $militiaEmployedManpower += $militiaUnits[_i].maxTroops - $militiaUnits[_i].troops>>
						<<set _expLoss = ($militiaUnits[_i].maxTroops - $militiaUnits[_i].troops) / $militiaUnits[_i].troops>>
						<<set $militiaUnits[_i].training -= $militiaUnits[_i].training * _expLoss>>
						<<set $militiaUnits[_i].troops = $militiaUnits[_i].maxTroops>>
					<<else>>
						<<set $militiaEmployedManpower += $militiaFreeManpower>>
						<<set _expLoss = $militiaFreeManpower / $militiaUnits[_i].troops>>
						<<set $militiaUnits[_i].training -= $militiaUnits[_i].training * _expLoss>>
						<<set $militiaUnits[_i].troops += $militiaFreeManpower>>
						<<set $militiaFreeManpower = 0>>
					<</if>>
					<<goto "secBarracks">>
				<</link>>
			<</if>>
		<<else>>
			<br>
			<br>
			$militiaUnits[_i].platoonName lost too many operatives to be considered active.
			<br>
			<<link "Disband the unit">>
				<<set $militiaFreeManpower += $militiaUnits[_i].troops>>
				<<set $militiaEmployedManpower -= $militiaUnits[_i].troops>>
				<<set _elimUnit = $militiaUnits[_i]>>
				<<set _newMilitiaUnits = []>>
				<<for _y = 0; _y < _sL; _y++>>
					<<if $slaveUnits[_y] != _elimUnit>>
						<<set _newMilitiaUnits.push($militiaUnits[_y])>>
					<</if>>
				<</for>>
				<<set $militiaUnits = _newMilitiaUnits>>
				<<set $activeUnits-->>
				<<goto "secBarracks">>
			<</link>>
			|
			<<if $militiaFreeManpower > 0>>
				<<link "Reform the unit">>
					<<if $militiaFreeManpower >= $militiaUnits[_i].maxTroops>>
						<<set $militiaEmployedManpower += $militiaUnits[_i].maxTroops>>
						<<set $militiaFreeManpower -= $militiaUnits[_i].maxTroops>>
						<<set $militiaUnits[_i].troops = $militiaUnits[_i].maxTroops>>
						<<set $militiaUnits[_i].training = 0>>
					<<else>>
						<<set $militiaEmployedManpower += $militiaFreeManpower>>
						<<set $militiaUnits[_i].troops += $militiaFreeManpower>>
						<<set $militiaFreeManpower = 0>>
						<<set $militiaUnits[_i].training = 0>>
					<</if>>
					<<set $militiaUnits[_i].active = 1>>
					<<goto "secBarracks">>
				<</link>>
			<</if>>
		<</if>>
		<</capture>>
	<</for>>
	<br>
<<else>>
	<br>
	<br>
	You have not yet founded the militia, you will not be able to form citizens units.
<</if>>

<<if $mercenaries >= 1>>
<br>
<br>
__Mercenaries__
<br>/* mercenaries */
	With the installation of a mercenary company in the arcology, many other are attracted to your free city, hoping to land a contract with you.
	You are able to organize them in units to use in the defense of the arcology. Excluding the defense force you set up, there are <<print $mercTotalManpower>> mercenaries in your arcology, of which <<print $mercEmployedManpower>> actively employed and <<print $mercFreeManpower>> not yet under contract. In total <<print $mercTotalCasualties>> mercenaries have died defending your arcology.
	<br>
	<<set _meL = $mercUnits.length>>
	<<if $mercFreeManpower > 0 && $activeUnits < $maxUnits>>
		<br>
		<<link "Form a new unit">>
			<<if $createdMercUnits == 0>>
				<<set _name = (1+$createdMercUnits) + "st mercenary platoon">>
			<<elseif $createdMercUnits == 1>>
				<<set _name = (1+$createdMercUnits) + "nd mercenary platoon">>
			<<elseif $createdMercUnits == 2>>
				<<set _name = (1+$createdMercUnits) + "rd mercenary platoon">>
			<<else>>
				<<set _name = (1+$createdMercUnits) + "th mercenary platoon">>
			<</if>>
			<<if $mercFreeManpower >= $maxTroops>>
				<<set _newUnit = {
				platoonName: _name,
				active: 1,
				isDeployed: 0,
				troops: $maxTroops,
				maxTroops: $maxTroops,
				equip: 0,
				training: 0,
				loyalty: 7,
				medics: 0,
				SF: 0,
				battlesFought: 0}>>
				<<set $mercUnits.push(_newUnit)>>
				<<set $mercFreeManpower -= 30>>
				<<set $mercEmployedManpower += 30>>
				<<set $createdMercUnits++>>
			<<else>>
				<<set _newUnit = {
				platoonName: _name,
				active: 1,
				isDeployed: 0,
				troops: $mercFreeManpower,
				maxTroops: $maxTroops,
				equip: 0,
				training: 0,
				loyalty: 0,
				medics: 0,
				SF: 0,
				battlesFought: 0}>>
				<<set $mercUnits.push(_newUnit)>>
				<<set $mercEmployedManpower += _newUnit.troops>>
				<<set $mercFreeManpower = 0>>
				<<set $createdMercUnits++>>
			<</if>>
			<<set $activeUnits++>>
			<<goto "secBarracks">>
		<</link>>
	<<elseif $mercFreeManpower > 0>>
		You have reached the maximum number of units. You'll have to disband one or enlarge the barracks before forming a new unit.
	<<elseif $activeUnits < $maxUnits>>
		You don't have any free mercenaries with which to form a new unit.
	<</if>>
	<<for _i = 0; _i < _meL; _i++>>
		<<capture _i>>
		<<if $mercUnits[_i].active == 1>>
			<br>
			<br>
			<<mercUnitsDescription $mercUnits[_i]>>
			<br>
			<<link "Disband the unit">>
				<<set $mercFreeManpower += $mercUnits[_i].troops>>
				<<set $mercEmployedManpower -= $mercUnits[_i].troops>>
				<<set _elimUnit = $mercUnits[_i]>>
				<<set _newMercUnits = []>>
				<<for _y = 0; _y < _meL; _y++>>
					<<if $mercUnits[_y] != _elimUnit>>
						<<set _newMercUnits.push($mercUnits[_y])>>
					<</if>>
				<</for>>
				<<set $mercUnits = _newMercUnits>>
				<<set $activeUnits-->>
				<<goto "secBarracks">>
			<</link>>
			|
			<<link "Review Equipment and upgrades">>
				<<set $targetUnit = "mercUnits">>
				<<set $targetIndex = _i>>
				<<goto "seeUnit">>
			<</link>>
			|
			<<if $mercUnits[_i].troops < $mercUnits[_i].maxTroops && $mercFreeManpower > 0>>
				<<link "Replenish unit">>
					<<if $mercFreeManpower >= $mercUnits[_i].maxTroops - $mercUnits[_i].troops>>
						<<set $mercFreeManpower -= $mercUnits[_i].maxTroops - $mercUnits[_i].troops>>
						<<set $mercEmployedManpower += $mercUnits[_i].maxTroops - $mercUnits[_i].troops>>
						<<set _expLoss = ($mercUnits[_i].maxTroops - $mercUnits[_i].troops) / $mercUnits[_i].troops>>
						<<set $mercUnits[_i].training -= $mercUnits[_i].training * _expLoss>>
						<<set $mercUnits[_i].troops = $mercUnits[_i].maxTroops>>
					<<else>>
						<<set $mercEmployedManpower += $mercFreeManpower>>
						<<set _expLoss = $mercFreeManpower / $mercUnits[_i].troops>>
						<<set $mercUnits[_i].training -= $mercUnits[_i].training * _expLoss>>
						<<set $mercUnits[_i].troops += $mercFreeManpower>>
						<<set $mercFreeManpower = 0>>
					<</if>>
					<<goto "secBarracks">>
				<</link>>
			<</if>>
			
		<<else>>
			<br>
			<br>
			$mercUnits[_i].platoonName lost too many operatives to be considered active.
			<br>
			<<link "Disband the unit">>
				<<set _elimUnit = $mercUnits[_i]>>
				<<set _newMercUnits = []>>
				<<for _y = 0; _y < _sL; _y++>>
					<<if $mercUnits[_y] != _elimUnit>>
						<<set _newMercUnits.push($mercUnits[_y])>>
					<</if>>
				<</for>>
				<<set $mercUnits = _newMercUnits>>
				<<set $activeUnits-->>
				<<goto "secBarracks">>
			<</link>>
			|
			<<if $mercFreeManpower > 0>>
				<<link "Reform the unit">>
					<<if $mercFreeManpower >= $mercUnits[_i].maxTroops>>
						<<set $mercEmployedManpower += $mercUnits[_i].maxTroops>>
						<<set $mercFreeManpower -= $mercUnits[_i].maxTroops>>
						<<set $mercUnits[_i].troops = $mercUnits[_i].maxTroops>>
						<<set $mercUnits[_i].training = 0>>
					<<else>>
						<<set $mercEmployedManpower += $mercFreeManpower>>
						<<set $mercUnits[_i].troops += $mercFreeManpower>>
						<<set $mercFreeManpower = 0>>
						<<set $mercUnits[_i].training = 0>>
					<</if>>
					<<set $mercUnits[_i].active = 1>>
					<<goto "secBarracks">>
				<</link>>
			<</if>>
		<</if>>
		<</capture>>
	<</for>>
<<else>>
	<br>
	<br>
	Mercenaries are not allowed inside the arcology. You will not be able to recruit mercenary units.
<</if>>