From ace9376e2fe0f64bd9e860212923f0d41485b276 Mon Sep 17 00:00:00 2001 From: kopareigns <kopareigns@gmail.com> Date: Tue, 8 Jan 2019 19:25:51 -0500 Subject: [PATCH] Cleaning up --- devNotes/twine JS.txt | 63 +++++++++++++++++---- src/init/storyInit.tw | 6 -- src/js/datatypeCleanupJS.tw | 23 +++----- src/uncategorized/BackwardsCompatibility.tw | 3 + src/uncategorized/arcmgmt.tw | 43 +++++++------- 5 files changed, 86 insertions(+), 52 deletions(-) diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt index b66186cadbc..e78de45fc22 100644 --- a/devNotes/twine JS.txt +++ b/devNotes/twine JS.txt @@ -37830,18 +37830,9 @@ window.PCDatatypeCleanup = function PCDatatypeCleanup() { PC.shouldersImplant = 0; }; -window.ArcologyDatatypeCleanup = function ArcologyDatatypeCleanup() { +window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() { const V = State.variables; - V.ACitizens = Math.max(+V.ACitizens, 0) || 0; - V.ASlaves = Math.max(+V.ASlaves, 0) || 0; - V.shelterAbuse = Math.max(+V.shelterAbuse, 0) || 0; - - V.arcologies[0].prosperity = Math.clamp(+V.arcologies[0].prosperity, 1, 300) || 1; - V.AProsperityCap = Math.max(+V.AProsperityCap, 0) || 0; - V.arcologies[0].ownership = Math.clamp(+V.arcologies[0].ownership, 0, 100) || 0; - V.arcologies[0].minority = Math.clamp(+V.arcologies[0].minority, 0, 100) || 0; - V.economy = Math.max(+V.economy, 20) || 100; V.difficultySwitch = Math.clamp(+V.difficultySwitch, 0, 1) || 0; V.localEcon = Math.max(+V.localEcon, 20) || V.economy; @@ -37862,12 +37853,64 @@ window.ArcologyDatatypeCleanup = function ArcologyDatatypeCleanup() { V.deltaDemand = Math.clamp(+V.deltaDemand, -3000, 3000) || 0; V.econWeatherDamage = Math.max(+V.econWeatherDamage, 0) || 0; V.disasterResponse = Math.clamp(+V.disasterResponse, 0, 2) || 0; + V.antiWeatherFreeze = Math.max(+V.antiWeatherFreeze, 0) || 0; V.GDP = Math.max(+V.GDP, 1) || 278.6; V.NPCSlaves = Math.max(+V.NPCSlaves, 0) || 0; + V.visitors = Math.max(+V.visitors, 0) || 0; + + V.LSCBase = Math.max(+V.LSCBase, 0) || 800; /* nowhere modified */ + V.rentEffectL = Math.max(+V.rentEffectL, 0) || 1; + if (V.lowerClass !== 0) { + V.lowerClass = Math.max(+V.lowerClass, 0) || 3120; + } + if (V.LCRent !== 0) { + V.LCRent = Math.max(+V.LCRent, 0) || 20; + } + + V.MCBase = Math.max(+V.MCBase, 0) || 200; /* nowhere modified */ + V.rentEffectM = Math.max(+V.rentEffectM, 0) || 1; + if (V.middleClass !== 0) { + V.middleClass = Math.max(+V.middleClass, 0) || 890; + } + if (V.MCRent !== 0) { + V.MCRent = Math.max(+V.MCRent, 0) || 50; + } + + V.UCBase = Math.max(+V.UCBase, 0) || 40; /* nowhere modified */ + V.rentEffectU = Math.max(+V.rentEffectU, 0) || 1; + if (V.upperClass !== 0) { + V.upperClass = Math.max(+V.upperClass, 0) || 200; + } + if (V.UCRent !== 0) { + V.UCRent = Math.max(+V.UCRent, 0) || 175; + } + + V.TCBase = Math.max(+V.TCBase, 0) || 20; /* nowhere modified */ + V.rentEffectT = Math.max(+V.rentEffectT, 0) || 1; + if (V.topClass !== 0) { + V.topClass = Math.max(+V.topClass, 0) || 38; + } + if (V.TCRent !== 0) { + V.TCRent = Math.max(+V.TCRent, 0) || 650; + } +}; + +window.ArcologyDatatypeCleanup = function ArcologyDatatypeCleanup() { + const V = State.variables; + + V.arcologies[0].prosperity = Math.clamp(+V.arcologies[0].prosperity, 1, 300) || 1; + V.AProsperityCap = Math.max(+V.AProsperityCap, 0) || 0; + V.arcologies[0].ownership = Math.clamp(+V.arcologies[0].ownership, 0, 100) || 0; + V.arcologies[0].minority = Math.clamp(+V.arcologies[0].minority, 0, 100) || 0; + V.menials = Math.max(+V.menials, 0) || 0; V.fuckdolls = Math.max(+V.fuckdolls, 0) || 0; V.menialBioreactors = Math.max(+V.menialBioreactors, 0) || 0; + V.ACitizens = Math.max(+V.ACitizens, 0) || 0; + V.ASlaves = Math.max(+V.ASlaves, 0) || V.NPCSlaves + V.menials + V.fuckdolls + V.menialBioreactors; + V.shelterAbuse = Math.max(+V.shelterAbuse, 0) || 0; + V.assistant = Math.clamp(+V.assistant, 0, 1) || 0; if (typeof V.assistantPronouns != "object") { V.assistantPronouns = {}; diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw index 618c8a17427..317dd630dbb 100644 --- a/src/init/storyInit.tw +++ b/src/init/storyInit.tw @@ -1090,7 +1090,6 @@ DairyRestraintsSetting($dairyRestraintsSetting) <<set $lowerClass = 3120>> <<set $LSCBase = 800>> <<set $visitors = 0>> -<<set $welfare = 0.004>> <<set $rentEffectL = 1>> <<set $LCRent = 20>> <<set $middleClass = 890>> @@ -1108,11 +1107,6 @@ DairyRestraintsSetting($dairyRestraintsSetting) <<set $GDP = 278.6>> <<set $NPCSlaves = 900>> <<set $ASlaves = 900>> -<<set $slaveDemandU = 2>> -<<set $slaveDemandT = 12>> -<<set $slaveProductivity = 0.8>> -<<set $enslaveChance = 0.2>> -<<set $slaveExpiration = 0.005>> <<set $AProsperityCap = 120>> <<set $sectors = [ diff --git a/src/js/datatypeCleanupJS.tw b/src/js/datatypeCleanupJS.tw index 9898305d271..65aaf9e11fe 100644 --- a/src/js/datatypeCleanupJS.tw +++ b/src/js/datatypeCleanupJS.tw @@ -1222,7 +1222,7 @@ window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() { V.NPCSlaves = Math.max(+V.NPCSlaves, 0) || 0; V.visitors = Math.max(+V.visitors, 0) || 0; - V.LSCBase = Math.max(+V.LSCBase, 0) || 800; /* no-where modified */ + V.LSCBase = Math.max(+V.LSCBase, 0) || 800; /* nowhere modified */ V.rentEffectL = Math.max(+V.rentEffectL, 0) || 1; if (V.lowerClass !== 0) { V.lowerClass = Math.max(+V.lowerClass, 0) || 3120; @@ -1231,7 +1231,7 @@ window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() { V.LCRent = Math.max(+V.LCRent, 0) || 20; } - V.MCBase = Math.max(+V.MCBase, 0) || 200; /* no-where modified */ + V.MCBase = Math.max(+V.MCBase, 0) || 200; /* nowhere modified */ V.rentEffectM = Math.max(+V.rentEffectM, 0) || 1; if (V.middleClass !== 0) { V.middleClass = Math.max(+V.middleClass, 0) || 890; @@ -1240,7 +1240,7 @@ window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() { V.MCRent = Math.max(+V.MCRent, 0) || 50; } - V.UCBase = Math.max(+V.UCBase, 0) || 40; /* no-where modified */ + V.UCBase = Math.max(+V.UCBase, 0) || 40; /* nowhere modified */ V.rentEffectU = Math.max(+V.rentEffectU, 0) || 1; if (V.upperClass !== 0) { V.upperClass = Math.max(+V.upperClass, 0) || 200; @@ -1249,7 +1249,7 @@ window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() { V.UCRent = Math.max(+V.UCRent, 0) || 175; } - V.TCBase = Math.max(+V.TCBase, 0) || 20; /* no-where modified */ + V.TCBase = Math.max(+V.TCBase, 0) || 20; /* nowhere modified */ V.rentEffectT = Math.max(+V.rentEffectT, 0) || 1; if (V.topClass !== 0) { V.topClass = Math.max(+V.topClass, 0) || 38; @@ -1257,22 +1257,11 @@ window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() { if (V.TCRent !== 0) { V.TCRent = Math.max(+V.TCRent, 0) || 650; } - - V.slaveDemandU = Math.max(+V.slaveDemandU, 0) || 2; /* no-where modified */ - V.slaveDemandT = Math.max(+V.slaveDemandT, 0) || 12; /* no-where modified */ - V.slaveProductivity = Math.max(+V.slaveProductivity, 0) || 0.8; /* no-where modified */ - V.enslaveChance = Math.clamp(+V.enslaveChance, 0, 1) || 0.2; /* no-where modified */ - V.slaveExpiration = Math.max(+V.slaveExpiration, 0) || 0.005; /* no-where modified */ - V.welfare = Math.max(+V.welfare, 0) || 0.004; /* no-where modified */ }; window.ArcologyDatatypeCleanup = function ArcologyDatatypeCleanup() { const V = State.variables; - V.ACitizens = Math.max(+V.ACitizens, 0) || 0; - V.ASlaves = Math.max(+V.ASlaves, 0) || 0; - V.shelterAbuse = Math.max(+V.shelterAbuse, 0) || 0; - V.arcologies[0].prosperity = Math.clamp(+V.arcologies[0].prosperity, 1, 300) || 1; V.AProsperityCap = Math.max(+V.AProsperityCap, 0) || 0; V.arcologies[0].ownership = Math.clamp(+V.arcologies[0].ownership, 0, 100) || 0; @@ -1282,6 +1271,10 @@ window.ArcologyDatatypeCleanup = function ArcologyDatatypeCleanup() { V.fuckdolls = Math.max(+V.fuckdolls, 0) || 0; V.menialBioreactors = Math.max(+V.menialBioreactors, 0) || 0; + V.ACitizens = Math.max(+V.ACitizens, 0) || 0; + V.ASlaves = Math.max(+V.ASlaves, 0) || V.NPCSlaves + V.menials + V.fuckdolls + V.menialBioreactors; + V.shelterAbuse = Math.max(+V.shelterAbuse, 0) || 0; + V.assistant = Math.clamp(+V.assistant, 0, 1) || 0; if (typeof V.assistantPronouns != "object") { V.assistantPronouns = {}; diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index c3b77759f12..4bbd02f11c3 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -2773,6 +2773,9 @@ Setting missing global variables: <<if def $ACitizenLimit || def $ASlaveLimit>> <<unset $ACitizenLimit, $ASlaveLimit>> <</if>> +<<if def $welfare || def $slaveDemandU || def $slaveDemandT|| def $slaveProductivity || def $enslaveChance || def $slaveExpiration>> + <<unset $welfare, $slaveDemandU, $slaveDemandT, $slaveProductivity, $enslaveChance, $slaveExpiration>> +<</if>> <<run EconomyDatatypeCleanup()>> <<run ArcologyDatatypeCleanup()>> diff --git a/src/uncategorized/arcmgmt.tw b/src/uncategorized/arcmgmt.tw index 6a80975eed3..bdfe5355636 100644 --- a/src/uncategorized/arcmgmt.tw +++ b/src/uncategorized/arcmgmt.tw @@ -11,17 +11,18 @@ More elite citizens require their own slaves and will cause the population of sl _FSScore = 0, /*FS progress for tourism*/ _slaveDemandU = 1, /*Changes to upperclass slave demand*/ _slaveDemandT = 1, /*Changes to topclass slave demand*/ -_expirationFS = 1, /*changes to likelihood of slave death*/ -_slaveProductivity = 0, /*changes to slave productivity*/ +_expirationFS = 0.005, /*changes to likelihood of slave death*/ +_slaveProductivity = 0.8, /*changes to slave productivity*/ _lowerClass = 0, /*fixed amount of changes to lowerclass interest to move in*/ _lowerClassP = 1, /*scaling changes to lowerclass interest ("stacking bonus")*/ -_welfareFS = 1, /*changes to likelihood of lowerclass getting enslaved*/ +_welfareFS = 0.004, /*changes to likelihood of lowerclass getting enslaved*/ _middleClass = 0, /*see lowerclass examples for the rest of these*/ _middleClassP = 1, _upperClass = 0, _upperClassP = 1, _topClass = 0, -_topClassP = 1>> +_topClassP = 1, +_enslaveChance = 0.2>> <<if $arcologies[0].FSSupremacist != "unset">> <<set _FSScore += Math.min($arcologies[0].FSSupremacist, 100), _slaveDemandU *= 1 + Math.trunc(Math.min($arcologies[0].FSSupremacist, 100) / 20) * 0.04, @@ -566,10 +567,10 @@ _middleClass *= 1 + ($TSS.subsidize + $GRI.subsidize + $SCP.subsidize + $LDE.sub <</if>> /*Slave expiration*/ -<<set _expirationPC = Math.trunc($menials * ($slaveExpiration * _expirationFS)), -_expirationFD = Math.trunc($fuckdolls * ($slaveExpiration * _expirationFS)), -_expirationBR = Math.trunc($menialBioreactors * ($slaveExpiration * _expirationFS)), -_expirationNPC = Math.trunc($NPCSlaves * ($slaveExpiration * _expirationFS)), +<<set _expirationPC = Math.trunc($menials * _expirationFS), +_expirationFD = Math.trunc($fuckdolls * _expirationFS), +_expirationBR = Math.trunc($menialBioreactors * _expirationFS), +_expirationNPC = Math.trunc($NPCSlaves * _expirationFS), _expiration = _expirationPC + _expirationNPC + _expirationFD + _expirationBR, $NPCSlaves -= _expirationNPC, $menials -= _expirationPC, @@ -598,12 +599,12 @@ $menialBioreactors -= _expirationBR>> <<if $arcologies[0].FSSupremacistLawME + $arcologies[0].FSSubjugationistLawME > 0>> <<set _banishedRatio *= 2 / 3>> <</if>> - <<set _banished = Math.trunc(($lowerClass * ($welfare * _welfareFS)) * (0.05 + _banishedRatio)), - _enslaved = Math.trunc($lowerClass * ($welfare * _welfareFS)) - _banished, + <<set _banished = Math.trunc(($lowerClass * _welfareFS) * (0.05 + _banishedRatio)), + _enslaved = Math.trunc($lowerClass * _welfareFS) - _banished, $lowerClass -= _banished>> <br>@@.red;<<print _banished>> citizens were banished@@ from your arcology, they committed enslavable offenses but were too old to be enslaved. <<else>> - <<set _enslaved = Math.trunc($lowerClass * ($welfare * _welfareFS))>> + <<set _enslaved = Math.trunc($lowerClass * _welfareFS)>> <</if>> <<set $lowerClass -= _enslaved>> @@ -748,7 +749,7 @@ $visitors = Math.trunc((($arcologies[0].prosperity + _FSScore * 5 + _honeymoon) /*Demand for simple labor*/ <<set _LSCD = Math.trunc(($LSCBase * ($localEcon / 100)) + ($arcologies[0].prosperity * 4) + (($middleClass + $visitors * 0.6) * 1.5) + (($upperClass + $visitors * 0.2) * 3.5) + ($topClass * 18)), /*Demand for owning slaves*/ -_SCD = Math.trunc(($upperClass * ($slaveDemandU + _slaveDemandU)) + ($topClass * ($slaveDemandT + _slaveDemandT)))>> +_SCD = Math.trunc(($upperClass * (2 + _slaveDemandU)) + ($topClass * (12 + _slaveDemandT)))>> <<if isNaN(_LSCD)>> <br>@@.red;LSCD is NaN, report this issue!@@ <<elseif isNaN(_SCD)>> @@ -764,10 +765,10 @@ _SCD = Math.trunc(($upperClass * ($slaveDemandU + _slaveDemandU)) + ($topClass * <br>@@.red;One slave@@ was sold by your inhabitants. They've got more than enough of them already. <</if>> /*More slaves than there is work*/ - <<elseif $NPCSlaves > (_LSCD / ($slaveProductivity + _slaveProductivity)) - $menials + _SCD>> - <<set _NPCSlavesSold = $NPCSlaves - Math.trunc(_LSCD / ($slaveProductivity + _slaveProductivity) - $menials + _SCD), + <<elseif $NPCSlaves > (_LSCD / _slaveProductivity) - $menials + _SCD>> + <<set _NPCSlavesSold = $NPCSlaves - Math.trunc(_LSCD / _slaveProductivity - $menials + _SCD), $menialDemandFactor -= _NPCSlavesSold, - $NPCSlaves = Math.trunc(_LSCD / ($slaveProductivity + _slaveProductivity))>> + $NPCSlaves = Math.trunc(_LSCD / _slaveProductivity)>> <<if _NPCSlavesSold > 1>> <br>@@.red;<<print _NPCSlavesSold>> slaves@@ were sold by your inhabitants. There was so little work that they failed to earn their keep. <<elseif _NPCSlavesSold > 0>> @@ -813,7 +814,7 @@ _SCD = Math.trunc(($upperClass * ($slaveDemandU + _slaveDemandU)) + ($topClass * /*Lower Class Citizens*/ /*Work left for lower class citizens*/ -<<set _LCD = Math.trunc((($LSCBase * ($localEcon / 100)) + ($arcologies[0].prosperity * 4) + _lowerClass + (($middleClass + $visitors * 0.6) * 1.5) + (($upperClass + $visitors * 0.2) * 3.5) + ($topClass * 18) - ($NPCSlaves + $menials) * ($slaveProductivity + _slaveProductivity)) * $rentEffectL * _lowerClassP)>> +<<set _LCD = Math.trunc((($LSCBase * ($localEcon / 100)) + ($arcologies[0].prosperity * 4) + _lowerClass + (($middleClass + $visitors * 0.6) * 1.5) + (($upperClass + $visitors * 0.2) * 3.5) + ($topClass * 18) - ($NPCSlaves + $menials) * _slaveProductivity) * $rentEffectL * _lowerClassP)>> <<if _LCD < 0>> <<set _LCD = 0>> <</if>> @@ -831,9 +832,9 @@ _SCD = Math.trunc(($upperClass * ($slaveDemandU + _slaveDemandU)) + ($topClass * <<elseif $lowerClass > _LCD>> <<set _LCEmigration = Math.trunc(($lowerClass - _LCD) * 0.6) + 1>> <<if $citizenRetirementMenials == 1>> - <<set _enslavedEmigrants = Math.trunc((($lowerClass - _LCD) * 0.6) * $enslaveChance * (0.05 + _banishedRatio))>> + <<set _enslavedEmigrants = Math.trunc((($lowerClass - _LCD) * 0.6) * _enslaveChance * (0.05 + _banishedRatio))>> <<else>> - <<set _enslavedEmigrants = Math.trunc((($lowerClass - _LCD) * 0.6) * $enslaveChance)>> + <<set _enslavedEmigrants = Math.trunc((($lowerClass - _LCD) * 0.6) * _enslaveChance)>> <</if>> <<set $lowerClass -= _LCEmigration, _enslaved += _enslavedEmigrants>> @@ -932,7 +933,7 @@ _SCD = Math.trunc(($upperClass * ($slaveDemandU + _slaveDemandU)) + ($topClass * /*Top Class Citizens*/ /*Setting GDP depending on population*/ -<<set $GDP = Math.trunc((($NPCSlaves + $menials) * 0.35 * $slaveProductivity) + ($lowerClass * 0.35) + ($middleClass * 0.75) + ($upperClass * 2) + ($topClass * 10)) / 10>> +<<set $GDP = Math.trunc((($NPCSlaves + $menials) * 0.28) + ($lowerClass * 0.35) + ($middleClass * 0.75) + ($upperClass * 2) + ($topClass * 10)) / 10>> /*Top Class Interest in living in your arcology*/ <<if $eliteFailTimer > 0>> /*when you fail the eugenics elite and they leave this triggers*/ <<set _TCD = Math.trunc(($GDP / 15 + _topClass) * $rentEffectT * _topClassP + $TCBase - ($eliteFail / 15 * $eliteFailTimer)), @@ -1095,8 +1096,8 @@ This week, rents from $arcologies[0].name came to @@.yellowgreen;<<print cashFor <<set _earnings = 0>> You own <<if $menials > 0>> - <<if $menials > Math.trunc(_LSCD / ($slaveProductivity + _slaveProductivity) - _SCD)>> - <<set _earnings += Math.trunc((_LSCD / ($slaveProductivity + _slaveProductivity) - _SCD) * 10>> + <<if $menials > Math.trunc(_LSCD / _slaveProductivity - _SCD)>> + <<set _earnings += Math.trunc(_LSCD / _slaveProductivity - _SCD) * 10>> <br>@@.red;more menial slaves than there was work,@@ consider selling some. You own <<else>> <<set _earnings += $menials*10>> -- GitLab