From 802dca152f1c43d54b2ed8835dbe5549c2112e63 Mon Sep 17 00:00:00 2001
From: x <okp57855@psoxs.com>
Date: Fri, 1 Jun 2018 00:43:23 +1200
Subject: [PATCH] Fixes I

---
 src/SecExp/propagandaHub.tw          | 20 ++++-----
 src/SecExp/riotControlCenter.tw      |  6 +--
 src/SecExp/seeUnit.tw                | 64 ++++++++++++++--------------
 src/SecExp/weaponsManufacturing.tw   |  6 +--
 src/uncategorized/SFMBarracks.tw     |  8 ++--
 src/uncategorized/generateXYSlave.tw |  7 ++-
 6 files changed, 54 insertions(+), 57 deletions(-)

diff --git a/src/SecExp/propagandaHub.tw b/src/SecExp/propagandaHub.tw
index 474231ed311..909e667de6d 100644
--- a/src/SecExp/propagandaHub.tw
+++ b/src/SecExp/propagandaHub.tw
@@ -27,7 +27,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 		<<goto "propagandaHub">>
 	<</link>>
 	<br>Set up a propaganda campaign to align your citizens with your goals.
-	<br>//Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology*_HistoryDiscount))>>. Will provide the focused resource each week, but will cost reputation in upkeep.//
+	<br>//Costs <<print cashFormat(5000*$upgradeMultiplierArcology*_HistoryDiscount)>>. Will provide the focused resource each week, but will cost reputation in upkeep.//
 <<else>>
 	You have set up a team of trained slaves and expert propagandists, ready to spread the message of your choosing to the population.
 	<br>
@@ -86,7 +86,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 			<<goto "propagandaHub">>
 		<</link>>
 		<br>Invest more resources into the project to increase its effectiveness.
-		<br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($propCampaign + 1) * _HistoryDiscount*$HackingSkillMultiplier))>>. Will provide more of the focused resource each week but increase reputation upkeep.//
+		<br>//Costs <<print cashFormat(5000 * $upgradeMultiplierArcology * ($propCampaign + 1) * _HistoryDiscount*$HackingSkillMultiplier)>>. Will provide more of the focused resource each week but increase reputation upkeep.//
 	<<else>>
 		You upgraded your propaganda machine to its limits.
 	<</if>>
@@ -104,7 +104,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 		<<goto "propagandaHub">>
 	<</link>>
 	<br>Set up a department tasked with guaranteeing the authenticity of all information available in the arcology. Of course if reality is against what is best for the arcology, then it should be redacted as well.
-	<br>//Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology * _HistoryDiscount))>>. Will provide authority and unlock special upgrades, but will increase upkeep.//
+	<br>//Costs <<print cashFormat(5000*$upgradeMultiplierArcology * _HistoryDiscount)>>. Will provide authority and unlock special upgrades, but will increase upkeep.//
 <<else>>
 	<<if $miniTruth < 5>>
 		<<link "Enlarge the authenticity department">>
@@ -114,7 +114,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 			<<goto "propagandaHub">>
 		<</link>>
 		<br>Invest more resources into the project to increase its effectiveness.
-		<br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($miniTruth + 1) * _HistoryDiscount))>>. Will provide more authority each week, but increases upkeep.//
+		<br>//Costs <<print cashFormat(5000 * $upgradeMultiplierArcology * ($miniTruth + 1) * _HistoryDiscount)>>. Will provide more authority each week, but increases upkeep.//
 	<<else>>
 		You have upgraded the authenticity department to its maximum.
 	<</if>>
@@ -127,7 +127,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 			<<goto "propagandaHub">>
 		<</link>>
 		<br>Install an automatic news generator, able to fabricate thousands of plausible sounding news every day.
-		<br>//Costs <<print cashFormat(Math.trunc(10000 * $upgradeMultiplierArcology * _HistoryDiscount))>>. The authenticity dept. now provides a small amount of reputation as well as authority, but increases upkeep.//
+		<br>//Costs <<print cashFormat(10000 * $upgradeMultiplierArcology * _HistoryDiscount)>>. The authenticity dept. now provides a small amount of reputation as well as authority, but increases upkeep.//
 	<<else>>
 		You have installed an automatic news generator. [[Remove news generator|propagandaHub][$fakeNews = 0, $propHubUpkeep -= $upgradeUpkeep]]
 	<</if>>
