mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 15:28:43 +02:00
Fixed bugs with Location code refactor
This commit is contained in:
30
src/PersonObjects/Player/PlayerObjectServerMethods.ts
Normal file
30
src/PersonObjects/Player/PlayerObjectServerMethods.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { IPlayer } from "../IPlayer";
|
||||
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { AllServers } from "../../Server/AllServers";
|
||||
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
import { SpecialServerIps } from "../../Server/SpecialServerIps";
|
||||
|
||||
export function hasTorRouter(this: IPlayer) {
|
||||
return SpecialServerIps.hasOwnProperty("Darkweb Server");
|
||||
}
|
||||
|
||||
export function getCurrentServer(this: IPlayer) {
|
||||
return AllServers[this.currentServer];
|
||||
}
|
||||
|
||||
export function getHomeComputer(this: IPlayer) {
|
||||
return AllServers[this.homeComputer];
|
||||
}
|
||||
|
||||
export function getUpgradeHomeRamCost(this: IPlayer) {
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
const currentRam = this.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 * mult * BitNodeMultipliers.HomeComputerRamCost;
|
||||
return cost;
|
||||
}
|
||||
Reference in New Issue
Block a user