diff --git a/src/Faction.js b/src/Faction.js index d476b9bec..6d54215f1 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -430,7 +430,7 @@ displayFactionContent = function(factionName) { //The old buttons need to be replaced to clear the old event listeners var newHackButton = hackButton.cloneNode(true); var newFieldWorkButton = fieldWorkButton.cloneNode(true); - var newSecurityWorkButton = securityWorkbutton.cloneNode(true); + var newSecurityWorkButton = securityWorkButton.cloneNode(true); hackButton.parentNode.replaceChild(newHackButton, hackButton); fieldWorkButton.parentNode.replaceChild(newFieldWorkButton, fieldWorkButton); diff --git a/src/Location.js b/src/Location.js index 435dc831d..75be74fb8 100644 --- a/src/Location.js +++ b/src/Location.js @@ -1243,7 +1243,7 @@ initLocationButtons = function() { purchaseTor.addEventListener("click", function() { purchaseTor(); return false; - } + }); travelToAevum.addEventListener("click", function() { travelBoxCreate(Locations.Aevum, 1000000); diff --git a/src/Netscript/Evaluator.js b/src/Netscript/Evaluator.js index 0c0de5dd9..fbb4017d7 100644 --- a/src/Netscript/Evaluator.js +++ b/src/Netscript/Evaluator.js @@ -254,8 +254,8 @@ function evaluate(exp, workerScript) { Player.hacking_exp += expGainedOnFailure; workerScript.scriptRef.onlineExpGained += expGainedOnFailure; - console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + expGainedOnFailure + "exp"); - workerScript.scriptRef.log("Script unsuccessful to hack " + server.hostname + ". Gained " + expGainedOnFailure + "exp"); + console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + expGainedOnFailure + " exp"); + workerScript.scriptRef.log("Script unsuccessful to hack " + server.hostname + ". Gained " + expGainedOnFailure + " exp"); resolve("Hack failure"); } }, hackingTime * 1000); @@ -529,7 +529,9 @@ function scriptCalculateHackingChance(server) { var difficultyMult = (100 - server.hackDifficulty) / 100; var skillMult = (Player.hacking_chance_mult * Player.hacking_skill); var skillChance = (skillMult - server.requiredHackingSkill) / skillMult; - return (skillChance * difficultyMult); + var chance = skillChance * difficultyMult; + if (chance < 0) {return 0;} + else {return chance;} } //The same as Player's calculateHackingTime() function but takes in the server as an argument diff --git a/src/Player.js b/src/Player.js index 7fa128580..87bf5b544 100644 --- a/src/Player.js +++ b/src/Player.js @@ -15,8 +15,8 @@ function PlayerObject() { //Hacking multipliers this.hacking_chance_mult = 2; //Increase through ascensions/augmentations - //this.hacking_speed_mult = 5; //Decrease through ascensions/augmentations - this.hacking_speed_mult = 1; //Make it faster for debugging + this.hacking_speed_mult = 5; //Decrease through ascensions/augmentations + //this.hacking_speed_mult = 1; //Make it faster for debugging this.hacking_money_mult = .001; //Increase through ascensions/augmentations. Can't go above 1 //Note: "Lifetime" refers to current ascension, "total" refers to the entire game history @@ -177,7 +177,9 @@ PlayerObject.prototype.calculateHackingChance = function() { var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100; var skillMult = (this.hacking_chance_mult * this.hacking_skill); var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult; - return (skillChance * difficultyMult); + var chance = skillChance * difficultyMult; + if (chance < 0) {return 0;} + else {return chance;} } //Calculate the time it takes to hack a server in seconds. Returns the time diff --git a/utils/FactionInvitationBox.js b/utils/FactionInvitationBox.js index 6d56d3281..fdd467857 100644 --- a/utils/FactionInvitationBox.js +++ b/utils/FactionInvitationBox.js @@ -40,7 +40,10 @@ factionInvitationBoxCreate = function(faction) { //TODO Faction invitation message var yesButton = document.getElementById("faction-invitation-box-yes"); - yesButton.addEventListener("click", function() { + var newYesButton = yesButton.cloneNode(true); + yesButton.parentNode.replaceChild(newYesButton, yesButton); + + newYesButton.addEventListener("click", function() { joinFaction(faction); factionInvitationBoxClose(); return false;