mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
Merge pull request #14 from danielyxie/dev
Massively nerfed Hacknet nodes because the math behind their producti…
This commit is contained in:
commit
83056cf1cf
@ -1,5 +1,5 @@
|
|||||||
CONSTANTS = {
|
CONSTANTS = {
|
||||||
Version: "0.8",
|
Version: "0.9",
|
||||||
|
|
||||||
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||||
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||||
@ -18,12 +18,16 @@ CONSTANTS = {
|
|||||||
BaseCostForHacknetNodeCore: 1000000,
|
BaseCostForHacknetNodeCore: 1000000,
|
||||||
|
|
||||||
/* Hacknet Node constants */
|
/* Hacknet Node constants */
|
||||||
HacknetNodeMoneyGainPerLevel: 1,
|
HacknetNodeMoneyGainPerLevel: 0.75,
|
||||||
HacknetNodePurchaseNextMult: 1.35, //Multiplier when purchasing an additional hacknet node
|
HacknetNodePurchaseNextMult: 1.35, //Multiplier when purchasing an additional hacknet node
|
||||||
HacknetNodeUpgradeLevelMult: 1.06, //Multiplier for cost when upgrading level
|
HacknetNodeUpgradeLevelMult: 1.06, //Multiplier for cost when upgrading level
|
||||||
HacknetNodeUpgradeRamMult: 1.25, //Multiplier for cost when upgrading RAM
|
HacknetNodeUpgradeRamMult: 1.25, //Multiplier for cost when upgrading RAM
|
||||||
HacknetNodeUpgradeCoreMult: 1.45, //Multiplier for cost when buying another core
|
HacknetNodeUpgradeCoreMult: 1.45, //Multiplier for cost when buying another core
|
||||||
|
|
||||||
|
HacknetNodeMaxLevel: 500,
|
||||||
|
HacknetNodeMaxRam: 64,
|
||||||
|
HacknetNodeMaxCores: 16,
|
||||||
|
|
||||||
/* Augmentation */
|
/* Augmentation */
|
||||||
//NeuroFlux Governor cost multiplier as you level up
|
//NeuroFlux Governor cost multiplier as you level up
|
||||||
NeuroFluxGovernorLevelMult: 1.09,
|
NeuroFluxGovernorLevelMult: 1.09,
|
||||||
|
@ -18,7 +18,7 @@ HacknetNode.prototype.updateMoneyGainRate = function() {
|
|||||||
|
|
||||||
//Each CPU core doubles the speed. Every 1GB of ram adds 15% increase
|
//Each CPU core doubles the speed. Every 1GB of ram adds 15% increase
|
||||||
this.moneyGainRatePerSecond = (this.level * gainPerLevel) *
|
this.moneyGainRatePerSecond = (this.level * gainPerLevel) *
|
||||||
Math.pow(1.15, this.ram-1) *
|
Math.pow(1.05, this.ram-1) *
|
||||||
this.numCores * Player.hacknet_node_money_mult;
|
this.numCores * Player.hacknet_node_money_mult;
|
||||||
if (isNaN(this.moneyGainRatePerSecond)) {
|
if (isNaN(this.moneyGainRatePerSecond)) {
|
||||||
this.moneyGainRatePerSecond = 0;
|
this.moneyGainRatePerSecond = 0;
|
||||||
@ -39,6 +39,7 @@ HacknetNode.prototype.purchaseLevelUpgrade = function() {
|
|||||||
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
|
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
|
||||||
if (cost > Player.money) {return;}
|
if (cost > Player.money) {return;}
|
||||||
Player.loseMoney(cost);
|
Player.loseMoney(cost);
|
||||||
|
if (this.level >= CONSTANTS.HacknetNodeMaxLevel) {return;}
|
||||||
++this.level;
|
++this.level;
|
||||||
this.updateMoneyGainRate();
|
this.updateMoneyGainRate();
|
||||||
}
|
}
|
||||||
@ -59,6 +60,7 @@ HacknetNode.prototype.purchaseRamUpgrade = function() {
|
|||||||
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
|
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
|
||||||
if (cost > Player.money) {return;}
|
if (cost > Player.money) {return;}
|
||||||
Player.loseMoney(cost);
|
Player.loseMoney(cost);
|
||||||
|
if (this.ram >= CONSTANTS.HacknetNodeMaxRam) {return;}
|
||||||
this.ram *= 2; //Ram is always doubled
|
this.ram *= 2; //Ram is always doubled
|
||||||
this.updateMoneyGainRate();
|
this.updateMoneyGainRate();
|
||||||
}
|
}
|
||||||
@ -74,6 +76,7 @@ HacknetNode.prototype.purchaseCoreUpgrade = function() {
|
|||||||
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
|
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
|
||||||
if (cost > Player.money) {return;}
|
if (cost > Player.money) {return;}
|
||||||
Player.loseMoney(cost);
|
Player.loseMoney(cost);
|
||||||
|
if (this.numCores >= CONSTANTS.HacknetNodeMaxCores) {return;}
|
||||||
++this.numCores;
|
++this.numCores;
|
||||||
this.updateMoneyGainRate();
|
this.updateMoneyGainRate();
|
||||||
}
|
}
|
||||||
@ -258,34 +261,52 @@ updateHacknetNodeDomElement = function(nodeObj) {
|
|||||||
"RAM: " + nodeObj.ram + "GB<br>" +
|
"RAM: " + nodeObj.ram + "GB<br>" +
|
||||||
"Cores: " + nodeObj.numCores;
|
"Cores: " + nodeObj.numCores;
|
||||||
|
|
||||||
|
//Upgrade level
|
||||||
var upgradeLevelButton = document.getElementById("hacknet-node-upgrade-level-" + nodeName);
|
var upgradeLevelButton = document.getElementById("hacknet-node-upgrade-level-" + nodeName);
|
||||||
if (upgradeLevelButton == null) {throw new Error("Cannot find upgrade level button element");}
|
if (upgradeLevelButton == null) {throw new Error("Cannot find upgrade level button element");}
|
||||||
var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost();
|
if (nodeObj.level >= CONSTANTS.HacknetNodeMaxLevel) {
|
||||||
upgradeLevelButton.innerHTML = "Upgrade Hacknet Node Level - $" + formatNumber(upgradeLevelCost, 2);
|
upgradeLevelButton.innerHTML = "MAX LEVEL";
|
||||||
if (upgradeLevelCost > Player.money) {
|
|
||||||
upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
|
upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
|
||||||
} else {
|
} else {
|
||||||
upgradeLevelButton.setAttribute("class", "a-link-button");
|
var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost();
|
||||||
|
upgradeLevelButton.innerHTML = "Upgrade Hacknet Node Level - $" + formatNumber(upgradeLevelCost, 2);
|
||||||
|
if (upgradeLevelCost > Player.money ) {
|
||||||
|
upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
|
||||||
|
} else {
|
||||||
|
upgradeLevelButton.setAttribute("class", "a-link-button");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Upgrade RAM
|
||||||
var upgradeRamButton = document.getElementById("hacknet-node-upgrade-ram-" + nodeName);
|
var upgradeRamButton = document.getElementById("hacknet-node-upgrade-ram-" + nodeName);
|
||||||
if (upgradeRamButton == null) {throw new Error("Cannot find upgrade ram button element");}
|
if (upgradeRamButton == null) {throw new Error("Cannot find upgrade ram button element");}
|
||||||
var upgradeRamCost = nodeObj.calculateRamUpgradeCost();
|
if (nodeObj.ram >= CONSTANTS.HacknetNodeMaxRam) {
|
||||||
upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM -$" + formatNumber(upgradeRamCost, 2);
|
upgradeRamButton.innerHTML = "MAX RAM";
|
||||||
if (upgradeRamCost > Player.money) {
|
|
||||||
upgradeRamButton.setAttribute("class", "a-link-button-inactive");
|
upgradeRamButton.setAttribute("class", "a-link-button-inactive");
|
||||||
} else {
|
} else {
|
||||||
upgradeRamButton.setAttribute("class", "a-link-button");
|
var upgradeRamCost = nodeObj.calculateRamUpgradeCost();
|
||||||
|
upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM -$" + formatNumber(upgradeRamCost, 2);
|
||||||
|
if (upgradeRamCost > Player.money) {
|
||||||
|
upgradeRamButton.setAttribute("class", "a-link-button-inactive");
|
||||||
|
} else {
|
||||||
|
upgradeRamButton.setAttribute("class", "a-link-button");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Upgrade Cores
|
||||||
var upgradeCoreButton = document.getElementById("hacknet-node-upgrade-core-" + nodeName);
|
var upgradeCoreButton = document.getElementById("hacknet-node-upgrade-core-" + nodeName);
|
||||||
if (upgradeCoreButton == null) {throw new Error("Cannot find upgrade cores button element");}
|
if (upgradeCoreButton == null) {throw new Error("Cannot find upgrade cores button element");}
|
||||||
var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost();
|
if (nodeObj.numCores >= CONSTANTS.HacknetNodeMaxCores) {
|
||||||
upgradeCoreButton.innerHTML = "Purchase additional CPU Core - $" + formatNumber(upgradeCoreCost, 2);
|
upgradeCoreButton.innerHTML = "MAX CORES";
|
||||||
if (upgradeCoreCost > Player.money) {
|
|
||||||
upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
|
upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
|
||||||
} else {
|
} else {
|
||||||
upgradeCoreButton.setAttribute("class", "a-link-button");
|
var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost();
|
||||||
|
upgradeCoreButton.innerHTML = "Purchase additional CPU Core - $" + formatNumber(upgradeCoreCost, 2);
|
||||||
|
if (upgradeCoreCost > Player.money) {
|
||||||
|
upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
|
||||||
|
} else {
|
||||||
|
upgradeCoreButton.setAttribute("class", "a-link-button");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +135,9 @@ function prestigeAugmentation() {
|
|||||||
SpecialServerIps = new SpecialServerIpsMap(); //Must be done before initForeignServers()
|
SpecialServerIps = new SpecialServerIpsMap(); //Must be done before initForeignServers()
|
||||||
initForeignServers();
|
initForeignServers();
|
||||||
|
|
||||||
|
//Darkweb is purchase-able
|
||||||
|
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
|
||||||
|
|
||||||
//Reset statistics of all scripts on home computer
|
//Reset statistics of all scripts on home computer
|
||||||
for (var i = 0; i < homeComp.scripts.length; ++i) {
|
for (var i = 0; i < homeComp.scripts.length; ++i) {
|
||||||
var s = homeComp.scripts[i];
|
var s = homeComp.scripts[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user