From 0af5a644a4b20b9eb48f4426d2124c779a8a8d85 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Tue, 9 Mar 2021 15:34:33 -0500 Subject: [PATCH] simplify paren --- src/events/nonRandomEvent.js | 100 +++++++++++++++++------------------ 1 file changed, 48 insertions(+), 52 deletions(-) diff --git a/src/events/nonRandomEvent.js b/src/events/nonRandomEvent.js index 9b45b20e3fd..cab806adc7a 100644 --- a/src/events/nonRandomEvent.js +++ b/src/events/nonRandomEvent.js @@ -1,17 +1,14 @@ globalThis.nonRandomEvent = function() { - V.activeSlave = 0; V.eventSlave = 0; - + const _effectiveWeek = V.week - V.nationHate; if (V.plot) { - - const _effectiveWeek = V.week - V.nationHate; if (_effectiveWeek === 4 && V.arcologies[0].name.indexOf("Arcology ") !== -1) { V.Event = "arcology naming"; Engine.play("Generic Plot Events"); - } else if ((_effectiveWeek >= 5 && V.FCTV.receiver === -1)) { + } else if (_effectiveWeek >= 5 && V.FCTV.receiver === -1) { Engine.play("SE FCTV Install"); - } else if ((V.projectN.status === 1)) { + } else if (V.projectN.status === 1) { V.projectN.status = 2; V.projectN.phase1 = _effectiveWeek; Engine.play("SE projectNInitialized"); @@ -50,23 +47,24 @@ globalThis.nonRandomEvent = function() { Engine.play("SE projectNtechrelease"); } else if ((V.projectN.status === 7) && (V.growingNewCat === 0)) { Engine.play("SE vatcatgirl"); - } else if ((V.projectN.status === 8) && (V.growingNewCat === 0)) { + } else if (V.projectN.status === 8 && V.growingNewCat === 0) { Engine.play("SE vatcatboy"); - } else if ((_effectiveWeek === 6)) { + } else if (_effectiveWeek === 6) { V.Event = "strip club closing"; Engine.play("Generic Plot Events"); - } else if ((_effectiveWeek === 8)) { + } else if (_effectiveWeek === 8) { V.Event = "strip club aftermath"; Engine.play("Generic Plot Events"); - } else if ((_effectiveWeek === 11)) { + } else if (_effectiveWeek === 11) { V.Event = "assistant"; Engine.play("Assistant Events"); } else if ((_effectiveWeek === 12) && V.raped === -1 && V.arcologyUpgrade.drones !== 1 && V.BodyguardID === 0 && V.PC.career !== "arcology owner") { Engine.play("P raped"); - } else if ((_effectiveWeek === 14) && V.badC !== 1) { + } else if (_effectiveWeek === 14 && V.badC !== 1) { const _valid = V.slaves.find(function(s) { return s.curatives > 1 || s.inflationType === "curative"; }); if (_valid) { - V.badC = 1, V.Event = "bad curatives"; + V.badC = 1; + V.Event = "bad curatives"; Engine.play("Generic Plot Events"); } else { V.badC = 1; @@ -76,23 +74,23 @@ globalThis.nonRandomEvent = function() { V.assholeKnight = 1; V.imperialEventWeek = _effectiveWeek; Engine.play("SE assholeknight"); - } else if ((_effectiveWeek === 17)) { + } else if (_effectiveWeek === 17) { V.Event = "shoot invitation"; Engine.play("Generic Plot Events"); - } else if ((_effectiveWeek === 20)) { + } else if (_effectiveWeek === 20) { V.Event = "slave food"; Engine.play("Generic Plot Events"); - } else if ((_effectiveWeek === 24)) { + } else if (_effectiveWeek === 24) { V.Event = "militia"; Engine.play("Generic Plot Events"); - } else if ((V.week === 29)) { + } else if (V.week === 29) { V.Event = "aid invitation"; Engine.play("Generic Plot Events"); - } else if ((_effectiveWeek === 31) && (V.mercenaries === 0)) { + } else if (_effectiveWeek === 31 && V.mercenaries === 0) { Engine.play("P mercenaries"); - } else if ((_effectiveWeek === 35) && (V.mercenaries > 0)) { + } else if (_effectiveWeek === 35 && V.mercenaries > 0) { Engine.play("P snatch and grab"); - } else if ((_effectiveWeek === 43)) { + } else if (_effectiveWeek === 43) { Engine.play("P invasion"); } else if ((_effectiveWeek === 44) && (V.mercenaries > 0) && V.mercRomeo !== 1) { const _valid = V.slaves.find(function(s) { return (["serve the public", "serve in the club", "whore", "work in the brothel"].includes(s.assignment) || s.counter.publicUse >= 50) && s.fetish !== "mindbroken" && s.fuckdoll === 0; }); @@ -102,49 +100,50 @@ globalThis.nonRandomEvent = function() { } else { Engine.play("Nonrandom Event"); } - } else if ((_effectiveWeek === 46) && (V.mercenaries > 0)) { + } else if (_effectiveWeek === 46 && V.mercenaries > 0) { Engine.play("P raid invitation"); - } else if ((_effectiveWeek === 48) && (V.experimental.food === 1)) { + } else if (_effectiveWeek === 48 && V.experimental.food === 1) { V.foodCrisis = 1; Engine.play("P food crisis"); - } else if ((_effectiveWeek === 50) && (V.rations > 0)) { + } else if (_effectiveWeek === 50 && V.rations > 0) { V.foodCrisis = 2; Engine.play("P food crisis"); } else if ((_effectiveWeek === 52) && (V.seeHyperPreg === 1) && V.seePreg !== 0 && V.badB !== 1) { const _valid = V.slaves.find(function(s) { return s.drugs === "breast injections" || s.drugs === "hyper breast injections" || s.drugs === "intensive breast injections"; }); if (_valid) { - V.badB = 1, V.Event = "bad breasts"; + V.badB = 1; + V.Event = "bad breasts"; Engine.play("Generic Plot Events"); } else { V.badB = 1; Engine.play("Nonrandom Event"); } - } else if (_effectiveWeek === 54 && (def V.peacekeepers) && V.peacekeepers.attitude >= 0) { + } else if (_effectiveWeek === 54 && (V.peacekeepers) && V.peacekeepers.attitude >= 0) { Engine.play("P peacekeepers deficit"); - } else if ((_effectiveWeek === 56)) { + } else if (_effectiveWeek === 56) { V.collaboration = 0; V.traitor = 0; V.hackerSupport = 0; Engine.play("P underground railroad"); - } else if ((_effectiveWeek === 58) && (V.traitor === 0)) { + } else if (_effectiveWeek === 58 && V.traitor === 0) { Engine.play("P bombing"); - } else if ((_effectiveWeek === 60) && (V.rations > 0)) { + } else if (_effectiveWeek === 60 && V.rations > 0) { V.foodCrisis = 3; Engine.play("P food crisis"); - } else if ((_effectiveWeek === 61) && (V.traitor !== 0)) { + } else if (_effectiveWeek === 61 && V.traitor !== 0) { Engine.play("P traitor message"); - } else if ((_effectiveWeek === 62) && (V.mercenaries < 3)) { + } else if (_effectiveWeek === 62 && V.mercenaries < 3) { Engine.play("P defense fears"); - } else if ((_effectiveWeek === 65) && (V.mercenaries >= 3)) { + } else if (_effectiveWeek === 65 && V.mercenaries >= 3) { Engine.play("P citizens and civilians"); - } else if ((_effectiveWeek === 67) && (V.traitor !== 0)) { + } else if (_effectiveWeek === 67 && V.traitor !== 0) { Engine.play("P collaboration choice"); - } else if ((_effectiveWeek === 69)) { + } else if (_effectiveWeek === 69) { Engine.play("P hacker support"); - } else if ((_effectiveWeek === 70) && (V.collaboration === 1) && V.traitorType !== "trapper") { + } else if (_effectiveWeek === 70 && V.collaboration === 1 && V.traitorType !== "trapper") { Engine.play("P coup collaboration"); - } else if ((_effectiveWeek === 71)) { - const _doubleAgent = (V.traitorType !== "agent" && V.traitorType !== "trapper") ? 0 : 1 + } else if (_effectiveWeek === 71) { + const _doubleAgent = (V.traitorType !== "agent" && V.traitorType !== "trapper") ? 0 : 1; if (V.traitorType === "trapper") { Engine.play("P coup betrayal"); } else if (V.mercenaries + V.personalArms + V.hackerSupport + _doubleAgent < 5) { @@ -152,22 +151,22 @@ globalThis.nonRandomEvent = function() { } else { Engine.play("P coup attempt"); } - } else if ((_effectiveWeek === 72)) { + } else if (_effectiveWeek === 72) { Engine.play("P coup aftermath"); } else if (V.SF.Toggle && V.SF.Active === -1 && _effectiveWeek >= 72) { Engine.play("Security Force Proposal"); } else if (V.arcologies[0].FSRestart !== "unset" && V.failedElite > 300 && V.eugenicsFullControl !== 1) { Engine.play("eliteTakeOver"); - } else if ((_effectiveWeek > 5) && (V.rep > 3000) && (V.FSAnnounced === 0)) { + } else if (_effectiveWeek > 5 && V.rep > 3000 && V.FSAnnounced === 0) { Engine.play("P FS Announcement"); } else if (_effectiveWeek > 18 && V.assistant.personality > 0 && !V.assistant.options) { V.Event = "assistant SP"; Engine.play("Assistant Events"); - } else if ((_effectiveWeek > 45) && (V.bodyswapAnnounced === 0) && (V.surgeryUpgrade === 1)) { + } else if (_effectiveWeek > 45 && V.bodyswapAnnounced === 0 && V.surgeryUpgrade === 1) { Engine.play("P Bodyswap Reveal"); } else if (_effectiveWeek > 48 && V.invasionVictory > 0 && V.peacekeepers === 0 && V.peacekeepersGone !== 1) { Engine.play("P peacekeepers intro"); - } else if ((V.arcologies[0].prosperity > 80) && (App.Utils.schoolCounter() === 0) && (V.schoolSuggestion === 0)) { + } else if (V.arcologies[0].prosperity > 80 && App.Utils.schoolCounter() === 0 && V.schoolSuggestion === 0) { Engine.play("P school suggestion"); } else if ((V.assistant.fsOptions !== 1) && V.assistant.personality > 0 && V.assistant.appearance !== "normal" && FutureSocieties.HighestDecoration() >= 40) { V.Event = "assistant FS"; @@ -178,15 +177,15 @@ globalThis.nonRandomEvent = function() { } else if (!V.assistant.market && V.assistant.power > 1) { V.Event = "market assistant"; Engine.play("Assistant Events"); - } else if ((_effectiveWeek > 70) && (V.corp.Incorporated > 0) && (V.rivalOwnerEnslaved > 0) && (V.mercenaries >= 3) && (V.mercenariesHelpCorp === 0) && (V.corp.DivExtra > 0)) { + } else if (_effectiveWeek > 70 && V.corp.Incorporated > 0 && V.rivalOwnerEnslaved > 0 && V.mercenaries >= 3 && V.mercenariesHelpCorp === 0 && V.corp.DivExtra > 0) { Engine.play("P Mercs Help Corp"); } else if (_effectiveWeek > 75 && (V.peacekeepers) && V.peacekeepers.strength < 50 && V.rivalOwner === 0 && V.peacekeepersFate !== 1) { Engine.play("P peacekeepers independence"); } else if ((V.peacekeepers) && V.peacekeepers.strength >= 50 && V.peacekeepers.influenceAnnounced === 0) { Engine.play("P peacekeepers influence"); - } else if ((V.cash > 120000) && (V.rep > 4000) && (V.corp.Announced === 0)) { + } else if (V.cash > 120000 && V.rep > 4000 && V.corp.Announced === 0) { Engine.play("P Corp Announcement"); - } else if ((V.rivalOwner > 0)) { + } else if (V.rivalOwner > 0) { if (V.hostageAnnounced === 0 && V.rivalSet !== 0) { Engine.play("P rivalry hostage"); } else if ((V.rivalOwner - V.rivalryPower + 10) / V.arcologies[0].prosperity < 0.5) { @@ -198,19 +197,19 @@ globalThis.nonRandomEvent = function() { } } else if ((V.arcologies[0].FSPaternalistDecoration === 100) && (V.swanSong === 2) && (V.week - V.swanSongWeek >= 3)) { Engine.play("RE The Siren Strikes Back"); - } else if ((V.eventResults.shoot === 1)) { + } else if (V.eventResults.shoot === 1) { V.Event = "shoot result"; Engine.play("Generic Plot Events"); - } else if ((V.eventResults.snatch === 1)) { + } else if (V.eventResults.snatch === 1) { Engine.play("P snatch and grab result"); - } else if ((V.eventResults.raid === 1)) { + } else if (V.eventResults.raid === 1) { Engine.play("P raid result"); - } else if ((V.eventResults.aid === 1)) { + } else if (V.eventResults.aid === 1) { V.Event = "aid result"; Engine.play("Generic Plot Events"); - } else if ((V.eventResults.slaveMedic > 0)) { + } else if (V.eventResults.slaveMedic > 0) { Engine.play("P slave medic"); - } else if ((V.eventResults.pit === 1) && (V.BodyguardID !== 0)) { + } else if (V.eventResults.pit === 1 && V.BodyguardID !== 0) { Engine.play("PE pit fight"); } else if ((_effectiveWeek >= 37) && (V.arcologies[0].FSNeoImperialistLaw1 === 1) && (V.arcologies[0].FSNeoImperialistLaw2 === 1) && V.poorKnight !== 1 && _effectiveWeek >= V.imperialEventWeek + 3) { V.poorKnight = 1; @@ -222,7 +221,7 @@ globalThis.nonRandomEvent = function() { Engine.play("SE newBaron"); } else if (V.rivalOwner === 0 && V.secExpEnabled > 0 && (_effectiveWeek >= 74 && V.SecExp.smilingMan.progress === 0 || _effectiveWeek >= 77 && V.SecExp.smilingMan.progress === 1 || _effectiveWeek >= 82 && V.SecExp.smilingMan.progress === 2 || V.SecExp.smilingMan.progress === 3)) { Engine.play("secExpSmilingMan"); - } else if ((V.rivalOwner === 0) && (V.seeFCNN === 1) && (V.FCNNstation === 0) && (V.week > 95) && (V.cash > 200000) && (V.rep > 7500)) { + } else if (V.rivalOwner === 0 && V.seeFCNN === 1 && V.FCNNstation === 0 && V.week > 95 && V.cash > 200000 && V.rep > 7500) { Engine.play("SE FCNN Station"); } else if (_effectiveWeek >= V.murderAttemptWeek) { Engine.play("Murder Attempt"); @@ -242,14 +241,11 @@ globalThis.nonRandomEvent = function() { Engine.play("Random Nonindividual Event"); } } - } else { - if (random(1, 200) > _effectiveWeek + 100 || V.hostageRescued === 1) { Engine.play("RIE Eligibility Check"); } else { Engine.play("Random Nonindividual Event"); } - } }; -- GitLab