Merge pull request #14 from danielyxie/dev

Massively nerfed Hacknet nodes because the math behind their producti…
This commit is contained in:
danielyxie 2017-05-15 17:24:31 -05:00 committed by GitHub
commit 83056cf1cf
3 changed files with 43 additions and 15 deletions

@ -1,5 +1,5 @@
CONSTANTS = {
Version: "0.8",
Version: "0.9",
//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
@ -18,12 +18,16 @@ CONSTANTS = {
BaseCostForHacknetNodeCore: 1000000,
/* Hacknet Node constants */
HacknetNodeMoneyGainPerLevel: 1,
HacknetNodeMoneyGainPerLevel: 0.75,
HacknetNodePurchaseNextMult: 1.35, //Multiplier when purchasing an additional hacknet node
HacknetNodeUpgradeLevelMult: 1.06, //Multiplier for cost when upgrading level
HacknetNodeUpgradeRamMult: 1.25, //Multiplier for cost when upgrading RAM
HacknetNodeUpgradeCoreMult: 1.45, //Multiplier for cost when buying another core
HacknetNodeMaxLevel: 500,
HacknetNodeMaxRam: 64,
HacknetNodeMaxCores: 16,
/* Augmentation */
//NeuroFlux Governor cost multiplier as you level up
NeuroFluxGovernorLevelMult: 1.09,

@ -18,7 +18,7 @@ HacknetNode.prototype.updateMoneyGainRate = function() {
//Each CPU core doubles the speed. Every 1GB of ram adds 15% increase
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;
if (isNaN(this.moneyGainRatePerSecond)) {
this.moneyGainRatePerSecond = 0;
@ -39,6 +39,7 @@ HacknetNode.prototype.purchaseLevelUpgrade = function() {
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
if (cost > Player.money) {return;}
Player.loseMoney(cost);
if (this.level >= CONSTANTS.HacknetNodeMaxLevel) {return;}
++this.level;
this.updateMoneyGainRate();
}
@ -59,6 +60,7 @@ HacknetNode.prototype.purchaseRamUpgrade = function() {
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
if (cost > Player.money) {return;}
Player.loseMoney(cost);
if (this.ram >= CONSTANTS.HacknetNodeMaxRam) {return;}
this.ram *= 2; //Ram is always doubled
this.updateMoneyGainRate();
}
@ -74,6 +76,7 @@ HacknetNode.prototype.purchaseCoreUpgrade = function() {
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
if (cost > Player.money) {return;}
Player.loseMoney(cost);
if (this.numCores >= CONSTANTS.HacknetNodeMaxCores) {return;}
++this.numCores;
this.updateMoneyGainRate();
}
@ -258,18 +261,29 @@ updateHacknetNodeDomElement = function(nodeObj) {
"RAM: " + nodeObj.ram + "GB<br>" +
"Cores: " + nodeObj.numCores;
//Upgrade level
var upgradeLevelButton = document.getElementById("hacknet-node-upgrade-level-" + nodeName);
if (upgradeLevelButton == null) {throw new Error("Cannot find upgrade level button element");}
if (nodeObj.level >= CONSTANTS.HacknetNodeMaxLevel) {
upgradeLevelButton.innerHTML = "MAX LEVEL";
upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
} else {
var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost();
upgradeLevelButton.innerHTML = "Upgrade Hacknet Node Level - $" + formatNumber(upgradeLevelCost, 2);
if (upgradeLevelCost > Player.money) {
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);
if (upgradeRamButton == null) {throw new Error("Cannot find upgrade ram button element");}
if (nodeObj.ram >= CONSTANTS.HacknetNodeMaxRam) {
upgradeRamButton.innerHTML = "MAX RAM";
upgradeRamButton.setAttribute("class", "a-link-button-inactive");
} else {
var upgradeRamCost = nodeObj.calculateRamUpgradeCost();
upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM -$" + formatNumber(upgradeRamCost, 2);
if (upgradeRamCost > Player.money) {
@ -277,9 +291,15 @@ updateHacknetNodeDomElement = function(nodeObj) {
} else {
upgradeRamButton.setAttribute("class", "a-link-button");
}
}
//Upgrade Cores
var upgradeCoreButton = document.getElementById("hacknet-node-upgrade-core-" + nodeName);
if (upgradeCoreButton == null) {throw new Error("Cannot find upgrade cores button element");}
if (nodeObj.numCores >= CONSTANTS.HacknetNodeMaxCores) {
upgradeCoreButton.innerHTML = "MAX CORES";
upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
} else {
var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost();
upgradeCoreButton.innerHTML = "Purchase additional CPU Core - $" + formatNumber(upgradeCoreCost, 2);
if (upgradeCoreCost > Player.money) {
@ -287,6 +307,7 @@ updateHacknetNodeDomElement = function(nodeObj) {
} else {
upgradeCoreButton.setAttribute("class", "a-link-button");
}
}
}
processAllHacknetNodeEarnings = function(numCycles) {

@ -135,6 +135,9 @@ function prestigeAugmentation() {
SpecialServerIps = new SpecialServerIpsMap(); //Must be done before initForeignServers()
initForeignServers();
//Darkweb is purchase-able
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
//Reset statistics of all scripts on home computer
for (var i = 0; i < homeComp.scripts.length; ++i) {
var s = homeComp.scripts[i];