more refactors

This commit is contained in:
phyzical 2022-03-22 23:02:15 +08:00
parent 673222eaf8
commit 4e73e489ed
6 changed files with 37 additions and 51 deletions

@ -776,6 +776,7 @@ export const achievements: IMap<Achievement> = {
// { ID: FactionNames.Bladeburners.toUpperCase(), Condition: () => Player.factions.includes(FactionNames.Bladeburners) }, // { ID: FactionNames.Bladeburners.toUpperCase(), Condition: () => Player.factions.includes(FactionNames.Bladeburners) },
// { ID: "DEEPSCANV1.EXE", Condition: () => Player.getHomeComputer().programs.includes(Programs.DeepscanV1.name) }, // { ID: "DEEPSCANV1.EXE", Condition: () => Player.getHomeComputer().programs.includes(Programs.DeepscanV1.name) },
// { ID: "DEEPSCANV2.EXE", Condition: () => Player.getHomeComputer().programs.includes(Programs.DeepscanV2.name) }, // { ID: "DEEPSCANV2.EXE", Condition: () => Player.getHomeComputer().programs.includes(Programs.DeepscanV2.name) },
// { ID: "INFILTRATORS", Condition: () => Player.factions.includes(FactionNames.Infiltators) },
// { // {
// ID: "SERVERPROFILER.EXE", // ID: "SERVERPROFILER.EXE",
// Condition: () => Player.getHomeComputer().programs.includes(Programs.ServerProfiler.name), // Condition: () => Player.getHomeComputer().programs.includes(Programs.ServerProfiler.name),

@ -97,8 +97,8 @@ function getRandomBonus(): any {
export const infiltratorsAugmentations = [ export const infiltratorsAugmentations = [
new Augmentation({ new Augmentation({
name: AugmentationNames.BagOfSand, name: AugmentationNames.BagOfSand,
repCost: 100, repCost: 1e2,
moneyCost: 1e9, moneyCost: 1e6,
info: info:
"You watched a bittube video about sword fighting, " + "You watched a bittube video about sword fighting, " +
"it suggested the best way to win a sword fight was to play dirty " + "it suggested the best way to win a sword fight was to play dirty " +
@ -110,8 +110,8 @@ export const infiltratorsAugmentations = [
}), }),
new Augmentation({ new Augmentation({
name: AugmentationNames.IntellisenseModule, name: AugmentationNames.IntellisenseModule,
repCost: 100, repCost: 1e2,
moneyCost: 1e9, moneyCost: 1e6,
info: info:
"A brain implant with AI power that focuses in auto linting and intellisense, which " + "A brain implant with AI power that focuses in auto linting and intellisense, which " +
"provides the ability to perform code completion better than any existing " + "provides the ability to perform code completion better than any existing " +
@ -121,8 +121,8 @@ export const infiltratorsAugmentations = [
}), }),
new Augmentation({ new Augmentation({
name: AugmentationNames.ReverseDictionary, name: AugmentationNames.ReverseDictionary,
repCost: 100, repCost: 1e2,
moneyCost: 1e9, moneyCost: 1e6,
info: info:
"An ancient dictionary with a thick layer of dust it looks like a different language, " + "An ancient dictionary with a thick layer of dust it looks like a different language, " +
"as you examine it further you realise that its actually just a normal dictionary but the words are " + "as you examine it further you realise that its actually just a normal dictionary but the words are " +
@ -132,8 +132,8 @@ export const infiltratorsAugmentations = [
}), }),
new Augmentation({ new Augmentation({
name: AugmentationNames.AmuletOfPersuasian, name: AugmentationNames.AmuletOfPersuasian,
repCost: 100, repCost: 1e2,
moneyCost: 1e9, moneyCost: 1e6,
info: info:
"A fancy looking amulet that looks like something an Egyptian goddess would wear, " + "A fancy looking amulet that looks like something an Egyptian goddess would wear, " +
"you hear faint whispers that are trying to convince you to do things you wouldn't normally do, " + "you hear faint whispers that are trying to convince you to do things you wouldn't normally do, " +
@ -143,8 +143,8 @@ export const infiltratorsAugmentations = [
}), }),
new Augmentation({ new Augmentation({
name: AugmentationNames.LameSharkRepository, name: AugmentationNames.LameSharkRepository,
repCost: 100, repCost: 1e2,
moneyCost: 1e9, moneyCost: 1e6,
info: info:
"You stumble across an old opensource repository for a weird defunct version of LameShark, " + "You stumble across an old opensource repository for a weird defunct version of LameShark, " +
"upon studying the source code it seems to just have a bunch of arrow key cheat codes. ", "upon studying the source code it seems to just have a bunch of arrow key cheat codes. ",
@ -153,8 +153,8 @@ export const infiltratorsAugmentations = [
}), }),
new Augmentation({ new Augmentation({
name: AugmentationNames.CyberDecoder, name: AugmentationNames.CyberDecoder,
repCost: 100, repCost: 1e2,
moneyCost: 1e9, moneyCost: 1e6,
info: info:
"A cool looking do hickey that oddly resembles Keanu Reeves face, " + "A cool looking do hickey that oddly resembles Keanu Reeves face, " +
"it has a usb cable that looks like it plugs into something.", "it has a usb cable that looks like it plugs into something.",
@ -163,8 +163,8 @@ export const infiltratorsAugmentations = [
}), }),
new Augmentation({ new Augmentation({
name: AugmentationNames.MineDetector, name: AugmentationNames.MineDetector,
repCost: 100, repCost: 1e2,
moneyCost: 1e9, moneyCost: 1e6,
info: info:
"You stumble across an old mine detector at an army surplus store, " + "You stumble across an old mine detector at an army surplus store, " +
"on the side is inscribed 'X(' i wonder what happened to the original owner, " + "on the side is inscribed 'X(' i wonder what happened to the original owner, " +
@ -179,8 +179,8 @@ export const infiltratorsAugmentations = [
}), }),
new Augmentation({ new Augmentation({
name: AugmentationNames.WireCuttingManual, name: AugmentationNames.WireCuttingManual,
repCost: 100, repCost: 1e2,
moneyCost: 1e9, moneyCost: 1e6,
info: info:
"You found an old wire cutting for dummies book in the local library, " + "You found an old wire cutting for dummies book in the local library, " +
"how hard can it be to cut wires, right?", "how hard can it be to cut wires, right?",

@ -55,10 +55,14 @@ function initAugmentations(): void {
Player.reapplyAllAugmentations(); Player.reapplyAllAugmentations();
} }
function getBaseAugmentationPriceMultiplier(): number {
return CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]];
}
export function getGenericAugmentationPriceMultiplier(): number {
return Math.pow(getBaseAugmentationPriceMultiplier(), Player.queuedAugmentations.length);
}
export function updateAugmentationCosts(): void { export function updateAugmentationCosts(): void {
const purchasedOrQueuedInfiltratorAugmentationCount = infiltratorsAugmentations.filter((augmentation) =>
Player.hasAugmentation(augmentation.name),
).length;
for (const name of Object.keys(Augmentations)) { for (const name of Object.keys(Augmentations)) {
if (Augmentations.hasOwnProperty(name)) { if (Augmentations.hasOwnProperty(name)) {
const augmentationToUpdate = Augmentations[name]; const augmentationToUpdate = Augmentations[name];
@ -70,19 +74,15 @@ export function updateAugmentationCosts(): void {
augmentationToUpdate.baseCost *= multiplier * BitNodeMultipliers.AugmentationMoneyCost; augmentationToUpdate.baseCost *= multiplier * BitNodeMultipliers.AugmentationMoneyCost;
for (let i = 0; i < Player.queuedAugmentations.length - 1; ++i) { for (let i = 0; i < Player.queuedAugmentations.length - 1; ++i) {
augmentationToUpdate.baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]]; augmentationToUpdate.baseCost *= getBaseAugmentationPriceMultiplier();
} }
} else if (augmentationToUpdate.factions.includes(FactionNames.Infiltrators)) { } else if (augmentationToUpdate.factions.includes(FactionNames.Infiltrators)) {
augmentationToUpdate.baseCost = Math.pow( const infiltratorMultiplier =
augmentationToUpdate.baseCost, infiltratorsAugmentations.filter((augmentation) => Player.hasAugmentation(augmentation.name)).length + 1;
purchasedOrQueuedInfiltratorAugmentationCount, augmentationToUpdate.baseCost = Math.pow(augmentationToUpdate.baseCost * 1000, infiltratorMultiplier);
); augmentationToUpdate.baseRepRequirement *= infiltratorMultiplier;
augmentationToUpdate.baseRepRequirement *= purchasedOrQueuedInfiltratorAugmentationCount;
} else { } else {
augmentationToUpdate.baseCost *= Math.pow( augmentationToUpdate.baseCost *= getGenericAugmentationPriceMultiplier();
CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]],
Player.queuedAugmentations.length,
);
} }
} }
} }

@ -239,9 +239,9 @@ export const AugmentationNames: {
ReverseDictionary: "Reverse Dictionary", ReverseDictionary: "Reverse Dictionary",
AmuletOfPersuasian: "Amulet of Persuasian", AmuletOfPersuasian: "Amulet of Persuasian",
LameSharkRepository: "Lame Shark Repository", LameSharkRepository: "Lame Shark Repository",
CyberDecoder: "CyberDecoder", CyberDecoder: "Cyber Decoder",
MineDetector: "MineDetector", MineDetector: "Mine Detector",
WireCuttingManual: "WireCuttingManual", WireCuttingManual: "Wire Cutting Manual",
//Wasteland Augs //Wasteland Augs
//PepBoy: "P.E.P-Boy", Plasma Energy Projection System //PepBoy: "P.E.P-Boy", Plasma Energy Projection System

@ -111,19 +111,6 @@ export function purchaseAugmentation(aug: Augmentation, fac: Faction, sing = fal
Player.loseMoney(aug.baseCost * factionInfo.augmentationPriceMult, "augmentations"); Player.loseMoney(aug.baseCost * factionInfo.augmentationPriceMult, "augmentations");
// If you just purchased Neuroflux Governor, recalculate the cost
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
let nextLevel = getNextNeuroFluxLevel();
--nextLevel;
const mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);
aug.baseRepRequirement = 500 * mult * BitNodeMultipliers.AugmentationRepCost;
aug.baseCost = 750e3 * mult * BitNodeMultipliers.AugmentationMoneyCost;
for (let i = 0; i < Player.queuedAugmentations.length - 1; ++i) {
aug.baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]];
}
}
updateAugmentationCosts(); updateAugmentationCosts();
if (sing) { if (sing) {

@ -23,7 +23,7 @@ import Typography from "@mui/material/Typography";
import Tooltip from "@mui/material/Tooltip"; import Tooltip from "@mui/material/Tooltip";
import TableBody from "@mui/material/TableBody"; import TableBody from "@mui/material/TableBody";
import Table from "@mui/material/Table"; import Table from "@mui/material/Table";
import { CONSTANTS } from "../../Constants"; import { getGenericAugmentationPriceMultiplier } from "../../Augmentation/AugmentationHelpers";
type IProps = { type IProps = {
faction: Faction; faction: Faction;
@ -180,10 +180,6 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
</> </>
); );
} }
const mult = Math.pow(
CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][player.sourceFileLvl(11)],
player.queuedAugmentations.length,
);
return ( return (
<> <>
<Button onClick={props.routeToMainPage}>Back</Button> <Button onClick={props.routeToMainPage}>Back</Button>
@ -204,7 +200,9 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
</Typography> </Typography>
} }
> >
<Typography>Price multiplier: x {numeralWrapper.formatMultiplier(mult)}</Typography> <Typography>
Price multiplier: x {numeralWrapper.formatMultiplier(getGenericAugmentationPriceMultiplier())}
</Typography>
</Tooltip> </Tooltip>
</Box> </Box>
<Button onClick={() => switchSortOrder(PurchaseAugmentationsOrderSetting.Cost)}>Sort by Cost</Button> <Button onClick={() => switchSortOrder(PurchaseAugmentationsOrderSetting.Cost)}>Sort by Cost</Button>