From 74ec98184742e3fa93d2cabae7ed8d9e1a76df78 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Thu, 29 Oct 2020 01:33:03 -0400 Subject: [PATCH] clean --- src/endWeek/economics/neighborsDevelopment.js | 51 +++++++++++++++++-- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/src/endWeek/economics/neighborsDevelopment.js b/src/endWeek/economics/neighborsDevelopment.js index b82fbda4a53..e895dcf2b5e 100644 --- a/src/endWeek/economics/neighborsDevelopment.js +++ b/src/endWeek/economics/neighborsDevelopment.js @@ -4,7 +4,7 @@ App.EndWeek.neighborsDevelopment = function() { const el = document.createElement("p"); let r = []; - let He, his, him, he; + let He, his; V.averageProsperity = 0; let _agentBonus = 0; @@ -12,6 +12,7 @@ App.EndWeek.neighborsDevelopment = function() { let _error; let _desc; let _prosperityDiff; + let _redHanded; // TODO: may be used too much and not properly reset. for (V.i = 0; V.i < V.arcologies.length; V.i++) { if (V.arcologies[V.i].prosperity < 10) { V.arcologies[V.i].prosperity = 10; @@ -44,17 +45,22 @@ App.EndWeek.neighborsDevelopment = function() { switch (V.arcologies[V.i].government) { case "elected officials": V.arcologies[V.i].prosperity += random(-1, 1); + break; case "a corporation": case "an oligarchy": V.arcologies[V.i].prosperity += random(-1, 2); + break; case "a committee": case "your trustees": V.arcologies[V.i].prosperity += random(0, 2); + break; case "an individual": V.arcologies[V.i].prosperity += random(0, 3); + break; case "your agent": _agentBonus = agentBonus(V.i); V.arcologies[V.i].prosperity += random(0, 3) + _agentBonus; + break; default: V.arcologies[V.i].prosperity += random(-1, 1); } @@ -67,7 +73,7 @@ App.EndWeek.neighborsDevelopment = function() { let _agentIndex; if (V.arcologies[V.i].government === "your agent") { const _Agent = App.currentAgent(V.i); - ({his, him, he} = getPronouns(_Agent)); + ({his} = getPronouns(_Agent)); r.push(`is being run by your agent <span class="deeppink">${SlaveFullName(_Agent)}.</span>`); _agentIndex = V.slaveIndices[_Agent.ID]; if (_agentIndex && V.slaves[_agentIndex].assignment !== "be your agent") { @@ -144,6 +150,7 @@ App.EndWeek.neighborsDevelopment = function() { r.push(`A power struggle is won by a single individual, leaving the arcology ruled like yours is.`); V.arcologies[V.i].government = "an individual"; } + break; default: if (random(0, 2) === 0) { r.push(`The failed individual who led it is run out and replaced by direct democracy.`); @@ -173,6 +180,7 @@ App.EndWeek.neighborsDevelopment = function() { r.push(`Its elected officials are forced to give way to a committee of public safety.`); V.arcologies[V.i].government = "a committee"; } + break; case "a committee": if (random(0, 2) === 0) { r.push(`Its ruling committee forms it into a corporation in the hope this will spur growth.`); @@ -181,6 +189,7 @@ App.EndWeek.neighborsDevelopment = function() { r.push(`A power struggle within its ruling committee leaves only a few leading citizens in power.`); V.arcologies[V.i].government = "an oligarchy"; } + break; case "an oligarchy": if (random(0, 2) === 0) { r.push(`Its leading citizens form a corporation to run the arcology more efficiently.`); @@ -189,6 +198,7 @@ App.EndWeek.neighborsDevelopment = function() { r.push(`A power struggle is won by a single individual, leaving the arcology ruled like yours is.`); V.arcologies[V.i].government = "an individual"; } + break; case "an individual": if (random(0, 2) === 0) { r.push(`The failed individual who led it is run out and replaced by direct democracy.`); @@ -197,6 +207,7 @@ App.EndWeek.neighborsDevelopment = function() { r.push(`The failed individual who led it is bought out by a corporation.`); V.arcologies[V.i].government = "a corporation"; } + break; case "a corporation": if (random(0, 2) === 0) { r.push(`A power struggle within the corporation that runs it is won by a single person.`); @@ -205,6 +216,7 @@ App.EndWeek.neighborsDevelopment = function() { r.push(`The corporation that runs it collapses and is replaced by an oligarchy of rich shareholders.`); V.arcologies[V.i].government = "an oligarchy"; } + break; default: r.push(`Its direct democracy votes to empower some elected officials in the hope they can lead the arcology out of its problems.`); V.arcologies[V.i].government = "elected officials"; @@ -348,10 +360,9 @@ App.EndWeek.neighborsDevelopment = function() { V.arcologies[V.i].prosperity -= V.arcologies[0].CyberEconomic*2; const _WarSpoils = Math.ceil(10+Math.max(((100/_weekModifier)*V.arcologies[V.i].prosperity*V.arcologies[0].CyberEconomic), 0)); V.arcologies[V.i].prosperity = Math.clamp(V.arcologies[V.i].prosperity, 1, V.AProsperityCap); - let _redHanded; if (random(0, 100) >= _Catchchance-(10*V.arcologies[0].CyberEconomic)) { V.arcologies[0].prosperity -= V.arcologies[0].CyberEconomic*3; - let _redHanded = 1; + _redHanded = 1; repX(forceNeg(random(100, 200)), "war"); if (V.secExpEnabled > 0) { V.SecExp.core.authority -= random(100, 500)*V.arcologies[0].CyberEconomic, V.SecExp.core.crimeLow += random(10, 25); @@ -394,7 +405,7 @@ App.EndWeek.neighborsDevelopment = function() { } V.arcologies[V.i].prosperity = Math.clamp(V.arcologies[V.i].prosperity, 1, 300); V.arcologies[V.i].ownership = Math.clamp(V.arcologies[V.i].ownership, 0, 100); - let _redHanded; + _redHanded; if (random(0, 100) >= _Catchchance-(10*V.arcologies[0].CyberReputation)) { V.arcologies[0].prosperity -= V.arcologies[0].CyberReputation*3; _redHanded = 1; @@ -447,17 +458,23 @@ App.EndWeek.neighborsDevelopment = function() { switch (V.arcologies[V.i].government) { case "elected officials": _efficiency = random(-2, 2); + break; case "a committee": _efficiency = random(-1, 2); + break; case "an oligarchy": case "your trustees": _efficiency = random(-1, 3); + break; case "an individual": _efficiency = random(-1, 5); + break; case "your agent": _efficiency = _agentBonus + random(-1, 1); + break; case "a corporation": _efficiency = random(1, 2); + break; default: _efficiency = random(-3, 3); } @@ -479,26 +496,37 @@ App.EndWeek.neighborsDevelopment = function() { switch (V.arcologies[V.i].FSSupremacistRace) { case "white": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistWhite); + break; case "asian": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistAsian); + break; case "latina": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistLatina); + break; case "middle eastern": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistMiddleEastern); + break; case "black": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistBlack); + break; case "indo-aryan": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistIndoAryan); + break; case "pacific islander": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistPacificIslander); + break; case "malay": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistMalay); + break; case "amerindian": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistAmerindian); + break; case "southern european": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistSouthernEuropean); + break; case "semitic": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistSemitic); + break; default: V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSupremacistMixedRace); } @@ -529,26 +557,37 @@ App.EndWeek.neighborsDevelopment = function() { switch (V.arcologies[V.i].FSSubjugationistRace) { case "white": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistWhite); + break; case "asian": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistAsian); + break; case "latina": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistLatina); + break; case "middle eastern": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistMiddleEastern); + break; case "black": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistBlack); + break; case "indo-aryan": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistIndoAryan); + break; case "pacific islander": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistPacificIslander); + break; case "malay": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistMalay); + break; case "amerindian": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistAmerindian); + break; case "southern european": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistSouthernEuropean); + break; case "semitic": V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistSemitic); + break; default: V.arcologies[V.i].name = App.Neighbor.getUnusedName(setup.ArcologyNamesSubjugationistMixedRace); } @@ -2019,4 +2058,6 @@ App.EndWeek.neighborsDevelopment = function() { // <br> } } + App.Events.addNode(el, r); + return el; }; -- GitLab