From 5653720052e865ac1bea48e045bb79384eabd10f Mon Sep 17 00:00:00 2001
From: hexall90 <hexall90@gmail.com>
Date: Thu, 25 Jan 2018 17:25:25 +0100
Subject: [PATCH] fixing smiling man

---
 src/SecExp/SecExpBackwardCompatibility.tw |  3 -
 src/SecExp/secExpSmilingMan.tw            | 70 ++++++++++-------------
 src/SecExp/secInit.tw                     |  1 -
 3 files changed, 29 insertions(+), 45 deletions(-)

diff --git a/src/SecExp/SecExpBackwardCompatibility.tw b/src/SecExp/SecExpBackwardCompatibility.tw
index 063e79d6b0f..5cc80af14c0 100644
--- a/src/SecExp/SecExpBackwardCompatibility.tw
+++ b/src/SecExp/SecExpBackwardCompatibility.tw
@@ -516,9 +516,6 @@
 <<if ndef $collaborationRoute>>
 <<set $collaborationRoute = 0>>
 <</if>>
-<<if ndef $hostileRoute>>
-<<set $hostileRoute = 0>>
-<</if>>
 <<if ndef $smilingManWeek>>
 <<set $smilingManWeek = 0>>
 <</if>>
diff --git a/src/SecExp/secExpSmilingMan.tw b/src/SecExp/secExpSmilingMan.tw
index 63d2fe04799..249fc4a14f0 100644
--- a/src/SecExp/secExpSmilingMan.tw
+++ b/src/SecExp/secExpSmilingMan.tw
@@ -18,51 +18,39 @@
 	<br>
 	<span id="result">
 	<br>
-	<<link "Devote funds to the search for this dangerous criminal">>
-		<<if $cash >= 10000>>
-			<<set $cash -= 10000>>
+	<<if $cash >= 10000>>
+		<<link "Devote funds to the search for this dangerous criminal">>
 			<<set $investedFunds = 1>>
-		<<else>>
-			<<set $investedFunds += cash>>
-			<<set $cash = 0>>
-		<</if>>
-		<<set $relationshipLM += 1>>
-		<<set $smilingManProgress += 1>>
-		<<replace "#result">>
-			You devote funds to capture and neutralize the threat. You cannot help but wonder what is the end game of the laughing man. Money? Fame? Or is he on an ideological crusade?
-		<</replace>>
-	<</link>>
-	<br>
-	<<link "Attempt to contact the mysterious figure, whatever it takes">>
-		<<if $cash >= 10000>>
+			<<set $cash -= 10000>>
+			<<set $relationshipLM += 1>>
+			<<set $smilingManProgress += 1>>
+			<<replace "#result">>
+				You devote funds to capture and neutralize the threat. You cannot help but wonder what is the end game of the laughing man. Money? Fame? Or is he on an ideological crusade?
+			<</replace>>
+		<</link>>
+		<br>
+		<<link "Attempt to contact the mysterious figure, whatever it takes">>
 			<<set $cash -= 10000>>
 			<<set $investedFunds = 1>>
-		<<else>>
-			<<set $investedFunds += cash>>
-			<<set $cash = 0>>
-		<</if>>
-		<<set $relationshipLM += 2>>
-		<<set $smilingManProgress += 1>>
-		<<replace "#result">>
-			You devote funds to the attempt at communicating with the smiling man. You cannot help but wonder what is the end game of the laughing man. Money? Fame? Or is he on an ideological crusade?
-		<</replace>>
-	<</link>>
-	<br>
-	<<link "Invest funds to increase the cyber-security of the arcology">>
-		<<if $cash >= 10000>>
+			<<set $relationshipLM += 2>>
+			<<set $smilingManProgress += 1>>
+			<<replace "#result">>
+				You devote funds to the attempt at communicating with the smiling man. You cannot help but wonder what is the end game of the laughing man. Money? Fame? Or is he on an ideological crusade?
+			<</replace>>
+		<</link>>
+		<br>
+		<<link "Invest funds to increase the cyber-security of the arcology">>
 			<<set $cash -= 10000>>
 			<<set $investedFunds = 1>>
-		<<else>>
-			<<set $investedFunds += cash>>
-			<<set $cash = 0>>
-		<</if>>
-		<<set $relationshipLM += random(5,10)>>
-		<<set $hostileRoute -= 1>>
-		<<set $smilingManProgress += 1>>
-		<<replace "#result">>
-			You devote funds to the improvement of the cyber-security of your arcology. You cannot help but wonder what is the end game of the laughing man. Money? Fame? Or is he on an ideological crusade?
-		<</replace>>
-	<</link>>
+			<<set $relationshipLM += random(5,10)>>
+			<<set $smilingManProgress += 1>>
+			<<replace "#result">>
+				You devote funds to the improvement of the cyber-security of your arcology. You cannot help but wonder what is the end game of the laughing man. Money? Fame? Or is he on an ideological crusade?
+			<</replace>>
+		<</link>>
+	<<else>>
+		Not enough funds to take further action.
+	<</if>>
 	<br>
 	<<link "Ignore the issue">>
 		<<set $smilingManProgress += 1>>
@@ -87,7 +75,7 @@
 	<br>The lights flickered once more and an instant later your assistant returned to her usual self.
 	<br>"I... I... I couldn't stop him! I'm sorry <<if def $PC.customTitle>>$PC.customTitle<<elseif $PC.title != 0>>sir<<else>>ma'am<</if>>."
 	<br>Without wasting time you rush the console and check your finances. It's as you feared, @@.red;you have been robbed@@.
-	<<set _lostCash = 200000>>
+	<<set _lostCash = Math.clamp(50000 * Math.trunc($week / 20), 50000, 1000000>>
 	<<if $assistantPower == 1>>
 		<<set _lostCash -= 20000>>
 		<br>Fortunately the computing power available to $assistantName allowed her to somewhat limit the losses.
diff --git a/src/SecExp/secInit.tw b/src/SecExp/secInit.tw
index 4cf11973a3b..fe2c0b31c56 100644
--- a/src/SecExp/secInit.tw
+++ b/src/SecExp/secInit.tw
@@ -177,7 +177,6 @@
 <<set $relationshipLM = 0>>
 <<set $captureRoute = 0>>
 <<set $collaborationRoute = 0>>
-<<set $hostileRoute = 0>>
 <<set $smilingManWeek = 0>>
 <<set $globalCrisisWeeks = 0>>
 <<set $smilingManFate = 4>>
-- 
GitLab