From 2d00f8dd56663ecd83dbb2b997d4de44d28b88ab Mon Sep 17 00:00:00 2001
From: Jones <Jones>
Date: Tue, 4 Dec 2018 15:11:59 +0100
Subject: [PATCH] Balance and visitors

Tried my hand at balancing the population impact on the mod a bit
Large amounts of visitors should also complicate security
---
 src/SecExp/rebellionGenerator.tw | 18 ++++-----
 src/SecExp/securityReport.tw     | 69 ++++++++++++++++++++------------
 2 files changed, 52 insertions(+), 35 deletions(-)

diff --git a/src/SecExp/rebellionGenerator.tw b/src/SecExp/rebellionGenerator.tw
index 42d83bfda29..7fef4f15e5f 100644
--- a/src/SecExp/rebellionGenerator.tw
+++ b/src/SecExp/rebellionGenerator.tw
@@ -20,17 +20,17 @@
 <<else>>
 	Your absolute authority does not allow slaves to have a single free thought.<<set _slave += 1>>
 <</if>>
-<<if _CSratio <= 0.2>>
+<<if _CSratio <= 0.4>>
 	There are a lot more slaves than citizens, making some doubt their masters are strong enough to stop them.<<set _slave += 30>>
-<<elseif _CSratio <= 0.4>>
-	There are a lot more slaves than citizens, making some doubt their masters are strong enough to stop them.<<set _slave += 25>>
 <<elseif _CSratio <= 0.6>>
-	There are more slaves than citizens, making some doubt their masters are strong enough to stop them.<<set _slave += 20>>
+	There are a lot more slaves than citizens, making some doubt their masters are strong enough to stop them.<<set _slave += 25>>
 <<elseif _CSratio <= 0.8>>
-	There are more slaves than citizens, making some doubt their masters are strong enough to stop them.<<set _slave += 15>>
+	There are more slaves than citizens, making some doubt their masters are strong enough to stop them.<<set _slave += 20>>
 <<elseif _CSratio <= 1>>
+	There are more slaves than citizens, making some doubt their masters are strong enough to stop them.<<set _slave += 15>>
+<<elseif _CSratio <= 1.5>>
 	There are fewer slaves than citizens, making some doubt they would be strong enough to defeat their masters.<<set _slave += 10>>
-<<elseif _CSratio >= 1.2>>
+<<elseif _CSratio >= 3>>
 	There are fewer slaves than citizens, making some doubt they would be strong enough to defeat their masters.<<set _slave -= 5>>
 <<else>>
 	Citizen and slave population is sufficiently balanced not to cause problems either way.<<set _slave -= 1>>
@@ -110,11 +110,11 @@
 	Many of your more conservative citizens do not enjoy the cultural freedom you afford the residents of the arcology.<<set _citizen += either(20,30)>>
 <</if>>
 <<if $arcologies[0].FSRestart != "unset">>
-	<<if _CSratio > 1>>
+	<<if _CSratio > 2>>
 		Your citizens are not happy with the noticeable lack of slaves compared to their numbers.<<set _citizen += 20>>
-	<<elseif _CSratio > 0.5>>
+	<<elseif _CSratio > 1>>
 		Your citizens are not happy with the lack of slaves compared to their numbers.<<set _citizen += 15>>
-	<<elseif _CSratio < 0.2>>
+	<<elseif _CSratio < 0.5>>
 		<<set _citizen -= 5>>
 	<</if>>
 <<elseif $arcologies[0].FSRepopulationFocus != "unset">>
diff --git a/src/SecExp/securityReport.tw b/src/SecExp/securityReport.tw
index 423a29a44ee..703cdd7f408 100644
--- a/src/SecExp/securityReport.tw
+++ b/src/SecExp/securityReport.tw
@@ -2,9 +2,11 @@
 
 /* init */
 <<if $ACitizens > $oldACitizens>>
-	<<set _immigration = $ACitizens - $oldACitizens>>
+	<<set _immigration = $ACitizens - $oldACitizens,
+	_emigration = 0>>
 <<else>>
-	<<set _emigration = $oldACitizens - $ACitizens>> /*takes into account citizens leaving and those getting enslaved*/
+	<<set _emigration = $oldACitizens - $ACitizens, /*takes into account citizens leaving and those getting enslaved*/
+	_immigration = 0>>
 <</if>>
 <<set _secGrowth = 0>>
 <<set _secRest = 0>>
@@ -48,38 +50,53 @@
 	The ex-criminal known to the world as The Smiling Man puts her impressive skills to work, dramatically increasing the efficiency of your security measures.
 	<<set _secGrowth += 2>>
 <</if>>
-<<if $ACitizens + $ASlaves <= 2000>>
+<<if $ACitizens + $ASlaves <= 5000>>
 	The small number of residents makes their job easier.<<set _secGrowth += 2>>
