code:
:: weaponsManufacturing [nobr]

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

This sector of the arcology has been dedicated to weapons manufacturing. These factories supply
<<if $militiaUnits.length > 0>> your militia and<</if>>
<<if $slaveUnits.length > 0>> your slave soldiers and<</if>>
<<if $mercenaries > 0>> your mercenaries and<</if>>
many small old world nations as the advanced technology that Free Cities have available is hard to come by otherwise.

<<if $weapProductivity == 1>>
	Production is completely manned by human workers. The complex has close to zero automation.
<<elseif $weapProductivity == 2>>
	Production is mostly handled by human workers. A few of the most tiresome tasks are handled by robots.
<<elseif $weapProductivity == 3>>
	A good part of production is handled by robots with humans handling the most complex tasks.
<<elseif $weapProductivity == 4>>
	Almost all production is handled by robots, with humans acting as support for the machines.
<<else>>
	All production here is handled by robots. The few humans working in the complex occupy themselves exclusively with management and quality assurance.
<</if>>

<<if $weapLab == 1>>
	There's a very Spartan lab attached to the complex that occupies itself mainly with weapons testing and small adjustments to the manufacturing process.
<<elseif $weapLab == 2>>
	There's a lab attached to the complex. It mainly test weapons effectiveness and manufacturing efficiency, but has enough equipment and personnel to develop new technology.
<<else>>
	There's a large lab attached to the complex. The complement of equipment and personnel makes it a great beacon of military science in an otherwise ignorant world.
<</if>>

<<if $weapMenials> 0>>Assigned here are $weapMenials slaves working to produce as much equipment as possible.<<else>>There are no assigned menial slaves here. The spaces is manned exclusively by low rank citizens.<</if>>
You own <<print num($menials)>> free menial slaves. This manufacturing complex can house 500 at most, with <<print 500 - $weapMenials>> free slots.

<<run MenialPopCap()>>
<<set _menialPrice = menialSlaveCost()>>
<<set _bulkMax = $PopCap-$menials-$fuckdolls-$menialBioreactors>>
<<if $cash > _menialPrice>>
	<<if _bulkMax > 0 || $menials+$fuckdolls+$menialBioreactors == 0>>

		[[Buy|weaponsManufacturing][$menials+=1,$menialSupplyFactor-=1,cashX(forceNeg(_menialPrice), "menialTransfer")]]
		<<if $cash > (menialSlaveCost(10))*10>>
			[[(x10)|weaponsManufacturing][$menials+=10,$menialSupplyFactor-=10,cashX(forceNeg((menialSlaveCost(10))*10), "menialTransfer")]]
		<</if>>
		<<if $cash > (menialSlaveCost(100))*100>>
			[[(x100)|weaponsManufacturing][$menials+=100,$menialSupplyFactor-=100,cashX(forceNeg((menialSlaveCost(100))*100), "menialTransfer")]]
		<</if>>
		<<if $cash > (_menialPrice+1)*2>>
			<<set _menialBulkPremium = Math.trunc(1 + Math.clamp($cash/_menialPrice,0,_bulkMax)/400)>>
			[[(max)|weaponsManufacturing][$menials+=Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)),$menialSupplyFactor-=Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)),cashX(forceNeg(Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)*(_menialPrice+_menialBulkPremium))), "menialTransfer")]]
		<</if>>
		//Bulk transactions may require offering a premium.//
	<</if>>
<</if>>

<<if $weapMenials < 500>>
	<<if $menials >= 1>>
		<<link "Transfer a menial slave">>
			<<set $menials-->>
			<<set $weapMenials++>>
			<<goto "weaponsManufacturing">>
		<</link>>
	<</if>>
	<<if $menials >= 10 && $weapMenials <= 490>>
		|
		<<link "Transfer 10 menial slaves">>
			<<set $menials -= 10>>
			<<set $weapMenials += 10>>
			<<goto "weaponsManufacturing">>
		<</link>>
	<</if>>
	<<if $menials > 0>>
		|
		<<link "Transfer all free menial slaves">>
			<<if $menials > 500 - $weapMenials>>
				<<set $menials -= 500 - $weapMenials>>
				<<set $weapMenials = 500>>
			<<else>>
				<<set $weapMenials += $menials>>
				<<set $menials = 0>>
			<</if>>
			<<goto "weaponsManufacturing">>
		<</link>>
	<</if>>
	<<if $weapMenials > 0>>

		<<link "Transfer out all menial slaves">>
			<<set $menials += $weapMenials>>
			<<set $weapMenials = 0>>
			<<goto "weaponsManufacturing">>
		<</link>>
	<</if>>
<<else>>
	The complex does not require more workers.

	<<link "Transfer out all menial slaves">>
		<<set $menials += $weapMenials>>
		<<set $weapMenials = 0>>
		<<goto "weaponsManufacturing">>
	<</link>>
<</if>>

<<if $weapProductivity < 5>>
	<<link "Invest in automating the complex">>
		<<run cashX(forceNeg(10000 * $weapProductivity), "capEx")>>
		<<set $weapProductivity++>>
		<<if $currentUpgrade.time > 0>>
			<<set _percentComplete = $currentUpgrade.time / ($baseUpgradeTime / ($weapProductivity - 1))>>
			<<set _newTime = Math.ceil(_percentComplete * $baseUpgradeTime / $weapProductivity)>>
			<<set $currentUpgrade.time = _newTime>>
		<</if>>
		<<goto "weaponsManufacturing">>
	<</link>>
	//Will cost <<print cashFormat(10000 * $weapProductivity)>> and will increase the facility income in addition to speeding up upgrade production.//
<<elseif $weapLab < 3>>
	You have fully automated the complex.
<</if>>

<<if $weapLab < 3>>
	<<link "Invest in research and development">>
		<<run cashX(forceNeg(10000 * $weapLab), "capEx")>>
		<<set $weapLab++>>
		<<goto "weaponsManufacturing">>
	<</link>>
	//Will cost <<print cashFormat(10000 * $weapLab)>> and will increase the facility income as well as unlock upgrades for our troops//
<<elseif $weapProductivity < 5>>
	You have fully upgraded and funded the R&D department
<</if>>
<<if $weapLab >= 3 && $weapProductivity >= 5>>
	The facility is completely automated and its R&D department is fully upgraded and funded.
<</if>>

__Markets__:
//You are free to sell to whoever you please, but expect hostile forces of a certain kind to be stronger if we'll ever meet in battle.//

<<if $sellTo.citizen == 1>>
	We are currently selling our weapons to the domestic market of the arcology.
	<<link "Forbid">>
		<<set $sellTo.citizen = 0>>
		<<goto "weaponsManufacturing">>
	<</link>>
<<else>>
	We are not selling our weaponry to our citizens.
	<<link "Allow">>
		<<set $sellTo.citizen = 1>>
		<<goto "weaponsManufacturing">>
	<</link>>
<</if>>

<<if $sellTo.raiders == 1>>
	We are currently selling our weapons to various groups of outlaws, also known as raiders.
	<<link "Forbid">>
		<<set $sellTo.raiders = 0>>
		<<goto "weaponsManufacturing">>
	<</link>>
<<else>>
	We are not selling our weaponry to raiders.
	<<link "Allow">>
		<<set $sellTo.raiders = 1>>
		<<goto "weaponsManufacturing">>
	<</link>>
<</if>>

<<if $sellTo.oldWorld == 1>>
	We are currently selling our weapons to many old world nations.
	<<link "Forbid">>
		<<set $sellTo.oldWorld = 0>>
		<<goto "weaponsManufacturing">>
	<</link>>
<<else>>
	We are not selling our weaponry to old world nations.
	<<link "Allow">>
		<<set $sellTo.oldWorld = 1>>
		<<goto "weaponsManufacturing">>
	<</link>>
<</if>>

<<if $sellTo.FC == 1>>
	We are currently selling our weapons to other Free Cities.
	<<link "Forbid">>
		<<set $sellTo.FC = 0>>
		<<goto "weaponsManufacturing">>
	<</link>>
<<else>>
	We are not selling our weaponry to other Free Cities.
	<<link "Allow">>
		<<set $sellTo.FC = 1>>
		<<goto "weaponsManufacturing">>
	<</link>>
<</if>>

<<set _time = Math.ceil($baseUpgradeTime / $weapProductivity)>>
Upgrades:
With our current industrial and research capabilities upgrades will be finished in _time weeks.

<<if $currentUpgrade.time <= 0>>

