From 81782beea25081a8c8842b64957f45093a75c672 Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Mon, 2 Apr 2018 15:32:16 -0400
Subject: [PATCH] tweak to values

---
 src/uncategorized/neighborInteract.tw     | 12 +++++++-----
 src/uncategorized/neighborsDevelopment.tw | 11 ++++++++---
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/uncategorized/neighborInteract.tw b/src/uncategorized/neighborInteract.tw
index cd950647774..a6e2ad87705 100644
--- a/src/uncategorized/neighborInteract.tw
+++ b/src/uncategorized/neighborInteract.tw
@@ -2,11 +2,13 @@
 
 <<set $nextLink = "Manage Arcology", $nextButton = "Back">>
 
-<<for $i = 0; $i < $arcologies.length; $i++>>
-  <<if $arcologies[$i].direction == $activeArcology.direction>>
-	<<set $arcologies[$i] = $activeArcology>><<break>>
-  <</if>>
-<</for>>
+<<set _nei = $arcologies.findIndex(function(s) { return s.direction == $activeArcology.direction; })>>
+<<if _nei != -1>>
+	<<set $arcologies[_nei] = $activeArcology>>
+<<else>>
+	//Neighbor not found, something has gone wrong!//
+<</if>>
+
 
 <<if $buyArcologyDirection != 0>>
 <<for $i = 0; $i < $arcologies.length; $i++>>
diff --git a/src/uncategorized/neighborsDevelopment.tw b/src/uncategorized/neighborsDevelopment.tw
index 6ec4ba9dd1a..3b1f0488df6 100644
--- a/src/uncategorized/neighborsDevelopment.tw
+++ b/src/uncategorized/neighborsDevelopment.tw
@@ -511,12 +511,14 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(Math.trunc((0.1*$arcol
 	<<elseif $PC.hacking >= 100>>
 		<<set _Catchtchance = 100>>
 	<</if>>
-	<<set $arcologies[$i].prosperity -= $arcologies[0].CyberEconomic, _WarSpoils = 5000*$arcologies[0].CyberEconomic>>
+	<<set $arcologies[$i].prosperity -= $arcologies[0].CyberEconomic*2, _WarSpoils = 10+Math.max((500*$arcologies[$i].prosperity*$arcologies[0].CyberEconomic),0)>>
+	<<set $arcologies[$i].prosperity = Math.clamp($arcologies[$i].prosperity, 1, 100)>>
 	<<if random(0,100) >= _Catchchance-(10*$arcologies[0].CyberEconomic)>>
 		<<set $arcologies[0].prosperity -= $arcologies[0].CyberEconomic*3, $rep -= random(100,200), _redHanded = 1>>
 		<<if $secExp == 1>>
 			 <<set $authority -= random(100,500)*$arcologies[0].CyberEconomic, $crime += random(10,25)>>
 		<</if>>
+		<<set $arcologies[0].prosperity = Math.clamp($arcologies[0].prosperity, 1, 100)>>
 	<</if>>
 	You target $arcologies[$i].name for @@.yellow;digital economic warfare,@@ successfully raiding its coffers for @@.yellowgreen;<<print cashFormat(_WarSpoils)>>@@ this week.
 	<<if _redHanded == 1>>
@@ -545,12 +547,14 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(Math.trunc((0.1*$arcol
 	<<elseif $PC.hacking >= 100>>
 		<<set _Catchtchance = 100>>
 	<</if>>
-	<<set $arcologies[$i].prosperity -= $arcologies[0].CyberReputation, $activeArcology.ownership -= $arcologies[0].CyberReputation*2>>
+	<<set $arcologies[$i].prosperity -= $arcologies[0].CyberReputation, $activeArcology.ownership -= $arcologies[0].CyberReputation>>
+	<<set $arcologies[$i].prosperity = Math.clamp($arcologies[$i].prosperity, 1, 100)>>
 	<<if random(0,100) >= _Catchchance-(10*$arcologies[0].CyberReputation)>>
-		<<set $arcologies[$j].prosperity -= $arcologies[0].CyberReputation*3, $rep -= random(100,200), _redHanded = 1>>
+		<<set $arcologies[0].prosperity -= $arcologies[0].CyberReputation*3, $rep -= random(100,200), _redHanded = 1>>
 		<<if $secExp == 1>>
 			 <<set $authority -= random(100,500)*$arcologies[0].CyberReputation, $crime += random(10,25)>>
 		<</if>>
+		<<set $arcologies[0].prosperity = Math.clamp($arcologies[0].prosperity, 1, 100)>>
 	<</if>>
 	You target $arcologies[$i].name's leadership for @@.yellow;character assassination@@ in an attempt to destabilize the arcology.
 	<<if _redHanded == 1>>
@@ -561,6 +565,7 @@ has an estimated GSP of @@.yellowgreen;<<print cashFormat(Math.trunc((0.1*$arcol
 	<</if>>
 <</if>>
 
+
 /* AI ARCOLOGY RENAMING */
 <<for $j = 0; $j < $arcologies.length; $j++>>
 <<if $arcologies[$i].direction != $arcologies[$j].direction>>
-- 
GitLab