fixe some bugs

This commit is contained in:
Daniel Xie
2017-04-17 07:26:54 -05:00
parent a02663edf5
commit ffda024431
5 changed files with 16 additions and 9 deletions
+5 -3
View File
@@ -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