Home Computer now has max RAM

This commit is contained in:
danielyxie
2019-01-09 02:43:59 -08:00
parent d5a2b9e0a1
commit ad1df00889
3 changed files with 22 additions and 44 deletions
+7 -3
View File
@@ -2992,16 +2992,20 @@ function NetscriptFunctions(workerScript) {
}
}
const cost = Player.getUpgradeHomeRamCost();
// Check if we're at max RAM
const homeComputer = Player.getHomeComputer();
if (homeComputer.maxRam >= CONSTANTS.HomeComputerMaxRam) {
workerScript.log(`ERROR: upgradeHomeRam() failed because your home computer is at max RAM`);
return false;
}
const cost = Player.getUpgradeHomeRamCost();
if (Player.money.lt(cost)) {
workerScript.scriptRef.log("ERROR: upgradeHomeRam() failed because you don't have enough money");
return false;
}
var homeComputer = Player.getHomeComputer();
homeComputer.maxRam *= 2;
Player.loseMoney(cost);
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);