From c541d89332f4f1a284230f4bf4d71aec6f033f40 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Thu, 1 Aug 2019 00:17:49 -0700
Subject: [PATCH] Maximum assistant power is currently 3; make some more code
 aware that assistant power greater than 2 is possible, so that the level 3
 upgrade doesn't actually make things worse.

---
 src/SecExp/attackHandler.tw               |  4 ++++
 src/SecExp/attackReport.tw                |  4 +++-
 src/SecExp/secExpSmilingMan.tw            | 11 +++++++----
 src/SecExp/tradeReport.tw                 |  2 +-
 src/uncategorized/neighborDescription.tw  |  2 +-
 src/uncategorized/neighborsDevelopment.tw |  2 +-
 6 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/SecExp/attackHandler.tw b/src/SecExp/attackHandler.tw
index 4616011f604..b7ab66137cb 100644
--- a/src/SecExp/attackHandler.tw
+++ b/src/SecExp/attackHandler.tw
@@ -225,6 +225,10 @@
 			<<set _defMod -= 0.10>>
 			<<set _tacChance -= 0.20>>
 		<<elseif $assistantPower == 2>>
+			<<set _atkMod += 0.10>>
+			<<set _defMod += 0.10>>
+			<<set _tacChance += 0.20>>
+		<<elseif $assistantPower >= 3>>
 			<<set _atkMod += 0.15>>
 			<<set _defMod += 0.15>>
 			<<set _tacChance += 0.30>>
diff --git a/src/SecExp/attackReport.tw b/src/SecExp/attackReport.tw
index 3a5a0aad145..f162afd99bb 100644
--- a/src/SecExp/attackReport.tw
+++ b/src/SecExp/attackReport.tw
@@ -917,7 +917,7 @@
 		<<if $deployingMercs == 1 || $deployingMilitia == 1 || $deployingSlaves == 1>>
 			No soldier trusts a computer to be their commander,
 			<<if _oldRep < 10000 && _oldAuth < 10000>>
-				no algorithm can substitute experience<<if $assistantPower == 0>>and as expected<<else>>, however, <</if>>
+				no algorithm can substitute experience, <<if $assistantPower == 0>>and as expected, <<else>>however, <</if>>
 			<<else>>
 				but they trust you enough to not question your decision<<if $assistantPower == 0>>, however<<else>>, <</if>>
 			<</if>>
@@ -929,6 +929,8 @@
 		<<elseif $assistantPower == 1>>
 			your assistant performs decently. While nothing to write home about your men are pleasantly surprised.
 		<<elseif $assistantPower == 2>>
+			your assistant performs admirably. _HisA upgraded computing power allows _himA to monitor the battlefield closely, enhancing the efficiency of your troops and the effectiveness of your battle plan.
+		<<elseif $assistantPower >= 3>>
 			your assistant performs admirably. _HisA vast computing power allows _himA to be everywhere on the battlefield, greatly enhancing the efficiency of your troops and the effectiveness of your battle plan.
 		<</if>>
 	<<elseif $leadingTroops == "bodyguard">>
diff --git a/src/SecExp/secExpSmilingMan.tw b/src/SecExp/secExpSmilingMan.tw
index b58a8526c21..7953ec802c9 100644
--- a/src/SecExp/secExpSmilingMan.tw
+++ b/src/SecExp/secExpSmilingMan.tw
@@ -80,18 +80,21 @@
 	<br>You waste no time in rushing to the console and checking your finances. It's as you feared, @@.red;you have been robbed.@@
 	<<set _lostCash = Math.clamp(50000 * Math.trunc($week / 20), 50000, 1000000)>>
 	<<if $assistantPower == 1>>
-		<<set _lostCash -= 20000>>
+		<<set _lostCash -= Math.min(20000, _lostCash)>>
 		<br>Fortunately, the computing power available to $assistantName allowed _himA to somewhat limit the losses.
 	<<elseif $assistantPower == 2>>
-		<<set _lostCash -= 30000>>
+		<<set _lostCash -= Math.min(30000, _lostCash)>>
 		<br>Fortunately, the computing power available to $assistantName allowed _himA to limit the losses.
