From efc903e6e8438d91b56280a744f1e936bdfef410 Mon Sep 17 00:00:00 2001 From: Blank_Alt <12406-Blank_Alt@users.noreply.gitgud.io> Date: Wed, 10 Mar 2021 17:53:47 +0000 Subject: [PATCH] endWeekHangupFix --- devTools/javaSanityCheck/ignoredVariables | 12 -- src/events/nonRandomEvent.js | 182 +++++++++++----------- 2 files changed, 90 insertions(+), 104 deletions(-) diff --git a/devTools/javaSanityCheck/ignoredVariables b/devTools/javaSanityCheck/ignoredVariables index d0ddb90cab4..da4a3be5612 100644 --- a/devTools/javaSanityCheck/ignoredVariables +++ b/devTools/javaSanityCheck/ignoredVariables @@ -1,10 +1,4 @@ # Add hits, that are false positives and should therefore be ignored, here -# likely bugged check -AGrowth -# -MIN -W;O;L -0 #re-added below 11/14 ############################ #corp @@ -12,8 +6,6 @@ perUnit DivLegal DivWhoreDev acquire -#tabs####################### -IntroSummary ############################ societyChanged totalMerc @@ -21,12 +13,8 @@ securityHQ waterwayTime dickSize bodyDesire -newModelUI dinnerParty -badOutcome RESSMuscles -royalNationalities tempEventToggle showAppraisal -Him sacrificeType \ No newline at end of file diff --git a/src/events/nonRandomEvent.js b/src/events/nonRandomEvent.js index 1d6df25f9b7..90ec2462c76 100644 --- a/src/events/nonRandomEvent.js +++ b/src/events/nonRandomEvent.js @@ -5,247 +5,245 @@ globalThis.nonRandomEvent = function() { if (V.plot) { if (effectiveWeek === 4 && V.arcologies[0].name.indexOf("Arcology ") !== -1) { V.Event = "arcology naming"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (effectiveWeek >= 5 && V.FCTV.receiver === -1) { - Engine.play("SE FCTV Install"); + setTimeout(() => Engine.play("SE FCTV Install"), Engine.minDomActionDelay); } else if (V.projectN.status === 1) { V.projectN.status = 2; V.projectN.phase1 = effectiveWeek; - Engine.play("SE projectNInitialized"); + setTimeout(() => Engine.play("SE projectNInitialized"), Engine.minDomActionDelay); } else if ((V.bodyPuristRiot === 1) && (V.puristRiotDone === 0) && (effectiveWeek >= V.projectN.phase1 + 1) && (V.projectN.status !== 9)) { - Engine.play("SE bodypuristprotest"); + setTimeout(() => Engine.play("SE bodypuristprotest"), Engine.minDomActionDelay); V.puristRiotDone = 1; } else if ((V.projectN.status === 2) && (V.projectN.public === 0) && (effectiveWeek >= V.projectN.phase1 + 3)) { - Engine.play("SE projectNmomoney"); + setTimeout(() => Engine.play("SE projectNmomoney"), Engine.minDomActionDelay); V.projectN.phase2 = effectiveWeek; } else if ((V.projectN.status === 2) && (V.projectN.public === 1) && (effectiveWeek >= V.projectN.phase1 + 5)) { - Engine.play("SE projectNmomoney"); + setTimeout(() => Engine.play("SE projectNmomoney"), Engine.minDomActionDelay); V.projectN.phase2 = effectiveWeek; } else if ((V.projectN.status === 3) && (V.projectN.wellFunded === 1) && (effectiveWeek >= V.projectN.phase2 + 4)) { - Engine.play("SE projectNbubbles"); + setTimeout(() => Engine.play("SE projectNbubbles"), Engine.minDomActionDelay); V.projectN.status = 4; V.projectN.phase3 = effectiveWeek; } else if ((V.projectN.status === 3) && (V.projectN.wellFunded !== 1) && (effectiveWeek >= V.projectN.phase2 + 6)) { - Engine.play("SE projectNbubbles"); + setTimeout(() => Engine.play("SE projectNbubbles"), Engine.minDomActionDelay); V.projectN.status = 4; V.projectN.phase3 = effectiveWeek; } else if ((V.projectN.status === 4) && (V.projectN.poorlyFunded !== 1) && (effectiveWeek >= V.projectN.phase3 + 4)) { - Engine.play("SE projectNsaboteur"); + setTimeout(() => Engine.play("SE projectNsaboteur"), Engine.minDomActionDelay); V.projectN.phase4 = effectiveWeek; } else if ((V.projectN.status === 4) && (V.projectN.public === 1) && (V.projectN.poorlyFunded === 1) && (effectiveWeek >= V.projectN.phase3 + 6)) { - Engine.play("SE projectNsaboteur"); + setTimeout(() => Engine.play("SE projectNsaboteur"), Engine.minDomActionDelay); V.projectN.phase4 = effectiveWeek; } else if ((V.projectN.status === 4) && (V.projectN.public === 0) && (V.projectN.poorlyFunded === 1) && (effectiveWeek >= V.projectN.phase3 + 6)) { - Engine.play("SE projectNblowingthelid"); + setTimeout(() => Engine.play("SE projectNblowingthelid"), Engine.minDomActionDelay); V.projectN.phase4 = effectiveWeek; } else if ((V.puristsFurious === 1) && (V.puristRiotDone === 0) && (effectiveWeek >= V.projectN.phase4 + 1 && (V.projectN.status !== 9))) { - Engine.play("SE bodypuristriot"); + setTimeout(() => Engine.play("SE bodypuristriot"), Engine.minDomActionDelay); V.puristRiotDone = 1; } else if ((V.projectN.status === 5) && (effectiveWeek >= V.projectN.phase4 + 4)) { - Engine.play("SE projectNcomplete"); + setTimeout(() => Engine.play("SE projectNcomplete"), Engine.minDomActionDelay); } else if ((V.projectN.status >= 6) && (V.projectN.status !== 9) && V.projectN.decisionMade !== 1 && (effectiveWeek >= V.projectN.phase4 + 5)) { - Engine.play("SE projectNtechrelease"); + setTimeout(() => Engine.play("SE projectNtechrelease"), Engine.minDomActionDelay); } else if ((V.projectN.status === 7) && (V.growingNewCat === 0)) { - Engine.play("SE vatcatgirl"); + setTimeout(() => Engine.play("SE vatcatgirl"), Engine.minDomActionDelay); } else if (V.projectN.status === 8 && V.growingNewCat === 0) { - Engine.play("SE vatcatboy"); + setTimeout(() => Engine.play("SE vatcatboy"), Engine.minDomActionDelay); } else if (effectiveWeek === 6) { V.Event = "strip club closing"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (effectiveWeek === 8) { V.Event = "strip club aftermath"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (effectiveWeek === 11) { V.Event = "assistant"; - Engine.play("Assistant Events"); + setTimeout(() => Engine.play("Assistant Events"), Engine.minDomActionDelay); } else if ((effectiveWeek === 12) && V.raped === -1 && V.arcologyUpgrade.drones !== 1 && V.BodyguardID === 0 && V.PC.career !== "arcology owner") { - Engine.play("P raped"); + setTimeout(() => Engine.play("P raped"), Engine.minDomActionDelay); } else if (effectiveWeek === 14 && V.badC !== 1) { const valid = V.slaves.find(function(s) { return s.curatives > 1 || s.inflationType === "curative"; }); + V.badC = 1; if (valid) { - V.badC = 1; V.Event = "bad curatives"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else { - V.badC = 1; - Engine.play("Nonrandom Event"); + setTimeout(() => Engine.play("Nonrandom Event"), Engine.minDomActionDelay); } } else if ((effectiveWeek >= 15) && (V.arcologies[0].FSNeoImperialistLaw1 === 1) && V.assholeKnight !== 1) { V.assholeKnight = 1; V.imperialEventWeek = effectiveWeek; - Engine.play("SE assholeknight"); + setTimeout(() => Engine.play("SE assholeknight"), Engine.minDomActionDelay); } else if (effectiveWeek === 17) { V.Event = "shoot invitation"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (effectiveWeek === 20) { V.Event = "slave food"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (effectiveWeek === 24) { V.Event = "militia"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (V.week === 29) { V.Event = "aid invitation"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (effectiveWeek === 31 && V.mercenaries === 0) { - Engine.play("P mercenaries"); + setTimeout(() => Engine.play("P mercenaries"), Engine.minDomActionDelay); } else if (effectiveWeek === 35 && V.mercenaries > 0) { - Engine.play("P snatch and grab"); + setTimeout(() => Engine.play("P snatch and grab"), Engine.minDomActionDelay); } else if (effectiveWeek === 43) { - Engine.play("P invasion"); + setTimeout(() => Engine.play("P invasion"), Engine.minDomActionDelay); } 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; }); V.mercRomeo = 1; if (valid) { - Engine.play("P mercenary romeo"); + setTimeout(() => Engine.play("P mercenary romeo"), Engine.minDomActionDelay); } else { - Engine.play("Nonrandom Event"); + setTimeout(() => Engine.play("Nonrandom Event"), Engine.minDomActionDelay); } } else if (effectiveWeek === 46 && V.mercenaries > 0) { - Engine.play("P raid invitation"); + setTimeout(() => Engine.play("P raid invitation"), Engine.minDomActionDelay); } else if (effectiveWeek === 48 && V.experimental.food === 1) { V.foodCrisis = 1; - Engine.play("P food crisis"); + setTimeout(() => Engine.play("P food crisis"), Engine.minDomActionDelay); } else if (effectiveWeek === 50 && V.rations > 0) { V.foodCrisis = 2; - Engine.play("P food crisis"); + setTimeout(() => Engine.play("P food crisis"), Engine.minDomActionDelay); } 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"; }); + V.badB = 1; if (valid) { - V.badB = 1; V.Event = "bad breasts"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else { - V.badB = 1; - Engine.play("Nonrandom Event"); + setTimeout(() => Engine.play("Nonrandom Event"), Engine.minDomActionDelay); } } else if (effectiveWeek === 54 && (V.peacekeepers) && V.peacekeepers.attitude >= 0) { - Engine.play("P peacekeepers deficit"); + setTimeout(() => Engine.play("P peacekeepers deficit"), Engine.minDomActionDelay); } else if (effectiveWeek === 56) { V.collaboration = 0; V.traitor = 0; V.hackerSupport = 0; - Engine.play("P underground railroad"); + setTimeout(() => Engine.play("P underground railroad"), Engine.minDomActionDelay); } else if (effectiveWeek === 58 && V.traitor === 0) { - Engine.play("P bombing"); + setTimeout(() => Engine.play("P bombing"), Engine.minDomActionDelay); } else if (effectiveWeek === 60 && V.rations > 0) { V.foodCrisis = 3; - Engine.play("P food crisis"); + setTimeout(() => Engine.play("P food crisis"), Engine.minDomActionDelay); } else if (effectiveWeek === 61 && V.traitor !== 0) { - Engine.play("P traitor message"); + setTimeout(() => Engine.play("P traitor message"), Engine.minDomActionDelay); } else if (effectiveWeek === 62 && V.mercenaries < 3) { - Engine.play("P defense fears"); + setTimeout(() => Engine.play("P defense fears"), Engine.minDomActionDelay); } else if (effectiveWeek === 65 && V.mercenaries >= 3) { - Engine.play("P citizens and civilians"); + setTimeout(() => Engine.play("P citizens and civilians"), Engine.minDomActionDelay); } else if (effectiveWeek === 67 && V.traitor !== 0) { - Engine.play("P collaboration choice"); + setTimeout(() => Engine.play("P collaboration choice"), Engine.minDomActionDelay); } else if (effectiveWeek === 69) { - Engine.play("P hacker support"); + setTimeout(() => Engine.play("P hacker support"), Engine.minDomActionDelay); } else if (effectiveWeek === 70 && V.collaboration === 1 && V.traitorType !== "trapper") { - Engine.play("P coup collaboration"); + setTimeout(() => Engine.play("P coup collaboration"), Engine.minDomActionDelay); } else if (effectiveWeek === 71) { const doubleAgent = (V.traitorType !== "agent" && V.traitorType !== "trapper") ? 0 : 1; if (V.traitorType === "trapper") { - Engine.play("P coup betrayal"); + setTimeout(() => Engine.play("P coup betrayal"), Engine.minDomActionDelay); } else if (V.mercenaries + V.personalArms + V.hackerSupport + doubleAgent < 5) { - Engine.play("P coup loss"); + setTimeout(() => Engine.play("P coup loss"), Engine.minDomActionDelay); } else { - Engine.play("P coup attempt"); + setTimeout(() => Engine.play("P coup attempt"), Engine.minDomActionDelay); } } else if (effectiveWeek === 72) { - Engine.play("P coup aftermath"); + setTimeout(() => Engine.play("P coup aftermath"), Engine.minDomActionDelay); } else if (V.SF.Toggle && V.SF.Active === -1 && effectiveWeek >= 72) { - Engine.play("Security Force Proposal"); + setTimeout(() => Engine.play("Security Force Proposal"), Engine.minDomActionDelay); } else if (V.arcologies[0].FSRestart !== "unset" && V.failedElite > 300 && V.eugenicsFullControl !== 1) { - Engine.play("eliteTakeOver"); + setTimeout(() => Engine.play("eliteTakeOver"), Engine.minDomActionDelay); } else if (effectiveWeek > 5 && V.rep > 3000 && V.FSAnnounced === 0) { - Engine.play("P FS Announcement"); + setTimeout(() => Engine.play("P FS Announcement"), Engine.minDomActionDelay); } else if (effectiveWeek > 18 && V.assistant.personality > 0 && !V.assistant.options) { V.Event = "assistant SP"; - Engine.play("Assistant Events"); + setTimeout(() => Engine.play("Assistant Events"), Engine.minDomActionDelay); } else if (effectiveWeek > 45 && V.bodyswapAnnounced === 0 && V.surgeryUpgrade === 1) { - Engine.play("P Bodyswap Reveal"); + setTimeout(() => Engine.play("P Bodyswap Reveal"), Engine.minDomActionDelay); } else if (effectiveWeek > 48 && V.invasionVictory > 0 && V.peacekeepers === 0 && V.peacekeepersGone !== 1) { - Engine.play("P peacekeepers intro"); + setTimeout(() => Engine.play("P peacekeepers intro"), Engine.minDomActionDelay); } else if (V.arcologies[0].prosperity > 80 && App.Utils.schoolCounter() === 0 && V.schoolSuggestion === 0) { - Engine.play("P school suggestion"); + setTimeout(() => Engine.play("P school suggestion"), Engine.minDomActionDelay); } else if ((V.assistant.fsOptions !== 1) && V.assistant.personality > 0 && V.assistant.appearance !== "normal" && FutureSocieties.HighestDecoration() >= 40) { V.Event = "assistant FS"; - Engine.play("Assistant Events"); + setTimeout(() => Engine.play("Assistant Events"), Engine.minDomActionDelay); } else if (V.assistant.personality > 0 && !V.assistant.announcedName && V.assistant.power > 0) { V.Event = "assistant name"; - Engine.play("Assistant Events"); + setTimeout(() => Engine.play("Assistant Events"), Engine.minDomActionDelay); } else if (!V.assistant.market && V.assistant.power > 1) { V.Event = "market assistant"; - Engine.play("Assistant Events"); + setTimeout(() => Engine.play("Assistant Events"), Engine.minDomActionDelay); } 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"); + setTimeout(() => Engine.play("P Mercs Help Corp"), Engine.minDomActionDelay); } else if (effectiveWeek > 75 && (V.peacekeepers) && V.peacekeepers.strength < 50 && V.rivalOwner === 0 && V.peacekeepersFate !== 1) { - Engine.play("P peacekeepers independence"); + setTimeout(() => Engine.play("P peacekeepers independence"), Engine.minDomActionDelay); } else if ((V.peacekeepers) && V.peacekeepers.strength >= 50 && V.peacekeepers.influenceAnnounced === 0) { - Engine.play("P peacekeepers influence"); + setTimeout(() => Engine.play("P peacekeepers influence"), Engine.minDomActionDelay); } else if (V.cash > 120000 && V.rep > 4000 && V.corp.Announced === 0) { - Engine.play("P Corp Announcement"); + setTimeout(() => Engine.play("P Corp Announcement"), Engine.minDomActionDelay); } else if (V.rivalOwner > 0) { if (V.hostageAnnounced === 0 && V.rivalSet !== 0) { - Engine.play("P rivalry hostage"); + setTimeout(() => Engine.play("P rivalry hostage"), Engine.minDomActionDelay); } else if ((V.rivalOwner - V.rivalryPower + 10) / V.arcologies[0].prosperity < 0.5) { - Engine.play("P rivalry victory"); + setTimeout(() => Engine.play("P rivalry victory"), Engine.minDomActionDelay); } else if (V.peacekeepers.attitude > 5 && V.rivalryDuration > 1) { - Engine.play("P rivalry peacekeepers"); + setTimeout(() => Engine.play("P rivalry peacekeepers"), Engine.minDomActionDelay); } else { - Engine.play("P rivalry actions"); + setTimeout(() => Engine.play("P rivalry actions"), Engine.minDomActionDelay); } } else if ((V.arcologies[0].FSPaternalistDecoration === 100) && (V.swanSong === 2) && (V.week - V.swanSongWeek >= 3)) { - Engine.play("RE The Siren Strikes Back"); + setTimeout(() => Engine.play("RE The Siren Strikes Back"), Engine.minDomActionDelay); } else if (V.eventResults.shoot === 1) { V.Event = "shoot result"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (V.eventResults.snatch === 1) { - Engine.play("P snatch and grab result"); + setTimeout(() => Engine.play("P snatch and grab result"), Engine.minDomActionDelay); } else if (V.eventResults.raid === 1) { - Engine.play("P raid result"); + setTimeout(() => Engine.play("P raid result"), Engine.minDomActionDelay); } else if (V.eventResults.aid === 1) { V.Event = "aid result"; - Engine.play("Generic Plot Events"); + setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay); } else if (V.eventResults.slaveMedic > 0) { - Engine.play("P slave medic"); + setTimeout(() => Engine.play("P slave medic"), Engine.minDomActionDelay); } else if (V.eventResults.pit === 1 && V.BodyguardID !== 0) { - Engine.play("PE pit fight"); + setTimeout(() => Engine.play("PE pit fight"), Engine.minDomActionDelay); } else if ((effectiveWeek >= 37) && (V.arcologies[0].FSNeoImperialistLaw1 === 1) && (V.arcologies[0].FSNeoImperialistLaw2 === 1) && V.poorKnight !== 1 && effectiveWeek >= V.imperialEventWeek + 3) { V.poorKnight = 1; V.imperialEventWeek = effectiveWeek; - Engine.play("SE poorknight"); + setTimeout(() => Engine.play("SE poorknight"), Engine.minDomActionDelay); } else if ((effectiveWeek >= 40) && (V.arcologies[0].prosperity > 80) && (V.arcologies[0].FSNeoImperialistLaw2 === 1) && V.newBaron !== 1 && effectiveWeek >= V.imperialEventWeek + 3) { V.newBaron = 1; V.imperialEventWeek = effectiveWeek; - Engine.play("SE newBaron"); + setTimeout(() => Engine.play("SE newBaron"), Engine.minDomActionDelay); } 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"); + setTimeout(() => Engine.play("secExpSmilingMan"), Engine.minDomActionDelay); } 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"); + setTimeout(() => Engine.play("SE FCNN Station"), Engine.minDomActionDelay); } else if (effectiveWeek >= V.murderAttemptWeek) { - Engine.play("Murder Attempt"); + setTimeout(() => Engine.play("Murder Attempt"), Engine.minDomActionDelay); } else if (V.illegalDeals.slave !== 0 && V.illegalDeals.slave !== -1) { V.event = "slave trade"; - Engine.play("Murder Attempt"); + setTimeout(() => Engine.play("Murder Attempt"), Engine.minDomActionDelay); } else if (V.illegalDeals.trade !== 0 && V.illegalDeals.trade !== -1 && effectiveWeek >= V.illegalDeals.trade.week) { V.event = "trade deal"; - Engine.play("Murder Attempt"); + setTimeout(() => Engine.play("Murder Attempt"), Engine.minDomActionDelay); } else if (V.illegalDeals.military !== 0 && V.illegalDeals.military !== -1 && effectiveWeek >= V.illegalDeals.military.week) { V.event = "military deal"; - Engine.play("Murder Attempt"); + setTimeout(() => Engine.play("Murder Attempt"), Engine.minDomActionDelay); } else { if (random(1, 100) > effectiveWeek + 25) { - Engine.play("RIE Eligibility Check"); + setTimeout(() => Engine.play("RIE Eligibility Check"), Engine.minDomActionDelay); } else { - Engine.play("Random Nonindividual Event"); + setTimeout(() => Engine.play("Random Nonindividual Event"), Engine.minDomActionDelay); } } } else { if (random(1, 200) > effectiveWeek + 100 || V.hostageRescued === 1) { - Engine.play("RIE Eligibility Check"); + setTimeout(() => Engine.play("RIE Eligibility Check"), Engine.minDomActionDelay); } else { - Engine.play("Random Nonindividual Event"); + setTimeout(() => Engine.play("Random Nonindividual Event"), Engine.minDomActionDelay); } } // never reached, just for typing -- GitLab