@@ -141,7 +141,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 			<<goto "propagandaHub">>
 		<</link>>
 		<br>Institute a system able to release erroneous, but plausible, information about your business, leading your competitors to prepared financial traps.
-		<br>//Costs <<print cashFormat(Math.trunc(10000 * $upgradeMultiplierArcology * _HistoryDiscount*$HackingSkillMultiplier))>>. The authenticity dept. now slightly increases prosperity each week as well as authority, but increases upkeep.//
+		<br>//Costs <<print cashFormat(10000 * $upgradeMultiplierArcology * _HistoryDiscount*$HackingSkillMultiplier)>>. The authenticity dept. now slightly increases prosperity each week as well as authority, but increases upkeep.//
 	<<else>>
 		You have instituted controlled leaks protocols, able to create fabricated leaks of sensible information. [[Shut down leak protocols|propagandaHub][$controlLeaks = 0, $propHubUpkeep -= $upgradeUpkeep]]
 	<</if>>
@@ -159,7 +159,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 		<<goto "propagandaHub">>
 	<</link>>
 	<br>Set up a department tasked with the protection of your person, as well as operations requiring a delicate approach.
-	<br>//Costs <<print cashFormat(Math.trunc(5000*$upgradeMultiplierArcology * _HistoryDiscount))>>. Will provide authority and unlock special upgrades, but will increase upkeep.//
+	<br>//Costs <<print cashFormat(10000*$upgradeMultiplierArcology * _HistoryDiscount)>>. Will provide authority and unlock special upgrades, but will increase upkeep.//
 <<else>>
 	<<if $secretService < 5 && $rep >= ($secretService * 1000) + 5000>>
 		<<link "Expand the secret service">>
@@ -169,7 +169,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 			<<goto "propagandaHub">>
 		<</link>>
 		<br>Invest more resources into the project to increase its effectiveness.
-		<br>//Costs <<print cashFormat(Math.trunc(5000 * $upgradeMultiplierArcology * ($secretService + 1) * _HistoryDiscount))>>. Will provide more authority each week, but increases upkeep.//
+		<br>//Costs <<print cashFormat(5000 * $upgradeMultiplierArcology * ($secretService + 1) * _HistoryDiscount)>>. Will provide more authority each week, but increases upkeep.//
 	<<elseif $secretService < 5>>
 		You lack the reputation to further expand operations.
 	<<else>>
@@ -184,7 +184,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 			<<goto "propagandaHub">>
 		<</link>>
 		<br>Create a black ops team, ready to carry out corporate sabotage and sensitive operations to further your goals.
-		<br>//Costs <<print cashFormat(Math.trunc(10000 * $upgradeMultiplierArcology * _HistoryDiscount))>>. The secret services now provides security as well as authority, but increases upkeep.//
+		<br>//Costs <<print cashFormat(10000 * $upgradeMultiplierArcology * _HistoryDiscount)>>. The secret services now provides security as well as authority, but increases upkeep.//
 	<<else>>
 		You have created a black ops team.
 	<</if>>
@@ -197,7 +197,7 @@ The propaganda hub is a surprisingly inconspicuous building, dimly lit from the
 			<<goto "propagandaHub">>
 		<</link>>
 		<br>Establish a presence on the black market in order to manipulate it.
-		<br>//Costs <<print cashFormat(Math.trunc(10000 * $upgradeMultiplierArcology * _HistoryDiscount))>>. The secret services now provides cash as well as authority each week, but will increase crime growth.//
+		<br>//Costs <<print cashFormat(10000 * $upgradeMultiplierArcology * _HistoryDiscount)>>. The secret services now provides cash as well as authority each week, but will increase crime growth.//
 	<<else>>
 		You have infiltrated the black market and are now in partial control of it. [[Withdraw from the black market|propagandaHub][$marketInfiltration = 0, $propHubUpkeep -= $upgradeUpkeep]]
 	<</if>>