-<<elseif $ACitizens + $ASlaves <= 4000>>
+<<elseif $ACitizens + $ASlaves <= 7500>>
 	The fairly low number of residents makes their job a little easier.<<set _secGrowth += 1>>
-<<elseif $ACitizens + $ASlaves <= 6000>>
+<<elseif $ACitizens + $ASlaves <= 10000>>
 	The fairly high number of residents makes their job a little harder.<<set _secGrowth -= -0.5>>
-<<elseif $ACitizens + $ASlaves <= 8000>>
+<<elseif $ACitizens + $ASlaves <= 15000>>
 	The high number of residents makes their job harder.<<set _secGrowth -= 1>>
 <<else>>
 	The extremely high number of residents makes their job a lot harder.<<set _secGrowth -= 2>>
 <</if>>
-<<if _immigration < 25>>
-	The limited number of immigrants that reached the arcology this week does not have any serious impact on the efficiency of current security measures.<<set _secGrowth += 0.5>>
-<<elseif _immigration < 75>>
-	The number of immigrants that reached the arcology this week is high enough to complicate security protocols.<<set _secGrowth -= 0.2>>
-<<elseif _immigration < 150>>
-	The high number of immigrants that reached the arcology this week complicates security protocols.<<set _secGrowth -= 0.5>>
-<<elseif _immigration < 250>>
-	The high number of immigrants that reached the arcology this week severely complicates security protocols.<<set _secGrowth -= 1>>
-<<else>>
-	The extremely high number of immigrants that reached the arcology this week severely complicates security protocols.<<set _secGrowth -= 2>>
-<</if>>
-<<if _emigration < 50>>
-	The limited reduction in citizens this week does not have any serious impact on the efficiency of current security measures.<<set _secGrowth += 0.5>>
-<<elseif _emigration < 150>>
-	The reduction in citizens this week is high enough to complicate security protocols.<<set _secGrowth -= 0.2>>
-<<elseif _emigration < 300>>
-	The large reduction in citizens this week complicates security protocols.<<set _secGrowth -= 0.5>>
-<<elseif _emigration < 500>>
-	The huge reduction in citizens this week severely complicates security protocols.<<set _secGrowth -= 1>>
+<<if _immigration >= 0 && _emigration == 0>>
+	<<if _immigration < 50>>
+		The limited number of immigrants that reached the arcology this week does not have any serious impact on the efficiency of current security measures.<<set _secGrowth += 0.5>>
+	<<elseif _immigration < 150>>
+		The number of immigrants that reached the arcology this week is high enough to complicate security protocols.<<set _secGrowth -= 0.2>>
+	<<elseif _immigration < 300>>
+		The high number of immigrants that reached the arcology this week complicates security protocols.<<set _secGrowth -= 0.5>>
+	<<elseif _immigration < 500>>
+		The high number of immigrants that reached the arcology this week severely complicates security protocols.<<set _secGrowth -= 1>>
+	<<else>>
+		The extremely high number of immigrants that reached the arcology this week severely complicates security protocols.<<set _secGrowth -= 2>>
+	<</if>>
+<</if>>
+<<if $visitors < 300>>
+	The limited number of visitors coming and going did not have any serious impact on the efficiency of current security measures.<<set _secGrowth += 0.5>>
+<<elseif _immigration < 750>>
+	The number of visitors coming and going somewhat complicates security protocols.<<set _secGrowth -= 0.2>>
+<<elseif _immigration < 1500>>
+	The high number of visitors coming and going complicates security protocols.<<set _secGrowth -= 0.5>>
+<<elseif _immigration < 2500>>
+	The high number of visitors coming and going greatly complicates security protocols.<<set _secGrowth -= 1>>
 <<else>>
-	The extreme reduction in citizens this week severely complicates security protocols.<<set _secGrowth -= 2>>
+	The extremely high number of visitors coming and going severely complicates security protocols.<<set _secGrowth -= 2>>
+<</if>>
+<<if _emigration != 0 && _immigration == 0>>
+	<<if _emigration < 100>>
+		The limited reduction in citizens this week does not have any serious impact on the efficiency of current security measures.<<set _secGrowth += 0.5>>
+	<<elseif _emigration < 300>>
+		The reduction in citizens this week is high enough to complicate security protocols.<<set _secGrowth -= 0.2>>
+	<<elseif _emigration < 600>>
+		The large reduction in citizens this week complicates security protocols.<<set _secGrowth -= 0.5>>
+	<<elseif _emigration < 1000>>
+		The huge reduction in citizens this week severely complicates security protocols.<<set _secGrowth -= 1>>
+	<<else>>
+		The extreme reduction in citizens this week severely complicates security protocols.<<set _secGrowth -= 2>>
+	<</if>>
 <</if>>
 <<if $crime < 20>>
 	Crime is a distant problem in the arcology, which makes improving security easier.<<set _secGrowth += 1>>
-- 
GitLab