From 6714d664d0db91f636db0714167308ce1a6517b0 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Wed, 31 May 2017 10:58:09 -0500 Subject: [PATCH] Added Soft Reset ability in Options. Cancelling work only halves reputation, not other stuff liek money and exp. Added 7 new hacking Augmentations --- index.html | 14 +++- src/Augmentations.js | 164 ++++++++++++++++++++++++++++++++++++-- src/Constants.js | 10 +-- src/HacknetNode.js | 2 +- src/NetscriptEvaluator.js | 2 +- src/Player.js | 51 ++++++------ src/engine.js | 11 ++- 7 files changed, 212 insertions(+), 42 deletions(-) diff --git a/index.html b/index.html index 7bf409b5a..6a076d6d0 100644 --- a/index.html +++ b/index.html @@ -760,7 +760,19 @@
Save Game Delete Game - (DEBUG) Delete Active Scripts + + (DEBUG) Delete Active Scripts + + Debug option used to forcefully kill all active running scripts, in case there is a bug or some unexpected issue with the game. After + using this, save the game and then reload the page. + + + + (DEBUG) Soft Reset + + Perform a soft reset. Resets everything as if you had just purchased an Augmentation + + diff --git a/src/Augmentations.js b/src/Augmentations.js index 153455e2b..061108d27 100644 --- a/src/Augmentations.js +++ b/src/Augmentations.js @@ -98,6 +98,13 @@ AugmentationNames = { ENMAnalyzeEngine: "Embedded Netburner Module Analyze Engine", ENMDMA: "Embedded Netburner Module Direct Memory Access Upgrade", Neuralstimulator: "Neuralstimulator", + NeuralAccelerator: "Neural Accelerator", + CranialSignalProcessorsG1: "Cranial Signal Processors - Gen I", + CranialSignalProcessorsG2: "Cranial Signal Processors - Gen II", + CranialSignalProcessorsG3: "Cranial Signal Processors - Gen III", + CranialSignalProcessorsG4: "Cranial Signal Processors - Gen IV", + CranialSignalProcessorsG5: "Cranial Signal Processors - Gen V", + NeuronalDensification: "Neuronal Densification", NuoptimalInjectorImplant: "Nuoptimal Nootropic Injector Implant", SpeechEnhancement: "Speech Enhancement", FocusWire: "FocusWire", @@ -416,7 +423,7 @@ initAugmentations = function() { BitWire.setRequirements(1500, 2000000); BitWire.setInfo("A small brain implant embedded in the cerebrum. This regulates and improves the brain's computing " + "capabilities.

This augmentation increases the player's hacking skill by 10%"); - BitWire.addToFactions(["CyberSec", "BitRunners", "NiteSec"]); + BitWire.addToFactions(["CyberSec", "NiteSec"]); if (augmentationExists(AugmentationNames.BitWire)) { BitWire.owned = Augmentations[AugmentationNames.BitWire].owned; delete Augmentations[AugmentationNames.BitWire]; @@ -629,6 +636,120 @@ initAugmentations = function() { } AddToAugmentations(Neuralstimulator); + var NeuralAccelerator = new Augmentation(AugmentationNames.NeuralAccelerator); + NeuralAccelerator.setRequirements(80000, 300000000); + NeuralAccelerator.setInfo("A microprocessor that accelerates the processing " + + "speed of biological neural networks. This is a cranial implant that is embedded inside the brain.

" + + "This augmentation:
" + + "Increases the player's hacking skill by 20%
" + + "Increases the player's hacking experience gain rate by 20%
" + + "Increases the amount of money the player gains from hacking by 20%"); + NeuralAccelerator.addToFactions(["BitRunners"]); + if (augmentationExists(AugmentationNames.NeuralAccelerator)) { + NeuralAccelerator.owned = Augmentations[AugmentationNames.NeuralAccelerator].owned; + delete Augmentations[AugmentationNames.NeuralAccelerator]; + } + AddToAugmentations(NeuralAccelerator); + + var CranialSignalProcessorsG1 = new Augmentation(AugmentationNames.CranialSignalProcessorsG1); + CranialSignalProcessorsG1.setRequirements(4000, 15000000); + CranialSignalProcessorsG1.setInfo("The first generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.

" + + "This augmentation:
" + + "Increases the player's hacking speed by 1%
" + + "Increases the player's hacking skill by 10%"); + CranialSignalProcessorsG1.addToFactions(["CyberSec"]); + if (augmentationExists(AugmentationNames.CranialSignalProcessorsG1)) { + CranialSignalProcessorsG1.owned = Augmentations[AugmentationNames.CranialSignalProcessorsG1].owned; + delete Augmentations[AugmentationNames.CranialSignalProcessorsG1]; + } + AddToAugmentations(CranialSignalProcessorsG1); + + var CranialSignalProcessorsG2 = new Augmentation(AugmentationNames.CranialSignalProcessorsG2); + CranialSignalProcessorsG2.setRequirements(7500, 21000000); + CranialSignalProcessorsG2.setInfo("The second generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.

" + + "This augmentation:
" + + "Increases the player's hacking speed by 2%
" + + "Increases the player's chance of successfully performing a hack by 5%
" + + "Increases the player's hacking skill by 10%"); + CranialSignalProcessorsG2.addToFactions(["NiteSec"]); + if (augmentationExists(AugmentationNames.CranialSignalProcessorsG2)) { + CranialSignalProcessorsG2.owned = Augmentations[AugmentationNames.CranialSignalProcessorsG2].owned; + delete Augmentations[AugmentationNames.CranialSignalProcessorsG2]; + } + AddToAugmentations(CranialSignalProcessorsG2); + + var CranialSignalProcessorsG3 = new Augmentation(AugmentationNames.CranialSignalProcessorsG3); + CranialSignalProcessorsG3.setRequirements(20000, 90000000); + CranialSignalProcessorsG3.setInfo("The third generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.

" + + "This augmentation:
" + + "Increases the player's hacking speed by 2%
" + + "Increases the amount of money the player gains from hacking by 20%
" + + "Increases the player's hacking skill by 10%"); + CranialSignalProcessorsG3.addToFactions(["NiteSec", "The Black Hand"]); + if (augmentationExists(AugmentationNames.CranialSignalProcessorsG3)) { + CranialSignalProcessorsG3.owned = Augmentations[AugmentationNames.CranialSignalProcessorsG3].owned; + delete Augmentations[AugmentationNames.CranialSignalProcessorsG3]; + } + AddToAugmentations(CranialSignalProcessorsG3); + + var CranialSignalProcessorsG4 = new Augmentation(AugmentationNames.CranialSignalProcessorsG4); + CranialSignalProcessorsG4.setRequirements(50000, 200000000); + CranialSignalProcessorsG4.setInfo("The fourth generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.

" + + "This augmentation:
" + + "Increases the player's hacking speed by 2%
" + + "Increases the amount of money the player gains from hacking by 25%
" + + "Increases the amount of money the player can inject into servers using grow() by 25%"); + CranialSignalProcessorsG4.addToFactions(["The Black Hand"]); + if (augmentationExists(AugmentationNames.CranialSignalProcessorsG4)) { + CranialSignalProcessorsG4.owned = Augmentations[AugmentationNames.CranialSignalProcessorsG4].owned; + delete Augmentations[AugmentationNames.CranialSignalProcessorsG4]; + } + AddToAugmentations(CranialSignalProcessorsG4); + + var CranialSignalProcessorsG5 = new Augmentation(AugmentationNames.CranialSignalProcessorsG5); + CranialSignalProcessorsG5.setRequirements(100000, 350000000); + CranialSignalProcessorsG5.setInfo("The fifth generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.

" + + "This augmentation:
" + + "Increases the player's hacking skill by 60%
" + + "Increases the amount of money the player can inject into servers using grow() by 50%"); + CranialSignalProcessorsG5.addToFactions(["BitRunners"]); + if (augmentationExists(AugmentationNames.CranialSignalProcessorsG5)) { + CranialSignalProcessorsG5.owned = Augmentations[AugmentationNames.CranialSignalProcessorsG5].owned; + delete Augmentations[AugmentationNames.CranialSignalProcessorsG5]; + } + AddToAugmentations(CranialSignalProcessorsG5); + + var NeuronalDensification = new Augmentation(AugmentationNames.NeuronalDensification); + NeuronalDensification.setRequirements(75000, 250000000); + NeuronalDensification.setInfo("The brain is surgically re-engineered to have increased neuronal density " + + "by decreasing the neuron gap junction. Then, the body is genetically modified " + + "to enhance the production and capabilities of its neural stem cells.

" + + "This augmentation:
" + + "Increases the player's hacking skill by 30%
" + + "Increases the player's hacking experience gain rate by 30%
"+ + "Increases the player's hacking speed by 3%"); + NeuronalDensification.addToFactions(["Clarke Incorporated"]); + if (augmentationExists(AugmentationNames.NeuronalDensification)) { + NeuronalDensification.owned = Augmentations[AugmentationNames.NeuronalDensification].owned; + delete Augmentations[AugmentationNames.NeuronalDensification]; + } + AddToAugmentations(NeuronalDensification); + //Work Augmentations var NuoptimalInjectorImplant = new Augmentation(AugmentationNames.NuoptimalInjectorImplant); NuoptimalInjectorImplant.setRequirements(2000, 2500000); @@ -745,7 +866,7 @@ initAugmentations = function() { "the brain. This allows the user to engineer custom hardware and software " + "for the Hacknet Node that provides better performance.

" + "This augmentation:
" + - "Increases the amount of money produced by Hacknet Nodes by 20%
" + + "Increases the amount of money produced by Hacknet Nodes by 15%
" + "Decreases the cost of purchasing a Hacknet Node Core by 15%"); HacknetNodeCPUUpload.addToFactions(["Netburners"]); if (augmentationExists(AugmentationNames.HacknetNodeCPUUpload)) { @@ -760,7 +881,7 @@ initAugmentations = function() { "into the brain. This allows the user to engineer custom cache hardware for the " + "Hacknet Node that offers better performance.

" + "This augmentation:
" + - "Increases the amount of money produced by Hacknet Nodes by 15%
" + + "Increases the amount of money produced by Hacknet Nodes by 10%
" + "Decreases the cost of leveling up a Hacknet Node by 15%"); HacknetNodeCacheUpload.addToFactions(["Netburners"]); if (augmentationExists(AugmentationNames.HacknetNodeCacheUpload)) { @@ -1477,6 +1598,39 @@ applyAugmentation = function(aug, reapply=false) { Player.hacking_chance_mult *= 1.1; Player.hacking_exp_mult *= 1.25; break; + case AugmentationNames.NeuralAccelerator: + Player.hacking_mult *= 1.2; + Player.hacking_exp_mult *= 1.2; + Player.hacking_money_mult *= 1.2; + break; + case AugmentationNames.CranialSignalProcessorsG1: + Player.hacking_speed_mult *= 0.99; + Player.hacking_mult *= 1.1; + break; + case AugmentationNames.CranialSignalProcessorsG2: + Player.hacking_speed_mult *= 0.98; + Player.hacking_chance_mult *= 1.05; + Player.hacking_mult *= 1.1; + break; + case AugmentationNames.CranialSignalProcessorsG3: + Player.hacking_speed_mult *= 0.98; + Player.hacking_money_mult *= 1.2; + Player.hacking_mult *= 1.1; + break; + case AugmentationNames.CranialSignalProcessorsG4: + Player.hacking_speed_mult *= 0.98; + Player.hacking_money_mult *= 1.25; + Player.hacking_grow_mult *= 1.25; + break; + case AugmentationNames.CranialSignalProcessorsG5: + Player.hacking_mult *= 1.6; + Player.hacking_grow_mult *= 1.5; + break; + case AugmentationNames.NeuronalDensification: + Player.hacking_mult *= 1.3; + Player.hacking_exp_mult *= 1.3; + Player.hacking_speed_mult *= 0.97; + break; //Work augmentations case AugmentationNames.NuoptimalInjectorImplant: //Low medium level @@ -1516,11 +1670,11 @@ applyAugmentation = function(aug, reapply=false) { //Hacknet Node Augmentations case AugmentationNames.HacknetNodeCPUUpload: - Player.hacknet_node_money_mult *= 1.2; + Player.hacknet_node_money_mult *= 1.15; Player.hacknet_node_purchase_cost_mult *= 0.85; break; case AugmentationNames.HacknetNodeCacheUpload: - Player.hacknet_node_money_mult *= 1.15; + Player.hacknet_node_money_mult *= 1.10; Player.hacknet_node_level_cost_mult *= 0.85; break; case AugmentationNames.HacknetNodeNICUpload: diff --git a/src/Constants.js b/src/Constants.js index 399d2600d..24234780f 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -19,10 +19,10 @@ CONSTANTS = { /* Hacknet Node constants */ HacknetNodeMoneyGainPerLevel: 1.65, - HacknetNodePurchaseNextMult: 1.38, //Multiplier when purchasing an additional hacknet node + HacknetNodePurchaseNextMult: 1.39, //Multiplier when purchasing an additional hacknet node HacknetNodeUpgradeLevelMult: 1.04, //Multiplier for cost when upgrading level - HacknetNodeUpgradeRamMult: 1.24, //Multiplier for cost when upgrading RAM - HacknetNodeUpgradeCoreMult: 1.48, //Multiplier for cost when buying another core + HacknetNodeUpgradeRamMult: 1.26, //Multiplier for cost when upgrading RAM + HacknetNodeUpgradeCoreMult: 1.49, //Multiplier for cost when buying another core HacknetNodeMaxLevel: 200, HacknetNodeMaxRam: 64, @@ -62,7 +62,7 @@ CONSTANTS = { ScriptHNUpgCoreRamCost: 0.8, //Server growth rate - ServerGrowthRate: 1.0015, + ServerGrowthRate: 1.0018, //Maximum number of log entries for a script MaxLogCapacity: 40, @@ -397,7 +397,7 @@ CONSTANTS = { "other actions such as using your terminal or visiting other locations (However, note that any scripts you have " + "running on servers will continue to run as you work!). It is possible to cancel your work shift before the " + "8 hours is up. However, if you have a full-time job, then cancelling a shift early will result in you gaining " + - "only half of all of the money, experience, and reputation " + + "only half of the reputation " + "that you had earned up to that point. There are also part-time/consultant jobs available where you will not " + " be penalized if you cancel a work shift early. However, these positions pay less than full-time positions.

" + "As you continue to work at a company, you will gain more and more reputation at that company. When your stats " + diff --git a/src/HacknetNode.js b/src/HacknetNode.js index 39aa2e51d..b8c3ef05f 100644 --- a/src/HacknetNode.js +++ b/src/HacknetNode.js @@ -49,7 +49,7 @@ HacknetNode.prototype.updateMoneyGainRate = function() { var gainPerLevel = CONSTANTS.HacknetNodeMoneyGainPerLevel; this.moneyGainRatePerSecond = (this.level * gainPerLevel) * - Math.pow(1.0375, this.ram-1) * + Math.pow(1.037, this.ram-1) * ((this.numCores + 4) / 5) * Player.hacknet_node_money_mult; if (isNaN(this.moneyGainRatePerSecond)) { this.moneyGainRatePerSecond = 0; diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index ffc49ddb2..b17124d0c 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -1266,7 +1266,7 @@ function scriptCalculateExpGain(server) { function scriptCalculatePercentMoneyHacked(server) { var difficultyMult = (100 - server.hackDifficulty) / 100; var skillMult = (Player.hacking_skill - (server.requiredHackingSkill - 1)) / Player.hacking_skill; - var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult / 350; + var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult / 150; if (percentMoneyHacked < 0) {return 0;} if (percentMoneyHacked > 1) {return 1;} return percentMoneyHacked; diff --git a/src/Player.js b/src/Player.js index 5fed36345..8497f4ad9 100644 --- a/src/Player.js +++ b/src/Player.js @@ -243,7 +243,7 @@ PlayerObject.prototype.calculateHackingTime = function() { PlayerObject.prototype.calculatePercentMoneyHacked = function() { var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100; var skillMult = (this.hacking_skill - (this.getCurrentServer().requiredHackingSkill - 1)) / this.hacking_skill; - var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult / 350; + var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult / 150; console.log("Percent money hacked calculated to be: " + percentMoneyHacked); if (percentMoneyHacked < 0) {return 0;} if (percentMoneyHacked > 1) {return 1;} @@ -367,47 +367,44 @@ PlayerObject.prototype.resetWorkStatus = function() { document.getElementById("work-in-progress-text").innerHTML = ""; } -PlayerObject.prototype.gainWorkExp = function(divMult = 1) { - this.gainHackingExp(this.workHackExpGained / divMult); - this.gainStrengthExp(this.workStrExpGained / divMult); - this.gainDefenseExp(this.workDefExpGained / divMult); - this.gainDexterityExp(this.workDexExpGained / divMult); - this.gainAgilityExp(this.workAgiExpGained / divMult); - this.gainCharismaExp(this.workChaExpGained / divMult); +PlayerObject.prototype.gainWorkExp = function() { + this.gainHackingExp(this.workHackExpGained); + this.gainStrengthExp(this.workStrExpGained); + this.gainDefenseExp(this.workDefExpGained); + this.gainDexterityExp(this.workDexExpGained); + this.gainAgilityExp(this.workAgiExpGained); + this.gainCharismaExp(this.workChaExpGained); } /* Working for Company */ PlayerObject.prototype.finishWork = function(cancelled) { //Since the work was cancelled early, player only gains half of what they've earned so far - var cancMult = 1; - if (cancelled) {cancMult = 2;} - - if (Engine.Debug) { - console.log("Player finishWork() called with " + this.workMoneyGained / cancMult + " $ gained"); + if (cancelled) { + this.workRepGained /= 2; } - this.gainWorkExp(cancMult); + this.gainWorkExp(); var company = Companies[this.companyName]; - company.playerReputation += (this.workRepGained / cancMult); + company.playerReputation += (this.workRepGained); - this.gainMoney(this.workMoneyGained / cancMult); + this.gainMoney(this.workMoneyGained); this.updateSkillLevels(); var txt = "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained / cancMult, 2) + "
" + - formatNumber(this.workRepGained / cancMult, 4) + " reputation for the company
" + - formatNumber(this.workHackExpGained / cancMult, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained / cancMult, 4) + " strength exp
" + - formatNumber(this.workDefExpGained / cancMult, 4) + " defense exp
" + - formatNumber(this.workDexExpGained / cancMult, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained / cancMult, 4) + " agility exp
" + - formatNumber(this.workChaExpGained / cancMult, 4) + " charisma exp
"; + "$" + formatNumber(this.workMoneyGained, 2) + "
" + + formatNumber(this.workRepGained, 4) + " reputation for the company
" + + formatNumber(this.workHackExpGained, 4) + " hacking exp
" + + formatNumber(this.workStrExpGained, 4) + " strength exp
" + + formatNumber(this.workDefExpGained, 4) + " defense exp
" + + formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + + formatNumber(this.workAgiExpGained, 4) + " agility exp
" + + formatNumber(this.workChaExpGained, 4) + " charisma exp
"; if (cancelled) { txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + - "Since you cancelled your work early, you only gained half of the experience, money, and reputation you earned.

" + txt; + "Since you cancelled your work early, you only gained half of the reputation you earned.

" + txt; } else { txt = "You worked a full shift of 8 hours!

" + "You earned a total of:
" + txt; @@ -492,8 +489,8 @@ PlayerObject.prototype.work = function(numCycles) { formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" + formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp

" + formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp

" + - "You will automatically finish after working for 8 hours. You can cancel earlier if you wish,
" + - "but you will only gain half of the experience, money, and reputation you've earned so far." + "You will automatically finish after working for 8 hours. You can cancel earlier if you wish, " + + "but you will only gain half of the reputation you've earned so far." } diff --git a/src/engine.js b/src/engine.js index 23b28909f..293ea3392 100644 --- a/src/engine.js +++ b/src/engine.js @@ -1094,11 +1094,18 @@ var Engine = { document.getElementById("world-menu-link").removeAttribute("class"); document.getElementById("tutorial-menu-link").removeAttribute("class"); - //DEBUG + //DEBUG Delete active Scripts on home document.getElementById("debug-delete-scripts-link").addEventListener("click", function() { console.log("Deleting running scripts on home computer"); Player.getHomeComputer().runningScripts = []; - dialogBoxCreate("Forcefully deleted scripts. Please refresh page"); + dialogBoxCreate("Forcefully deleted all running scripts on home computer. Please save and refresh page"); + return false; + }); + + //DEBUG Soft Reset + document.getElementById("debug-soft-reset").addEventListener("click", function() { + dialogBoxCreate("Soft Reset!"); + prestigeAugmentation(); return false; }); },