diff --git a/src/SecExp/riotControlCenter.tw b/src/SecExp/riotControlCenter.tw
index 962d9b99dbb..5697f2d456b 100644
--- a/src/SecExp/riotControlCenter.tw
+++ b/src/SecExp/riotControlCenter.tw
@@ -150,17 +150,17 @@ The riot control center opens its guarded doors to you. The great chamber inside
 			<<set $riotUpkeep += 5000>>
 			<<goto "riotControlCenter">>
 		<</link>>
-		<br>//Will take weeks of work and will cost 5000 each week, but once finished rebellions will progress a lot slower.//
+		<br>//Will take weeks of work and will cost <<print cashFormat(5000)>> each week, but once finished rebellions will progress a lot slower.//
 	<<elseif $brainImplantProject < 5>>
 		<<link "Invest more resources in the brain implant project">>
 			<<set $brainImplantProject += 1>>
-			<<set $cash -= 50000 * $upgradeMultiplierArcology * $brainImplantProject*$HackingSkillMultiplier>> 
+			<<set $cash -= 50000 * $upgradeMultiplierArcology * $brainImplantProject*$HackingSkillMultiplier>>
 			<<set $PC.hacking += 1>>
 			<<set $riotUpkeep += 5000>>
 			<<goto "riotControlCenter">>
 		<</link>>
 		<br>Invest more resources into the project to increase its speed.
-		<br>//One-time cost of <<print cashFormat(Math.trunc(50000 * $upgradeMultiplierArcology * $brainImplantProject*$HackingSkillMultiplier))>> with an additional 5000 each week in maintenance. Will shorten the time required to complete the project.//
+		<br>//One-time cost of <<print cashFormat(Math.trunc(50000 * $upgradeMultiplierArcology * $brainImplantProject*$HackingSkillMultiplier))>> with an additional <<print cashFormat(5000)>> each week in maintenance. Will shorten the time required to complete the project.//
 	<<else>>
 		You sped up the project to its maximum.
 	<</if>>
diff --git a/src/SecExp/seeUnit.tw b/src/SecExp/seeUnit.tw
index b65c6460af6..2ad539ccd55 100644
--- a/src/SecExp/seeUnit.tw
+++ b/src/SecExp/seeUnit.tw
@@ -25,7 +25,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in the development of more refined controls for your drones to increase the maximum number of drones in the unit.
-		<br>//Costs 5000 per upgrade and each will increase the max by 10//
+		<br>//Costs <<print cashFormat(5000)>> per upgrade and each will increase the max by 10//
 	<<elseif $secBots.maxTroops < 100 && $SFSupportLevel >= 1>>
 		<br>
 		<<link "Refine the drone network with $securityForceName assistance">>
@@ -34,7 +34,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Utilize the technological developments made by $securityForceName to further improve the control matrix of the security drones.
-		<br>//Costs <<print 5000 + 10 * $secBotsUpgradeCost * $secBots.equip>> and will increase the max by 10//
+		<br>//Costs <<print cashFormat(5000 + 10 * $secBotsUpgradeCost * $secBots.equip)>> and will increase the max by 10//
 	<<elseif $SFSupportLevel < 1 && $securityForceCreate == 1>>
 		There's little left to improve in the matrix. However support from $securityForceName might give some more room from improvement.
 	<<else>>
@@ -48,7 +48,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in better equipment for your drones to increase their battle effectiveness.
-		<br>//Costs <<print (($secBotsUpgradeCost * $secBots.maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
+		<br>//Costs <<print cashFormat(($secBotsUpgradeCost * $secBots.maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
 	<<else>>
 		<br>
 		Your drones are equipped with top tier weaponry and armor.
@@ -60,7 +60,7 @@
 		<br>Equipment bonus: + <<print $secBots.equip * 15>>%
 		<br>Security drones base hp: $secBotsBaseHp <<if $droneUpgrades.hp > 0>> + 1 <</if>>
 		<br>Security drones base morale: $secBotsMorale
-	<</if>>	
+	<</if>>
 <<elseif $targetUnit == "militiaUnits">>
 	<<militiaUnitsDescription $militiaUnits[$targetIndex]>>
 	<br>
