From 6025db7a5f382cde1a31e5c38297f4fa074a92f7 Mon Sep 17 00:00:00 2001
From: hexall90 <hexall90@gmail.com>
Date: Sat, 2 Dec 2017 08:40:37 +0100
Subject: [PATCH] fixing bugs

---
 src/SecExp/seeUnit.tw | 18 +++++++++---------
 src/js/economyJS.tw   |  1 +
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/SecExp/seeUnit.tw b/src/SecExp/seeUnit.tw
index 274ee5bfb57..4831ce07e26 100644
--- a/src/SecExp/seeUnit.tw
+++ b/src/SecExp/seeUnit.tw
@@ -30,11 +30,11 @@
 		<br>
 		<<link "Refine the drone network with $securityForceName assistance">>
 		<<set $secBots.maxTroops += 10>>
-			<<set $cash -= 5000>>
+			<<set $cash -= 5000 + 10 * $secBotsUpgradeCost * $secBots.equip>>
 			<<goto "seeUnit">>
 		<</link>>
 		Utilize the technological developments made by $securityForceName to further improve the control matrix of the security drones.
-		<br>//Costs 5000 per upgrade and each will increase the max by 10//
+		<br>//Costs <<print 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>>
@@ -43,7 +43,7 @@
 	<<if $secBots.equip < 3>>
 		<br>
 		<<link "Improve drone weaponry and armor">>
-			<<set $secBots.equip += 1>>
+			<<set  += 1>>
 			<<set $cash -= (($secBotsUpgradeCost * $secBots.maxTroops) + 1000)>>
 			<<goto "seeUnit">>
 		<</link>>
@@ -89,11 +89,11 @@
 		<br>
 		<<link "Intensive officers training">>
 			<<set $militiaUnits[$targetIndex].maxTroops += 10>>
-			<<set $cash -= 5000>>
+			<<set $cash -= 5000 + 10 * $equipUpgradeCost * ($militiaUnits[$targetIndex].equip + $militiaUnits[$targetIndex].commissars + $militiaUnits[$targetIndex].cyber + $militiaUnits[$targetIndex].SF)>>
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in the training of your officers to increase the maximum number of soldiers in the unit.
-		<br>//Costs 5000 per upgrade and each will increase the max by 10//
+		<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//
 	<<else>>
 		<br>
 		Your officers rached their peak. Further training will have little impact on the number of troops they can effectively lead.
@@ -249,11 +249,11 @@
 		<br>
 		<<link "Intensive officers training">>
 			<<set $slaveUnits[$targetIndex].maxTroops += 10>>
-			<<set $cash -= 5000>>
+			<<set $cash -= 5000 + 10 * $equipUpgradeCost * ($slaveUnits[$targetIndex].equip + $slaveUnits[$targetIndex].commissars + $slaveUnits[$targetIndex].cyber + $slaveUnits[$targetIndex].SF)>>
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in the training of your officers to increase the maximum number of soldiers in the unit.
-		<br>//Costs 5000 per upgrade and each will increase the max by 10//
+		<br>//Costs <<print 5000 + 10 * $equipUpgradeCost * ($slaveUnits[$targetIndex].equip + $slaveUnits[$targetIndex].commissars + $slaveUnits[$targetIndex].cyber + $slaveUnits[$targetIndex].SF)>> and will increase the max by 10//
 	<<else>>
 		<br>Your officers rached their peak. Further training will have little impact on the number of troops they can effectively lead.
 	<</if>>
@@ -406,11 +406,11 @@
 		<br>
 		<<link "Intensive officers training">>
 			<<set $mercUnits[$targetIndex].maxTroops += 10>>
-			<<set $cash -= 5000>>
+			<<set $cash -= 5000 + 10 * $equipUpgradeCost * ($mercUnits[$targetIndex].equip + $mercUnits[$targetIndex].commissars + $mercUnits[$targetIndex].cyber + $mercUnits[$targetIndex].SF)>>
 			<<goto "seeUnit">>
 		<</link>>
 		Invest in the training of your officers to increase the maximum number of soldiers in the unit.
-		<br>//Costs 5000 per upgrade and each will increase the max by 10//
+		<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//
 	<<else>>
 		<br>Your officers rached their peak. Further training will have little impact on the number of troops they can effectively lead.
 	<</if>>
diff --git a/src/js/economyJS.tw b/src/js/economyJS.tw
index 034ff72a8bf..a8a3cb0a62b 100644
--- a/src/js/economyJS.tw
+++ b/src/js/economyJS.tw
@@ -113,6 +113,7 @@ window.getCost = function(array) {
 				}
 			}
 		}
+		costs += secExpCost;
 	}
 	
 	//general arcology costs
-- 
GitLab