From 49a09ea454f934bcda660b4ea59255062376c370 Mon Sep 17 00:00:00 2001 From: Jones <Jones> Date: Tue, 30 Oct 2018 22:37:56 +0100 Subject: [PATCH] Disaster Response Unit and Economy Fix --- src/init/storyInit.tw | 2 ++ src/js/economyJS.tw | 3 ++ src/pregmod/manageEconomy.tw | 14 ++++++++++ src/uncategorized/BackwardsCompatibility.tw | 9 ++++++ src/uncategorized/costsReport.tw | 4 +++ src/uncategorized/nextWeek.tw | 4 +-- src/uncategorized/persBusiness.tw | 31 +++++++++++++++++++++ 7 files changed, 65 insertions(+), 2 deletions(-) diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw index f16808347da..ea974b0dbf8 100644 --- a/src/init/storyInit.tw +++ b/src/init/storyInit.tw @@ -389,6 +389,8 @@ You should have received a copy of the GNU General Public License along with thi <<set $economy = 100>> <<set $econRate = 2>> <<set $difficultySwitch = 0>> + <<set $econWeatherDamage = 0>> + <<set $disasterResponse = 0>> <<set $neighboringArcologies = 3>> <<set $newDescriptions = 0>> <<set $familyTesting = 0>> diff --git a/src/js/economyJS.tw b/src/js/economyJS.tw index 42629b15dd9..99cc80c6fcc 100644 --- a/src/js/economyJS.tw +++ b/src/js/economyJS.tw @@ -335,6 +335,9 @@ window.getCost = function(array) { costs += Math.ceil(T.SFCashBonus); } } + if(State.variables.econWeatherDamage && State.variables.disasterResponse > 0) { + costs += Math.trunc(State.variables.disasterResponse * 200000 / State.variables.localEcon); + } // clean up if(costs < 0) { costs = 0; diff --git a/src/pregmod/manageEconomy.tw b/src/pregmod/manageEconomy.tw index d66c6ff7126..bb05654a280 100644 --- a/src/pregmod/manageEconomy.tw +++ b/src/pregmod/manageEconomy.tw @@ -45,6 +45,20 @@ <<set _econPercent = Math.trunc(100000/$localEcon-1000)/10>> increasing prices by @@.red;''<<print _econPercent>> %.''@@ <</if>> + <<if $econWeatherDamage > 0>> + <br><br>The recent terrible weather has damaged the local infrastructure. It is @@.red;reducing the local economy score by <<print $econWeatherDamage>>.@@ + <<if $disasterResponse == 0>> + <br>Locals will do their best to repair the damage on their own, but setting up a disaster response unit <br>will improve the recovery of infrastructure critical for keeping goods, people and information flowing smoothly in and out of your arcology. + <br>Creating the unit will cost <<print cashFormat(50000)>> and incur upkeep. [[Create Disaster Response Unit|Manage Economy][$cash -= 50000, $disasterResponse = 1]] + <<elseif $disasterResponse == 1>> + <br>You are sending your disaster response unit to repair critical infrastructure. They are doing what they can. + <br>The unit can be made more effective with an additional investment of <<print cashFormat(100000)>>. This will also increase upkeep. [[Improve Disaster Response Unit|Manage Economy][$cash -= 100000, $disasterResponse = 2]] + <<else>> + <br>Your highly capable disaster response unit is rapidly repairing the weather damage. + <</if>> + <<elseif $disasterResponse > 0>> + <br><br>Your disaster response unit is idle. It won't cost you any upkeep this week. + <</if>> <br><br> <</if>> diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index ad3fa0f7160..d09af19cea8 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -3495,3 +3495,12 @@ Done! <<if $releaseID < 1031>> <<set $releaseID = 1031>> <</if>> + +<<if $difficultySwitch == 1>> + <<if ndef $econWeatherDamage>> + <<set $econWeatherDamage = 0>> + <</if>> + <<if ndef $disasterResponse>> + <<set $disasterResponse = 0>> + <</if>> +<</if>> diff --git a/src/uncategorized/costsReport.tw b/src/uncategorized/costsReport.tw index 6d2c9df6844..9b3f39662ae 100644 --- a/src/uncategorized/costsReport.tw +++ b/src/uncategorized/costsReport.tw @@ -156,6 +156,10 @@ your __personal living expenses__ are <<print cashFormat(Math.trunc($girls*(250+ <</for>> <</if>> +<<if $econWeatherDamage && $disasterResponse > 0>> + <<set _DRUUpkeep = Math.trunc($disasterResponse * 200000 / $localEcon)>> + <br>__Disaster Response Unit__ expenses: <<print cashFormat(_DRUUpkeep)>> +<</if>> <<if $FSSpending != 0>> <br>__Society Shaping__ expenses: <<print cashFormat($FSSpending)>> <</if>> diff --git a/src/uncategorized/nextWeek.tw b/src/uncategorized/nextWeek.tw index e9a301d8ad1..c8a9e955591 100644 --- a/src/uncategorized/nextWeek.tw +++ b/src/uncategorized/nextWeek.tw @@ -37,7 +37,7 @@ <<set $economy = 20>> <</if>> <<set _localEconSeed = random(1,100)>> - <<if $localEcon <= ($globalEcon + $econAdvantage)>> + <<if $localEcon <= ($economy + $econAdvantage)>> <<if _localEconSeed > 95>> <<set $localEcon += 2>> <<elseif _localEconSeed > 50>> @@ -47,7 +47,7 @@ <<elseif _localEconSeed <= 10>> <<set $localEcon -= 1>> <</if>> - <<elseif $localEcon <= ($globalEcon + $econAdvantage + 5)>> + <<elseif $localEcon <= ($economy + $econAdvantage + 5)>> <<if _localEconSeed > 98>> <<set $localEcon += 2>> <<elseif _localEconSeed > 66>> diff --git a/src/uncategorized/persBusiness.tw b/src/uncategorized/persBusiness.tw index 111294fe8f9..83e582bcec2 100644 --- a/src/uncategorized/persBusiness.tw +++ b/src/uncategorized/persBusiness.tw @@ -1033,14 +1033,45 @@ The RomanFS may need further tweaking (it probably got weaker). Could increase t <</if>> <<if $difficultySwitch == 1>> +<<if $econWeatherDamage > 0>> + <<set _repairSeed = random(1,3)>> + <<if $disasterResponse == 0>> + <<if _repairSeed == 3>> + <<set $econWeatherDamage -= 1>> + <<set $localEcon += 1>> + <</if>> + <<elseif $disasterResponse == 1>> + <<if _repairSeed > 1>> + <<set $econWeatherDamage -= 1>> + <<set $localEcon += 1>> + <</if>> + <<else>> + <<if _repairSeed == 3>> + <<if $econWeatherDamage > 1>> + <<set $econWeatherDamage -= 2>> + <<set $localEcon += 2>> + <<else>> + <<set $econWeatherDamage -= 1>> + <<set $localEcon += 1>> + <</if>> + <<else>> + <<set $econWeatherDamage -= 1>> + <<set $localEcon += 1>> + <</if>> + <</if>> +<</if>> +<<if $terrain != "oceanic">> <<if $weatherToday.severity == 3>> <<set $localEcon -= 1>> + <<set $econWeatherDamage += 1>> <br><br>This week's terrible weather did a number on the region, @@.red;hurting the local economy.@@ <<elseif $weatherToday.severity > 3>> <<set $localEcon -= 3>> + <<set $econWeatherDamage += 3>> <br><br>This week's extreme weather ravaged the region, @@.red;the local economy is seriously disrupted.@@ <</if>> <</if>> +<</if>> -- GitLab