From edcfe71eeddfdfa6b1301d9fa4211b528030593f Mon Sep 17 00:00:00 2001 From: Steven Evans Date: Tue, 31 Jul 2018 14:00:03 -0400 Subject: [PATCH] [refactor] Moving BitNodeMultipliers to its own file to break cyclical module references. --- src/Augmentations.js | 2 +- src/BitNode.js | 42 +-------- src/BitNodeMultipliers.ts | 178 ++++++++++++++++++++++++++++++++++++++ src/Bladeburner.js | 2 +- src/CompanyManagement.js | 2 +- src/Faction.js | 2 +- src/HacknetNode.js | 2 +- src/Infiltration.js | 2 +- src/NetscriptEvaluator.js | 2 +- src/Player.js | 2 +- src/RedPill.js | 2 +- src/Server.js | 2 +- src/SourceFile.js | 2 +- utils/InfiltrationBox.js | 2 +- 14 files changed, 192 insertions(+), 52 deletions(-) create mode 100644 src/BitNodeMultipliers.ts diff --git a/src/Augmentations.js b/src/Augmentations.js index d75916c1c..50acfd11c 100644 --- a/src/Augmentations.js +++ b/src/Augmentations.js @@ -1,4 +1,4 @@ -import {BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {CONSTANTS} from "./Constants"; import {Engine} from "./engine"; import {Factions, getNextNeurofluxLevel, diff --git a/src/BitNode.js b/src/BitNode.js index 4fc881dc4..c84f399a4 100644 --- a/src/BitNode.js +++ b/src/BitNode.js @@ -1,4 +1,5 @@ -import {Player} from "./Player"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; +import {Player} from "./Player"; function BitNode(n, name, desc="", info="") { this.number = n; @@ -199,43 +200,6 @@ function initBitNodes() { BitNodes["BitNode24"] = new BitNode(24, "", "COMING SOON"); } -let BitNodeMultipliers = { - HackingLevelMultiplier: 1, - - ServerMaxMoney: 1, - ServerStartingMoney: 1, - ServerGrowthRate: 1, - ServerWeakenRate: 1, - ServerStartingSecurity: 1, - - ManualHackMoney: 1, - ScriptHackMoney: 1, - CompanyWorkMoney: 1, - CrimeMoney: 1, - HacknetNodeMoney: 1, - - CompanyWorkExpGain: 1, - ClassGymExpGain: 1, - FactionWorkExpGain: 1, - HackExpGain: 1, - CrimeExpGain: 1, - - FactionWorkRepGain: 1, - FactionPassiveRepGain: 1, - RepToDonateToFaction: 1, - - AugmentationRepCost: 1, - AugmentationMoneyCost: 1, - - InfiltrationMoney: 1, - InfiltrationRep: 1, - - CorporationValuation: 1, - - BladeburnerRank: 1, - BladeburnerSkillCost: 1, -} - function initBitNodeMultipliers() { if (Player.bitNodeN == null) { Player.bitNodeN = 1; @@ -403,7 +367,5 @@ function initBitNodeMultipliers() { } export {initBitNodes, - BitNode, BitNodes, - BitNodeMultipliers, initBitNodeMultipliers}; diff --git a/src/BitNodeMultipliers.ts b/src/BitNodeMultipliers.ts new file mode 100644 index 000000000..e6dfdcd25 --- /dev/null +++ b/src/BitNodeMultipliers.ts @@ -0,0 +1,178 @@ +/** + * Bitnode multipliers influence the difficulty of different aspects of the game. + * Each Bitnode has a different theme/strategy to achieving the end goal, so these multipliers will can help drive the + * player toward the intended strategy. Unless they really want to play the long, slow game of waiting... + */ +interface IBitNodeMultipliers { + /** + * Influences the base cost to purchase an augmentation. + */ + AugmentationMoneyCost: number; + + /** + * Influences the base rep the player must have with a faction to purchase an augmentation. + */ + AugmentationRepCost: number; + + /** + * Influences how quickly the player can gain rank within Bladeburner. + */ + BladeburnerRank: number; + + /** + * Influences the cost of skill levels from Bladeburner. + */ + BladeburnerSkillCost: number; + + /** + * Influences the experience gained for each ability when a player completes a class. + */ + ClassGymExpGain: number; + + /** + * Influences the experience gained for each ability when the player completes working their job. + */ + CompanyWorkExpGain: number; + + /** + * Influences how much money the player earns when completing working their job. + */ + CompanyWorkMoney: number; + + /** + * Influences the valuation of corporations created by the player. + */ + CorporationValuation: number; + + /** + * Influences the base experience gained for each ability when the player commits a crime. + */ + CrimeExpGain: number; + + /** + * Influences the base money gained when the player commits a crime. + */ + CrimeMoney: number; + + /** + * Influences how much rep the player gains in each faction simply by being a member. + */ + FactionPassiveRepGain: number; + + /** + * Influences the experience gained for each ability when the player completes work for a Faction. + */ + FactionWorkExpGain: number; + + /** + * Influences how much rep the player gains when performing work for a faction. + */ + FactionWorkRepGain: number; + + /** + * Influences the experienced gained when hacking a server. + */ + HackExpGain: number; + + /** + * Influences how quickly the player's hacking level (not experience) scales + */ + HackingLevelMultiplier: number; + + /** + * Influences how much money each Hacknet node can generate. + */ + HacknetNodeMoney: number; + + /** + * Influences how much money is gained when the player infiltrates a company. + */ + InfiltrationMoney: number; + + /** + * Influences how much rep the player can gain from factions when selling stolen documents and secrets + */ + InfiltrationRep: number; + + /** + * Influences how much money can be stolen from a server when the player performs a hack against it through + * the Terminal. + */ + ManualHackMoney: number; + + /** + * Influences the minimum favor the player must have with a faction before they can donate to gain rep. + */ + RepToDonateToFaction: number; + + /** + * Influences how much money can be stolen from a server when a script performs a hack against it. + */ + ScriptHackMoney: number; + + /** + * Influences the growth percentage per cycle against a server. + */ + ServerGrowthRate: number; + + /** + * Influences the maxmimum money that a server can grow to. + */ + ServerMaxMoney: number; + + /** + * Influences the initial money that a server starts with. + */ + ServerStartingMoney: number; + + /** + * Influences the initial security level (hackDifficulty) of a server. + */ + ServerStartingSecurity: number; + + /** + * Influences the weaken amount per invocation against a server. + */ + ServerWeakenRate: number; +} + +/** + * The multipliers that are influenced by current Bitnode progression. + */ +// tslint:disable-next-line:variable-name +export const BitNodeMultipliers: IBitNodeMultipliers = { + HackingLevelMultiplier: 1, + + ServerGrowthRate: 1, + ServerMaxMoney: 1, + ServerStartingMoney: 1, + ServerStartingSecurity: 1, + ServerWeakenRate: 1, + + CompanyWorkMoney: 1, + CrimeMoney: 1, + HacknetNodeMoney: 1, + ManualHackMoney: 1, + ScriptHackMoney: 1, + + ClassGymExpGain: 1, + CompanyWorkExpGain: 1, + CrimeExpGain: 1, + FactionWorkExpGain: 1, + HackExpGain: 1, + + FactionPassiveRepGain: 1, + FactionWorkRepGain: 1, + RepToDonateToFaction: 1, + + AugmentationMoneyCost: 1, + AugmentationRepCost: 1, + + InfiltrationMoney: 1, + InfiltrationRep: 1, + + CorporationValuation: 1, + + BladeburnerRank: 1, + BladeburnerSkillCost: 1, +}; diff --git a/src/Bladeburner.js b/src/Bladeburner.js index c69f8f793..55fa5693d 100644 --- a/src/Bladeburner.js +++ b/src/Bladeburner.js @@ -1,5 +1,5 @@ import {Augmentations, AugmentationNames} from "./Augmentations"; -import {BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {CONSTANTS} from "./Constants"; import {Engine} from "./engine"; import {Faction, Factions, factionExists, diff --git a/src/CompanyManagement.js b/src/CompanyManagement.js index 381d003e7..abb67e1b7 100644 --- a/src/CompanyManagement.js +++ b/src/CompanyManagement.js @@ -1,4 +1,4 @@ -import {BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {Factions} from "./Faction"; import {showLiterature} from "./Literature"; import {Locations} from "./Locations"; diff --git a/src/Faction.js b/src/Faction.js index 661611e6f..688021af9 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -1,6 +1,6 @@ import {Augmentations, AugmentationNames, PlayerOwnedAugmentation} from "./Augmentations"; -import {BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {CONSTANTS} from "./Constants"; import {Engine} from "./engine"; import {FactionInfos} from "./FactionInfo"; diff --git a/src/HacknetNode.js b/src/HacknetNode.js index 6325e9192..8f1faa218 100644 --- a/src/HacknetNode.js +++ b/src/HacknetNode.js @@ -1,4 +1,4 @@ -import {BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {CONSTANTS} from "./Constants"; import {Engine} from "./engine"; import {iTutorialSteps, iTutorialNextStep, diff --git a/src/Infiltration.js b/src/Infiltration.js index 4fe0558da..feb8b0609 100644 --- a/src/Infiltration.js +++ b/src/Infiltration.js @@ -1,4 +1,4 @@ -import {BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {CONSTANTS} from "./Constants"; import {Engine} from "./engine"; import {Player} from "./Player"; diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index 1a6c56c07..a6c6668c7 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -1,4 +1,4 @@ -import {BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {CONSTANTS} from "./Constants"; import {Player} from "./Player"; import {Environment} from "./NetscriptEnvironment"; diff --git a/src/Player.js b/src/Player.js index 18ab3ba3b..b82203691 100644 --- a/src/Player.js +++ b/src/Player.js @@ -1,7 +1,7 @@ import {Augmentations, applyAugmentation, AugmentationNames, PlayerOwnedAugmentation} from "./Augmentations"; -import {BitNodes, BitNode, BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {Company, Companies, getNextCompanyPosition, getJobRequirementText, CompanyPosition, CompanyPositions} from "./Company"; diff --git a/src/RedPill.js b/src/RedPill.js index cc5d54d03..b95c86e63 100644 --- a/src/RedPill.js +++ b/src/RedPill.js @@ -1,4 +1,4 @@ -import {BitNode, BitNodes} from "./BitNode"; +import {BitNodes} from "./BitNode"; import {Engine} from "./engine"; import {Player} from "./Player"; import {prestigeSourceFile} from "./Prestige"; diff --git a/src/Server.js b/src/Server.js index 0391f657f..8ad390e67 100644 --- a/src/Server.js +++ b/src/Server.js @@ -1,4 +1,4 @@ -import {BitNodeMultipliers} from "./BitNode"; +import {BitNodeMultipliers} from "./BitNodeMultipliers"; import {CONSTANTS} from "./Constants"; import {Programs} from "./CreateProgram"; import {Player} from "./Player"; diff --git a/src/SourceFile.js b/src/SourceFile.js index 2e07e1b54..fb4861af2 100644 --- a/src/SourceFile.js +++ b/src/SourceFile.js @@ -1,5 +1,5 @@ import {Player} from "./Player"; -import {BitNode, BitNodes} from "./BitNode"; +import {BitNodes} from "./BitNode"; /* SourceFile.js */ //Each SourceFile corresponds to a BitNode with the same number diff --git a/utils/InfiltrationBox.js b/utils/InfiltrationBox.js index 8d43044e4..efd86089b 100644 --- a/utils/InfiltrationBox.js +++ b/utils/InfiltrationBox.js @@ -1,4 +1,4 @@ -import {BitNodeMultipliers} from "../src/BitNode"; +import {BitNodeMultipliers} from "../src/BitNodeMultipliers"; import {CONSTANTS} from "../src/Constants"; import {Factions, Faction} from "../src/Faction"; import {Player} from "../src/Player";