+	<<elseif $assistantPower >= 3>>
+		<<set _lostCash -= Math.min(40000, _lostCash)>>
+		<br>Fortunately, the computing power available to $assistantName allowed _himA to significantly limit the losses.
 	<</if>>
 	<<if $secUpgrades.cyberBots == 1>>
-		<<set _lostCash -= 30000>>
+		<<set _lostCash -= Math.min(30000, _lostCash)>>
 		The additional cyber defenses acquired and running in the security HQ <<if _lostCash < 200000>>further<</if>> limit the damage.
 	<</if>>
 	<<if $investedFunds == 1>>
-		<<set _lostCash -= 20000>>
+		<<set _lostCash -= Math.min(20000, _lostCash)>>
 		The funding you dedicated to the Smiling Man case saved some of the assets that would have been otherwise lost.
 	<</if>>
 	<<run cashX(forceNeg(_lostCash), "event")>>
diff --git a/src/SecExp/tradeReport.tw b/src/SecExp/tradeReport.tw
index eaefe588a9c..d7be2a36b3f 100644
--- a/src/SecExp/tradeReport.tw
+++ b/src/SecExp/tradeReport.tw
@@ -57,7 +57,7 @@
 <<if $assistantPower == 1>>
 	Thanks to the computing power available to _himA, $assistantName is able to guide the commercial development of the arcology to greater levels.
 	<<set _tradeChange++>>
-<<elseif $assistantPower == 2>>
+<<elseif $assistantPower >= 2>>
 	Thanks to the incredible computing power available to _himA, $assistantName is able to guide the commercial development of the arcology to greater levels.
 	<<set _tradeChange += 2>>
 <</if>>
diff --git a/src/uncategorized/neighborDescription.tw b/src/uncategorized/neighborDescription.tw
index d16585fddfe..163709184ab 100644
--- a/src/uncategorized/neighborDescription.tw
+++ b/src/uncategorized/neighborDescription.tw
@@ -36,7 +36,7 @@
 	<</if>>
 <</if>>
 <<if $arcologies[$i].PCminority > 0>>You own @@.lime;$arcologies[$i].PCminority%@@ of this arcology<<if (($arcologies[$i].government == "your trustees") || ($arcologies[$i].government == "your agent")) && $arcologies[$i].minority > $arcologies[$i].PCminority-10>>, a dangerously narrow margin over competition with a @@.red;<<print Math.trunc(($arcologies[$i].minority*random(100-$economicUncertainty,100+$economicUncertainty))/100)>>%@@ share<</if>>.<</if>>
-<<set $economicUncertainty -= 2*$assistantPower>>
+<<set $economicUncertainty -= Math.min(2*$assistantPower, $economicUncertainty)>>
 The arcology has an estimated GSP of @@.yellowgreen;<<print cashFormat(Math.trunc((0.1*$arcologies[$i].prosperity*random(100-$economicUncertainty,100+$economicUncertainty))/100))>>m,@@
 <<if Math.abs($arcologies[$i].prosperity - $averageProsperity) < 5>>
 	average among
diff --git a/src/uncategorized/neighborsDevelopment.tw b/src/uncategorized/neighborsDevelopment.tw
index 0c86f19588b..f89fc69162d 100644
--- a/src/uncategorized/neighborsDevelopment.tw
+++ b/src/uncategorized/neighborsDevelopment.tw
@@ -73,7 +73,7 @@
 <<else>>
 	<<set _error = 10>>
 <</if>>
-<<set _error -= 2*$assistantPower>>
+<<set _error -= Math.min(2*$assistantPower, _error)>>
 <<set _prosperity = (Math.trunc((0.1*$arcologies[$i].prosperity*random(100-_error,100+_error))/100))>>
 has an estimated GSP of @@.yellowgreen;<<print cashFormat(_prosperity)>><<if $showNumbers != 2>><<if ($showNumbers == 1) && (_prosperity > $showNumbersMax)>>m<<else>> million<</if>><<else>>m<</if>>,@@
 
-- 
GitLab