From e50cb2f0656e10b052434269b91e926a2604b840 Mon Sep 17 00:00:00 2001 From: Jones <Jones> Date: Wed, 27 Nov 2019 14:10:18 +0100 Subject: [PATCH] difficulty tweaks --- src/Corporation/corporate.js | 6 +----- src/cheats/mod_EditArcologyCheat.tw | 18 +++++++++--------- src/events/intro/economyIntro.tw | 18 +++++++++--------- src/events/intro/introSummary.tw | 17 ++++++----------- src/init/storyInit.tw | 2 +- src/js/datatypeCleanupJS.js | 13 +++++++++++++ src/js/economyJS.js | 2 +- src/uncategorized/BackwardsCompatibility.tw | 8 ++------ src/uncategorized/arcmgmt.tw | 1 + src/uncategorized/manageArcology.tw | 8 ++++---- src/uncategorized/options.tw | 9 +++++++++ src/uncategorized/reputation.tw | 4 ++-- 12 files changed, 58 insertions(+), 48 deletions(-) diff --git a/src/Corporation/corporate.js b/src/Corporation/corporate.js index 6dd9bac8125..97d077d76c3 100644 --- a/src/Corporation/corporate.js +++ b/src/Corporation/corporate.js @@ -333,10 +333,7 @@ App.Corporate.Init = function() { const divisionOverhead = Object.values(this.maintenanceCategories).reduce((r, categoryLedger) => r + categoryLedger.cost, 0); const corpMaintInfo = App.Corporate.maintenance.corporate; let corpOverhead = Math.pow(Math.max(divCount - corpMaintInfo.freeDivisions, 0), 2) * corpMaintInfo.divisionCost; - let retval = divisionOverhead + corpOverhead; - if(App.Corporate.easyMode) { - retval /= 2; - } + let retval = (divisionOverhead + corpOverhead) * 1 - (5 - State.variables.difficulty) / 8; return Math.trunc(retval); } get canExpandNow() { return this._var.canExpandNow; } @@ -505,7 +502,6 @@ App.Corporate.Init = function() { founded: "Incorporated", hasMarket: "Market", payoutCash: "CashDividend", - easyMode: "Easy", canExpand: 'ExpandToken', } for(const property in propertyToStoryBool) { diff --git a/src/cheats/mod_EditArcologyCheat.tw b/src/cheats/mod_EditArcologyCheat.tw index be898de5ba8..f234fe7979b 100644 --- a/src/cheats/mod_EditArcologyCheat.tw +++ b/src/cheats/mod_EditArcologyCheat.tw @@ -9,21 +9,21 @@ <</if>> <br><br>The economic situation is -<<if $economy > 125>> +<<if $difficulty == 1>> ''not truly dire. Not yet.'' //Very Easy// - <br>[[Harder|MOD_Edit Arcology Cheat][$economy = 125]] -<<elseif $economy > 100>> + <br>[[Harder|MOD_Edit Arcology Cheat][$economy = 125, $difficulty = 2]] +<<elseif $difficulty == 2>> ''getting a touch dire.'' //Easy// - <br>[[Harder|MOD_Edit Arcology Cheat][$economy = 100]] | [[Easier|MOD_Edit Arcology Cheat][$economy = 200]] -<<elseif $economy > 80>> + <br>[[Harder|MOD_Edit Arcology Cheat][$economy = 100, $difficulty = 3]] | [[Easier|MOD_Edit Arcology Cheat][$economy = 200, $difficulty = 1]] +<<elseif $difficulty == 3>> ''serious risks.'' //Default Difficulty// - <br>[[Harder|MOD_Edit Arcology Cheat][$economy = 80]] | [[Easier|MOD_Edit Arcology Cheat][$economy = 125]] -<<elseif $economy > 67>> + <br>[[Harder|MOD_Edit Arcology Cheat][$economy = 80, $difficulty = 4]] | [[Easier|MOD_Edit Arcology Cheat][$economy = 125, $difficulty = 2]] +<<elseif $difficulty == 4>> ''ugly.'' //Hard// - <br>[[Harder|MOD_Edit Arcology Cheat][$economy = 67]] | [[Easier|MOD_Edit Arcology Cheat][$economy = 100]] + <br>[[Harder|MOD_Edit Arcology Cheat][$economy = 67, $difficulty = 5]] | [[Easier|MOD_Edit Arcology Cheat][$economy = 100, $difficulty = 3]] <<else>> ''this is the last dance.'' //Very Hard// - <br>[[Easier|MOD_Edit Arcology Cheat][$economy = 80]] + <br>[[Easier|MOD_Edit Arcology Cheat][$economy = 80, $difficulty = 4]] <</if>> <br>The economy is forecasted to <<if $difficultySwitch == 0>> diff --git a/src/events/intro/economyIntro.tw b/src/events/intro/economyIntro.tw index 6bce3ce2d2f..406fc2d831b 100644 --- a/src/events/intro/economyIntro.tw +++ b/src/events/intro/economyIntro.tw @@ -5,21 +5,21 @@ <<else>> It is the year 2037, and the past 21 years have not been kind. The world is starting to fall apart. The climate is deteriorating, resources are being exhausted, and there are more people to feed every year. Technology is advancing, but not fast enough to save everyone. @@.orange;Exactly how bad is the situation?@@ <br> - <<if $economy > 125>> + <<if $difficulty == 1>> <br>''Not truly dire. Not yet.'' //Very Easy// - <br>[[Harder|Economy Intro][$economy = 125]] - <<elseif $economy > 100>> + <br>[[Harder|Economy Intro][$economy = 125, $difficulty = 2]] + <<elseif $difficulty == 2>> <br>''Getting a touch dire.'' //Easy// - <br>[[Harder|Economy Intro][$economy = 100]] | [[Easier|Economy Intro][$economy = 200]] - <<elseif $economy > 80>> + <br>[[Harder|Economy Intro][$economy = 100, $difficulty = 3]] | [[Easier|Economy Intro][$economy = 200, $difficulty = 1]] + <<elseif $difficulty == 3>> <br>''Very serious.'' //Default Difficulty// - <br>[[Harder|Economy Intro][$economy = 80]] | [[Easier|Economy Intro][$economy = 125]] - <<elseif $economy > 67>> + <br>[[Harder|Economy Intro][$economy = 80, $difficulty = 4]] | [[Easier|Economy Intro][$economy = 125, $difficulty = 2]] + <<elseif $difficulty == 4>> <br>''It won't be pretty.'' //Hard// - <br>[[Harder|Economy Intro][$economy = 67]] | [[Easier|Economy Intro][$economy = 100]] + <br>[[Harder|Economy Intro][$economy = 67, $difficulty = 5]] | [[Easier|Economy Intro][$economy = 100, $difficulty = 3]] <<else>> <br>''This is the last dance.'' //Very Hard// - <br>[[Easier|Economy Intro][$economy = 80]] + <br>[[Easier|Economy Intro][$economy = 80, $difficulty = 4]] <</if>> /*Economy settings*/ diff --git a/src/events/intro/introSummary.tw b/src/events/intro/introSummary.tw index 8b787f4af70..7336c275813 100644 --- a/src/events/intro/introSummary.tw +++ b/src/events/intro/introSummary.tw @@ -24,17 +24,17 @@ You may review your settings before clicking "Continue" to begin. __''World Settings''__ <br> <<set $localEcon = $economy>> -<<options $economy>> +<<options $difficulty>> Economic climate: - <<option 200 "Very Easy">> + <<option 1 "Very Easy" "$economy = 200">> ''not truly dire. Not yet.'' //Very Easy// - <<option 125 "Easy">> + <<option 2 "Easy" "$economy = 125">> ''getting a touch dire.'' //Easy// - <<option 100 "Default Difficulty">> + <<option 3 "Default Difficulty" "$economy = 100">> ''serious risks.'' //Default Difficulty// - <<option 80 "Hard">> + <<option 4 "Hard" "$economy = 80">> ''ugly.'' //Hard// - <<option 67 "Very Hard">> + <<option 5 "Very Hard" "$economy = 67">> ''this is the last dance.'' //Very Hard// <</options>> <<if $difficultySwitch == 1>><<set $econAdvantage = -2>><</if>> @@ -71,11 +71,6 @@ Economic forecast: <<set $rulesCost = Math.trunc(10000/$economy)>> <<set $modCost = Math.trunc(5000/$economy)>> <<set $surgeryCost = Math.trunc(30000/$economy)>> -<<if $economy > 100>> - <<set $corpEasy = 1>> -<<else>> - <<set $corpEasy = 0>> -<</if>> <br> diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw index e481f7ad4ef..8b61911ee52 100644 --- a/src/init/storyInit.tw +++ b/src/init/storyInit.tw @@ -355,6 +355,7 @@ You should have received a copy of the GNU General Public License along with thi /* Pregmod specific */ <<set $economy = 100>> + <<set $difficulty = 3>> <<set $difficultySwitch = 0>> <<set $neighboringArcologies = 3>> <<set $newDescriptions = 0>> @@ -792,7 +793,6 @@ You should have received a copy of the GNU General Public License along with thi /*new corporation variables*/ <<set $newCorp = 1>> -<<set $corpEasy = 0>> <<set $vanillaShareSplit = 1>> <<set $corpEcon = 0>> <<set $corpCashDividend = 0>> diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index 5a0079a59db..f23f8e7c59b 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -1628,6 +1628,19 @@ window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() { V.economy = Math.max(+V.economy, 20) || 100; V.difficultySwitch = Math.clamp(+V.difficultySwitch, 0, 1) || 0; + if (V.difficulty) { + V.difficulty = Math.clamp(+V.difficulty, 0, 5) || 3; + } else if ($economy > 125) { + V.difficulty = 1; + } else if ($economy > 100) { + V.difficulty = 2; + } else if ($economy > 80) { + V.difficulty = 3; + } else if ($economy > 67) { + V.difficulty = 4; + } else { + V.difficulty = 5; + } V.localEcon = Math.max(+V.localEcon, 20) || V.economy; V.econRate = Math.clamp(+V.econRate, 1, 4) || 2; V.slaveCostFactor = Math.max(+V.slaveCostFactor, 0) || 1; diff --git a/src/js/economyJS.js b/src/js/economyJS.js index 5752692576a..aebfe7beaa7 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -1358,7 +1358,7 @@ window.repX = function(rep, what, who) { /* we don't want to curve startup or cheating.*/ V.lastWeeksRepIncome[what] += rep; } else if (typeof V.lastWeeksRepIncome[what] !== 'undefined') { - rep = Math.round(Math.pow(1000 * rep + Math.pow(V.rep, 2), 0.5) - V.rep) * (V.corpEasy + 1); + rep = Math.round(Math.pow(1000 * rep + Math.pow(V.rep, 2), 0.5) - V.rep); V.lastWeeksRepIncome[what] += rep; } else { V.lastWeeksRepErrors += `Unknown place "${what}" gained you ${rep}<br>`; diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index 5b845129fc5..177f4644d74 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -2778,12 +2778,8 @@ Setting missing global variables: <<if ndef $corpSpecRaces>> <<set $corpSpecRaces = []>> <</if>> -<<if ndef $corpEasy>> - <<if $economy > 100>> - <<set $corpEasy = 1>> - <<else>> - <<set $corpEasy = 0>> - <</if>> +<<if def $corpEasy>> + <<unset $corpEasy>> <</if>> <<set $dividendTimer = $dividendTimer || 13>> <<if ndef $corpEcon>> diff --git a/src/uncategorized/arcmgmt.tw b/src/uncategorized/arcmgmt.tw index 321d415a805..5ff4f5dd30f 100644 --- a/src/uncategorized/arcmgmt.tw +++ b/src/uncategorized/arcmgmt.tw @@ -1244,6 +1244,7 @@ _percTopClass = Math.trunc(($topClass / ($ACitizens + $ASlaves)) * 1000) / 10>> <<set _rentMultiplier *= 1.05>> Those of your citizens who have not yet subscribed to the society you are building are permitted to live and do business here, but must pay a moderate jizya tax for the privilege as part of their rent. <</if>> +<<set _rentMultiplier *= 1 + (5 - $difficulty) / 20>> <<set _rents = Math.trunc(($lowerClass * $LCRent + $middleClass * $MCRent + $upperClass * $UCRent + $topClass * $TCRent) * _rentMultiplier / 25)>> <<if !Number.isInteger(_rents)>> <br>@@.red;Error: rents is outside accepted range, please report this issue@@ diff --git a/src/uncategorized/manageArcology.tw b/src/uncategorized/manageArcology.tw index b6e2c24f28a..8d9cd8f44b8 100644 --- a/src/uncategorized/manageArcology.tw +++ b/src/uncategorized/manageArcology.tw @@ -208,7 +208,7 @@ _percLowerClass = Math.trunc(($lowerClass / ($ACitizens + $ASlaves)) * 1000) / 1 _percMiddleClass = Math.trunc(($middleClass / ($ACitizens + $ASlaves)) * 1000) / 10, _percUpperClass = Math.trunc(($upperClass / ($ACitizens + $ASlaves)) * 1000) / 10, _percTopClass = Math.trunc(($topClass / ($ACitizens + $ASlaves)) * 1000) / 10>> -<br>Lower Class Citizens | $lowerClass | <<print _percLowerClass>>% | Rent @@.yellowgreen;<<print cashFormat($LCRent / 25)>>@@ +<br>Lower Class Citizens | $lowerClass | <<print _percLowerClass>>% | Rent @@.yellowgreen;<<print cashFormat($LCRent * (1 + (5 - $difficulty) / 20) / 25)>>@@ <<if $LCRent > 30>> //Very High// | [[Decrease|Manage Arcology][$LCRent = 30, $rentEffectL = 0.94]] <<elseif $LCRent > 20>> @@ -220,7 +220,7 @@ _percTopClass = Math.trunc(($topClass / ($ACitizens + $ASlaves)) * 1000) / 10>> <<else>> //Free// | [[Increase|Manage Arcology][$LCRent = 10, $rentEffectL = 1.04]] <</if>> -<br>Middle Class Citizens | $middleClass | <<print _percMiddleClass>>% | Rent @@.yellowgreen;<<print cashFormat($MCRent / 25)>>@@ +<br>Middle Class Citizens | $middleClass | <<print _percMiddleClass>>% | Rent @@.yellowgreen;<<print cashFormat($MCRent * (1 + (5 - $difficulty) / 20) / 25)>>@@ <<if $MCRent > 75>> //Very High// | [[Decrease|Manage Arcology][$MCRent = 75, $rentEffectM = 0.94]] <<elseif $MCRent > 50>> @@ -232,7 +232,7 @@ _percTopClass = Math.trunc(($topClass / ($ACitizens + $ASlaves)) * 1000) / 10>> <<else>> //Free// | [[Increase|Manage Arcology][$MCRent = 25, $rentEffectM = 1.04]] <</if>> -<br>Upper Class Citizens | $upperClass | <<print _percUpperClass>>% | Rent @@.yellowgreen;<<print cashFormat($UCRent / 25)>>@@ +<br>Upper Class Citizens | $upperClass | <<print _percUpperClass>>% | Rent @@.yellowgreen;<<print cashFormat($UCRent * (1 + (5 - $difficulty) / 20) / 25)>>@@ <<if $UCRent > 270>> //Very High// | [[Decrease|Manage Arcology][$UCRent = 270, $rentEffectU = 0.94]] <<elseif $UCRent > 180>> @@ -244,7 +244,7 @@ _percTopClass = Math.trunc(($topClass / ($ACitizens + $ASlaves)) * 1000) / 10>> <<else>> //Free// | [[Increase|Manage Arcology][$UCRent = 90, $rentEffectU = 1.04]] <</if>> -<br>Millionaires | $topClass | <<print _percTopClass>>% | Rent @@.yellowgreen;<<print cashFormat($TCRent / 25)>>@@ +<br>Millionaires | $topClass | <<print _percTopClass>>% | Rent @@.yellowgreen;<<print cashFormat($TCRent * (1 + (5 - $difficulty) / 10) / 25)>>@@ <<if $TCRent > 975>> //Very High// | [[Decrease|Manage Arcology][$TCRent = 975, $rentEffectT = 0.94]] <<elseif $TCRent > 650>> diff --git a/src/uncategorized/options.tw b/src/uncategorized/options.tw index e4a082b4f67..8a28f01321a 100644 --- a/src/uncategorized/options.tw +++ b/src/uncategorized/options.tw @@ -386,6 +386,15 @@ This save was created using FC version $ver build $releaseID. <div class="subHeading"> ''Content'' </div> + <<options $difficulty>> + The difficulty setting is currently set to + <<option 1 "Very Easy">> + <<option 2 "Easy">> + <<option 3 "Default">> + <<option 4 "Hard">> + <<option 5 "Very Hard">> + <</options>> + <<options $seeExtreme>> Extreme content like amputation is currently <<option 1 "Enabled">> diff --git a/src/uncategorized/reputation.tw b/src/uncategorized/reputation.tw index 95ea9741333..005f8e0e696 100644 --- a/src/uncategorized/reputation.tw +++ b/src/uncategorized/reputation.tw @@ -103,8 +103,8 @@ On formal occasions, you are announced as $PCTitle. <<elseif $enduringRep > 2000>> However, you have been a figure of regard for long enough that some of your reputation has become permanent. <</if>> - <<if _repLoss > 500>> - <<set _repLoss = 500>> + <<if _repLoss > 500 * (1 - (5 - $difficulty) / 10)>> + <<set _repLoss = 500 * (1 - (5 - $difficulty) / 10)>> <<elseif _repLoss < 0>> <<set _repLoss = 0>> <</if>> -- GitLab