From eeab5cf7859b7eae58e33b9432d64ef8b155fcf3 Mon Sep 17 00:00:00 2001
From: j <okp57855@psoxs.com>
Date: Fri, 29 Dec 2017 22:42:08 +1300
Subject: [PATCH]  Fixed second bug.

---
 .../SecForceEX/securityForceTradeShow.tw      | 27 ++++++++++---------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/pregmod/SecForceEX/securityForceTradeShow.tw b/src/pregmod/SecForceEX/securityForceTradeShow.tw
index d5fa523b7fb..9be6bdbe6e8 100644
--- a/src/pregmod/SecForceEX/securityForceTradeShow.tw
+++ b/src/pregmod/SecForceEX/securityForceTradeShow.tw
@@ -44,8 +44,7 @@ The (bi-yearly) security trade show has finally come around and even though you'
 	<<replace "#choice2">><br>
 	<br>"Thanks <<if def $PC.customTitle>>$PC.customTitle<<elseif $PC.title != 0>>sir<<else>>ma'am<</if>>"
 
-	<<set $CurrentTradeShowAttendanceGranted = 1, _TradeShowAttendes = 150, _BonusProviderPercentage = .15>>
-	<<set _MenialSlavesPerAttendee = 15>>
+	<<set $CurrentTradeShowAttendanceGranted = 1, _TradeShowAttendes = 150, _BonusProviderPercentage = .15, _MenialSlavesPerAttendee = 15>>
 	
 	<<include "SpecialForceUpgradeTree">>
 
@@ -73,6 +72,7 @@ The (bi-yearly) security trade show has finally come around and even though you'
 		<<set _TradingPower = 16>>
 	<</if>>
 
+	<<set _SuccesfulPersuationAttempt == 0>>
 	<<if ($SFNO || $SFO) < 10 && random(0,100)+_TradingPower > 90>>
 		<<set _SuccesfulPersuationAttempt = 1>>
 		<<set _PersuationBonus = 1.05>>
@@ -107,22 +107,23 @@ The (bi-yearly) security trade show has finally come around and even though you'
 		<<set _SuccesfulPersuationAttempt = 1>>
 		<<set _PersuationBonus = 1.10>>
 	<</if>>
+	
+	<<if _SuccesfulPersuationAttempt == 0>>
+		<<set _PersuationBonus = 1>>
+	<</if>>
 
-	<<set _RawMenialSlaves = random(0,_TradeShowAttendes)*_BonusProviderPercentage*_MenialSlavesPerAttendee*_PersuationBonus>>
-	<<set _SuccesfulPersuationAttempt = 0>>
-
-	<<set _RawProfit = ($cash*.010*$SFNO || $SFO*$arcologies[0].prosperity*$Env)*_PersuationBonus>>
-	<<set _ProcessedProfit = Math.trunc(_RawProfit)>>
+	<<set _MenialSlaves = Math.ceil(random(0,_TradeShowAttendes)*_BonusProviderPercentage*_MenialSlavesPerAttendee*_PersuationBonus)>>
+	<<set _Profit = Math.ceil($cash*.010*$SFNO || $SFO*$arcologies[0].prosperity*$Env)*_PersuationBonus>>
 
 		<br>During a break, The Colonel manages to sell some generic scematics to the _TradeShowAttendes people peresent, some decided to also give her some menial slaves as a bonus.
 
-			<<set $helots = $helots+_RawMenialSlaves>>
-			<<set $TradeShowHelots += _RawMenialSlaves>>
-			<<set $TotalTradeShowHelots += _RawMenialSlaves>>
+			<<set $helots = $helots+_MenialSlaves>>
+			<<set $TradeShowHelots += _MenialSlaves>>
+			<<set $TotalTradeShowHelots += _MenialSlaves>>
 
-			<<set $cash = $cash+_ProcessedProfit>>
-			<<set $TradeShowIncome += _ProcessedProfit>>
-			<<set $TotalTradeShowIncome += _ProcessedProfit>>
+			<<set $cash = $cash+_Profit>>
+			<<set $TradeShowIncome += _Profit>>
+			<<set $TotalTradeShowIncome += _Profit>>
 
 	<</replace>>
 	<</link>>
-- 
GitLab