Security Drones:
	<<if $weapLab < 3>>
		Upgrade the research facility further to unlock more upgrades for the security drones.
	<<elseif $completedUpgrades.includesAll(-1, -2, -3)>>
		You have fully upgraded the security drones.
	<</if>>
	<<if !$completedUpgrades.includesAll(-1, -2, -3)>>
 <</if>>
	/* Drones upgrades */
	<<if !$completedUpgrades.includes(-1)>>
		<<link "Develop dynamic battle aware AI">>
			<<set $currentUpgrade = {
				ID: -1,
				name: "dynamic battle aware AI",
				unit: 0,
				type: "attack",
				time: _time}>>
			<<run cashX(forceNeg(10000*$HackingSkillMultiplier), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(10000*$HackingSkillMultiplier)>> and will increase the base attack value of the security drones.//
	<<elseif !$completedUpgrades.includes(-2) && $weapLab >= 2>>
		<<link "Develop adaptive armored frames">>
			<<set $currentUpgrade = {
				ID: -2,
				name: "adaptive armored frames",
				unit: 0,
				type: "defense",
				time: _time}>>
			<<run cashX(forceNeg(10000), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(10000)>> and will increase the base defense value of the security drones.//
	<<elseif !$completedUpgrades.includes(-3) && $weapLab >= 3>>

		<<link "Develop advanced synthetic alloys">>
			<<set $currentUpgrade = {
				ID: -3,
				name: "advanced synthetic alloys",
				unit: 0,
				type: "hp",
				time: _time}>>
			<<run cashX(forceNeg(30000), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(30000)>> and will increase the base hp value of the security drones.//
	<</if>>
	<<if !$completedUpgrades.includesAll(-1, -2, -3)>>
 <</if>>

	/* human troops upgrades */

Troops:
	<<if $SF.Toggle && $SF.Active >= 1 && ($humanUpgrade.attack >= 4 || $humanUpgrade.hp >= 4 || $humanUpgrade.morale >= 40 || $humanUpgrade.defense >= 4)>>
		You have fully upgraded your human troops.
	<<elseif $humanUpgrade.attack >= 2 || $humanUpgrade.hp >= 2 || $humanUpgrade.morale >= 20 || $humanUpgrade.defense >= 2>>
		You have fully upgraded your human troops.
		<<if $SF.Toggle && $SF.Active >= 1 && ($humanUpgrade.attack < 4 || $humanUpgrade.hp < 4 || $humanUpgrade.morale < 40 || $humanUpgrade.defense < 4) && (($SFSupportLevel >= 2 && $SF.Squad.Firebase >= 7) || ($SFSupportLevel >= 4 && $SF.Squad.Drugs >= 8) || ($SFSupportLevel >= 5))>>
			With support from $SF.Lower, however, we may be able to further upgrade our troops.
		<</if>>
	<<elseif $weapLab < 3>>
		Upgrade the research facility further to unlock more upgrades for human troops.
	<</if>>
	<<if !$completedUpgrades.includes(0)>>

		<<link "Develop magnetic based ballistic weaponry">>
			<<set $currentUpgrade = {
				ID: 0,
				name: "magnetic based ballistic weaponry",
				unit: 1,
				type: "attack",
				time: _time}>>
			<<run cashX(forceNeg(30000), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(30000)>> and will increase the base attack value of human troops.//

	<</if>>
	<<if !$completedUpgrades.includes(1)>>
		<<link "Develop ceramo-metallic alloys">>
			<<set $currentUpgrade = {
				ID: 1,
				name: "ceramo-metallic alloys",
				unit: 1,
				type: "defense",
				time: _time}>>
			<<run cashX(forceNeg(30000), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(30000)>> and will increase the base defense value of human troops.//
	<</if>>
	<<if !$completedUpgrades.includes(2) && $weapLab >= 2>>

		<<link "Develop rapid action stimulants">>
			<<set $currentUpgrade = {
				ID: 2,
				name: "rapid action stimulants",
				unit: 1,
				type: "hp",
				time: _time}>>
			<<run cashX(forceNeg(60000), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(60000)>> and will increase the base hp value of human troops.//

	<</if>>
	<<if !$completedUpgrades.includes(3) && $weapLab >= 2>>
		<<link "Develop fast response neural stimulant">>
			<<set $currentUpgrade = {
				ID: 3,
				name: "fast response neural stimulant",
				unit: 1,
				type: "morale",
				time: _time}>>
			<<run cashX(forceNeg(60000), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(60000)>> and will increase the base morale value of human troops.//
	<</if>>
	<<if !$completedUpgrades.includes(4) && $weapLab >= 3>>

		<<link "Develop universal cyber enhancements">>
			<<set $currentUpgrade = {
				ID: 4,
				name: "universal cyber enhancements",
				unit: 1,
				type: "attackAndDefense",
				time: _time}>>
			<<run cashX(forceNeg(120000*$HackingSkillMultiplier), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(120000*$HackingSkillMultiplier)>> and will increase the base attack and "defense" values of human troops.//
	<</if>>
	<<if !$completedUpgrades.includes(5) && $weapLab >= 3>>

		<<link "Develop remote neural links">>
			<<set $currentUpgrade = {
				ID: 5,
				name: "remote neural links",
				unit: 1,
				type: "hpAndMorale",
				time: _time}>>
			<<run cashX(forceNeg(120000*$HackingSkillMultiplier), "capEx")>>
			<<goto "weaponsManufacturing">>
		<</link>>

//Will take _time weeks, cost <<print cashFormat(120000*$HackingSkillMultiplier)>> and will increase the base hp and morale values of human troops.//
	<</if>>
	<<if $SF.Toggle && $SF.Active >= 1>>

		<<if !$completedUpgrades.includes(6) && $weapLab >= 2 && $SFSupportLevel >= 2 && $SF.Squad.Firebase >= 7>>

			<<link "Develop combined training regimens with $SF.Lower">>
				<<set $currentUpgrade = {
					ID: 6,
					name: "combined training regimens with the special force",
					unit: 1,
					type: "attackAndDefense",
					time: _time}>>
				<<goto "weaponsManufacturing">>
			<</link>>

//Will take _time weeks, and will increase the base attack and defense values of human troops.//
		<</if>>
		<<if !$completedUpgrades.includes(7) && $weapLab >= 2 && $SFSupportLevel >= 4 && $SF.Squad.Drugs >= 8>>

			<<link "Develop a variant of the stimulant cocktail that $SF.Lower created">>
				<<set $currentUpgrade = {
					ID: 7,
					name: "a variant of the stimulant cocktail that the special force created",
					unit: 1,
					type: "hpAndMorale",
					time: _time}>>
				<<run cashX(forceNeg(300000), "capEx")>>
				<<goto "weaponsManufacturing">>
			<</link>>

//Will take _time weeks, cost <<print cashFormat(300000)>> and will increase the base morale and hp values of human troops.//
		<</if>>
		<<if !$completedUpgrades.includes(8) && $weapLab >= 3 && $SFSupportLevel >= 5>>

			<<link "Create a mesh network based off the custom network of $SF.Lower">>
				<<set $currentUpgrade = {
					ID: 8,
					name: "a mesh network based off the custom network of the special force",
					unit: 1,
					type: "all",
					time: _time}>>
				<<run cashX(forceNeg(1000000*$HackingSkillMultiplier), "capEx")>>
				<<goto "weaponsManufacturing">>
			<</link>>

//Will take _time weeks, cost <<print cashFormat(1000000*$HackingSkillMultiplier)>> and will increase all base stats of human troops.//
		<</if>>
	<</if>>
<<else>>

	You are developing <<print $currentUpgrade.name>>.
	It is for <<if $currentUpgrade.unit == 0>> the security drones<<else>> our troops<</if>>. It will enhance their
	<<if $currentUpgrade.type == "attack">>
		attack power.
	<<elseif $currentUpgrade.type == "defense">>
		defensive capabilities.
	<<elseif $currentUpgrade.type == "hp">>
		survivability.
	<<elseif $currentUpgrade.type == "morale">>
		standing power.
	<<elseif $currentUpgrade.type == "attackAndDefense">>
		offensive and defensive effectiveness.
	<<elseif $currentUpgrade.type == "hpAndMorale">>
		morale and survivability.
	<<elseif $currentUpgrade.type == "all">>
		offensive, defensive effectiveness in addition to morale and survivability.
	<</if>>
	Estimated completion time is <<print $currentUpgrade.time>> weeks.
<</if>>
<<if $completedUpgrades.length > 0>>

	You have completed the following projects:
	<<for _i = 0; _i < $completedUpgrades.length; _i++>>
		<<if _i < $completedUpgrades.length - 2>>
			<<if $completedUpgrades[_i] == 0>>
				magnetic based ballistic weaponry,
			<<elseif $completedUpgrades[_i] == 1>>
				ceramo-metallic alloys,
			<<elseif $completedUpgrades[_i] == 2>>
				rapid action stimulants,
			<<elseif $completedUpgrades[_i] == 3>>
				fast response neural stimulant,
			<<elseif $completedUpgrades[_i] == 4>>
				universal cyber enhancements,
			<<elseif $completedUpgrades[_i] == 5>>
				remote neural links,
			<<elseif $completedUpgrades[_i] == 6>>
				combined training regimens with the special force,
			<<elseif $completedUpgrades[_i] == 7>>
				a variant of the stimulant cocktail that the special force created,
			<<elseif $completedUpgrades[_i] == 8>>
				a mesh network based off the custom network of the special force,
			<<elseif $completedUpgrades[_i] == -1>>
				dynamic battle aware AI,
			<<elseif $completedUpgrades[_i] == -2>>
				adaptive armored frames,
			<<elseif $completedUpgrades[_i] == -3>>
				advanced synthetic alloys,
			<</if>>
		<<else>>
			<<if $completedUpgrades[_i] == 0>>
				magnetic based ballistic weaponry.
			<<elseif $completedUpgrades[_i] == 1>>
				ceramo-metallic alloys.
			<<elseif $completedUpgrades[_i] == 2>>
				rapid action stimulants.
			<<elseif $completedUpgrades[_i] == 3>>
				fast response neural stimulant.
			<<elseif $completedUpgrades[_i] == 4>>
				universal cyber enhancements.
			<<elseif $completedUpgrades[_i] == 5>>
				remote neural links.
			<<elseif $completedUpgrades[_i] == 6>>
				combined training regimens with the special force.
			<<elseif $completedUpgrades[_i] == 7>>
				a variant of the stimulant cocktail that the special force created.
			<<elseif $completedUpgrades[_i] == 8>>
				a mesh network based off the custom network of the special force.
			<<elseif $completedUpgrades[_i] == -1>>
				dynamic battle aware AI.
			<<elseif $completedUpgrades[_i] == -2>>
				adaptive armored frames.
			<<elseif $completedUpgrades[_i] == -3>>
				advanced synthetic alloys.
			<</if>>
		<</if>>
	<</for>>
<</if>>

[[Return this sector to standard manufacturing|Main][$weapManu = 0, cashX(forceNeg(Math.trunc(10000*$upgradeMultiplierArcology)), "capEx"), App.Arcology.cellUpgrade($building, App.Arcology.Cell.Manufacturing, "Weapon Manufacturing", "Manufacturing")]] //Costs <<print cashFormat(Math.trunc(10000*$upgradeMultiplierArcology))>>//


code:
:: edicts [nobr jump-to-safe jump-from-safe]

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

''__Active Edicts__''

<<if $alternativeRents == 1>>

''Alternative rent payment:'' you are allowing citizens to pay for their rents in menial slaves rather than cash.
	[[Repeal|edicts][$alternativeRents = 0]]
<</if>>

<<if $enslavementRights == 1>>

''Enslavement rights:'' you are the only authority able to declare a person enslaved or not.
	[[Repeal|edicts][$enslavementRights = 0]]
<</if>>

<<if $sellData == 1>>

''Private Data marketization:'' you are selling private citizens' data to the best bidder.
	[[Repeal|edicts][$sellData = 0]]
<</if>>

<<if $propCampaignBoost == 1>>

''Obligatory educational material:'' you are forcing residents to read curated educational material about the arcology.
	[[Repeal|edicts][$propCampaignBoost = 0]]
<</if>>

<<if $tradeLegalAid == 1>>

''Legal aid for new businesses:'' New businesses can rely on your help for legal expenses and issues.
	[[Repeal|edicts][$tradeLegalAid = 0]]
<</if>>

<<if $taxTrade == 1>>

''Trade tariffs:'' all goods transitioning in your arcology have to pay a transition fee.
	[[Repeal|edicts][$taxTrade = 0]]
<</if>>

<<if $slaveWatch == 1>>

''@@.lime;Slave mistreatment watch:@@'' slaves are able access a special security service in case of mistreatment.
	[[Repeal|edicts][$slaveWatch = 0]]
<</if>>

<<if $subsidyChurch == 1>>

''@@.lime;Religious activities subsidy:@@'' you are providing economic support to religious activities following the official dogma.
	[[Repeal|edicts][$subsidyChurch = 0]]
<</if>>

<<if $SF.Toggle && $SF.Active >= 1 && $SFSupportLevel > 0>>

__Special Force:__
	<<if $SFSupportLevel === 1>>

''Equipment provision:'' <<= App.SF.Caps()>> is providing the security HQ with advanced equipment, boosting its efficiency.
		[[Repeal|edicts][$SFSupportLevel--]]
	<<elseif $SFSupportLevel === 2>>

''Personnel training:'' <<= App.SF.Caps()>> is currently providing advanced equipment and training to security HQ personnel.
		[[Repeal|edicts][$SFSupportLevel--]]
	<<elseif $SFSupportLevel === 3>>

''Troops detachment:'' <<= App.SF.Caps()>> has currently transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.
		[[Repeal|edicts][$SFSupportLevel--]]
	<<elseif $SFSupportLevel === 4>>

''Full support:'' <<= App.SF.Caps()>> is currently providing its full support to the security department, while transferring troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.
		[[Repeal|edicts][$SFSupportLevel--]]
	<<elseif $SFSupportLevel === 5>>

''Network assistance:'' <<= App.SF.Caps()>> is currently assisting with a local install of its custom network full support and has transferred troops to the security department HQ in addition to providing advanced equipment and training to security HQ personnel.
		[[Repeal|edicts][$SFSupportLevel--]]
	<</if>>
<</if>>

<<if $limitImmigration == 1 || $openBorders == 1>>

__Immigration:__

	<<if $limitImmigration == 1>>

''Immigration limits:'' you put strict limits to the amount of people the arcology can accept each week.
		[[Repeal|edicts][$limitImmigration = 0]]
	<</if>>

	<<if $openBorders == 1>>

''Open borders:'' you have lowered considerably the requirements to become citizens.
		[[Repeal|edicts][$openBorders = 0]]
	<</if>>
<</if>>

__Weapons:__

<<if $weaponsLaw == 0>>

''Forbid weapons inside the arcology:'' residents are forbidden to buy, sell and keep weaponry while within the arcology.
	[[Repeal|edicts][$weaponsLaw = 3]]
<<elseif $weaponsLaw == 2>>

''Heavy weaponry forbidden:'' residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-heavy, non-explosive.
	[[Repeal|edicts][$weaponsLaw = 3]]
<<elseif $weaponsLaw == 1>>

''Heavily restricted weaponry:'' residents are allowed to buy, sell and keep weapons within the arcology as long as they are non-automatic, non-high caliber.
	[[Repeal|edicts][$weaponsLaw = 3]]
<<else>>

''All weapons allowed:'' residents are allowed to buy, sell and keep all kind of weapons in the arcology.
<</if>>

<<if $hasFoughtOnce == 1>>

__Defense Force:__
	<<if $soldierWages == 0>>

''Low wages for soldiers:'' wages for soldiers are set to a low level compared to market standards.
		[[Repeal|edicts][$soldierWages = 1]]
	<<elseif $soldierWages == 1>>

''Average wages for soldiers:'' wages for soldiers are set to the market standards.
	<<else>>

''High wages for soldiers:'' wages for soldiers are set to a high level compared to market standards.
		[[Repeal|edicts][$soldierWages = 1]]
	<</if>>

	<<if $slavesOfficers == 1>>

''Slave Officers:'' your trusted slaves are allowed to lead the defense forces of the arcology.
		[[Repeal|edicts][$slavesOfficers = 0]]
	<</if>>

	<<if $mercenaries > 0>>
		<<if $discountMercenaries == 1>>

''Mercenary subsidy:'' mercenaries willing to immigrate in your arcology will be offered a discount on rent.
			[[Repeal|edicts][$discountMercenaries = 0]]
		<</if>>
	<</if>>

	<<if $militiaFounded == 1>>
		<<if $conscription == 1>>

''Conscription:'' every citizen is required to train in the militia and serve the arcology for a limited amount of time.
			[[Repeal|edicts][$conscription = 0, $recruitVolunteers = 1]]
		<</if>>
		<<if $militaryService == 1>>

''Obligatory military service:'' every citizen is required to register and serve under the militia.
			[[Repeal|edicts][$militaryService = 0, $recruitVolunteers = 1]]
		<</if>>
		<<if $militarizedSociety == 1>>

''Militarized Society:'' every adult citizen is required to train and actively participate in the military of the arcology.
			[[Repeal|edicts][$militarizedSociety = 0, $recruitVolunteers = 1]]
		<</if>>

		<<if $militaryExemption == 1>>

''Military exemption:'' you allow citizens to avoid military duty by paying a weekly fee.
			[[Repeal|edicts][$militaryExemption = 0]]
		<</if>>

		<<if $lowerRquirements == 1>>

''@@.lime;Revised minimum requirements:@@'' you allow citizens outside the normally accepted range to join the militia.
			[[Repeal|edicts][$lowerRquirements = 0]]
		<</if>>

		<<if $noSubhumansInArmy == 1>>

''@@.lime;No subhumans in the militia:@@'' it is forbidden for subhumans to join the militia.
			[[Repeal|edicts][$noSubhumansInArmy = 0]]
		<</if>>

		<<if $pregExemption == 1>>

''@@.lime;Military exemption for pregnancies:@@'' pregnant citizens are allowed, and encouraged, to avoid military service.
			[[Repeal|edicts][$pregExemption = 0]]
		<</if>>
	<</if>>

	<<if $militiaSoldierPrivilege == 1>>

''Special militia privileges:'' citizens joining the militia are exempt from rent payment.
		[[Repeal|edicts][$militiaSoldierPrivilege = 0]]
	<</if>>

	<<if $slaveSoldierPrivilege == 1>>

''Special slaves privileges:'' Slaves into the army are allowed to have material possessions.
		[[Repeal|edicts][$slaveSoldierPrivilege = 0]]
	<</if>>

	<<if $mercSoldierPrivilege == 1>>

''Special mercenary privileges:'' Mercenaries under contract can claim part of the loot gained from battles.
		[[Repeal|edicts][$mercSoldierPrivilege = 0]]
	<</if>>

	<<if $martialSchool == 1>>

''@@.lime;Slave martial schools:@@'' specialized schools are training slaves in martial arts and bodyguarding.
		[[Repeal|edicts][$martialSchool = 0, $slaveBaseMorale -= 5]]
	<</if>>

	<<if $eliteOfficers == 1>>

''@@.lime;Elite officers:@@'' officers are exclusively recruited from the elite of society.
		[[Repeal|edicts][$eliteOfficers = 0, $militiaBaseMorale += 5, $slaveBaseMorale -= 5]]
	<</if>>

	<<if $liveTargets == 1>>

''@@.lime;Live targets drills:@@'' disobedient slaves are used as live targets at shooting ranges.
		[[Repeal|edicts][$liveTargets = 0]]
	<</if>>
<</if>>

<<if $FSAnnounced>>
	<<if $legionTradition == 1>>

''@@.lime;Legionaries traditions:@@'' you are funding specialized training for your recruits following the Roman tradition of professional armies.
		[[Repeal|edicts][$legionTradition = 0, $militiaBaseDefense -= 2, $militiaBaseMorale -= 5, $militiaBaseHp--]]
	<</if>>

	<<if $pharaonTradition == 1>>

''@@.lime;Pharaonic traditions:@@'' you are funding specialized training for your recruits to turn them into an army worthy of a pharaon.
		[[Repeal|edicts][$pharaonTradition = 0, $militiaBaseAttack -= 2, $militiaBaseDefense -= 2, $militiaBaseMorale -= 10]]
	<</if>>

	<<if $eagleWarriors == 1>>

''@@.lime;Eagle warriors traditions:@@'' you are funding specialized training for your mercenaries following the Aztec tradition of elite warriors.
		[[Repeal|edicts][$eagleWarriors = 0, $mercBaseAttack -= 4, $mercBaseDefense += 2, $mercBaseMorale -= 10]]
	<</if>>

	<<if $ronin == 1>>

''@@.lime;Ronin traditions:@@'' you are funding specialized training for your mercenaries following the Japanese tradition of elite errant samurai.
		[[Repeal|edicts][$ronin = 0, $mercBaseAttack -= 2, $mercBaseDefense -= 2, $mercBaseMorale -= 10]]
	<</if>>

	<<if $mamluks == 1>>

''@@.lime;Mamluks traditions:@@'' you are funding specialized training for your slaves following the Arabian tradition of mamluks slave soldiers.
		[[Repeal|edicts][$mamluks = 0, $slaveBaseAttack -= 2, $slaveBaseHp--, $slaveBaseMorale -= 10]]
	<</if>>

	<<if $sunTzu == 1>>

''@@.lime;Sun Tzu Teachings:@@'' you are funding specialized training for your units and officers to follow the teachings of the "Art of War".
		[[Repeal|edicts][$sunTzu = 0, $militiaBaseAttack--, $militiaBaseDefense--, $mercBaseAttack--, $mercBaseDefense--, $slaveBaseAttack--, $slaveBaseDefense--, $militiaBaseMorale -= 5, $mercBaseMorale -= 5, $slaveBaseMorale -= 5]]
	<</if>>
<</if>>

''__Available Edicts__''

//Passing any edict will cost <<print cashFormat(5000)>> and some authority. More edicts will become available as the arcology develops.//

<<if $alternativeRents == 0>>

''Alternative rent payment:'' allow citizens to pay for their rents in menial slaves rather than cash, if so they wish.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$alternativeRents = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will decrease rents, but will supply a small amount of menial slaves each week.//
<</if>>

<<if $enslavementRights == 0>>

''Enslavement rights:'' the arcology owner will be the only authority able to declare a person enslaved or not.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$enslavementRights = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will provide cash each week. The higher the flux of citizens to slaves the higher the income. Will cost a small amount of authority each week.//
<</if>>

<<if $sellData == 0 && ($secUpgrades.nanoCams == 1 || $secUpgrades.cyberBots == 1 || $secUpgrades.eyeScan == 1 || $secUpgrades.cryptoAnalyzer == 1 || $crimeUpgrades.autoTrial == 1 || $crimeUpgrades.autoArchive == 1 || $crimeUpgrades.worldProfiler == 1 || $crimeUpgrades.advForensic == 1)>>

''Private Data marketization:'' allow the selling of private citizens' data.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$sellData = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will generate income dependent on the amount of upgrades installed in the security HQ, but will cost a small amount of authority each week.//
<</if>>

<<if $SecExp.buildings.propHub.active == 1>>
	<<if $propCampaignBoost == 0>>

''Obligatory educational material:'' force residents to read curated educational material about the arcology.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$propCampaignBoost = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will increase the effectiveness of propaganda campaigns, but will incur upkeep costs.//
	<</if>>
<</if>>

<<if $transportHub == 1>>
	<<if $tradeLegalAid == 0>>

''Legal aid for new businesses:'' Support new businesses in the arcology by helping them cover legal costs and issues.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$tradeLegalAid = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will increase trade, but will incur upkeep costs.//
	<</if>>
	<<if $taxTrade == 0>>

''Trade tariffs:'' all goods transitioning in your arcology will have to pay a transition fee.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$taxTrade = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will provide income based on trade level, but will negatively affect trade.//
	<</if>>
<</if>>

<<if $arcologies[0].FSPaternalist != "unset">>
	<<if $slaveWatch == 0>>

''@@.lime;Slave mistreatment watch:@@'' slaves will be able access a special security service in case of mistreatment.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$slaveWatch = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will help advance paternalism, but will incur upkeep costs.//
	<</if>>
<</if>>

<<if $arcologies[0].FSChattelReligionist >= 40>>
	<<if $subsidyChurch == 0>>

''@@.lime;Religious activities subsidy:@@'' will provide economic support to religious activities following the official dogma.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$subsidyChurch = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will provide authority each week, but will incur upkeep costs.//
	<</if>>
<</if>>

<<if $SF.Toggle && $SF.Active >= 1 && $SFSupportLevel < 5>>

__Special Force:__
	<<if !$SFSupportLevel && App.SecExp.Check.reqMenials() > 5>>

''Equipment provision:'' <<= App.SF.Caps()>> will provide the security HQ with advanced equipment.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$SFSupportLevel++, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will lower the amount of personnel necessary to man the security HQ by 5, but will incur upkeep costs.//
	<<elseif $SFSupportLevel && $SF.Squad.Firebase >= 4 && App.SecExp.Check.reqMenials() > 5>>

''Personnel training:'' <<= App.SF.Caps()>> will provide the security HQ personnel with advanced training.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$SFSupportLevel++, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs.//
	<<elseif $SFSupportLevel === 2 && $SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5>>

''Troops detachment:'' <<= App.SF.Caps()>> will provide troops to the security department.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$SFSupportLevel++, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs.//
	<<elseif $SFSupportLevel === 3 && $SF.Squad.Firebase >= 6 && App.SecExp.Check.reqMenials() > 5>>

''Full Support:'' <<= App.SF.Caps()>> will give the security department its full support.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$SFSupportLevel++, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs.//
	<<elseif $SFSupportLevel === 4 && $SF.Squad.Firebase === 10 && App.SecExp.Check.reqMenials() > 5>>

''Network assistance:'' <<= App.SF.Caps()>> will assist the security department with installing a local version of their custom network.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$SFSupportLevel++, cashX(-50000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will lower the amount of personnel necessary to man the security HQ by a further 5, but will incur additional upkeep costs.//
	<</if>>
<</if>>

__Immigration:__

<<if $limitImmigration == 0>>

''Immigration limits:'' institute limits to the amount of people the arcology will accept each week.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$openBorders = 0, $limitImmigration = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will lower the amount of people immigrating into the arcology and enhance security.//
<</if>>

<<if $openBorders == 0>>

''Open borders:'' considerably lower requirements to become citizens.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$openBorders = 1, $limitImmigration = 0, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will increase immigration to the arcology, but will increase crime.//
<</if>>

__Weapons:__
<<if $weaponsLaw == 3>>

''Heavy weaponry forbidden:'' set the range of weapons allowed within the arcology to non-heavy, non-explosive.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$weaponsLaw = 2, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed.//
<<elseif $weaponsLaw == 2>>

''All weapons allowed:'' allow residents of the arcology to buy, sell and keep weaponry of any kind within the arcology.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$weaponsLaw = 3, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will slightly increase prosperity and provide a small weekly amount of reputation, but rebellions will be very well armed.//

''Heavily restricted weaponry:'' set the range of weapons allowed within the arcology to non-automatic, non-high caliber.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$weaponsLaw = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will cost some authority each week, but rebellions will be poorly armed.//
<<elseif $weaponsLaw == 1>>

''Heavy weaponry forbidden:'' set the range of weapons allowed within the arcology to non-heavy, non-explosive.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$weaponsLaw = 2, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will slightly increase prosperity, but will cost a small amount of authority each week and will leave rebellions decently armed.//

''Forbid weapons inside the arcology:'' forbid residents to buy, sell and keep weaponry while within the arcology.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$weaponsLaw = 0, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will cost a moderate amount of authority each week, but rebellions will be very poorly armed.//
<<elseif $weaponsLaw == 0>>

''Heavily restricted weaponry:'' set the range of weapons allowed within the arcology to non-automatic, non-high caliber.
	<<if $SecExp.core.authority >= 1000>>
		[[Implement|edicts][$weaponsLaw = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
	<<else>>

//Not enough Authority.//
	<</if>>

    //Will cost some authority each week, but rebellions will be poorly armed.//
<</if>>

<<if $hasFoughtOnce == 1 || $mercenaries > 0>>

__Defense Force__:

	<<if $soldierWages == 0>>

''Average wages for soldiers:'' will set the wages paid to the soldiers of the arcology to an average amount.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$soldierWages += 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will raise all units upkeep and push loyalty to average levels.//
	<<elseif $soldierWages == 1>>

''Low wages for soldiers:'' will set the wages paid to the soldiers of the arcology to a low amount.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$soldierWages -= 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will lower all units upkeep and push loyalty to low levels.//

''High wages for soldiers:'' will set the wages paid to the soldiers of the arcology to a high amount.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$soldierWages += 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will raise all units upkeep and push loyalty to high levels.//
	<<else>>

''Average wages for soldiers:'' will set the wages paid to the soldiers of the arcology to an average amount.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$soldierWages -= 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will lower all units upkeep and push loyalty to average levels.//
	<</if>>

	<<if $slavesOfficers == 0>>

''Slave Officers:'' allow your trusted slaves to lead the defense forces of the arcology.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$slavesOfficers = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will allow your bodyguard and Head Girl to lead troops into battle, but will cost a small amount of authority each week.//
	<</if>>

	<<if $mercenaries > 0>>
		<<if $discountMercenaries == 0>>

''Mercenary subsidy:'' mercenaries willing to immigrate in your arcology will be offered a discount on rent.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$discountMercenaries = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will slightly lower rent, but will increase the amount of available mercenaries.//
		<</if>>
	<</if>>

	<<if $militiaFounded == 0>>

''Found the militia:'' lay the groundwork for the formation of the arcology's citizens' army.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$militiaFounded = 1, $recruitVolunteers = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will allow for the recruitment and training of citizens.//
	<</if>>

	<<if $militiaFounded == 1>>
		<<if $recruitVolunteers == 0>>

''Volunteers' militia:'' only volunteers will be accepted in the militia.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$militarizedSociety = 0, $militaryService = 0, $conscription = 0, $recruitVolunteers = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will replenish militia manpower slowly and will cap at 2% of the total citizens population.//
		<</if>>
		<<if $conscription == 0>>

''Conscription:'' every citizen is required to train in the militia and serve the arcology if the need arises.
			<<if $SecExp.core.authority >= 4000>>
				[[Implement|edicts][$militarizedSociety = 0, $militaryService = 0, $conscription = 1, $recruitVolunteers = 0, cashX(-5000, "edicts"), $SecExp.core.authority -= 4000]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will replenish militia manpower moderately fast and will cap at 5% of the total citizens population, but has a high authority cost//
		<</if>>
		<<if $militaryService == 0>>

''Obligatory military service:'' every citizen is required to register and serve under the militia.
			<<if $SecExp.core.authority >= 6000>>
				[[Implement|edicts][$militarizedSociety = 0, $militaryService = 1, $conscription = 0, $recruitVolunteers = 0, cashX(-5000, "edicts"), $SecExp.core.authority -= 6000]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will quickly replenish militia manpower and will cap at 10% of the total citizens population, but has a very high authority cost//
		<</if>>
		<<if $militarizedSociety == 0>>

''Militarized Society:'' every adult citizen is required to train and participate in the defense of the arcology.
			<<if $SecExp.core.authority >= 8000>>
				[[Implement|edicts][$militarizedSociety = 1, $militaryService = 0, $conscription = 0, $recruitVolunteers = 0, cashX(-5000, "edicts"), $SecExp.core.authority -= 8000]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will very quickly replenish militia manpower and will cap at 20% of the total citizens population, but has an extremely high authority cost//
		<</if>>

		<<if $militaryExemption == 0 && ($conscription == 1 || $militaryService == 1 || $militarizedSociety == 1)>>

''Military exemption:'' allow citizens to avoid military duty by paying a weekly fee.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$militaryExemption = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will slow down the replenishment of manpower, but will supply cash each week. More profitable with stricter recruitment laws.//
		<</if>>

		<<if $arcologies[0].FSHedonisticDecadence >= 40>>
			<<if $lowerRquirements == 0>>

''@@.lime;Revised minimum requirements:@@'' will allow citizens outside the normally accepted range to join the militia.
				<<if $SecExp.core.authority >= 1000>>
					[[Implement|edicts][$lowerRquirements = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $militiaBaseDefense--, $militiaBaseHp--]]
				<<else>>

//Not enough Authority.//
				<</if>>

    //Will slightly lower defense and hp of militia units, but will increase the manpower replenishment rate.//
			<</if>>
		<</if>>

		<<if $arcologies[0].FSSubjugationist >= 40>>
			<<if $noSubhumansInArmy == 0>>

''@@.lime;No subhumans in the militia:@@'' prevent subhumans from joining the militia.
				<<if $SecExp.core.authority >= 1000>>
					[[Implement|edicts][$noSubhumansInArmy = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
				<<else>>

//Not enough Authority.//
				<</if>>

    //Will help advance racial Subjugation, but will slow down slightly manpower replenishment.//
			<</if>>
		<</if>>

		<<if $arcologies[0].FSRepopulationFocus >= 40 && ($conscription == 1 || $militaryService == 1 || $militarizedSociety == 1)>>
			<<if $pregExemption == 0>>

''@@.lime;Military exemption for pregnancies:@@'' pregnant citizens will be allowed, and encouraged, to avoid military service.
				<<if $SecExp.core.authority >= 1000>>
					[[Implement|edicts][$pregExemption = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
				<<else>>

//Not enough Authority.//
				<</if>>

    //Will help advance repopulation focus, but will slow down slightly manpower replenishment.//
			<</if>>
		<</if>>
	<</if>>

	<<if $militiaSoldierPrivilege == 0 && $militiaFounded == 1>>

''Special militia privileges'' will allow citizens joining the militia to avoid paying rent.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$militiaSoldierPrivilege = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will increase the loyalty of militia units, but will decrease rents.//
	<</if>>

	<<if $slaveSoldierPrivilege == 0>>

''Special slaves privileges'' will allow slaves drafted into the army to be able to have material possessions.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$slaveSoldierPrivilege = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will increase the loyalty of slave units, but will cost authority each week.//
	<</if>>

	<<if $mercSoldierPrivilege == 0 && $mercenaries > 0>>

''Special mercenary privileges'' will allow mercenaries under contract to claim part of the loot gained from battles.
		<<if $SecExp.core.authority >= 1000>>
			[[Implement|edicts][$mercSoldierPrivilege = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
		<<else>>

//Not enough Authority.//
		<</if>>

    //Will increase the loyalty of mercenary units, but will reduce cash and menial slaves gained from battles.//
	<</if>>

	<<if $arcologies[0].FSPhysicalIdealist >= 40>>
		<<if $martialSchool == 0>>

''@@.lime;Slave martial schools:@@'' specialized schools will be set up to train slaves in martial arts and bodyguarding.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$martialSchool = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $slaveBaseMorale += 5]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will slightly increase morale of slave units, but will incur upkeep costs.//
		<</if>>
	<</if>>

	<<if $arcologies[0].FSRestart >= 40>>
		<<if $eliteOfficers == 0>>

''@@.lime;Elite officers:@@'' officers will be exclusively recruited from the elite of society.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$eliteOfficers = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $militiaBaseMorale += 5, $slaveBaseMorale -= 5]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will help advance eugenics and provide a small morale boost to militia units, but will give a small morale malus to slave units.//
		<</if>>
	<</if>>

	<<if $arcologies[0].FSDegradationist >= 40>>
		<<if $liveTargets == 0>>

''@@.lime;Live targets drills:@@'' disobedient slaves will be used as live targets at shooting ranges.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$liveTargets = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will help advance degradationism and provide a small amount of exp to units, but will make the slave population slowly decline.//
		<</if>>
	<</if>>
<</if>>

<<if $FSAnnounced>>

__Future Societies:__
	<<if $arcologies[0].FSRomanRevivalist >= 40 && $militiaFounded == 1>>
		<<if $legionTradition == 0>>

''@@.lime;Legionaries traditions:@@'' Fund specialized training for your recruits to turn them into the professional of Roman tradition.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$legionTradition = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $militiaBaseDefense += 2, $militiaBaseMorale += 5, $militiaBaseHp++]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will increase defense, morale and hp of militia units, but will incur upkeep costs.//
		<</if>>
	<</if>>

	<<if $arcologies[0].FSEgyptianRevivalist >= 40 && $militiaFounded == 1>>
		<<if $pharaonTradition == 0>>

''@@.lime;Pharaonic traditions:@@'' Fund specialized training for your recruits to turn them into an army worthy of a pharaoh.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$pharaonTradition = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $militiaBaseAttack += 2, $militiaBaseDefense += 2, $militiaBaseMorale += 10]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will increase attack, defense and morale of militia units, but will incur upkeep costs.//
		<</if>>
	<</if>>

	<<if $arcologies[0].FSAztecRevivalist >= 40 && $mercenaries > 0>>
		<<if $eagleWarriors == 0>>

''@@.lime;Eagle warriors traditions:@@'' Fund specialized training for your mercenaries to turn them into the elite units of Aztec tradition.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$eagleWarriors = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $mercBaseAttack += 4, $mercBaseDefense -= 2, $mercBaseMorale += 10]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will give a high increase in attack and morale, but will lower defense of mercenary units and will incur upkeep costs.//
		<</if>>
	<</if>>

	<<if $arcologies[0].FSEdoRevivalist >= 40 && $mercenaries > 0>>
		<<if $ronin == 0>>

''@@.lime;Ronin traditions:@@'' Fund specialized training for your mercenaries to turn them into the errant samurai of Japanese tradition.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$ronin = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $mercBaseAttack += 2, $mercBaseDefense += 2, $mercBaseMorale += 10]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will increase attack, defense and morale of mercenary units, but will incur upkeep costs.//
		<</if>>
	<</if>>

	<<if $arcologies[0].FSArabianRevivalist >= 40>>
		<<if $mamluks == 0>>

''@@.lime;Mamluks traditions:@@'' Fund specialized training for your slaves to turn them into the mamluks slave soldiers of Arabian tradition.
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$mamluks = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $slaveBaseAttack += 2, $slaveBaseHp++, $slaveBaseMorale += 10]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will increase attack, morale and hp of slave units, but will incur upkeep costs.//
		<</if>>
	<</if>>

	<<if $arcologies[0].FSChineseRevivalist >= 40>>
		<<if $sunTzu == 0>>

''@@.lime;Sun Tzu Teachings:@@'' Fund specialized training for your units and officers to conform your army to the teachings of the "Art of War".
			<<if $SecExp.core.authority >= 1000>>
				[[Implement|edicts][$sunTzu = 1, cashX(-5000, "edicts"), $SecExp.core.authority -= 1000, $militiaBaseAttack++, $militiaBaseDefense++, $mercBaseAttack++, $mercBaseDefense++, $slaveBaseAttack++, $slaveBaseDefense++, $militiaBaseMorale += 5, $mercBaseMorale += 5, $slaveBaseMorale += 5]]
			<<else>>

//Not enough Authority.//
			<</if>>

    //Will slightly increase attack, defense and morale of all units, but will incur upkeep costs.//
		<</if>>
	<</if>>
<</if>>

repo_name: KnightBoulegard/fc

license: mit


code:
globalThis.SecExpBase = function() {
	return new App.SecExp.SecurityExpansionState();
};

App.SecExp.upkeep = function(input = '') {
	let value = 0;
	if (input === 'edictsCash') {
		const vars = ['slaveWatch', 'subsidyChurch', 'martialSchool',
		'legionTradition', 'pharaonTradition', 'eagleWarriors', 'ronin',
		'mamluks', 'sunTzu', 'tradeLegalAid', 'propCampaignBoost'];
			for(let i = 0; i < vars.length; i++) {
				if (jsDef(V[vars[i]]) && V[vars[i]] > 0) {
					value += 1000;
				}
			}
		} else if (input === 'edictsAuth') {
			if(V.enslavementRights > 0) {
				value += 10;
			}
			if (V.sellData === 1) {
				value += 10;
			}
			if (V.slaveSoldierPrivilege === 1) {
				value += 10;
			}
			if (V.weaponsLaw === 0) {
				value += 30;
			} else if (V.weaponsLaw === 2) {
				value += 10;
			} else if (V.weaponsLaw === 1) {
				value += 20;
			}
			if (V.slavesOfficers === 1) {
				value += 10;
			}
		} else if(input === 'SF') {
			if(V.SFSupportLevel >= 1) {
				value += 1000;
			}
			if (V.SFSupportLevel >= 2) {
				value += 2000;
			}
			if (V.SFSupportLevel >= 3) {
				value += 3000;
			}
			if (V.SFSupportLevel >= 4) {
				value += 3000;
			}
			if (V.SFSupportLevel >= 5) {
				value += 4000;
			}
		} else if (input === 'buildings') {
				const base = V.facilityCost * 5, upgrade = 50;
				let buildingUgradePool = [];
				if (V.propHub > 0) {
					value += base;
					buildingUgradePool.push(V.SecExp.buildings.propHub.campaign);
					buildingUgradePool.push(V.SecExp.buildings.propHub.miniTruth);
					buildingUgradePool.push(V.SecExp.buildings.propHub.fakeNews);
					buildingUgradePool.push(V.SecExp.buildings.propHub.controlLeaks);
					buildingUgradePool.push(V.SecExp.buildings.propHub.secretService);
					buildingUgradePool.push(V.SecExp.buildings.propHub.blackOps);
					buildingUgradePool.push(V.SecExp.buildings.propHub.marketInfiltration);
					for(let i = 0; i < buildingUgradePool; i++) {
						if(i > 0) {
							value += upgrade*buildingUgradePool[i];
						}
					}
				}
				if (V.secHQ > 0) {
					value += base + 20 * V.secMenials;
					buildingUgradePool.push(V.secUpgrades);
					buildingUgradePool.push(V.crimeUpgrades);
					buildingUgradePool.push(V.readinessUpgrades);
					buildingUgradePool.push(V.intelUpgrades);
					for(let i = 0; i < buildingUgradePool; i++) {
						if(i > 0) {
							value += upgrade*buildingUgradePool[i];
						}
					}
					if(V.SFSupportLevel >= 5) {
						value += 1000;
					}
				}
				if (V.secBarracks > 0) {
					value += base;
					buildingUgradePool.push(V.SecExp.buildings.barracks.upgrades);
					for(let i = 0; i < buildingUgradePool; i++) {
						if(i > 0) {
							value += upgrade*buildingUgradePool[i];
						}
					}
				}
				if (V.riotCenter > 0) {
					value += base;
					buildingUgradePool.push(V.riotUpgrades);
					for(let i = 0; i < buildingUgradePool; i++) {
						if(i > 0) {
							value += upgrade*buildingUgradePool[i];
						}
					}
					if(V.brainImplant < 106 && V.brainImplantProject > 0) {
						value += 5000*V.brainImplantProject;
					}
					if (V.SF.Toggle && V.SF.Active >= 1 && V.SFGear > 0) {
						value += 15000;
					}
				}
		}
			// break;
		return value;
}; // Closes upkeep function.

App.SecExp.conflict = (function() {
	"use strict";
	return {
		deployedUnits:deployedUnits,
		troopCount:troopCount,
	};

	function deployedUnits(input = '') {
		let bots = 0, militiaC = 0, slavesC = 0, mercsC = 0, init = 0;
		if(V.slaveRebellion !== 1 && V.citizenRebellion !== 1) {
			if(V.secBots.isDeployed > 0) {
				bots++;
			}
			if(passage() !== "attackOptions") {
				if (V.SF.Toggle && V.SF.Active >= 1 && V.SFIntervention) { // battle
					init++;
				}
			}
			if(V.slaveRebellion+V.citizenRebellion > 0) {
				if (V.SF.Toggle && V.SF.Active >= 1) { // rebellion
					init++;
				}
				if(V.irregulars > 0) {
					militiaC++;
				}
			}

			const Militia = V.militiaUnits.length;
			for(let i = 0; i < Militia; i++) {
				if(V.militiaUnits[i].isDeployed > 0) {
					militiaC++;
				}
			}

			const Slaves = V.slaveUnits.length;
			for(let i = 0; i < Slaves; i++) {
				if(V.slaveUnits[i].isDeployed > 0) {
					slavesC++;
				}
			}

			const Mercs = V.mercUnits.length;
			for(let i = 0; i < Mercs; i++) {
				if(V.mercUnits[i].isDeployed > 0) {
					mercsC++;
				}
			}
		} else {
			if(V.secBots.active > 0) {
				bots++;
			}
			if(passage() !== "attackOptions") {
				if (V.SF.Toggle && V.SF.Active >= 1 && V.SFIntervention) { // battle
					init++;
				}
			}
			if(V.slaveRebellion+V.citizenRebellion > 0) {
				if (V.SF.Toggle && V.SF.Active >= 1) { // rebellion
					init++;
				}
				if(V.irregulars > 0) {
					militiaC++;
				}
			}

			const Militia = V.militiaUnits.length;
			for(let i = 0; i < Militia; i++) {
				if(V.militiaUnits[i].active > 0) {
					militiaC++;
				}
			}

			const Slaves = V.slaveUnits.length;
			for(let i = 0; i < Slaves; i++) {
				if(V.slaveUnits[i].active > 0) {
					slavesC++;
				}
			}

			const Mercs = V.mercUnits.length;
			for(let i = 0; i < Mercs; i++) {
				if(V.mercUnits[i].active > 0) {
					mercsC++;
				}
			}
		}

		if(input === '') {
			return bots+militiaC+slavesC+mercsC+init;
		} else if(input === 'bots') {
			return bots;
		} else if(input === 'militia') {
			return militiaC;
		} else if(input === 'slaves') {
			return slavesC;
		} else if(input === 'mercs') {
			return mercsC;
		}
	}

	function troopCount() {
		let troops = 0;

		if (V.attackThisWeek === 1) {
			if (V.secBots.isDeployed === 1) {
				troops += V.secBots.troops;
			}
			for(let i = 0; i < V.militiaUnits.length; i++) {
				if (V.militiaUnits[i].isDeployed === 1) {
					troops += V.militiaUnits[i].troops;
				}
			}
			for(let i = 0; i < V.slaveUnits.length; i++) {
				if (V.slaveUnits[i].isDeployed === 1) {
					troops += V.slaveUnits[i].troops;
				}
			}
			for(let i = 0; i < V.mercUnits.length; i++) {
				if (V.mercUnits[i].isDeployed === 1) {
					troops += V.mercUnits[i].troops;
				}
			}
			if (V.SF.Toggle && V.SF.Active >= 1 && V.SFIntervention) {
				troops += V.carriableSoldiers;
			}
		} else if (V.slaveRebellion === 1 || V.citizenRebellion === 1) {
			if (V.irregulars > 0) {
				troops += V.irregulars;
			}
			if (V.secBots.active === 1) {
				troops += V.secBots.troops;
			}
			for(let i = 0; i < V.militiaUnits.length; i++) {
				if (V.militiaUnits[i].active === 1 && V.loyalID.includes(V.militiaUnits[i].ID)) {
					troops += V.militiaUnits[i].troops;
				}
			}
			for(let i = 0; i < V.slaveUnits.length; i++) {
				if (V.slaveUnits[i].active === 1 && V.loyalID.includes(V.slaveUnits[i].ID)) {
					troops += V.slaveUnits[i].troops;
				}
			}
			for(let i = 0; i < V.mercUnits.length; i++) {
				if (V.mercUnits[i].active === 1 && V.loyalID.includes(V.mercUnits[i].ID)) {
					troops += V.mercUnits[i].troops;
				}
			}
			if (V.SF.Toggle && V.SF.Active >= 1) {
				troops += V.carriableSoldiers;
			}
		}
		return troops;
	}
})();

App.SecExp.battle = (function() {
	"use strict";
	return {
		deploySpeed:deploySpeed,
		deployableUnits:deployableUnits,
		activeUnits:activeUnits,
		maxUnits:maxUnits,
		recon:recon,
		bribeCost:bribeCost,
	};

	function deploySpeed() {
		let init = 1;
		if(V.readinessUpgrades.pathways > 0) {
			init += 1;
		}
		if(V.readinessUpgrades.rapidVehicles > 0) {
			init += 2;
		}
		if(V.readinessUpgrades.rapidPlatforms > 0) {
			init += 2;
		}
		if(V.readinessUpgrades.earlyWarn > 0) {
			init += 2;
		}
		if( V.SF.Toggle && V.SF.Active >= 1 && V.sectionInFirebase >= 1) {
			init += 2;
		}
		return init;
	}

	function deployableUnits() {
		let init = 2 * App.SecExp.battle.deploySpeed();
		if(V.secBots.isDeployed > 0) {
			init--;
		}

		const Militia = V.militiaUnits.length;
		for(let i = 0; i < Militia; i++) {
			if(V.militiaUnits[i].isDeployed > 0) {
				init--;
			}
		}

		const Slaves = V.slaveUnits.length;
		for(let i = 0; i < Slaves; i++) {
			if(V.slaveUnits[i].isDeployed > 0) {
				init--;
			}
		}

		const Mercs = V.mercUnits.length;
		for(let i = 0; i < Mercs; i++) {
			if(V.mercUnits[i].isDeployed > 0) {
				init--;
			}
		}

		if(init < 0) {
			init = 0;
		}
		return init;
	}

	function activeUnits() {
		return V.secBots.isDeployed + V.militiaUnits.length + V.slaveUnits.length + V.mercUnits.length;
	}

	function maxUnits() {
		let max = 8 + (V.SecExp.buildings.barracks.upgrades.size * 2);
		if(App.SecExp.battle.deploySpeed() === 10) {
			max += 2;
		}
		return max;
	}

	function recon() {
		let recon = 0;
		if (V.intelUpgrades.sensors > 0) {
			recon++;
		}
		if (V.intelUpgrades.signalIntercept > 0) {
			recon++;
		}
		if (V.intelUpgrades.radar > 0) {
			recon++;
		}
		return recon;
	}

	function bribeCost() {
		let cost; const baseBribePerAttacker = 5;
		if (V.week <= 30) {
			cost = 5000 + baseBribePerAttacker * V.attackTroops;
		} else if (V.week <= 40) {
			cost = 10000 + baseBribePerAttacker * V.attackTroops;
		} else if (V.week <= 50) {
			cost = 15000 + baseBribePerAttacker * V.attackTroops;
		} else if (V.week <= 60) {
			cost = 20000 + baseBribePerAttacker * V.attackTroops;
		} else if (V.week <= 70) {
			cost = 25000 + baseBribePerAttacker * V.attackTroops;
		}
		if (V.majorBattle > 0) {
			cost *= 3;
		}
		cost = Math.trunc(Math.clamp(cost, 0, 1000000));
		return cost;
	}
})();

App.SecExp.Check = (function() {
	"use strict";
	return {
		general:general,
		secRestPoint:secRestPoint,
		crimeCap:crimeCap,
		reqMenials:reqMenials,
	};

	function general() {
		V.secBots = V.secBots || {};
		if (jsDef(V.secExp)) {
			if (V.secExpEnabled !== 1) {
				V.secExpEnabled = V.secExp;
			}
			delete V.secExp;
		}
		if (typeof V.secExpEnabled !== "number") {
			V.secExpEnabled = 0;
		}
		V.SecExp = V.SecExp || SecExpBase();
		V.SecExp.settings = V.SecExp.settings || {};
		delete V.SecExp.settings.show;

		delete V.SecExp.army;

		if (V.secExpEnabled > 0) {
			Object.assign(V.secBots, {
				active: V.secBots.active || V.arcologyUpgrade.drones > 0 ? 1 : 0,
				ID: -1,
				isDeployed: V.secBots.isDeployed || 0,
				troops: Math.max(V.secBots.troops, V.arcologyUpgrade.drones > 0 ? 30 : 0),
				maxTroops: Math.max(V.secBots.maxTroops, V.arcologyUpgrade.drones > 0 ? 30 : 0)
			});

			V.SecExp.core = V.SecExp.core || {};

			V.SecExp.core.trade = V.SecExp.core.trade || 0;
			if (passage() === "Acquisition" || V.SecExp.core.trade === 0) {
				let init = jsRandom(20, 30);
				if (V.terrain === "urban") {
					init += jsRandom(10, 10);
				} else if (V.terrain === "ravine") {
					init -= jsRandom(5, 5);
				}
				if (["BlackHat", "capitalist", "celebrity", "wealth"].includes(V.PC.career)) {
					init += jsRandom(5, 5);
				} else if (["escort", "gang", "servant"].includes(V.PC.career)) {
					init -= jsRandom(5, 5);
				}
				V.SecExp.core.trade = init;
			}
			if (jsDef(V.trade)) {
				V.SecExp.core.trade = V.trade;
			}

			V.SecExp.core.authority = V.SecExp.core.authority || 0;
			if (jsDef(V.authority)) {
				V.SecExp.core.authority = V.authority;
			}

			V.SecExp.security = V.SecExp.security || {};
			V.SecExp.security.cap = V.SecExp.security.cap || 100;
			if (jsDef(V.security)) {
				V.SecExp.security.cap = V.security;
			}
			V.SecExp.core.crimeLow = V.SecExp.core.crimeLow || 30;
			if (jsDef(V.crime)) {
				V.SecExp.core.crimeLow = V.crime;
			}

			V.SecExp.settings.difficulty = V.SecExp.settings.difficulty || 1;
			if (jsDef(V.difficulty)) {
				V.SecExp.settings.difficulty = V.difficulty;
			}

			V.SecExp.settings.battle = V.SecExp.settings.battle || {};
			V.SecExp.settings.battle.enabled = V.SecExp.settings.battle.enabled || 1;
			if (jsDef(V.battlesEnabled)) {
				V.SecExp.settings.battle.enabled = V.battlesEnabled;
			}
			delete V.SecExp.battle;

			V.SecExp.settings.battle.major = V.SecExp.settings.battle.major || {};
			V.SecExp.settings.battle.frequency = V.SecExp.settings.battle.frequency || 1;
			if (jsDef(V.battleFrequency)) {
				V.SecExp.settings.battle.frequency = V.battleFrequency;
			}
			V.SecExp.settings.battle.force = V.SecExp.settings.battle.force || 0;
			if (jsDef(V.forceBattle)) {
				V.SecExp.settings.battle.force = V.forceBattle;
			}

			if (jsDef(V.readiness)) {
				if(V.readiness === 10) {
					V.sectionInFirebase = 1;
				}
			}

			V.SecExp.settings.unitDescriptions = V.SecExp.settings.unitDescriptions || 0;

			V.SecExp.settings.battle.allowSlavePrestige = V.SecExp.settings.battle.allowSlavePrestige || 1;
			if (jsDef(V.allowPrestigeFromBattles)) {
				V.SecExp.settings.battle.allowSlavePrestige = V.allowPrestigeFromBattles;
			}

			V.SecExp.settings.battle.major.enabled = 0;
			if (jsDef(V.majorBattlesEnabled)) {
				V.SecExp.settings.battle.major.enabled = V.majorBattlesEnabled;
			}

			V.SecExp.settings.battle.major.gameOver = V.SecExp.settings.battle.major.gameOver || 1;
			if (jsDef(V.majorBattleGameOver)) {
				V.SecExp.settings.battle.major.gameOver = V.majorBattleGameOver;
			}
			V.SecExp.settings.battle.major.force = V.SecExp.settings.battle.major.force || 0;
			if (jsDef(V.forceMajorBattle)) {
				V.SecExp.settings.battle.major.force = V.forceMajorBattle;
			}

			delete V.SecExp.settings.battle.major.mult;

			V.SecExp.settings.rebellion = V.SecExp.settings.rebellion || {};
			V.SecExp.settings.rebellion.enabled = V.SecExp.settings.rebellion.enabled || 1;
			if (jsDef(V.rebellionsEnabled)) {
				V.SecExp.settings.rebellion.enabled = V.rebellionsEnabled;
			}

			V.SecExp.settings.rebellion.force = V.SecExp.settings.rebellion.force || 0;
			if (jsDef(V.forceRebellion)) {
				V.SecExp.settings.rebellion.force = V.forceRebellion;
			}
			V.SecExp.settings.rebellion.gameOver = V.SecExp.settings.rebellion.gameOver || 1;
			if (jsDef(V.rebellionGameOver)) {
				V.SecExp.settings.rebellion.gameOver = V.rebellionGameOver;
			}

			V.SecExp.settings.rebellion.speed = V.SecExp.settings.rebellion.speed || 1;
			if (jsDef(V.rebellionSpeed)) {
				V.SecExp.settings.rebellion.speed = V.rebellionSpeed;
			}

			if (V.SecExp.settings.battle.enabled + V.SecExp.settings.rebellion.enabled > 0) {
				V.SecExp.settings.showStats = V.SecExp.settings.showStats || 0;
				if (jsDef(V.showBattleStatistics)) {
					V.SecExp.settings.showStats = V.showBattleStatistics;
				}
			}

			V.SecExp.buildings = V.SecExp.buildings || {};
			V.SecExp.buildings.propHub = V.SecExp.buildings.propHub || {};
			V.SecExp.buildings.propHub.active = V.SecExp.buildings.propHub.active || 0;
			if (V.SecExp.buildings.pr === null) {
				delete V.SecExp.buildings.pr;
			}
			if (jsDef(V.SecExp.buildings.pr)) {
				V.SecExp.buildings.propHub = V.SecExp.buildings.pr;
				delete V.SecExp.buildings.pr;
			}
			if (jsDef(V.propHub)) {
				V.SecExp.buildings.propHub.active = V.propHub;
			}

			if (V.SecExp.buildings.propHub.active > 0) {
				V.SecExp.buildings.propHub.recuriterOffice = V.SecExp.buildings.propHub.recuriterOffice || 0;
				V.SecExp.buildings.propHub.campaign = V.SecExp.buildings.propHub.campaign || 0;
				if (jsDef(V.propCampaign)) {
					V.SecExp.buildings.propHub.campaign = V.propCampaign;
				}

				V.SecExp.buildings.propHub.miniTruth = V.SecExp.buildings.propHub.miniTruth || 0;
				if (jsDef(V.miniTruth)) {
					V.SecExp.buildings.propHub.miniTruth = V.miniTruth;
				}

				V.SecExp.buildings.propHub.secretService = V.SecExp.buildings.propHub.secretService || 0;
				if (jsDef(V.secretService)) {
					V.SecExp.buildings.propHub.secretService = V.secretService;
				}
				if (jsDef(V.SecExp.buildings.propHub.SS)) {
					V.SecExp.buildings.propHub.secretService = V.SecExp.buildings.propHub.SS;
					delete V.SecExp.buildings.propHub.SS;
				}

				if (V.SecExp.buildings.propHub.campaign >= 1) {
					V.SecExp.buildings.propHub.focus = V.SecExp.buildings.propHub.focus || "social engineering";
					if (jsDef(V.propFocus) && V.propFocus !== "none") {
						V.SecExp.buildings.propHub.focus = V.propFocus;
					}
				}

				if (jsDef(V.RecuriterOffice)) {
					V.recuriterOffice = V.RecuriterOffice;
				}
				const vars = ['recuriterOffice', 'fakeNews', 'controlLeaks', 'marketInfiltration', 'blackOps'];
				for(let i = 0; i < vars.length; i++) {
					if (jsDef(V[vars[i]]) && V[vars[i]] > 0) {
						V.SecExp.buildings.propHub[vars[i]] = V[vars[i]];
						delete V[vars[i]];
					} else {
						V.SecExp.buildings.propHub[vars[i]] = V.SecExp.buildings.propHub[vars[i]] || 0;
					}
				}
			}

			V.SecExp.buildings.barracks = V.SecExp.buildings.barracks || {};
			V.SecExp.buildings.barracks.active = V.SecExp.buildings.barracks.active || 0;
			if (jsDef(V.secBarracks)) {
				V.SecExp.buildings.barracks.active = V.secBarracks;
			}

			if (V.SecExp.buildings.barracks.active > 0) {
				V.SecExp.buildings.barracks.upgrades = V.SecExp.buildings.barracks.upgrades || {};
				V.SecExp.buildings.barracks.upgrades.size = V.SecExp.buildings.barracks.upgrades.size || 0;
				V.SecExp.buildings.barracks.upgrades.luxury = V.SecExp.buildings.barracks.upgrades.luxury || 0;
				V.SecExp.buildings.barracks.upgrades.training = V.SecExp.buildings.barracks.upgrades.training || 0;
				V.SecExp.buildings.barracks.upgrades.loyaltyMod = V.SecExp.buildings.barracks.upgrades.loyaltyMod || 0;
				if (jsDef(V.secBarracksUpgrades)) {
					V.SecExp.buildings.barracks.upgrades = V.secBarracksUpgrades;
				}
			}

			V.SecExp.proclamation = V.SecExp.proclamation || {};
			V.SecExp.proclamation.cooldown = V.SecExp.proclamation.cooldown || 0;
			if (jsDef(V.proclamationsCooldown)) {
				V.SecExp.proclamation.cooldown = V.proclamationsCooldown;
			}
			V.SecExp.proclamation.currency = V.SecExp.proclamation.currency || "";
			if (jsDef(V.proclamationCurrency)) {
				V.SecExp.proclamation.currency = V.proclamationCurrency;
			}
			V.SecExp.proclamation.type = V.SecExp.proclamation.type || "crime";
			if (jsDef(V.proclamationType)) {
				if (V.proclamationType !== "none") {
					V.SecExp.proclamation.type = V.proclamationType;
				}
			}
		}

		if (jsDef(V.SecExp.core)) {
			delete V.SecExp.core.crimeCap;
		}
	} // Closes general check function.

	function secRestPoint() {
		let rest = 40;

		if(V.secUpgrades.nanoCams === 1) {
			rest += 15;
		}
		if(V.secUpgrades.cyberBots === 1) {
			rest += 15;
		}
		if(V.secUpgrades.eyeScan === 1) {
			rest += 20;
		}
		if(V.secUpgrades.cryptoAnalyzer === 1) {
			rest += 20;
		}

		return rest;
	}

	function crimeCap() {
		let cap = 100;

		if(V.crimeUpgrades.autoTrial === 1) {
			cap -= 10;
		}
		if(V.crimeUpgrades.autoArchive === 1) {
			cap -= 10;
		}
		if(V.crimeUpgrades.worldProfiler === 1) {
			cap -= 15;
		}
		if(V.crimeUpgrades.advForensic === 1) {
			cap -= 15;
		}

		return cap;
	}

	function reqMenials() {
		let Req = 20;

		if(V.secUpgrades.nanoCams === 1) {
			Req += 5;
		}
		if(V.secUpgrades.cyberBots === 1) {
			Req += 5;
		}
		if(V.secUpgrades.eyeScan === 1) {
			Req += 10;
		}
		if(V.secUpgrades.cryptoAnalyzer === 1) {
			Req += 10;
		}
		if(V.crimeUpgrades.autoTrial === 1) {
			Req += 5;
		}
		if(V.crimeUpgrades.autoArchive === 1) {
			Req += 5;
		}
		if(V.crimeUpgrades.worldProfiler === 1) {
			Req += 10;
		}
		if(V.crimeUpgrades.advForensic === 1) {
			Req += 10;
		}
		if(V.intelUpgrades.sensors === 1) {
			Req += 5;
		}
		if(V.intelUpgrades.signalIntercept === 1) {
			Req += 5;
		}
		if(V.intelUpgrades.radar === 1) {
			Req += 10;
		}
		if(V.readinessUpgrades.rapidVehicles === 1) {
			Req += 5;
		}
		if(V.readinessUpgrades.rapidPlatforms === 1) {
			Req += 10;
		}
		if(V.readinessUpgrades.earlyWarn === 1) {
			Req += 10;
		}
		if(V.SFSupportLevel >= 1) {
			Req -= 5 * V.SFSupportLevel;
		}
		if(V.secUpgrades.coldstorage >= 1) {
			Req -= 10 * V.secUpgrades.coldstorage;
		}

		return Req;
	}
})();

App.SecExp.unit = (function() {
	return {
		dec:description,
	};

	function description(input, unitType = '') {
		let r = ``;
		if (V.SecExp.settings.unitDescriptions === 0) {
			if (unitType !== "Bots") {
				r += `\n<strong>${input.platoonName}</strong> `;
			} else {
				r += `\nThe drone unit is made up of ${input.troops} drones. `;
			}

			if (unitType !== "Bots") {
					if(input.battlesFought > 1) {
						r += `has participated in ${input.battlesFought} battles and is ready to face the enemy once more at your command. `;
					} else if (input.battlesFought === 1) {
						r += `is ready to face the enemy once more at your command. `;
					} else {
						r += `is ready to face the enemy in battle. `;
					}
				r += `\nIt's ${input.troops} men and women are `;

				if(unitType === "Militia") {
					r += `all proud citizens of your arcology, willing to put their lives on the line to protect their home. `;
				} else if (unitType === "Slaves") {
					r += `slaves in your possession, tasked with the protection of their owner and their arcology. `;
				} else if (unitType === "Mercs") {
				r += `mercenaries contracted to defend the arcology against external threats. `;
				}
			} else {
				r += `All of which are assembled in an ordered formation in front of you, absolutely silent and ready to receive their orders. `;
			}

			if(input.troops < input.maxTroops) {
				r += `The unit is not at its full strength of ${input.maxTroops} operatives. `;
			}

			if(unitType !== "Bots") {
				if(input.equip === 0) {
					r += `They are issued with simple, yet effective equipment: firearms, a few explosives and standard uniforms, nothing more. `;
				} else if (input.equip === 1) {
					r += `They are issued with good, modern equipment: firearms, explosives and a few specialized weapons like sniper rifles and machine guns. They also carry simple body armor. `;
				} else if (input.equip === 2) {
					r += `They are issued with excellent, high tech equipment: modern firearms, explosives, specialized weaponry and modern body armor. They are also issued with modern instruments like night vision and portable radars. `;
				} else {
					r += `They are equipped with the best the modern world has to offer: modern firearms, explosives, specialized weaponry, experimental railguns, adaptive body armor and high tech recon equipment. `;
				}
			} else {
				if(input.equip === 0) {
					r += `They are equipped with light weaponry, mainly anti-riot nonlethal weapons. Not particularly effective in battle. `;
				} else if (input.equip === 1) {
					r += `They are equipped with light firearms, not an overwhelming amount of firepower, but with their mobility good enough to be effective. `;
				} else if (input.equip === 2) {
					r += `They are equipped with powerful, modern firearms and simple armor mounted around their frames. They do not make for a pretty sight, but on the battlefield they are a dangerous weapon. `;
				} else {
					r += `They are equipped with high energy railguns and adaptive armor. They are a formidable force on the battlefield, even for experienced soldiers. `;
				}
			}

			if(unitType !== "Bots") {
				if(input.training <= 33) {
					r += `They lack the experience to be considered professionals, but `;
				if (input === "Militia") {
					r += `their eagerness to defend the arcology makes up for it. `;
					} else if (unitType === "Slaves") {
						r += `their eagerness to prove themselves makes up for it. `;
					} else if (unitType === "Mercs") {
						r += `they're trained more than enough to still be an effective unit. `;
					}
				} else if (input.training <= 66) {
					r += `They have trained `;
					if (input.battlesFought > 0) {
						r += `and fought `;
					}
					r += `enough to be considered disciplined, professional soldiers, ready to face the battlefield. `;
				} else {
					r += `They are consummate veterans, with a wealth of experience and perfectly trained. On the battlefield they are a well oiled war machine capable of facing pretty much anything. `;
				}

				if(input.loyalty < 10) {
					r += `The unit is extremely disloyal. Careful monitoring of their activities and relationships should be implemented. `;
				} else if (input.loyalty < 33) {
					r += `Their loyalty is low. Careful monitoring of their activities and relationships is advised. `;
				} else if (input.loyalty < 66) {
					r += `Their loyalty is not as high as it can be, but they are not actively working against their arcology owner. `;
				} else if (input.loyalty < 90) {
					r += `Their loyalty is high and strong. The likelihood of this unit betraying the arcology is low to non-existent. `;
				} else {
					r += `The unit is fanatically loyal. They would prefer death over betrayal. `;
				}

				if (input.cyber > 0) {
					r += `The soldiers of the unit have been enhanced with numerous cyberaugmentations which greatly increase their raw power. `;
				}
				if (input.medics > 0) {
					r += `The unit has a dedicated squad of medics that will follow them in battle. `;
				}
				if(V.SF.Toggle && V.SF.Active >= 1 && input.SF > 0) {
					r += `The unit has attached "advisors" from ${V.SF.Lower} that will help the squad remain tactically aware and active. `;
				}
			}
		} else if (V.SecExp.settings.unitDescriptions > 0) {
			if (unitType !== "Bots") {
				r += `\n${input.platoonName}. `;
			} else {
				r += `Drone squad. `;
			}
			r += `Unit size: ${input.troops}. `;
			r += `Equipment quality: `;
			if (input.equip === 0) {
				r += `basic. `;
			} else if (input.equip === 1) {
				r += `average. `;
			} else if (input.equip === 2) {
				r += `high. `;
			} else {
				r += `advanced. `;
			}
			if (jsDef(input.battlesFought)) {
				r += `Battles fought: ${input.battlesFought}. `;
			}
			if (jsDef(input.training)) {
				r += `\nTraining: `;
				if (input.training <= 33) {
					r += `low. `;
				} else if(input.training <= 66) {
					r += `medium. `;
				} else {
					r += `high. `;
				}
			}
			if (jsDef(input.loyalty)) {
				r += `Loyalty: `;
				if(input.loyalty < 10) {
						r += `extremely disloyal. `;
					} else if (input.loyalty < 33) {
						r += `low. `;
					} else if (input.loyalty < 66) {
						r += `medium. `;
					} else if (input.loyalty < 90) {
						r += `high. `;
					} else {
						r += `fanatical. `;
					}
			}
			if (jsDef(input.cyber) && input.cyber > 0) {
				r += `\nHave been cyberaugmentated. `;
			}
			if (jsDef(input.medics) && input.medics > 0) {
				r += `Has a medic squad attached. `;
			}
			if(V.SF.Toggle && V.SF.Active >= 1 && jsDef(input.SF) || input.SF > 0) {
				r += `${App.SF.Caps()} "advisors" are attached. `;
			}
		}

		if (!input.active) {
			r += `<br>This unit has lost too many operatives `;
			if (jsDef(input.battlesFought)) {
				r += `in the ${input.battlesFought} it fought `;
			}
			r += `and can no longer be considered a unit at all.`;
		}
		return r;
	}
})();


code:
App.SecExp.majorBattleState = class {
	constructor() {
		this.enabled = 1;
		this.gameOver = 1;
		this.force = 0;
		this.mult = 1;
	}
};

App.SecExp.battleState = class {
	constructor() {
		this.enabled = 1;
		this.frequency = 1;
		this.force = 0;
		this.allowSlavePrestige = 1;
		this.major = new App.SecExp.majorBattleState();
	}
};

App.SecExp.rebellionState = class {
	constructor() {
		this.enabled = 1;
		this.gameOver = 1;
		this.force = 0;
		this.speed = 1;
	}
};

App.SecExp.settingsState = class {
	constructor() {
		this.difficulty = 1;
		this.unitDescriptions = 0;
		this.showStats = 0;
		this.battle = new App.SecExp.battleState();
		this.rebellion = new App.SecExp.rebellionState();
	}
};

App.SecExp.coreState = class {
	constructor() {
		this.trade = 0;
		this.authority = 0;
		this.crimeLow = 30;
	}
};

App.SecExp.securityState = class {
	constructor() {
		this.cap = 100;
	}
};

App.SecExp.propHubState = class {
	constructor() {
		this.active = 0;
		this.recuriterOffice = 0;
		this.campaign = 0;
		this.miniTruth = 0;
		this.secretService = 0;
		this.fakeNews = 0;
		this.controlLeaks = 0;
		this.marketInfiltration = 0;
		this.blackOps = 0;
		this.focus = "social engineering";
	}
};

App.SecExp.barracksUpgradesState = class {
	constructor() {
		this.size = 0;
		this.luxury = 0;
		this.training = 0;
		this.loyaltyMod = 0;
	}
};

App.SecExp.barracksState = class {
	constructor() {
		this.active = 0;
		this.upgrades = new App.SecExp.barracksUpgradesState();
	}
};

App.SecExp.buildingState = class {
	constructor() {
		this.propHub = new App.SecExp.propHubState();
		this.barracks = new App.SecExp.barracksState();
	}
};

App.SecExp.proclamationState = class {
	constructor() {
		this.cooldown = 0;
		this.currency = "cash";
		this.type = "crime";
	}
};

App.SecExp.SecurityExpansionState = class SecurityExpansionState {
	constructor() {
		this.settings = new App.SecExp.settingsState();
		this.core = new App.SecExp.coreState();
		this.security = new App.SecExp.securityState();
		this.buildings = new App.SecExp.buildingState();
		this.proclamation = new App.SecExp.buildingState();
	}

	/** Creates an object suitable for setting nested attributes as it would be a SecurityExpansionState
		* @returns {object} object containing all the attributes
		* that are complex objects in the SecurityExpansionState class
		*/
	static makeSecExpSkeleton() {
		return {
			settings: {
				battle: {
					major: {}
				},
				rebellion: {},
			},
			core: {},
			security: {},
			buildings: {
				propHub: {},
				barracks: {
					upgrades: {}
				},
			},
			proclamation: {},
		};
	}
};


code:
:: proclamations [nobr]

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

<<if $SecExp.proclamation.cooldown == 0>>
	__Issue a proclamation:__

You can dedicate the week to issuing a proclamation, a powerful tool that will have an immediate noticeable effect on the arcology.

You will use $SecExp.proclamation.currency to enact it and will be about $SecExp.proclamation.type.

Use:
	<<if $SecExp.core.authority >= 2000>>
		<<link "authority" "Personal Attention Select">>
			<<set $SecExp.proclamation.currency = "authority">>
		<</link>>
	<<else>>
		//Requires at least <<= num(2000)>> authority//
	<</if>>
	|
	<<if $rep >= 4000>>
		<<link "reputation" "Personal Attention Select">>
			<<set $SecExp.proclamation.currency = "reputation">>
		<</link>>
	<<else>>
		//Requires at least <<= num(4000)>> reputation//
	<</if>>
	|
	<<if $cash >= 8000>>
		<<link "cash" "Personal Attention Select">>
			<<set $SecExp.proclamation.currency = "cash">>
		<</link>>
	<<else>>
		//Requires at least <<print cashFormat(8000)>> cash//
	<</if>>
	<<if $SecExp.proclamation.currency != "">>

		<<link "Issue a proclamation about security" "Main">>
			<<set $personalAttention = "proclamation", $SecExp.proclamation.type = "security">>
		<</link>>

//You will use your <<if $SecExp.proclamation.currency == "authority">>control over the arcology<<elseif $SecExp.proclamation.currency == "reputation">>great influence<<elseif $SecExp.proclamation.currency == "cash">> vast financial means<</if>>
		to force citizens to give up on sensitive information for the good of the arcology.//

		<<link "Issue a proclamation about crime" "Main">>
			<<set $personalAttention = "proclamation", $SecExp.proclamation.type = "crime">>
		<</link>>

//You will use your <<if $SecExp.proclamation.currency == "authority">>control over the arcology<<elseif $SecExp.proclamation.currency == "reputation">>great influence<<elseif $SecExp.proclamation.currency == "cash">> vast financial means<</if>>
		to force the arrest of suspected citizens without passing through the normal legal procedures.//
	<</if>>
<<else>>
	It's too early to issue another proclamation. Another will be available in <<if $SecExp.proclamation.cooldown == 1>> one week.<<else>> $SecExp.proclamation.cooldown weeks.<</if>>
<</if>>


code:
:: rebellionEvents [nobr]

<<if $slaveRebellionEventFires == 1>>
	<<if $tension <= 33>>
		<<set _event = 1>>
	<<elseif $tension <= 66>>
		<<set _event = 2>>
	<<else>>
		<<set _event = 3>>
	<</if>>
<<elseif $citizenRebellionEventFires == 1>>
	<<if $tension <= 33>>
		<<set _event = 4>>
	<<elseif $tension <= 66>>
		<<set _event = 5>>
	<<else>>
		<<set _event = 6>>
	<</if>>
<</if>>

<<setNonlocalPronouns $seeDicks>>
<<switch _event>>
<<case 1>>
	/* low tension slave rebellion events */
	<<set _rand = random(0,6)>>
	<<if _rand == 0>>
		This week several slaves were found plotting the death of their master. They were quickly dealt with, but their owner's choice of punishment did little to calm tensions in the arcology.
	<<elseif _rand == 1>>
		This week a large group of slaves attempted to escape. Several were recaptured, but others were deemed too dangerous and were shot on sight. The unfortunate circumstances raised the disapproval of many citizens, either because of the waste of good slaves or the brutality with which the operation was carried. With a bit of luck, however, the incident will be soon forgotten.
	<<elseif _rand == 2>>
		This week books of unknown origin and dangerous content were found in the possession of several slaves. They were mostly sociopolitical treaties, making it clear that the intent of the ones responsible was to fan the fire of rebellion. The books were quickly collected and archived, hopefully this affair will not have lasting consequences.
	<<elseif _rand == 3>>
		This week a citizen was caught giving refuge to an escaped slave. He was not able to pay for the value of the stolen goods, so he was processed as the case required and the slave returned to their rightful master. Many questions however remain without answers.
	<<elseif _rand == 4>>
		This week a member of a well known anti-slavery group was caught trying to infiltrate the arcology. During the capture attempt shots were fired and several guards were injured, and in the end the fugitive unfortunately managed to escape. Reports indicate several slaves helped the criminal, some going as far as using themselves as shields against the bullets of the security drones.
	<<elseif _rand == 5>>
		This week a slave was caught attempting to sabotage a machine in one of the factories. _HeU explained _hisU action as "trying to defend _himselfU from a dangerous machine". Reports confirmed that the apparatus is indeed quite deadly, having killed several slaves since it was installed, but the expert way _heU handled the sabotage leaves open the possibility of a deliberate plan or even external help.
	<<else>>
		This week a slave was found dead in one of the sewer tunnels. It seems _heU was stabbed repeatedly with a sharp object. _HeU was fairly famous for _hisU capabilities as a slave trainer; _hisU old master spent not an insignificant amount of money trying to find _himU once he realized _heU was missing. The episode might have been a simple mugging gone wrong, but _hisU activities as a slave breaker might have played a role in _hisU homicide.
	<</if>>
	<<set $tension += random(1,5)>>
<<case 2>>
	/* med tension slave rebellion events */
	<<set _rand = random(0,5)>>
	<<if _rand == 0>>
		This week some strange reports came in: it seems some assemblies of slaves were observed several nights in a row. The slaves were traced and their masters notified, but many suspect there may be something deeper than a few slaves congregating in the night.
	<<elseif _rand == 1>>
		This week an underground railroad was discovered. The rebels did not go down without a fight, but in the end <<if $mercenaries >= 1>>your mercenaries<<else>>your security drones<</if>> managed to destroy the old tunnels they were using to ship out slaves out of the arcology.
	<<elseif _rand == 2>>
		This week a famous citizen was assaulted and brutally murdered by his slaves. The ones responsible were apprehended and dealt with easily enough, but the mere fact something like this could have happened is concerning. Those slaves had to be aware of their certain doom.
	<<elseif _rand == 3>>
		This week a group of slavers entering the arcology was assaulted. Many reported heavy injuries, but fortunately there were no casualties. The attackers were disguised, but the security systems already identified several slaves who were likely part of the group, based on camera feeds.
	<<elseif _rand == 4>>
		This week the waterways were found infected by a virulent pathogen. The cause was later found to be a diseased slave that died while in the maintenance tunnels. It's not clear if the slave was there because of orders given to _himU or if _heU was trying to escape.
	<<else>>
		This week a sleeper cell of a famous anti slavery organization was discovered in the low levels of the arcology. The group, however, was aware of the coming security forces and retreated before they could be dealt with.
	<</if>>
	<<set $tension += random(5,10)>>
<<case 3>>
	/* high tension slave rebellion events */
	<<set _rand = random(0,4)>>
	<<if _rand == 0>>
		This week a group of slaves took control of one of the manufacturing plants and barricaded themselves inside. It took several days of negotiations and skirmishes to finally end this little insurrection. Many of the slaves involved will be executed in the next few days.
	<<elseif _rand == 1>>
		This week a number of shops were burned to the ground by rioting slaves and sympathetic citizens. It took considerable effort for the security forces to take control of the situation. Harsh punishment is required and scheduled for the instigators.
	<<elseif _rand == 2>>
		This week a mass escape attempt was barely stopped before becoming a catastrophe. Many citizens were trampled by the desperate horde of slaves. It will take some time to restore the streets involved to working order.
	<<elseif _rand == 3>>
		This week a number of riots inflamed the arcology. Many slaves took violent actions against citizens and security personnel. The number of victims keeps getting higher as still now the last sparks of revolt are still active.
	<</if>>
	<<set $tension += random(10,15)>>
<<case 4>>
	<<set _rand = random(0,6)>>
	<<if _rand == 0>>
		This week a citizen refused to pay rent, claiming ideological opposition to the arcology's ownership policies. He was quickly dealt with, but his words might not have fallen silent yet.
	<<elseif _rand == 1>>
		This week books of unknown origin and dangerous content were found in the possession of several citizens. They were mostly sociopolitical treaties, making it clear that the intent of the ones responsible was to fan the fire of rebellion. Most of them were bought and archived, but a few are still circling amongst the citizens of the arcology.
	<<elseif _rand == 2>>
		This week a citizen was caught giving refuge to other citizens, who would be liable to be enslaved because of their debts. The situation was quickly resolved, but the misplaced generosity of that citizen might have inflamed a few souls.
	<<elseif _rand == 3>>
		This week a citizen died in one of the factories. His death sparked some outrage, even some talk of protests against the owners of the factory, but things seem to have calmed down for now.
	<<elseif _rand == 4>>
		This week a citizen refused to be evicted from his house. After some negotiations the man was forcibly removed from the property by your security forces. Unfortunately the forced entry caused some damage to the building.
	<<elseif _rand == 5>>
		This week a citizen refused to be enslaved as his contract established. With an impressive display of his rhetoric capabilities he managed to gather a small crowd agreeing with his position. The impromptu assembly was promptly disrupted by the drones.
	<<else>>
		This week a security drone was found disabled and stripped of important electronic components. It seems the act was not dictated by greed, as the most precious parts of the drone were left on the machine, but rather to cover up something that the drone saw.
	<</if>>
	<<set $tension += random(1,5)>>
<<case 5>>
	<<set _rand = random(0,5)>>
	<<if _rand == 0>>
		This week a factory was subject to a strike by a group of citizens protesting against the owner. They were promptly arrested and the factory returned to its rightful proprietor by your security department.
	<<elseif _rand == 1>>
		This week a group of citizens organized a protest against the systemic enslavement of the citizens of the arcology. Their little parade gathered a surprisingly large crowd, but it was nonetheless quickly suppressed by your forces.
	<<elseif _rand == 2>>
		This week the security department registered the formation of several assemblies of citizens, whose purpose seems to be political in nature. For now no further steps were taken, but it's a worrying sign of further political opposition within the arcology.
	<<elseif _rand == 3>>
		This week there was a protest against one of the wealthiest citizen of the arcology. Many criticize his near monopoly. Supporters of the citizen met the protesters on the streets and it was just thanks to the intervention of the security drones that violence was avoided.
	<<elseif _rand == 4>>
		This week several cameras were sabotaged and in many cases damaged beyond repair. A group of anonymous citizens claims to be responsible; their motivation is apparently the excessive surveillance in the arcology and their attack a response to the breach of their privacy.
	<<else>>
		This week several citizens barricaded themselves in a private brothel. It seems their intention is to protest against the use of ex-citizens in the sex trade, claiming that such a position is unfitting for them. The problem was quickly resolved with the intervention of the security department.
	<</if>>
	<<set $tension += random(5,10)>>
<<case 6>>
	<<set _rand = random(0,4)>>
	<<if _rand == 0>>
		This week the arcology was shaken by a number of strikes throughout the manufacturing levels. Many lament the predatory nature of Free Cities society, many other just want to cause damage to their perceived oppressors. It was a significant effort for the security department to stop all protests.
	<<elseif _rand == 1>>
		This week several factories were set aflame by their workers. The security department worked day and night to control the fire and apprehend the criminals behind the act. Many are known dissidents, but there are a fair few new faces within them. This is a worrying sign.
	<<elseif _rand == 2>>
		This week numerous riots exploded all over the arcology. Many citizens took to the streets to protest against the arcology owner and its supporters. The security forces slowly managed to stop the rioters, with no small amount of trouble and only through generous use of violence.
	<<elseif _rand == 3>>
		This week a massive protest of citizens and slaves gathered just outside the penthouse. The crowd was dispersed only after several hours. There were several victims from both sides and no shortage of injured.
	<</if>>
	<<set $tension += random(10,15)>>
<</switch>>

<<set $tension = Math.clamp($tension,0,100)>>