mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 07:02:26 +01:00
Server security increases slightly when hacked
This commit is contained in:
parent
e70f499f13
commit
07d9dc6db8
@ -62,8 +62,10 @@ CONSTANTS = {
|
|||||||
ScriptHNUpgRamRamCost: 0.6,
|
ScriptHNUpgRamRamCost: 0.6,
|
||||||
ScriptHNUpgCoreRamCost: 0.8,
|
ScriptHNUpgCoreRamCost: 0.8,
|
||||||
|
|
||||||
//Server growth rate
|
//Server constants
|
||||||
ServerGrowthRate: 1.0018,
|
ServerGrowthRate: 1.0018, //Growth rate
|
||||||
|
ServerFortifyAmount: 0.001, //Amount by which server's security increases when its hacked
|
||||||
|
ServerWeakenAmount: 0.1, //Amount by which server's security decreases when weakened
|
||||||
|
|
||||||
//Maximum number of log entries for a script
|
//Maximum number of log entries for a script
|
||||||
MaxLogCapacity: 40,
|
MaxLogCapacity: 40,
|
||||||
|
@ -288,6 +288,7 @@ function evaluate(exp, workerScript) {
|
|||||||
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
|
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
|
||||||
console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
|
console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
|
||||||
workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
|
workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
|
||||||
|
server.fortify(CONSTANTS.ServerFortifyAmount);
|
||||||
resolve("Hack success");
|
resolve("Hack success");
|
||||||
} else {
|
} else {
|
||||||
if (env.stopFlag) {reject(workerScript); return;}
|
if (env.stopFlag) {reject(workerScript); return;}
|
||||||
|
@ -108,6 +108,17 @@ Server.prototype.getScript = function(scriptName) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Strengthens a server's security level (difficulty) by the specified amount
|
||||||
|
Server.prototype.fortify = function(amt) {
|
||||||
|
this.hackDifficulty += amt;
|
||||||
|
if (this.hackDifficulty > 99) {this.hackDifficulty = 99;}
|
||||||
|
}
|
||||||
|
|
||||||
|
Server.prototype.weaken = function(amt) {
|
||||||
|
this.hackDifficulty -= amt;
|
||||||
|
if (this.hackDifficulty < 1) {this.hackDifficulty = 1;}
|
||||||
|
}
|
||||||
|
|
||||||
//Functions for loading and saving a Server
|
//Functions for loading and saving a Server
|
||||||
Server.prototype.toJSON = function() {
|
Server.prototype.toJSON = function() {
|
||||||
return Generic_toJSON("Server", this);
|
return Generic_toJSON("Server", this);
|
||||||
|
@ -291,6 +291,8 @@ var Terminal = {
|
|||||||
Player.gainMoney(moneyGained);
|
Player.gainMoney(moneyGained);
|
||||||
|
|
||||||
Player.gainHackingExp(expGainedOnSuccess)
|
Player.gainHackingExp(expGainedOnSuccess)
|
||||||
|
|
||||||
|
Player.getCurrentServer().fortify(CONSTANTS.ServerFortifyAmount);
|
||||||
|
|
||||||
post("Hack successful! Gained $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " hacking EXP");
|
post("Hack successful! Gained $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " hacking EXP");
|
||||||
} else { //Failure
|
} else { //Failure
|
||||||
@ -317,8 +319,7 @@ var Terminal = {
|
|||||||
else {rootAccess = "NO";}
|
else {rootAccess = "NO";}
|
||||||
post("Root Access: " + rootAccess);
|
post("Root Access: " + rootAccess);
|
||||||
post("Required hacking skill: " + Player.getCurrentServer().requiredHackingSkill);
|
post("Required hacking skill: " + Player.getCurrentServer().requiredHackingSkill);
|
||||||
//TODO Make these actual estimates by adding a random offset to result?
|
post("Estimated server security level(1-100): " + formatNumber(addOffset(Player.getCurrentServer().hackDifficulty, 5), 0));
|
||||||
//TODO Change the text to sound better
|
|
||||||
post("Estimated chance to hack: " + formatNumber(addOffset(Player.calculateHackingChance() * 100, 5), 2) + "%");
|
post("Estimated chance to hack: " + formatNumber(addOffset(Player.calculateHackingChance() * 100, 5), 2) + "%");
|
||||||
post("Estimated time to hack: " + formatNumber(addOffset(Player.calculateHackingTime(), 5), 3) + " seconds");
|
post("Estimated time to hack: " + formatNumber(addOffset(Player.calculateHackingTime(), 5), 3) + " seconds");
|
||||||
post("Estimated total money available on server: $" + formatNumber(addOffset(Player.getCurrentServer().moneyAvailable, 5), 2));
|
post("Estimated total money available on server: $" + formatNumber(addOffset(Player.getCurrentServer().moneyAvailable, 5), 2));
|
||||||
|
Loading…
Reference in New Issue
Block a user