diff --git a/src/uncategorized/neighborInteract.tw b/src/uncategorized/neighborInteract.tw index cd9506477742642dc1abf1215472f766bba4ecf1..a6e2ad8770536ec29e0c116eb35ecd9e43dee835 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 6ec4ba9dd1a12a363e6eb639b2b41dbac2515059..3b1f0488df670933fefcec32ee70eea4fbb9d0a7 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>>