@@ -83,7 +83,7 @@
 			<</if>>
 			<<goto "seeUnit">>
 		<</link>>
-	<</if>>	
+	<</if>>
 	<br>
 	<<if $militiaUnits[$targetIndex].maxTroops < 50>>
 		<br>
@@ -93,7 +93,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in the training of your officers to increase the maximum number of soldiers in the unit.
-		<br>//Costs <<print 5000 + 10 * $equipUpgradeCost * ($militiaUnits[$targetIndex].equip + $militiaUnits[$targetIndex].commissars + $militiaUnits[$targetIndex].cyber + $militiaUnits[$targetIndex].SF)>> and will increase the max by 10//
+		<br>//Costs <<print cashFormat(5000 + 10 * $equipUpgradeCost * ($militiaUnits[$targetIndex].equip + $militiaUnits[$targetIndex].commissars + $militiaUnits[$targetIndex].cyber + $militiaUnits[$targetIndex].SF))>> and will increase the max by 10//
 	<<else>>
 		<br>
 		Your officers reached their peak. Further training will have little impact on the number of troops they can effectively lead.
@@ -106,7 +106,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in better equipment for your soldiers to increase their battle effectiveness.
-		<br>//Costs <<print ($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000>> and will increase attack and defense value of the unit by 15% for every upgrade.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
 	<<else>>
 		<br>
 		The unit is equipped with state of the art weaponry and equipment.
@@ -119,8 +119,8 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Attach a small squad of commissars to the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000>> and will slowly increase the loyalty of the unit.//
-	<<elseif $militiaUnits[$targetIndex].commissars < 2>>	
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000)>> and will slowly increase the loyalty of the unit.//
+	<<elseif $militiaUnits[$targetIndex].commissars < 2>>
 		<br>
 		<<link "Intensive loyalty training">>
 			<<set $militiaUnits[$targetIndex].commissars += 1>>
@@ -128,7 +128,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Provide special training for the officers and the commissars of the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000>> and will increase the loyalty of the unit faster.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000)>> and will increase the loyalty of the unit faster.//
 	<<elseif $militiaUnits[$targetIndex].commissars == 1>>
 		<br>The unit has a commissar detachment, keeping under control the ambitions of the unit's officers.
 	<<else>>
@@ -143,10 +143,10 @@
 				<<goto "seeUnit">>
 			<</link>>
 			Will augment all soldiers of the unit with high tech cyber enhancements.
-			<br>//Costs <<print ($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 2000>> and will increase attack, defense and base hp values of the unit.//
+			<br>//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 2000)>> and will increase attack, defense and base hp values of the unit.//
 		<<else>>
 			<br>The unit is equipped with advanced cybernetic enhancements.
-		<</if>>	
+		<</if>>
 	<</if>>
 	<<if $militiaUnits[$targetIndex].medics == 0>>
 		<br>
@@ -156,7 +156,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Attach a small squad of trained medics to the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000>> and will decrease the number of casualties suffered during battle.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 1000)>> and will decrease the number of casualties suffered during battle.//
 	<<else>>
 		<br>The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers.
 	<</if>>
@@ -169,12 +169,12 @@
 				<<goto "seeUnit">>
 			<</link>>
 			Attach $securityForceName advisors to the unit.
-			<br>//Costs <<print ($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 5000>> and will slightly increase the base stats of the unit.//
+			<br>//Costs <<print cashFormat(($equipUpgradeCost * $militiaUnits[$targetIndex].maxTroops) + 5000)>> and will slightly increase the base stats of the unit.//
 		<<else>>
-			<br>The unit has attached advisors from $securityForceName that will help the squad remain tactically aware and active. 
+			<br>The unit has attached advisors from $securityForceName that will help the squad remain tactically aware and active.
 		<</if>>
 	<</if>>
-	
+
 	<<if $showBattleStatistics == 1>>
 		<<if $militiaUnits[$targetIndex].training <= 10>>
 			<<set _expBonus = 0>>
@@ -265,7 +265,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in better equipment for your soldiers to increase their battle effectiveness.
-		<br>//Costs <<print ($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000>> and will increase attack and defense value of the unit by 15% for every upgrade.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
 	<<else>>
 		<br>The unit is equipped with state of the art weaponry and equipment.
 	<</if>>
