made upgrade home ram cost consistent and precision to 5 to display better in game

This commit is contained in:
Olivier Gagnon
2018-06-07 14:54:34 -04:00
parent 2332532d91
commit 289a005fbb
3 changed files with 20 additions and 30 deletions
+14
View File
@@ -405,6 +405,20 @@ PlayerObject.prototype.getHomeComputer = function() {
return AllServers[this.homeComputer];
}
PlayerObject.prototype.getUpgradeHomeRamCost = function() {
//Calculate how many times ram has been upgraded (doubled)
const currentRam = Player.getHomeComputer().maxRam;
const numUpgrades = Math.log2(currentRam);
//Calculate cost
//Have cost increase by some percentage each time RAM has been upgraded
const mult = Math.pow(1.58, numUpgrades);
var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome;
cost = cost * mult;
cost = cost.toPrecision(5);
return cost;
}
//Calculates skill level based on experience. The same formula will be used for every skill
PlayerObject.prototype.calculateSkill = function(exp) {
return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);