mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 00:04:22 +02:00
TYPESAFETY: Strict internal typing for AugmentationName (#608)
This commit is contained in:
+18
-84
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import { Player } from "@player";
|
||||
import { BitNodeMultipliers, IBitNodeMultipliers } from "./BitNodeMultipliers";
|
||||
import { CityName, FactionName } from "@enums";
|
||||
import { BitNodeMultipliers, replaceCurrentNodeMults } from "./BitNodeMultipliers";
|
||||
|
||||
class BitNode {
|
||||
// A short description, or tagline, about the BitNode
|
||||
@@ -447,82 +447,16 @@ export function initBitNodes() {
|
||||
);
|
||||
}
|
||||
|
||||
export const defaultMultipliers: IBitNodeMultipliers = {
|
||||
HackingLevelMultiplier: 1,
|
||||
StrengthLevelMultiplier: 1,
|
||||
DefenseLevelMultiplier: 1,
|
||||
DexterityLevelMultiplier: 1,
|
||||
AgilityLevelMultiplier: 1,
|
||||
CharismaLevelMultiplier: 1,
|
||||
|
||||
ServerGrowthRate: 1,
|
||||
ServerMaxMoney: 1,
|
||||
ServerStartingMoney: 1,
|
||||
ServerStartingSecurity: 1,
|
||||
ServerWeakenRate: 1,
|
||||
|
||||
HomeComputerRamCost: 1,
|
||||
|
||||
PurchasedServerCost: 1,
|
||||
PurchasedServerSoftcap: 1,
|
||||
PurchasedServerLimit: 1,
|
||||
PurchasedServerMaxRam: 1,
|
||||
|
||||
CompanyWorkMoney: 1,
|
||||
CrimeMoney: 1,
|
||||
HacknetNodeMoney: 1,
|
||||
ManualHackMoney: 1,
|
||||
ScriptHackMoney: 1,
|
||||
ScriptHackMoneyGain: 1,
|
||||
CodingContractMoney: 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,
|
||||
|
||||
FourSigmaMarketDataCost: 1,
|
||||
FourSigmaMarketDataApiCost: 1,
|
||||
|
||||
CorporationValuation: 1,
|
||||
CorporationSoftcap: 1,
|
||||
CorporationDivisions: 1,
|
||||
|
||||
BladeburnerRank: 1,
|
||||
BladeburnerSkillCost: 1,
|
||||
|
||||
GangSoftcap: 1,
|
||||
GangUniqueAugs: 1,
|
||||
|
||||
DaedalusAugsRequirement: 30,
|
||||
|
||||
StaneksGiftPowerMultiplier: 1,
|
||||
StaneksGiftExtraSize: 0,
|
||||
|
||||
WorldDaemonDifficulty: 1,
|
||||
};
|
||||
|
||||
export const defaultMultipliers = new BitNodeMultipliers();
|
||||
Object.freeze(defaultMultipliers);
|
||||
|
||||
export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultipliers {
|
||||
const mults = Object.assign({}, defaultMultipliers);
|
||||
export function getBitNodeMultipliers(n: number, lvl: number): BitNodeMultipliers {
|
||||
switch (n) {
|
||||
case 1: {
|
||||
return mults;
|
||||
return new BitNodeMultipliers();
|
||||
}
|
||||
case 2: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
HackingLevelMultiplier: 0.8,
|
||||
|
||||
ServerGrowthRate: 0.8,
|
||||
@@ -546,7 +480,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 3: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
HackingLevelMultiplier: 0.8,
|
||||
|
||||
ServerGrowthRate: 0.2,
|
||||
@@ -578,7 +512,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 4: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
ServerMaxMoney: 0.1125,
|
||||
ServerStartingMoney: 0.75,
|
||||
|
||||
@@ -606,7 +540,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 5: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
ServerStartingSecurity: 2,
|
||||
ServerStartingMoney: 0.5,
|
||||
|
||||
@@ -635,7 +569,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 6: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
HackingLevelMultiplier: 0.35,
|
||||
|
||||
ServerMaxMoney: 0.2,
|
||||
@@ -669,7 +603,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 7: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
HackingLevelMultiplier: 0.35,
|
||||
|
||||
ServerMaxMoney: 0.2,
|
||||
@@ -711,7 +645,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 8: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
PurchasedServerSoftcap: 4,
|
||||
|
||||
CompanyWorkMoney: 0,
|
||||
@@ -739,7 +673,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 9: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
HackingLevelMultiplier: 0.5,
|
||||
StrengthLevelMultiplier: 0.45,
|
||||
DefenseLevelMultiplier: 0.45,
|
||||
@@ -780,7 +714,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 10: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
HackingLevelMultiplier: 0.35,
|
||||
StrengthLevelMultiplier: 0.4,
|
||||
DefenseLevelMultiplier: 0.4,
|
||||
@@ -823,7 +757,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 11: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
HackingLevelMultiplier: 0.6,
|
||||
|
||||
ServerGrowthRate: 0.2,
|
||||
@@ -861,8 +795,8 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
const inc = Math.pow(1.02, lvl);
|
||||
const dec = 1 / inc;
|
||||
|
||||
return Object.assign(mults, {
|
||||
DaedalusAugsRequirement: Math.floor(Math.min(mults.DaedalusAugsRequirement + inc, 40)),
|
||||
return new BitNodeMultipliers({
|
||||
DaedalusAugsRequirement: Math.floor(Math.min(defaultMultipliers.DaedalusAugsRequirement + inc, 40)),
|
||||
|
||||
HackingLevelMultiplier: dec,
|
||||
StrengthLevelMultiplier: dec,
|
||||
@@ -929,7 +863,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
});
|
||||
}
|
||||
case 13: {
|
||||
return Object.assign(mults, {
|
||||
return new BitNodeMultipliers({
|
||||
HackingLevelMultiplier: 0.25,
|
||||
StrengthLevelMultiplier: 0.7,
|
||||
DefenseLevelMultiplier: 0.7,
|
||||
@@ -982,5 +916,5 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
|
||||
}
|
||||
|
||||
export function initBitNodeMultipliers(): void {
|
||||
Object.assign(BitNodeMultipliers, getBitNodeMultipliers(Player.bitNodeN, Player.sourceFileLvl(Player.bitNodeN) + 1));
|
||||
replaceCurrentNodeMults(getBitNodeMultipliers(Player.bitNodeN, Player.sourceFileLvl(Player.bitNodeN) + 1));
|
||||
}
|
||||
|
||||
@@ -1,168 +1,173 @@
|
||||
import { defaultMultipliers } from "./BitNode";
|
||||
import { PartialRecord, getRecordEntries } from "../Types/Record";
|
||||
|
||||
/**
|
||||
* 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...
|
||||
*/
|
||||
export interface IBitNodeMultipliers {
|
||||
export class BitNodeMultipliers {
|
||||
/** Influences how quickly the player's agility level (not exp) scales */
|
||||
AgilityLevelMultiplier: number;
|
||||
AgilityLevelMultiplier = 1;
|
||||
|
||||
/** Influences the base cost to purchase an augmentation. */
|
||||
AugmentationMoneyCost: number;
|
||||
AugmentationMoneyCost = 1;
|
||||
|
||||
/** Influences the base rep the player must have with a faction to purchase an augmentation. */
|
||||
AugmentationRepCost: number;
|
||||
AugmentationRepCost = 1;
|
||||
|
||||
/** Influences how quickly the player can gain rank within Bladeburner. */
|
||||
BladeburnerRank: number;
|
||||
BladeburnerRank = 1;
|
||||
|
||||
/** Influences the cost of skill levels from Bladeburner. */
|
||||
BladeburnerSkillCost: number;
|
||||
BladeburnerSkillCost = 1;
|
||||
|
||||
/** Influences how quickly the player's charisma level (not exp) scales */
|
||||
CharismaLevelMultiplier: number;
|
||||
CharismaLevelMultiplier = 1;
|
||||
|
||||
/** Influences the experience gained for each ability when a player completes a class. */
|
||||
ClassGymExpGain: number;
|
||||
ClassGymExpGain = 1;
|
||||
|
||||
/**Influences the amount of money gained from completing Coding Contracts. */
|
||||
CodingContractMoney: number;
|
||||
CodingContractMoney = 1;
|
||||
|
||||
/** Influences the experience gained for each ability when the player completes working their job. */
|
||||
CompanyWorkExpGain: number;
|
||||
CompanyWorkExpGain = 1;
|
||||
|
||||
/** Influences how much money the player earns when completing working their job. */
|
||||
CompanyWorkMoney: number;
|
||||
CompanyWorkMoney = 1;
|
||||
|
||||
/** Influences the valuation of corporations created by the player. */
|
||||
CorporationValuation: number;
|
||||
CorporationValuation = 1;
|
||||
|
||||
/** Influences the base experience gained for each ability when the player commits a crime. */
|
||||
CrimeExpGain: number;
|
||||
CrimeExpGain = 1;
|
||||
|
||||
/** Influences the base money gained when the player commits a crime. */
|
||||
CrimeMoney: number;
|
||||
CrimeMoney = 1;
|
||||
|
||||
/** Influences how many Augmentations you need in order to get invited to the Daedalus faction */
|
||||
DaedalusAugsRequirement: number;
|
||||
DaedalusAugsRequirement = 30;
|
||||
|
||||
/** Influences how quickly the player's defense level (not exp) scales */
|
||||
DefenseLevelMultiplier: number;
|
||||
DefenseLevelMultiplier = 1;
|
||||
|
||||
/** Influences how quickly the player's dexterity level (not exp) scales */
|
||||
DexterityLevelMultiplier: number;
|
||||
DexterityLevelMultiplier = 1;
|
||||
|
||||
/** Influences how much rep the player gains in each faction simply by being a member. */
|
||||
FactionPassiveRepGain: number;
|
||||
FactionPassiveRepGain = 1;
|
||||
|
||||
/** Influences the experience gained for each ability when the player completes work for a Faction. */
|
||||
FactionWorkExpGain: number;
|
||||
FactionWorkExpGain = 1;
|
||||
|
||||
/** Influences how much rep the player gains when performing work for a faction. */
|
||||
FactionWorkRepGain: number;
|
||||
FactionWorkRepGain = 1;
|
||||
|
||||
/** Influences how much it costs to unlock the stock market's 4S Market Data API */
|
||||
FourSigmaMarketDataApiCost: number;
|
||||
FourSigmaMarketDataApiCost = 1;
|
||||
|
||||
/** Influences how much it costs to unlock the stock market's 4S Market Data (NOT API) */
|
||||
FourSigmaMarketDataCost: number;
|
||||
FourSigmaMarketDataCost = 1;
|
||||
|
||||
/** Reduces gangs earning. */
|
||||
GangSoftcap: number;
|
||||
GangSoftcap = 1;
|
||||
|
||||
/** Percentage of unique augs that the gang has. */
|
||||
GangUniqueAugs: number;
|
||||
GangUniqueAugs = 1;
|
||||
|
||||
/** Influences the experienced gained when hacking a server. */
|
||||
HackExpGain: number;
|
||||
HackExpGain = 1;
|
||||
|
||||
/** Influences how quickly the player's hacking level (not experience) scales */
|
||||
HackingLevelMultiplier: number;
|
||||
HackingLevelMultiplier = 1;
|
||||
|
||||
/**
|
||||
* Influences how much money is produced by Hacknet Nodes.
|
||||
* Influences the hash rate of Hacknet Servers (unlocked in BitNode-9)
|
||||
*/
|
||||
HacknetNodeMoney: number;
|
||||
HacknetNodeMoney = 1;
|
||||
|
||||
/** Influences how much money it costs to upgrade your home computer's RAM */
|
||||
HomeComputerRamCost: number;
|
||||
HomeComputerRamCost = 1;
|
||||
|
||||
/** Influences how much money is gained when the player infiltrates a company. */
|
||||
InfiltrationMoney: number;
|
||||
InfiltrationMoney = 1;
|
||||
|
||||
/** Influences how much rep the player can gain from factions when selling stolen documents and secrets */
|
||||
InfiltrationRep: number;
|
||||
InfiltrationRep = 1;
|
||||
|
||||
/**
|
||||
* Influences how much money can be stolen from a server when the player performs a hack against it through
|
||||
* the Terminal.
|
||||
*/
|
||||
ManualHackMoney: number;
|
||||
ManualHackMoney = 1;
|
||||
|
||||
/** Influence how much it costs to purchase a server */
|
||||
PurchasedServerCost: number;
|
||||
PurchasedServerCost = 1;
|
||||
|
||||
/** Influence how much it costs to purchase a server */
|
||||
PurchasedServerSoftcap: number;
|
||||
PurchasedServerSoftcap = 1;
|
||||
|
||||
/** Influences the maximum number of purchased servers you can have */
|
||||
PurchasedServerLimit: number;
|
||||
PurchasedServerLimit = 1;
|
||||
|
||||
/** Influences the maximum allowed RAM for a purchased server */
|
||||
PurchasedServerMaxRam: number;
|
||||
PurchasedServerMaxRam = 1;
|
||||
|
||||
/** Influences the minimum favor the player must have with a faction before they can donate to gain rep. */
|
||||
RepToDonateToFaction: number;
|
||||
RepToDonateToFaction = 1;
|
||||
|
||||
/** Influences how much money can be stolen from a server when a script performs a hack against it. */
|
||||
ScriptHackMoney: number;
|
||||
ScriptHackMoney = 1;
|
||||
|
||||
/**
|
||||
* The amount of money actually gained when script hack a server. This is
|
||||
* different than the above because you can reduce the amount of money but
|
||||
* not gain that same amount.
|
||||
*/
|
||||
ScriptHackMoneyGain: number;
|
||||
ScriptHackMoneyGain = 1;
|
||||
|
||||
/** Influences the growth percentage per cycle against a server. */
|
||||
ServerGrowthRate: number;
|
||||
ServerGrowthRate = 1;
|
||||
|
||||
/** Influences the maximum money that a server can grow to. */
|
||||
ServerMaxMoney: number;
|
||||
ServerMaxMoney = 1;
|
||||
|
||||
/** Influences the initial money that a server starts with. */
|
||||
ServerStartingMoney: number;
|
||||
ServerStartingMoney = 1;
|
||||
|
||||
/** Influences the initial security level (hackDifficulty) of a server. */
|
||||
ServerStartingSecurity: number;
|
||||
ServerStartingSecurity = 1;
|
||||
|
||||
/** Influences the weaken amount per invocation against a server. */
|
||||
ServerWeakenRate: number;
|
||||
ServerWeakenRate = 1;
|
||||
|
||||
/** Influences how quickly the player's strength level (not exp) scales */
|
||||
StrengthLevelMultiplier: number;
|
||||
StrengthLevelMultiplier = 1;
|
||||
|
||||
/** Influences the power of the gift. */
|
||||
StaneksGiftPowerMultiplier: number;
|
||||
StaneksGiftPowerMultiplier = 1;
|
||||
|
||||
/** Influences the size of the gift. */
|
||||
StaneksGiftExtraSize: number;
|
||||
StaneksGiftExtraSize = 0;
|
||||
|
||||
/** Influences the hacking skill required to backdoor the world daemon. */
|
||||
WorldDaemonDifficulty: number;
|
||||
WorldDaemonDifficulty = 1;
|
||||
|
||||
/** Influences profits from corporation dividends and selling shares. */
|
||||
CorporationSoftcap: number;
|
||||
CorporationSoftcap = 1;
|
||||
|
||||
/** Influences number of divisions a corporation can have. */
|
||||
CorporationDivisions: number;
|
||||
CorporationDivisions = 1;
|
||||
|
||||
// Index signature
|
||||
[key: string]: number;
|
||||
constructor(a: PartialRecord<keyof BitNodeMultipliers, number> = {}) {
|
||||
for (const [key, value] of getRecordEntries(a)) this[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/** The multipliers that are influenced by current Bitnode progression. */
|
||||
export const BitNodeMultipliers = Object.assign({}, defaultMultipliers);
|
||||
/** The multipliers currently in effect */
|
||||
export let currentNodeMults = new BitNodeMultipliers();
|
||||
|
||||
export function replaceCurrentNodeMults(mults: BitNodeMultipliers) {
|
||||
currentNodeMults = mults;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import React from "react";
|
||||
import { uniqueId } from "lodash";
|
||||
import { Box, Collapse, ListItemButton, ListItemText, Paper, Table, TableBody, Typography } from "@mui/material";
|
||||
import ExpandLess from "@mui/icons-material/ExpandLess";
|
||||
import ExpandMore from "@mui/icons-material/ExpandMore";
|
||||
import { Box, Collapse, ListItemButton, ListItemText, Paper, Table, TableBody, Typography } from "@mui/material";
|
||||
import { uniqueId } from "lodash";
|
||||
import React from "react";
|
||||
|
||||
import { Player } from "@player";
|
||||
import { SpecialServers } from "../../Server/data/SpecialServers";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { Player } from "@player";
|
||||
import { StatsRow } from "../../ui/React/StatsRow";
|
||||
import { defaultMultipliers, getBitNodeMultipliers } from "../BitNode";
|
||||
import { IBitNodeMultipliers } from "../BitNodeMultipliers";
|
||||
import { BitNodeMultipliers } from "../BitNodeMultipliers";
|
||||
import { PartialRecord, getRecordEntries } from "../../Types/Record";
|
||||
|
||||
interface IProps {
|
||||
n: number;
|
||||
@@ -60,8 +62,8 @@ export const BitNodeMultipliersDisplay = ({ n, level }: IProps): React.ReactElem
|
||||
);
|
||||
};
|
||||
|
||||
type IBNMultRows = Record<
|
||||
string,
|
||||
type IBNMultRows = PartialRecord<
|
||||
keyof BitNodeMultipliers,
|
||||
{
|
||||
name: string;
|
||||
content?: string;
|
||||
@@ -72,11 +74,11 @@ type IBNMultRows = Record<
|
||||
interface IBNMultTableProps {
|
||||
sectionName: string;
|
||||
rowData: IBNMultRows;
|
||||
mults: IBitNodeMultipliers;
|
||||
mults: BitNodeMultipliers;
|
||||
}
|
||||
|
||||
const BNMultTable = (props: IBNMultTableProps): React.ReactElement => {
|
||||
const rowsArray = Object.entries(props.rowData)
|
||||
const rowsArray = getRecordEntries(props.rowData)
|
||||
.filter(([key]) => props.mults[key] !== defaultMultipliers[key])
|
||||
.map(([key, value]) => (
|
||||
<StatsRow
|
||||
@@ -101,7 +103,7 @@ const BNMultTable = (props: IBNMultTableProps): React.ReactElement => {
|
||||
|
||||
interface IMultsProps {
|
||||
n: number;
|
||||
mults: IBitNodeMultipliers;
|
||||
mults: BitNodeMultipliers;
|
||||
}
|
||||
|
||||
function GeneralMults({ mults }: IMultsProps): React.ReactElement {
|
||||
|
||||
Reference in New Issue
Block a user