@@ -277,7 +277,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Attach a small squad of commissars to the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000>> and will slowly increase the loyalty of the unit.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000)>> and will slowly increase the loyalty of the unit.//
 	<<elseif $slaveUnits[$targetIndex].commissars < 2>>
 		<br>
 		<<link "Intensive loyalty training">>
@@ -286,7 +286,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Provide special training for the officers and the commissars of the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000>> and will	increase the loyalty of the unit faster.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000)>> and will	increase the loyalty of the unit faster.//
 	<<elseif $slaveUnits[$targetIndex].commissars == 1>>
 		<br>The unit has a commissar detachment, keeping under control the ambitions of the unit's officers.
 	<<else>>
@@ -301,10 +301,10 @@
 				<<goto "seeUnit">>
 			<</link>>
 			Will augment all soldiers of the unit with high tech cyber enhancements.
-			<br>//Costs <<print ($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 2000>> and will increase attack, defense and base hp values of the unit.//
+			<br>//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 2000)>> and will increase attack, defense and base hp values of the unit.//
 		<<else>>
 			<br>The unit is equipped with advanced cybernetic enhancements.
-		<</if>>	
+		<</if>>
 	<</if>>
 	<<if $slaveUnits[$targetIndex].medics == 0>>
 		<br>
@@ -314,7 +314,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Attach a small squad of trained medics to the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000>> and will decrease the number of casualties suffered during battle.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 1000)>> and will decrease the number of casualties suffered during battle.//
 	<<else>>
 		<br>The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers.
 	<</if>>
@@ -327,7 +327,7 @@
 				<<goto "seeUnit">>
 			<</link>>
 			Attach $securityForceName advisors to the unit.
-			<br>//Costs <<print ($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 5000>> and will slightly increase the base stats of the unit.//
+			<br>//Costs <<print cashFormat(($equipUpgradeCost * $slaveUnits[$targetIndex].maxTroops) + 5000)>> and will slightly increase the base stats of the unit.//
 		<<else>>
 			<br>The unit has attached advisors from $securityForceName that will help the squad remain tactically aware and active.
 		<</if>>
@@ -410,7 +410,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in the training of your officers to increase the maximum number of soldiers in the unit.
-		<br>//Costs <<print 5000 + 10 * $equipUpgradeCost * ($mercUnits[$targetIndex].equip + $mercUnits[$targetIndex].commissars + $mercUnits[$targetIndex].cyber + $mercUnits[$targetIndex].SF)>> and will increase the max by 10//
+		<br>//Costs <<print cashFormat(5000 + 10 * $equipUpgradeCost * ($mercUnits[$targetIndex].equip + $mercUnits[$targetIndex].commissars + $mercUnits[$targetIndex].cyber + $mercUnits[$targetIndex].SF))>> and will increase the max by 10//
 	<<else>>
 		<br>Your officers reached their peak. Further training will have little impact on the number of troops they can effectively lead.
 	<</if>>
@@ -422,7 +422,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in better equipment for your soldiers to increase their battle effectiveness.
-		<br>//Costs <<print ($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000>> and will increase attack and defense value of the unit by 15% for every upgrade.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000)>> and will increase attack and defense value of the unit by 15% for every upgrade.//
 	<<else>>
 		<br>The unit is equipped with state of the art weaponry and equipment.
 	<</if>>
@@ -434,7 +434,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Attach a small squad of commissars to the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000>> and will slowly increase the loyalty of the unit.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000)>> and will slowly increase the loyalty of the unit.//
 	<<elseif $mercUnits[$targetIndex].commissars < 2>>
 		<br>
 		<<link "Intensive loyalty training">>
@@ -443,7 +443,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Provide special training for the officers and the commissars of the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000>> and will increase the loyalty of the unit faster.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 1000)>> and will increase the loyalty of the unit faster.//
 	<<elseif $mercUnits[$targetIndex].commissars == 1>>
 		<br>The unit has a commissar detachment, keeping under control the ambitions of the unit's officers.
 	<<else>>
