Added Soft Reset ability in Options. Cancelling work only halves reputation, not other stuff liek money and exp. Added 7 new hacking Augmentations

This commit is contained in:
Daniel Xie 2017-05-31 10:58:09 -05:00
parent 2752ec069a
commit 6714d664d0
7 changed files with 212 additions and 42 deletions

@ -760,7 +760,19 @@
<br>
<a id="save-game-link" class="a-link-button" style="display:block;"> Save Game </a>
<a id="delete-game-link" class="a-link-button" style="display:block;"> Delete Game </a>
<a id="debug-delete-scripts-link" class="a-link-button" style="display:block;"> (DEBUG) Delete Active Scripts </a>
<a id="debug-delete-scripts-link" class="a-link-button tooltip" style="display:block;">
(DEBUG) Delete Active Scripts
<span class="tooltiptext">
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.
</span>
</a>
<a id="debug-soft-reset" class="a-link-button tooltip" style="display:block;">
(DEBUG) Soft Reset
<span class="tooltiptext">
Perform a soft reset. Resets everything as if you had just purchased an Augmentation
</span>
</a>
</div>
</div>

@ -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. <br><br> 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. <br><br>" +
"This augmentation: <br>" +
"Increases the player's hacking skill by 20%<br>" +
"Increases the player's hacking experience gain rate by 20%<br>" +
"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. <br><br>" +
"This augmentation: <br>" +
"Increases the player's hacking speed by 1%<br>" +
"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. <br><br>" +
"This augmentation: <br>" +
"Increases the player's hacking speed by 2%<br>" +
"Increases the player's chance of successfully performing a hack by 5%<br>" +
"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. <br><br>" +
"This augmentation:<br>" +
"Increases the player's hacking speed by 2%<br>" +
"Increases the amount of money the player gains from hacking by 20%<br>" +
"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. <br><br>" +
"This augmentation: <br>" +
"Increases the player's hacking speed by 2%<br>" +
"Increases the amount of money the player gains from hacking by 25%<br>" +
"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. <br><br>" +
"This augmentation:<br>" +
"Increases the player's hacking skill by 60%<br>" +
"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. <br><br>" +
"This augmentation: <br>" +
"Increases the player's hacking skill by 30%<br>" +
"Increases the player's hacking experience gain rate by 30%<br>"+
"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.<br><br>" +
"This augmentation:<br>" +
"Increases the amount of money produced by Hacknet Nodes by 20%<br>" +
"Increases the amount of money produced by Hacknet Nodes by 15%<br>" +
"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.<br><br>" +
"This augmentation:<br> " +
"Increases the amount of money produced by Hacknet Nodes by 15%<br>" +
"Increases the amount of money produced by Hacknet Nodes by 10%<br>" +
"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:

@ -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.<br><br>" +
"As you continue to work at a company, you will gain more and more reputation at that company. When your stats " +

@ -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;

@ -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;

@ -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: <br>" +
"$" + formatNumber(this.workMoneyGained / cancMult, 2) + "<br>" +
formatNumber(this.workRepGained / cancMult, 4) + " reputation for the company <br>" +
formatNumber(this.workHackExpGained / cancMult, 4) + " hacking exp <br>" +
formatNumber(this.workStrExpGained / cancMult, 4) + " strength exp <br>" +
formatNumber(this.workDefExpGained / cancMult, 4) + " defense exp <br>" +
formatNumber(this.workDexExpGained / cancMult, 4) + " dexterity exp <br>" +
formatNumber(this.workAgiExpGained / cancMult, 4) + " agility exp <br>" +
formatNumber(this.workChaExpGained / cancMult, 4) + " charisma exp<br>";
"$" + formatNumber(this.workMoneyGained, 2) + "<br>" +
formatNumber(this.workRepGained, 4) + " reputation for the company <br>" +
formatNumber(this.workHackExpGained, 4) + " hacking exp <br>" +
formatNumber(this.workStrExpGained, 4) + " strength exp <br>" +
formatNumber(this.workDefExpGained, 4) + " defense exp <br>" +
formatNumber(this.workDexExpGained, 4) + " dexterity exp <br>" +
formatNumber(this.workAgiExpGained, 4) + " agility exp <br>" +
formatNumber(this.workChaExpGained, 4) + " charisma exp<br>";
if (cancelled) {
txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " +
"Since you cancelled your work early, you only gained half of the experience, money, and reputation you earned. <br><br>" + txt;
"Since you cancelled your work early, you only gained half of the reputation you earned. <br><br>" + txt;
} else {
txt = "You worked a full shift of 8 hours! <br><br> " +
"You earned a total of: <br>" + txt;
@ -492,8 +489,8 @@ PlayerObject.prototype.work = function(numCycles) {
formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp <br>" +
formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp <br><br> " +
formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp <br><br>" +
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, <br>" +
"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."
}

@ -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;
});
},