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: "DEEPSCANV1.EXE", Condition: () => Player.getHomeComputer().programs.includes(Programs.DeepscanV1.name) },
// { ID: "DEEPSCANV2.EXE", Condition: () => Player.getHomeComputer().programs.includes(Programs.DeepscanV2.name) },
// { ID: "INFILTRATORS", Condition: () => Player.factions.includes(FactionNames.Infiltators) },
// {
// ID: "SERVERPROFILER.EXE",
// Condition: () => Player.getHomeComputer().programs.includes(Programs.ServerProfiler.name),

@ -97,8 +97,8 @@ function getRandomBonus(): any {
export const infiltratorsAugmentations = [
new Augmentation({
name: AugmentationNames.BagOfSand,
repCost: 100,
moneyCost: 1e9,
repCost: 1e2,
moneyCost: 1e6,
info:
"You watched a bittube video about sword fighting, " +
"it suggested the best way to win a sword fight was to play dirty " +
@ -110,8 +110,8 @@ export const infiltratorsAugmentations = [
}),
new Augmentation({
name: AugmentationNames.IntellisenseModule,
repCost: 100,
moneyCost: 1e9,
repCost: 1e2,
moneyCost: 1e6,
info:
"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 " +
@ -121,8 +121,8 @@ export const infiltratorsAugmentations = [
}),
new Augmentation({
name: AugmentationNames.ReverseDictionary,
repCost: 100,
moneyCost: 1e9,
repCost: 1e2,
moneyCost: 1e6,
info:
"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 " +
@ -132,8 +132,8 @@ export const infiltratorsAugmentations = [
}),
new Augmentation({
name: AugmentationNames.AmuletOfPersuasian,
repCost: 100,
moneyCost: 1e9,
repCost: 1e2,
moneyCost: 1e6,
info:
"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, " +
@ -143,8 +143,8 @@ export const infiltratorsAugmentations = [
}),
new Augmentation({
name: AugmentationNames.LameSharkRepository,
repCost: 100,
moneyCost: 1e9,
repCost: 1e2,
moneyCost: 1e6,
info:
"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. ",
@ -153,8 +153,8 @@ export const infiltratorsAugmentations = [
}),
new Augmentation({
name: AugmentationNames.CyberDecoder,
repCost: 100,
moneyCost: 1e9,
repCost: 1e2,
moneyCost: 1e6,
info:
"A cool looking do hickey that oddly resembles Keanu Reeves face, " +
"it has a usb cable that looks like it plugs into something.",
@ -163,8 +163,8 @@ export const infiltratorsAugmentations = [
}),
new Augmentation({
name: AugmentationNames.MineDetector,
repCost: 100,
moneyCost: 1e9,
repCost: 1e2,
moneyCost: 1e6,
info:
"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, " +
@ -179,8 +179,8 @@ export const infiltratorsAugmentations = [
}),
new Augmentation({
name: AugmentationNames.WireCuttingManual,
repCost: 100,
moneyCost: 1e9,
repCost: 1e2,
moneyCost: 1e6,
info:
"You found an old wire cutting for dummies book in the local library, " +
"how hard can it be to cut wires, right?",

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

@ -239,9 +239,9 @@ export const AugmentationNames: {
ReverseDictionary: "Reverse Dictionary",
AmuletOfPersuasian: "Amulet of Persuasian",
LameSharkRepository: "Lame Shark Repository",
CyberDecoder: "CyberDecoder",
MineDetector: "MineDetector",
WireCuttingManual: "WireCuttingManual",
CyberDecoder: "Cyber Decoder",
MineDetector: "Mine Detector",
WireCuttingManual: "Wire Cutting Manual",
//Wasteland Augs
//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");
// 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();
if (sing) {

@ -23,7 +23,7 @@ import Typography from "@mui/material/Typography";
import Tooltip from "@mui/material/Tooltip";
import TableBody from "@mui/material/TableBody";
import Table from "@mui/material/Table";
import { CONSTANTS } from "../../Constants";
import { getGenericAugmentationPriceMultiplier } from "../../Augmentation/AugmentationHelpers";
type IProps = {
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 (
<>
<Button onClick={props.routeToMainPage}>Back</Button>
@ -204,7 +200,9 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
</Typography>
}
>
<Typography>Price multiplier: x {numeralWrapper.formatMultiplier(mult)}</Typography>
<Typography>
Price multiplier: x {numeralWrapper.formatMultiplier(getGenericAugmentationPriceMultiplier())}
</Typography>
</Tooltip>
</Box>
<Button onClick={() => switchSortOrder(PurchaseAugmentationsOrderSetting.Cost)}>Sort by Cost</Button>