@@ -457,10 +457,10 @@
 				<<set $cash -= $equipUpgradeCost * $mercUnits[$targetIndex].maxTroops + 2000>>
 				<<goto "seeUnit">>
 			<</link>>Will augment all soldiers of the unit with high tech cyber enhancements.
-			<br>//Costs <<print ($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 2000>> and will increase attack, defense and base hp values of the unit.//
+			<br>//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 2000)>> and will increase attack, defense and base hp values of the unit.//
 		<<else>>
 			<br>The unit is equipped with advanced cybernetic enhancements.
-		<</if>>	
+		<</if>>
 	<</if>>
 	<<if $mercUnits[$targetIndex].medics == 0>>
 		<br>
@@ -470,7 +470,7 @@
 			<<goto "seeUnit">>
 		<</link>>
 		Attach a small squad of trained medics to the unit.
-		<br>//Costs <<print ($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 5000>> and will decrease the number of casualties suffered during battle.//
+		<br>//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 5000)>> and will decrease the number of casualties suffered during battle.//
 	<<else>>
 		<br>The unit has a medic detachment following it into battle, decreasing the number of casualties the unit suffers.
 	<</if>>
@@ -483,7 +483,7 @@
 				<<goto "seeUnit">>
 			<</link>>
 			Attach $securityForceName advisors to the unit.
-			<br>//Costs <<print ($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 5000>> and will slightly increase the base stats of the unit.//
+			<br>//Costs <<print cashFormat(($equipUpgradeCost * $mercUnits[$targetIndex].maxTroops) + 5000)>> and will slightly increase the base stats of the unit.//
 		<<else>>
 			<br>The unit has attached advisors from $securityForceName that will help the squad remain tactically aware and active.
 		<</if>>
@@ -534,4 +534,4 @@
 			<br>Medics detachment bonus: +25%
 		<</if>>
 	<</if>>
-<</if>>
\ No newline at end of file
+<</if>>
diff --git a/src/SecExp/weaponsManufacturing.tw b/src/SecExp/weaponsManufacturing.tw
index aac1e8a7925..5aa12d624e4 100644
--- a/src/SecExp/weaponsManufacturing.tw
+++ b/src/SecExp/weaponsManufacturing.tw
@@ -104,7 +104,7 @@ You own <<print commaNum($helots)>> free menial slaves. This manufacturing compl
 		<</if>>
 		<<goto "weaponsManufacturing">>
 	<</link>>
-	//Will cost <<print 10000 * $weapProductivity>> and will increase the facility income in addition to speeding up upgrade production.//
+	//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>>
@@ -115,7 +115,7 @@ You own <<print commaNum($helots)>> free menial slaves. This manufacturing compl
 		<<set $weapLab++>>
 		<<goto "weaponsManufacturing">>
 	<</link>>
-	//Will cost <<print 10000 * $weapLab>> and will increase the facility income as well as unlock upgrades for our troops//
+	//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>>
@@ -456,5 +456,3 @@ __Upgrades__:
 		<</if>>
 	<</for>>
 <</if>>
-
-<br>[[Return this sector to standard manufacturing|Main][$cash -= Math.trunc(10000*$upgradeMultiplierArcology), $sectors[$AS].type = "Manufacturing", $weapManu = 0]] //Costs <<print cashFormat(Math.trunc(10000*$upgradeMultiplierArcology))>>//
diff --git a/src/uncategorized/SFMBarracks.tw b/src/uncategorized/SFMBarracks.tw
index 864155e0631..5c426fda6aa 100644
--- a/src/uncategorized/SFMBarracks.tw
+++ b/src/uncategorized/SFMBarracks.tw
@@ -75,12 +75,12 @@
 		<<set $CashGift = 25000*(Math.max(0.99,$SFAO/10))*$Env>>
 			<<if random(1,100) > 50>>
 				<<if random(1,100) > 50>>
