From 680081c548fc47131f24acec47f94da5a3d5c1ee Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 29 Mar 2022 14:09:17 -0400 Subject: [PATCH] post-grafting changes --- doc/source/advancedgameplay.rst | 1 + doc/source/advancedgameplay/grafting.rst | 18 ++++ doc/source/advancedgameplay/intelligence.rst | 2 +- doc/source/advancedgameplay/sleeves.rst | 17 ---- doc/source/advancedgameplay/sourcefiles.rst | 2 +- .../ui/InstalledAugmentations.tsx | 6 +- src/Constants.ts | 18 ++-- src/DevMenu/ui/Entropy.tsx | 20 ++-- src/Netscript/RamCostGenerator.ts | 2 +- src/NetscriptFunctions.ts | 2 +- src/NetscriptFunctions/Grafting.ts | 49 +++++----- ...gmentation.ts => GraftableAugmentation.ts} | 6 +- .../Grafting/ui/GraftingRoot.tsx | 44 ++++----- src/PersonObjects/IPlayer.ts | 12 +-- src/PersonObjects/Player/PlayerObject.ts | 34 +++---- .../Player/PlayerObjectGeneralMethods.tsx | 98 +++++++++---------- src/Prestige.ts | 2 +- src/SaveObject.tsx | 5 + src/ScriptEditor/NetscriptDefinitions.d.ts | 26 ++--- src/engine.tsx | 6 +- src/ui/React/CharacterOverview.tsx | 10 +- src/ui/WorkInProgressRoot.tsx | 8 +- 22 files changed, 198 insertions(+), 190 deletions(-) create mode 100644 doc/source/advancedgameplay/grafting.rst rename src/PersonObjects/Grafting/{CraftableAugmentation.ts => GraftableAugmentation.ts} (86%) diff --git a/doc/source/advancedgameplay.rst b/doc/source/advancedgameplay.rst index 8687c8c89..3f943156a 100644 --- a/doc/source/advancedgameplay.rst +++ b/doc/source/advancedgameplay.rst @@ -12,4 +12,5 @@ must be unlocked. Source-Files Intelligence Sleeves + Grafting Hacking algorithms diff --git a/doc/source/advancedgameplay/grafting.rst b/doc/source/advancedgameplay/grafting.rst new file mode 100644 index 000000000..7ba78ade5 --- /dev/null +++ b/doc/source/advancedgameplay/grafting.rst @@ -0,0 +1,18 @@ +.. _gameplay_grafting: + +Grafting +======== +Grafting is an experimental process through which you can obtain the benefits of +Augmentations, without needing to reboot your body. + +In order to graft, you must first purchase a blueprint for and craft the Augmentation. +This can be done at VitaLife in New Tokyo, where you'll find a shady researcher with +questionable connections. Once you purchase a blueprint, you will start crafting the +Augmentation, and it will be grafted to your body once complete. + +Be warned, some who have tested grafting have reported an unidentified malware. Dubbed +"Entropy", this virus seems to grow in potency as more Augmentations are grafted, +causing unpredictable affects to the victim. + +Note that when crafting an Augmentation, cancelling will **not** save your progress, +and the money spent will **not** be returned. diff --git a/doc/source/advancedgameplay/intelligence.rst b/doc/source/advancedgameplay/intelligence.rst index 7ca645387..17e1dab86 100644 --- a/doc/source/advancedgameplay/intelligence.rst +++ b/doc/source/advancedgameplay/intelligence.rst @@ -16,4 +16,4 @@ Intelligence will boost your production for many actions in the game, including: * Crime success rate * Bladeburner * Reputation gain for companies & factions -* Augmentation crafting speed +* Augmentation grafting speed diff --git a/doc/source/advancedgameplay/sleeves.rst b/doc/source/advancedgameplay/sleeves.rst index 27b5d9d1b..0790da5dc 100644 --- a/doc/source/advancedgameplay/sleeves.rst +++ b/doc/source/advancedgameplay/sleeves.rst @@ -91,20 +91,3 @@ and above, and is only available after defeating BitNode-10 at least once. Memory is a persistent stat, meaning it never gets reset back to 1. The maximum possible value for a sleeve's memory is 100. - -Grafting -^^^^^^^^ -Grafting is an experimental process through which you can obtain the benefits of -Augmentations, without needing to install them. - -In order to graft, you must first purchase a blueprint for and craft the Augmentation. -This can be done at VitaLife in New Tokyo, where you'll find a shady researcher with -questionable connections. Once you purchase a blueprint, you will start crafting the -Augmentation, and it will be grafted to your body once complete. - -Be warned, some who have tested grafting have reported an unidentified malware. Dubbed -"Entropy", this virus seems to grow in potency as more Augmentations are grafted, -causing unpredictable affects to the victim. - -Note that when crafting an Augmentation, cancelling will **not** save your progress, -and the money spent will **not** be returned. diff --git a/doc/source/advancedgameplay/sourcefiles.rst b/doc/source/advancedgameplay/sourcefiles.rst index dba38b763..5aaed1dc8 100644 --- a/doc/source/advancedgameplay/sourcefiles.rst +++ b/doc/source/advancedgameplay/sourcefiles.rst @@ -53,7 +53,7 @@ List of all Source-Files +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ || BitNode-10: Digital Carbon || * Each level of this grants a Duplicate Sleeve. | || || * Allows the player to access the `Sleeve API `_ in other BitNodes. | -|| || * Grants the player access to the VitaLife grafting laboratory in other BitNodes. Also grants access to the Grafting API. | +|| || * Grants the player access to the VitaLife secret laboratory in other BitNodes. Also grants access to the Grafting API. | +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ || BitNode-11: The Big Crash || * Company favor increases both the player's salary and reputation gain at that | || || company by 1% per favor (rather than just the reputation gain). | diff --git a/src/Augmentation/ui/InstalledAugmentations.tsx b/src/Augmentation/ui/InstalledAugmentations.tsx index b850e1504..292c89c6b 100644 --- a/src/Augmentation/ui/InstalledAugmentations.tsx +++ b/src/Augmentation/ui/InstalledAugmentations.tsx @@ -59,7 +59,7 @@ export function InstalledAugmentations(): React.ReactElement { - {player.entropyStacks > 0 && + {player.entropy > 0 && (() => { const [open, setOpen] = useState(false); @@ -69,7 +69,7 @@ export function InstalledAugmentations(): React.ReactElement { - Entropy ({player.entropyStacks} accumulated) + Entropy virus - Level {player.entropy} } /> @@ -83,7 +83,7 @@ export function InstalledAugmentations(): React.ReactElement { All multipliers decreased by:{" "} - {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropyStacks) * 100, 3)}% (multiplicative) + {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropy) * 100, 3)}% (multiplicative) diff --git a/src/Constants.ts b/src/Constants.ts index 8a3716783..bc1ebef06 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -41,7 +41,7 @@ export const CONSTANTS: { IntelligenceInfiltrationWeight: number; IntelligenceCrimeBaseExpGain: number; IntelligenceProgramBaseExpGain: number; - IntelligenceCraftBaseExpGain: number; + IntelligenceGraftBaseExpGain: number; IntelligenceTerminalHackBaseExpGain: number; IntelligenceSingFnBaseExpGain: number; IntelligenceClassBaseExpGain: number; @@ -72,7 +72,7 @@ export const CONSTANTS: { WorkTypeCreateProgram: string; WorkTypeStudyClass: string; WorkTypeCrime: string; - WorkTypeCraftAugmentation: string; + WorkTypeGraftAugmentation: string; ClassStudyComputerScience: string; ClassDataStructures: string; ClassNetworks: string; @@ -110,8 +110,8 @@ export const CONSTANTS: { CodingContractBaseFactionRepGain: number; CodingContractBaseCompanyRepGain: number; CodingContractBaseMoneyGain: number; - AugmentationCraftingCostMult: number; - AugmentationCraftingTimeBase: number; + AugmentationGraftingCostMult: number; + AugmentationGraftingTimeBase: number; EntropyEffect: number; TotalNumBitNodes: number; LatestUpdate: string; @@ -185,7 +185,7 @@ export const CONSTANTS: { IntelligenceInfiltrationWeight: 0.1, // Weight for how much int affects infiltration success rates IntelligenceCrimeBaseExpGain: 0.05, IntelligenceProgramBaseExpGain: 0.1, // Program required hack level divided by this to determine int exp gain - IntelligenceCraftBaseExpGain: 0.05, + IntelligenceGraftBaseExpGain: 0.05, IntelligenceTerminalHackBaseExpGain: 200, // Hacking exp divided by this to determine int exp gain IntelligenceSingFnBaseExpGain: 1.5, IntelligenceClassBaseExpGain: 0.01, @@ -230,7 +230,7 @@ export const CONSTANTS: { WorkTypeCreateProgram: "Working on Create a Program", WorkTypeStudyClass: "Studying or Taking a class at university", WorkTypeCrime: "Committing a crime", - WorkTypeCraftAugmentation: "Crafting an Augmentation", + WorkTypeGraftAugmentation: "Grafting an Augmentation", ClassStudyComputerScience: "studying Computer Science", ClassDataStructures: "taking a Data Structures course", @@ -277,11 +277,11 @@ export const CONSTANTS: { CodingContractBaseMoneyGain: 75e6, // Augmentation crafting multipliers - AugmentationCraftingCostMult: 1.2, - AugmentationCraftingTimeBase: 3600000, + AugmentationGraftingCostMult: 3, + AugmentationGraftingTimeBase: 3600000, // Value raised to the number of entropy stacks, then multiplied to player multipliers - EntropyEffect: 0.99, + EntropyEffect: 0.98, // BitNode/Source-File related stuff TotalNumBitNodes: 24, diff --git a/src/DevMenu/ui/Entropy.tsx b/src/DevMenu/ui/Entropy.tsx index 93c63df71..acac53af0 100644 --- a/src/DevMenu/ui/Entropy.tsx +++ b/src/DevMenu/ui/Entropy.tsx @@ -27,21 +27,21 @@ export function Entropy(props: IProps): React.ReactElement { { - props.player.entropyStacks += num; - props.player.applyEntropy(props.player.entropyStacks); + add={(num) => { + props.player.entropy += num; + props.player.applyEntropy(props.player.entropy); }} - subtract={num => { - props.player.entropyStacks -= num; - props.player.applyEntropy(props.player.entropyStacks); + subtract={(num) => { + props.player.entropy -= num; + props.player.applyEntropy(props.player.entropy); }} tons={() => { - props.player.entropyStacks += 1e12; - props.player.applyEntropy(props.player.entropyStacks); + props.player.entropy += 1e12; + props.player.applyEntropy(props.player.entropy); }} reset={() => { - props.player.entropyStacks = 0; - props.player.applyEntropy(props.player.entropyStacks); + props.player.entropy = 0; + props.player.applyEntropy(props.player.entropy); }} /> diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 31524d5b4..57a9af5d2 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -389,7 +389,7 @@ export const RamCosts: IMap = { grafting: { getAugmentationCraftPrice: 3.75, getAugmentationCraftTime: 3.75, - craftAugmentation: 7.5, + graftAugmentation: 7.5, }, heart: { diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 7b292a209..fe92e2b77 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -2318,7 +2318,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { tor: Player.hasTorRouter(), inBladeburner: Player.inBladeburner(), hasCorporation: Player.hasCorporation(), - entropyStacks: Player.entropyStacks, + entropy: Player.entropy, }; Object.assign(data.jobs, Player.jobs); return data; diff --git a/src/NetscriptFunctions/Grafting.ts b/src/NetscriptFunctions/Grafting.ts index fa1e2339d..4e7605acc 100644 --- a/src/NetscriptFunctions/Grafting.ts +++ b/src/NetscriptFunctions/Grafting.ts @@ -2,16 +2,15 @@ import { CityName } from "../Locations/data/CityNames"; import { Augmentations } from "../Augmentation/Augmentations"; import { getRamCost } from "../Netscript/RamCostGenerator"; import { WorkerScript } from "../Netscript/WorkerScript"; -import { CraftableAugmentation } from "../PersonObjects/Grafting/CraftableAugmentation"; +import { GraftableAugmentation } from "../PersonObjects/Grafting/GraftableAugmentation"; import { getAvailableAugs } from "../PersonObjects/Grafting/ui/GraftingRoot"; import { IPlayer } from "../PersonObjects/IPlayer"; import { Grafting as IGrafting } from "../ScriptEditor/NetscriptDefinitions"; -import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; import { Router } from "../ui/GameRoot"; import { INetscriptHelper } from "./INetscriptHelper"; export function NetscriptGrafting(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): IGrafting { - const checkGraftingAPIAccess = (func: any): void => { + const checkGraftingAPIAccess = (func: string): void => { if (!player.canAccessGrafting()) { throw helper.makeRuntimeErrorMsg( `grafting.${func}`, @@ -21,54 +20,58 @@ export function NetscriptGrafting(player: IPlayer, workerScript: WorkerScript, h }; return { - getAugmentationCraftPrice: (augName: string): number => { - helper.updateDynamicRam("getAugmentationCraftPrice", getRamCost(player, "grafting", "getAugmentationCraftPrice")); - checkGraftingAPIAccess("getAugmentationCraftPrice"); + getAugmentationGraftPrice: (_augName: unknown): number => { + const augName = helper.string("getAugmentationGraftPrice", "augName", _augName); + helper.updateDynamicRam("getAugmentationGraftPrice", getRamCost(player, "grafting", "getAugmentationGraftPrice")); + checkGraftingAPIAccess("getAugmentationGraftPrice"); if (!Augmentations.hasOwnProperty(augName)) { - throw helper.makeRuntimeErrorMsg("grafting.getAugmentationCraftPrice", `Invalid aug: ${augName}`); + throw helper.makeRuntimeErrorMsg("grafting.getAugmentationGraftPrice", `Invalid aug: ${augName}`); } - const craftableAug = new CraftableAugmentation(Augmentations[augName]); + const craftableAug = new GraftableAugmentation(Augmentations[augName]); return craftableAug.cost; }, - getAugmentationCraftTime: (augName: string): number => { - helper.updateDynamicRam("getAugmentationCraftTime", getRamCost(player, "grafting", "getAugmentationCraftTime")); - checkGraftingAPIAccess("getAugmentationCraftTime"); + getAugmentationGraftTime: (_augName: string): number => { + const augName = helper.string("getAugmentationGraftTime", "augName", _augName); + helper.updateDynamicRam("getAugmentationGraftTime", getRamCost(player, "grafting", "getAugmentationGraftTime")); + checkGraftingAPIAccess("getAugmentationGraftTime"); if (!Augmentations.hasOwnProperty(augName)) { - throw helper.makeRuntimeErrorMsg("grafting.getAugmentationCraftTime", `Invalid aug: ${augName}`); + throw helper.makeRuntimeErrorMsg("grafting.getAugmentationGraftTime", `Invalid aug: ${augName}`); } - const craftableAug = new CraftableAugmentation(Augmentations[augName]); + const craftableAug = new GraftableAugmentation(Augmentations[augName]); return craftableAug.time; }, - craftAugmentation: (augName: string, focus = true): boolean => { - helper.updateDynamicRam("craftAugmentation", getRamCost(player, "grafting", "craftAugmentation")); - checkGraftingAPIAccess("craftAugmentation"); + graftAugmentation: (_augName: string, _focus: unknown = true): boolean => { + const augName = helper.string("graftAugmentation", "augName", _augName); + const focus = helper.boolean(_focus); + helper.updateDynamicRam("graftAugmentation", getRamCost(player, "grafting", "graftAugmentation")); + checkGraftingAPIAccess("graftAugmentation"); if (player.city !== CityName.NewTokyo) { throw helper.makeRuntimeErrorMsg( - "grafting.craftAugmentation", + "grafting.graftAugmentation", "You must be in New Tokyo to begin crafting an Augmentation.", ); } if (!getAvailableAugs(player).includes(augName)) { - workerScript.log("grafting.craftAugmentation", () => `Invalid aug: ${augName}`); + workerScript.log("grafting.graftAugmentation", () => `Invalid aug: ${augName}`); return false; } const wasFocusing = player.focus; if (player.isWorking) { const txt = player.singularityStopWork(); - workerScript.log("craftAugmentation", () => txt); + workerScript.log("graftAugmentation", () => txt); } - const craftableAug = new CraftableAugmentation(Augmentations[augName]); + const craftableAug = new GraftableAugmentation(Augmentations[augName]); if (player.money < craftableAug.cost) { - workerScript.log("grafting.craftAugmentation", () => `You don't have enough money to craft ${augName}`); + workerScript.log("grafting.graftAugmentation", () => `You don't have enough money to craft ${augName}`); return false; } player.loseMoney(craftableAug.cost, "augmentations"); - player.startCraftAugmentationWork(augName, craftableAug.time); + player.startGraftAugmentationWork(augName, craftableAug.time); if (focus) { player.startFocusing(); @@ -78,7 +81,7 @@ export function NetscriptGrafting(player: IPlayer, workerScript: WorkerScript, h Router.toTerminal(); } - workerScript.log("grafting.craftAugmentation", () => `Began crafting Augmentation ${augName}.`); + workerScript.log("grafting.graftAugmentation", () => `Began crafting Augmentation ${augName}.`); return true; }, }; diff --git a/src/PersonObjects/Grafting/CraftableAugmentation.ts b/src/PersonObjects/Grafting/GraftableAugmentation.ts similarity index 86% rename from src/PersonObjects/Grafting/CraftableAugmentation.ts rename to src/PersonObjects/Grafting/GraftableAugmentation.ts index 0d365ebd7..46658d9c8 100644 --- a/src/PersonObjects/Grafting/CraftableAugmentation.ts +++ b/src/PersonObjects/Grafting/GraftableAugmentation.ts @@ -9,7 +9,7 @@ export interface IConstructorParams { readonly time: number; } -export class CraftableAugmentation { +export class GraftableAugmentation { // The augmentation that this craftable corresponds to augmentation: Augmentation; @@ -18,7 +18,7 @@ export class CraftableAugmentation { } get cost(): number { - return this.augmentation.startingCost * CONSTANTS.AugmentationCraftingCostMult; + return this.augmentation.startingCost * CONSTANTS.AugmentationGraftingCostMult; } get time(): number { @@ -26,6 +26,6 @@ export class CraftableAugmentation { const antiLog = Math.max(sum(Object.values(this.augmentation.mults)), 1); const mult = Math.log2(antiLog); - return CONSTANTS.AugmentationCraftingTimeBase * mult + CONSTANTS.MillisecondsPerHalfHour; + return CONSTANTS.AugmentationGraftingTimeBase * mult + CONSTANTS.MillisecondsPerHalfHour; } } diff --git a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx index 838fc8f7e..0854ca187 100644 --- a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx +++ b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx @@ -17,9 +17,9 @@ import { CONSTANTS } from "../../../Constants"; import { IPlayer } from "../../IPlayer"; -import { CraftableAugmentation } from "../CraftableAugmentation"; +import { GraftableAugmentation } from "../GraftableAugmentation"; -const CraftableAugmentations: IMap = {}; +const GraftableAugmentations: IMap = {}; export const getAvailableAugs = (player: IPlayer): string[] => { const augs: string[] = []; @@ -39,12 +39,12 @@ export const GraftingRoot = (): React.ReactElement => { for (const aug of Object.values(Augmentations)) { const name = aug.name; - const craftableAug = new CraftableAugmentation(aug); - CraftableAugmentations[name] = craftableAug; + const graftableAug = new GraftableAugmentation(aug); + GraftableAugmentations[name] = graftableAug; } const [selectedAug, setSelectedAug] = useState(getAvailableAugs(player)[0]); - const [craftOpen, setCraftOpen] = useState(false); + const [graftOpen, setGraftOpen] = useState(false); return ( @@ -63,7 +63,7 @@ export const GraftingRoot = (): React.ReactElement => { - Craft Augmentations + Graft Augmentations {getAvailableAugs(player).map((k, i) => ( @@ -77,29 +77,29 @@ export const GraftingRoot = (): React.ReactElement => { {selectedAug} setCraftOpen(false)} + open={graftOpen} + onClose={() => setGraftOpen(false)} onConfirm={() => { - const craftableAug = CraftableAugmentations[selectedAug]; - player.loseMoney(craftableAug.cost, "augmentations"); - player.startCraftAugmentationWork(selectedAug, craftableAug.time); + const graftableAug = GraftableAugmentations[selectedAug]; + player.loseMoney(graftableAug.cost, "augmentations"); + player.startGraftAugmentationWork(selectedAug, graftableAug.time); player.startFocusing(); router.toWork(); }} confirmationText={ <> - Cancelling crafting will not save crafting progress, and the money you spend will not be + Cancelling grafting will not save grafting progress, and the money you spend will not be returned.

@@ -108,9 +108,9 @@ export const GraftingRoot = (): React.ReactElement => { } /> - Time to Craft:{" "} + Time to Graft:{" "} {convertTimeMsToTimeElapsedString( - CraftableAugmentations[selectedAug].time / (1 + (player.getIntelligenceBonus(3) - 1) / 3), + GraftableAugmentations[selectedAug].time / (1 + (player.getIntelligenceBonus(3) - 1) / 3), )} {/* Use formula so the displayed creation time is accurate to player bonus */} @@ -135,14 +135,14 @@ export const GraftingRoot = (): React.ReactElement => {
- Entropy Accumulation + Entropy virus - Accumulated Entropy: {player.entropyStacks} + Entropy strength: {player.entropy}
All multipliers decreased by:{" "} - {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropyStacks) * 100, 3)}% (multiplicative) + {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropy) * 100, 3)}% (multiplicative)
diff --git a/src/PersonObjects/IPlayer.ts b/src/PersonObjects/IPlayer.ts index 41881462a..ca1f2940a 100644 --- a/src/PersonObjects/IPlayer.ts +++ b/src/PersonObjects/IPlayer.ts @@ -128,8 +128,8 @@ export interface IPlayer { factionWorkType: string; createProgramName: string; timeWorkedCreateProgram: number; - craftAugmentationName: string; - timeWorkedCraftAugmentation: number; + graftAugmentationName: string; + timeWorkedGraftAugmentation: number; crimeType: string; committingCrimeThruSingFn: boolean; singFnCrimeWorkerScript: WorkerScript | null; @@ -160,7 +160,7 @@ export interface IPlayer { workChaExpGainRate: number; workMoneyLossRate: number; - entropyStacks: number; + entropy: number; // Methods work(numCycles: number): boolean; @@ -288,8 +288,8 @@ export interface IPlayer { setMult(name: string, mult: number): void; canAccessCotMG(): boolean; sourceFileLvl(n: number): number; - startCraftAugmentationWork(augmentationName: string, time: number): void; - craftAugmentationWork(numCycles: number): boolean; - finishCraftAugmentationWork(cancelled: boolean): string; + startGraftAugmentationWork(augmentationName: string, time: number): void; + graftAugmentationWork(numCycles: number): boolean; + finishGraftAugmentationWork(cancelled: boolean): string; applyEntropy(stacks?: number): void; } diff --git a/src/PersonObjects/Player/PlayerObject.ts b/src/PersonObjects/Player/PlayerObject.ts index 65603c3af..943598b60 100644 --- a/src/PersonObjects/Player/PlayerObject.ts +++ b/src/PersonObjects/Player/PlayerObject.ts @@ -137,8 +137,8 @@ export class PlayerObject implements IPlayer { factionWorkType: string; createProgramName: string; timeWorkedCreateProgram: number; - craftAugmentationName: string; - timeWorkedCraftAugmentation: number; + graftAugmentationName: string; + timeWorkedGraftAugmentation: number; crimeType: string; committingCrimeThruSingFn: boolean; singFnCrimeWorkerScript: WorkerScript | null; @@ -169,7 +169,7 @@ export class PlayerObject implements IPlayer { workChaExpGainRate: number; workMoneyLossRate: number; - entropyStacks: number; + entropy: number; // Methods work: (numCycles: number) => boolean; @@ -298,9 +298,9 @@ export class PlayerObject implements IPlayer { setMult: (name: string, mult: number) => void; canAccessCotMG: () => boolean; sourceFileLvl: (n: number) => number; - startCraftAugmentationWork: (augmentationName: string, time: number) => void; - craftAugmentationWork: (numCycles: number) => boolean; - finishCraftAugmentationWork: (cancelled: boolean) => string; + startGraftAugmentationWork: (augmentationName: string, time: number) => void; + graftAugmentationWork: (numCycles: number) => boolean; + finishGraftAugmentationWork: (cancelled: boolean) => string; applyEntropy: (stacks?: number) => void; constructor() { @@ -425,8 +425,8 @@ export class PlayerObject implements IPlayer { this.createProgramName = ""; this.createProgramReqLvl = 0; - this.craftAugmentationName = ""; - this.timeWorkedCraftAugmentation = 0; + this.graftAugmentationName = ""; + this.timeWorkedGraftAugmentation = 0; this.className = ""; @@ -470,7 +470,7 @@ export class PlayerObject implements IPlayer { //bitnode this.bitNodeN = 1; - this.entropyStacks = 0; + this.entropy = 0; //Used to store the last update time. this.lastUpdate = 0; @@ -493,11 +493,11 @@ export class PlayerObject implements IPlayer { // Let's get a hash of some semi-random stuff so we have something unique. this.identifier = cyrb53( "I-" + - new Date().getTime() + - navigator.userAgent + - window.innerWidth + - window.innerHeight + - getRandomInt(100, 999), + new Date().getTime() + + navigator.userAgent + + window.innerWidth + + window.innerHeight + + getRandomInt(100, 999), ); this.init = generalMethods.init; @@ -551,9 +551,9 @@ export class PlayerObject implements IPlayer { this.startCreateProgramWork = generalMethods.startCreateProgramWork; this.createProgramWork = generalMethods.createProgramWork; this.finishCreateProgramWork = generalMethods.finishCreateProgramWork; - this.startCraftAugmentationWork = generalMethods.startCraftAugmentationWork; - this.craftAugmentationWork = generalMethods.craftAugmentationWork; - this.finishCraftAugmentationWork = generalMethods.finishCraftAugmentationWork; + this.startGraftAugmentationWork = generalMethods.startGraftAugmentationWork; + this.graftAugmentationWork = generalMethods.craftAugmentationWork; + this.finishGraftAugmentationWork = generalMethods.finishGraftAugmentationWork; this.startClass = generalMethods.startClass; this.takeClass = generalMethods.takeClass; this.finishClass = generalMethods.finishClass; diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index 2a862085e..b370d9974 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -180,7 +180,7 @@ export function prestigeAugmentation(this: PlayerObject): void { } export function prestigeSourceFile(this: IPlayer): void { - this.entropyStacks = 0; + this.entropy = 0; this.prestigeAugmentation(); this.karma = 0; // Duplicate sleeves are reset to level 1 every Bit Node (but the number of sleeves you have persists) @@ -528,12 +528,12 @@ export function resetWorkStatus(this: IPlayer, generalType?: string, group?: str this.timeWorked = 0; this.timeWorkedCreateProgram = 0; - this.timeWorkedCraftAugmentation = 0; + this.timeWorkedGraftAugmentation = 0; this.currentWorkFactionName = ""; this.currentWorkFactionDescription = ""; this.createProgramName = ""; - this.craftAugmentationName = ""; + this.graftAugmentationName = ""; this.className = ""; this.workType = ""; } @@ -610,8 +610,8 @@ export function process(this: IPlayer, router: IRouter, numCycles = 1): void { if (this.workPartTime(numCycles)) { router.toCity(); } - } else if (this.workType === CONSTANTS.WorkTypeCraftAugmentation) { - if (this.craftAugmentationWork(numCycles)) { + } else if (this.workType === CONSTANTS.WorkTypeGraftAugmentation) { + if (this.graftAugmentationWork(numCycles)) { router.toGrafting(); } } else if (this.work(numCycles)) { @@ -1335,17 +1335,13 @@ export function finishCreateProgramWork(this: IPlayer, cancelled: boolean): stri return "You've finished creating " + programName + "! The new program can be found on your home computer."; } -export function startCraftAugmentationWork( - this: IPlayer, - augmentationName: string, - time: number, -): void { - this.resetWorkStatus() +export function startGraftAugmentationWork(this: IPlayer, augmentationName: string, time: number): void { + this.resetWorkStatus(); this.isWorking = true; - this.workType = CONSTANTS.WorkTypeCraftAugmentation; + this.workType = CONSTANTS.WorkTypeGraftAugmentation; this.timeNeededToCompleteWork = time; - this.craftAugmentationName = augmentationName; + this.graftAugmentationName = augmentationName; } export function craftAugmentationWork(this: IPlayer, numCycles: number): boolean { @@ -1358,35 +1354,37 @@ export function craftAugmentationWork(this: IPlayer, numCycles: number): boolean skillMult *= focusBonus; this.timeWorked += CONSTANTS._idleSpeed * numCycles; - this.timeWorkedCraftAugmentation += CONSTANTS._idleSpeed * numCycles * skillMult; + this.timeWorkedGraftAugmentation += CONSTANTS._idleSpeed * numCycles * skillMult; - if (this.timeWorkedCraftAugmentation >= this.timeNeededToCompleteWork) { - this.finishCraftAugmentationWork(false); + if (this.timeWorkedGraftAugmentation >= this.timeNeededToCompleteWork) { + this.finishGraftAugmentationWork(false); return true; } return false; } -export function finishCraftAugmentationWork(this: IPlayer, cancelled: boolean): string { - const augName = this.craftAugmentationName; +export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean): string { + const augName = this.graftAugmentationName; if (cancelled === false) { - dialogBoxCreate(`You've finished crafting ${augName}.
The augmentation has been grafted to your body, but you feel a bit off.`) + dialogBoxCreate( + `You've finished crafting ${augName}.
The augmentation has been grafted to your body, but you feel a bit off.`, + ); applyAugmentation(Augmentations[augName]); - this.entropyStacks += 1; - this.applyEntropy(this.entropyStacks); + this.entropy += 1; + this.applyEntropy(this.entropy); } else { - dialogBoxCreate(`You cancelled the crafting of ${augName}.
Your money was not returned to you.`) + dialogBoxCreate(`You cancelled the crafting of ${augName}.
Your money was not returned to you.`); } // Intelligence gain if (!cancelled) { - this.gainIntelligenceExp((CONSTANTS.IntelligenceCraftBaseExpGain * this.timeWorked) / 10000); + this.gainIntelligenceExp((CONSTANTS.IntelligenceGraftBaseExpGain * this.timeWorked) / 10000); } this.isWorking = false; this.resetWorkStatus(); - return `Crafting of ${augName} has ended.` + return `Grafting of ${augName} has ended.`; } /* Studying/Taking Classes */ @@ -1567,20 +1565,20 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string { if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) { ws.scriptRef.log( "SUCCESS: Crime successful! Gained " + - numeralWrapper.formatMoney(this.workMoneyGained) + - ", " + - numeralWrapper.formatExp(this.workHackExpGained) + - " hack exp, " + - numeralWrapper.formatExp(this.workStrExpGained) + - " str exp, " + - numeralWrapper.formatExp(this.workDefExpGained) + - " def exp, " + - numeralWrapper.formatExp(this.workDexExpGained) + - " dex exp, " + - numeralWrapper.formatExp(this.workAgiExpGained) + - " agi exp, " + - numeralWrapper.formatExp(this.workChaExpGained) + - " cha exp.", + numeralWrapper.formatMoney(this.workMoneyGained) + + ", " + + numeralWrapper.formatExp(this.workHackExpGained) + + " hack exp, " + + numeralWrapper.formatExp(this.workStrExpGained) + + " str exp, " + + numeralWrapper.formatExp(this.workDefExpGained) + + " def exp, " + + numeralWrapper.formatExp(this.workDexExpGained) + + " dex exp, " + + numeralWrapper.formatExp(this.workAgiExpGained) + + " agi exp, " + + numeralWrapper.formatExp(this.workChaExpGained) + + " cha exp.", ); } } else { @@ -1619,18 +1617,18 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string { if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) { ws.scriptRef.log( "FAIL: Crime failed! Gained " + - numeralWrapper.formatExp(this.workHackExpGained) + - " hack exp, " + - numeralWrapper.formatExp(this.workStrExpGained) + - " str exp, " + - numeralWrapper.formatExp(this.workDefExpGained) + - " def exp, " + - numeralWrapper.formatExp(this.workDexExpGained) + - " dex exp, " + - numeralWrapper.formatExp(this.workAgiExpGained) + - " agi exp, " + - numeralWrapper.formatExp(this.workChaExpGained) + - " cha exp.", + numeralWrapper.formatExp(this.workHackExpGained) + + " hack exp, " + + numeralWrapper.formatExp(this.workStrExpGained) + + " str exp, " + + numeralWrapper.formatExp(this.workDefExpGained) + + " def exp, " + + numeralWrapper.formatExp(this.workDexExpGained) + + " dex exp, " + + numeralWrapper.formatExp(this.workAgiExpGained) + + " agi exp, " + + numeralWrapper.formatExp(this.workChaExpGained) + + " cha exp.", ); } } else { diff --git a/src/Prestige.ts b/src/Prestige.ts index 066fb1d59..5299cb4c2 100755 --- a/src/Prestige.ts +++ b/src/Prestige.ts @@ -109,7 +109,7 @@ export function prestigeAugmentation(): void { initMessages(); // Apply entropy from grafting - Player.applyEntropy(Player.entropyStacks); + Player.applyEntropy(Player.entropy); // Gang const gang = Player.gang; diff --git a/src/SaveObject.tsx b/src/SaveObject.tsx index f6ee3b1f7..fc6a5ff06 100755 --- a/src/SaveObject.tsx +++ b/src/SaveObject.tsx @@ -393,6 +393,11 @@ function evaluateVersionCompatibility(ver: string | number): void { } } } + if (ver < 12) { + if (anyPlayer.resleeves !== undefined) { + delete anyPlayer.resleeves; + } + } } } diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index cc6d664cd..49393dca4 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -95,7 +95,7 @@ interface Player { tor: boolean; hasCorporation: boolean; inBladeburner: boolean; - entropyStacks: number; + entropy: number; } /** @@ -3722,39 +3722,39 @@ export interface Sleeve { export interface Grafting { /** - * Retrieve the crafting cost of an aug. + * Retrieve the grafting cost of an aug. * @remarks * RAM cost: 3.75 GB * * @param augName - Name of the aug to check the price of. Must be an exact match. - * @returns The cost required to craft the named augmentation. + * @returns The cost required to graft the named augmentation. * @throws Will error if an invalid Augmentation name is provided. */ - getAugmentationCraftPrice(augName: string): number; + getAugmentationGraftPrice(augName: string): number; /** - * Retrieves the time required to craft an aug. + * Retrieves the time required to graft an aug. * @remarks * RAM cost: 3.75 GB * - * @param augName - Name of the aug to check the crafting time of. Must be an exact match. - * @returns The time required, in millis, to craft the named augmentation. + * @param augName - Name of the aug to check the grafting time of. Must be an exact match. + * @returns The time required, in millis, to graft the named augmentation. * @throws Will error if an invalid Augmentation name is provided. */ - getAugmentationCraftTime(augName: string): number; + getAugmentationGraftTime(augName: string): number; /** - * Begins crafting the named aug. You must be in New Tokyo to use this. + * Begins grafting the named aug. You must be in New Tokyo to use this. * @remarks * RAM cost: 7.5 GB * - * @param augName - The name of the aug to begin crafting. Must be an exact match. - * @param focus - Acquire player focus on this Augmentation crafting. Optional. Defaults to true. - * @returns True if the aug successfully began crafting, false otherwise (e.g. not enough money, or + * @param augName - The name of the aug to begin grafting. Must be an exact match. + * @param focus - Acquire player focus on this Augmentation grafting. Optional. Defaults to true. + * @returns True if the aug successfully began grafting, false otherwise (e.g. not enough money, or * invalid Augmentation name provided). * @throws Will error if called while you are not in New Tokyo. */ - craftAugmentation(augName: string, focus?: boolean): boolean; + graftAugmentation(augName: string, focus?: boolean): boolean; } /** diff --git a/src/engine.tsx b/src/engine.tsx index c8303f54c..43d459bdd 100644 --- a/src/engine.tsx +++ b/src/engine.tsx @@ -264,7 +264,7 @@ const Engine: { } // Apply penalty for entropy accumulation - Player.applyEntropy(Player.entropyStacks); + Player.applyEntropy(Player.entropy); // Calculate the number of cycles have elapsed while offline Engine._lastUpdate = new Date().getTime(); @@ -305,8 +305,8 @@ const Engine: { Player.commitCrime(numCyclesOffline); } else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) { Player.workPartTime(numCyclesOffline); - } else if (Player.workType === CONSTANTS.WorkTypeCraftAugmentation) { - Player.craftAugmentationWork(numCyclesOffline); + } else if (Player.workType === CONSTANTS.WorkTypeGraftAugmentation) { + Player.graftAugmentationWork(numCyclesOffline); } else { Player.work(numCyclesOffline); } diff --git a/src/ui/React/CharacterOverview.tsx b/src/ui/React/CharacterOverview.tsx index 5cc6ba828..877ec685c 100644 --- a/src/ui/React/CharacterOverview.tsx +++ b/src/ui/React/CharacterOverview.tsx @@ -194,13 +194,13 @@ function Work(): React.ReactElement { ); break; - case CONSTANTS.WorkTypeCraftAugmentation: - details = <>Crafting {player.craftAugmentationName}; - header = <>Crafting an Augmentation; + case CONSTANTS.WorkTypeGraftAugmentation: + details = <>Grafting {player.graftAugmentationName}; + header = <>Grafting an Augmentation; innerText = ( <> - {((player.timeWorkedCraftAugmentation / player.timeNeededToCompleteWork) * 100).toFixed(2)}% - {" "}done + {((player.timeWorkedGraftAugmentation / player.timeNeededToCompleteWork) * 100).toFixed(2)}%{" "} + done ); } diff --git a/src/ui/WorkInProgressRoot.tsx b/src/ui/WorkInProgressRoot.tsx index e263790e4..a462f5acd 100644 --- a/src/ui/WorkInProgressRoot.tsx +++ b/src/ui/WorkInProgressRoot.tsx @@ -483,9 +483,9 @@ export function WorkInProgressRoot(): React.ReactElement { ); } - if (player.craftAugmentationName !== "") { + if (player.graftAugmentationName !== "") { function cancel(): void { - player.finishCraftAugmentationWork(true); + player.finishGraftAugmentationWork(true); router.toTerminal(); } function unfocus(): void { @@ -496,14 +496,14 @@ export function WorkInProgressRoot(): React.ReactElement { - You are currently working on crafting {player.craftAugmentationName}. + You are currently working on crafting {player.graftAugmentationName}.

You have been working for {convertTimeMsToTimeElapsedString(player.timeWorked)}

The augmentation is{" "} - {((player.timeWorkedCraftAugmentation / player.timeNeededToCompleteWork) * 100).toFixed(2)}% done being + {((player.timeWorkedGraftAugmentation / player.timeNeededToCompleteWork) * 100).toFixed(2)}% done being crafted.
If you cancel, your work will not be saved, and the money you spent will not be returned.