Added RAM cost for getHostname() and hasRootAccess(). Applied hacking grow_mult to server growth)

git p
This commit is contained in:
Daniel Xie 2017-05-29 18:12:57 -05:00
parent d8fd1e1164
commit 66d311f9d8
4 changed files with 8 additions and 3 deletions

@ -49,6 +49,8 @@ CONSTANTS = {
ScriptHttpwormRamCost: 0.05,
ScriptSqlinjectRamCost: 0.05,
ScriptRunRamCost: 0.8,
ScriptHasRootAccessRamCost: 0.05,
ScriptGetHostnameRamCost: 0.1,
ScriptGetHackingLevelRamCost: 0.1,
ScriptGetServerMoneyRamCost: 0.1,
ScriptOperatorRamCost: 0.01,

@ -169,7 +169,6 @@ function evaluate(exp, workerScript) {
var pForLoop = evaluateFor(exp, workerScript);
pForLoop.then(function(forLoopRes) {
resolve("forLoopDone");
workerScript.scriptRef.log("Exiting for loop");
}, function(e) {
reject(e);
});

@ -182,6 +182,8 @@ Script.prototype.updateRamUsage = function() {
var httpwormCount = numOccurrences(codeCopy, "httpworm(");
var sqlinjectCount = numOccurrences(codeCopy, "sqlinject(");
var runCount = numOccurrences(codeCopy, "run(");
var hasRootAccessCount = numOccurrences(codeCopy, "hasRootAccess(");
var getHostnameCount = numOccurrences(codeCopy, "getHostname(");
var getHackingLevelCount = numOccurrences(codeCopy, "getHackingLevel(");
var getServerMoneyAvailableCount = numOccurrences(codeCopy, "getServerMoneyAvailable(");
var numOperators = numNetscriptOperators(codeCopy);
@ -204,6 +206,8 @@ Script.prototype.updateRamUsage = function() {
(httpwormCount * CONSTANTS.ScriptHttpwormRamCost) +
(sqlinjectCount * CONSTANTS.ScriptSqlinjectRamCost) +
(runCount * CONSTANTS.ScriptRunRamCost) +
(hasRootAccessCount * CONSTANTS.ScriptHasRootAccessRamCost) +
(getHostnameCount * CONSTANTS.ScriptGetHostnameRamCost) +
(getHackingLevelCount * CONSTANTS.ScriptGetHackingLevelRamCost) +
(getServerMoneyAvailableCount * CONSTANTS.ScriptGetServerMoneyRamCost) +
(numOperators * CONSTANTS.ScriptOperatorRamCost) +

@ -651,7 +651,7 @@ processServerGrowth = function(numCycles) {
var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage;
//Apply serverGrowth for the calculated number of growth cycles
var serverGrowth = Math.pow(CONSTANTS.ServerGrowthRate, numServerGrowthCyclesAdjusted);
var serverGrowth = Math.pow(CONSTANTS.ServerGrowthRate, numServerGrowthCyclesAdjusted) * Player.hacking_grow_mult;
if (serverGrowth < 1) {
console.log("WARN: serverGrowth calculated to be less than 1");
serverGrowth = 1;
@ -674,7 +674,7 @@ processSingleServerGrowth = function(server, numCycles) {
var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage;
//Apply serverGrowth for the calculated number of growth cycles
var serverGrowth = Math.pow(CONSTANTS.ServerGrowthRate, numServerGrowthCyclesAdjusted);
var serverGrowth = Math.pow(CONSTANTS.ServerGrowthRate, numServerGrowthCyclesAdjusted) * Player.hacking_grow_mult;
if (serverGrowth < 1) {
console.log("WARN: serverGrowth calculated to be less than 1");
serverGrowth = 1;