-					_Name nods. "Sure boss," she says, "we had a bit of a haul this week. One of my sergeants convinced a woman to tell us where she had hidden her shit. Cut her up pretty bad, but she told us. Bunch of nice jewelry, I kept a nice piece for myself." She picks up a tablet on the table, tapping a few commands on it. "@@.yellowgreen;There's your cut,@@ <<print cashFormat($CashGift)>>."
+					_Name nods. "Sure boss," she says, "we had a bit of a haul this week. One of my sergeants convinced a woman to tell us where she had hidden her shit. Cut her up pretty bad, but she told us. Bunch of nice jewelry, I kept a nice piece for myself." She picks up a tablet on the table, tapping a few commands on it. "@@.yellowgreen;There's your cut,@@ <<print cashFormat(Math.ceil($CashGift))>>."
 				<<else>>
-					_Name smiles widely. "Sure boss," she says, "we pulled in some good shit this week. One of the boys found a real nice family hiding in a basement. 18-year old triplets. Brought in a good bit of cash." She picks up a tablet on the table, tapping a few commands on it. "@@.yellowgreen;There's your cut,@@ <<print cashFormat($CashGift)>>."
+					_Name smiles widely. "Sure boss," she says, "we pulled in some good shit this week. One of the boys found a real nice family hiding in a basement. 18-year old triplets. Brought in a good bit of cash." She picks up a tablet on the table, tapping a few commands on it. "@@.yellowgreen;There's your cut,@@ <<print cashFormat(Math.ceil($CashGift))>>."
 				<</if>>
 			<<else>>
-				_Name picks up a tablet. "Sure boss," she says, "we had a nice score this week. Looters fucked up and left a bunch of nice shit behind." She taps a few commands on the tablet. "@@.yellowgreen;There's your cut,@@ <<print cashFormat($CashGift)>>."
+				_Name picks up a tablet. "Sure boss," she says, "we had a nice score this week. Looters fucked up and left a bunch of nice shit behind." She taps a few commands on the tablet. "@@.yellowgreen;There's your cut,@@ <<print cashFormat(Math.ceil($CashGift))>>."
 			<</if>>
 			<<set $securityForceGiftToken = 1>>
 			<<set $cash += $CashGift>>
@@ -165,4 +165,4 @@
 <</if>>
 
 <<include "SpecialForceUpgradeOptions">>
-<<include "SpecialForceBarracksAdditionalColonelInteractions">>
\ No newline at end of file
+<<include "SpecialForceBarracksAdditionalColonelInteractions">>
diff --git a/src/uncategorized/generateXYSlave.tw b/src/uncategorized/generateXYSlave.tw
index e9c081a4e42..f65b6921df7 100644
--- a/src/uncategorized/generateXYSlave.tw
+++ b/src/uncategorized/generateXYSlave.tw
@@ -109,7 +109,7 @@
 <</if>>
 <<NationalityToRace $activeSlave>>
 /* Corporate slavegen with race selection */
-<<if passage() == "Corporate Market" && ($captureUpgradeRace != "unselected") && ($captureUpgradeRace != "none")>> 
+<<if passage() == "Corporate Market" && ($captureUpgradeRace != "unselected") && ($captureUpgradeRace != "none")>>
 	<<if $captureUpgradeRace == "mixed race">>
 		<<set $activeSlave.race = "mixed race">>
 	<<else>>
@@ -592,7 +592,7 @@
 
 /%pedoshit%/
 <<if $activeSlave.physicalAge <= 13>>
-	<<set $activeSlave.dick = either(1, 1, 1, 1, 2, 2, 2, 3)>>	
+	<<set $activeSlave.dick = either(1, 1, 1, 1, 2, 2, 2, 3)>>
 	<<set $activeSlave.balls = either(0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3)>>
 	<<set $activeSlave.scrotum = $activeSlave.balls>>
 	<<set $activeSlave.anus = either(0, 0, 0, 0, 0, 1)>>
@@ -635,8 +635,7 @@
 <<if passage() == "Slave Markets" && $slaveMarket == "corporate">>
 	<<if ($captureUpgradeRace != "unselected") && ($captureUpgradeRace != "none")>>
 	<<if $activeSlave.race != $captureUpgradeRace>>
-		<<set $slaveMarket = "corporate">>
-		<<goto "Slave Markets">>
+		<<set $activeSlave.race = $captureUpgradeRace>>
 	<</if>>
 	<</if>>
 <</if>>
-- 
GitLab