From 78104b40adfd439efb9bc81fd51eb6476a2b9801 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Wed, 4 May 2022 20:07:12 -0500 Subject: [PATCH 1/3] Fix missing logic for applying NFG --- src/Augmentation/AugmentationHelpers.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx index dd5b106e5..2b0b51093 100644 --- a/src/Augmentation/AugmentationHelpers.tsx +++ b/src/Augmentation/AugmentationHelpers.tsx @@ -85,9 +85,17 @@ function applyAugmentation(aug: IPlayerOwnedAugmentation, reapply = false): void Player.applyEntropy(Player.entropy); } + // Special logic for NeuroFlux Governor + const ownedNfg = Player.augmentations.find((pAug) => pAug.name === AugmentationNames.NeuroFluxGovernor); + if (aug.name === AugmentationNames.NeuroFluxGovernor && !reapply && ownedNfg) { + ownedNfg.level = aug.level; + return; + } + // Push onto Player's Augmentation list if (!reapply) { const ownedAug = new PlayerOwnedAugmentation(aug.name); + Player.augmentations.push(ownedAug); } } From 965d5c7c20d62419986cfd40dfa796c7c98d0ee2 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Wed, 4 May 2022 20:16:23 -0500 Subject: [PATCH 2/3] Add migration for broken saves --- src/Constants.ts | 2 +- src/SaveObject.tsx | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Constants.ts b/src/Constants.ts index a37ce6bba..41d541061 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -120,7 +120,7 @@ export const CONSTANTS: { LatestUpdate: string; } = { VersionString: "1.6.4", - VersionNumber: 16, + VersionNumber: 17, // Speed (in ms) at which the main loop is updated _idleSpeed: 200, diff --git a/src/SaveObject.tsx b/src/SaveObject.tsx index 5367ad25c..d406b597b 100755 --- a/src/SaveObject.tsx +++ b/src/SaveObject.tsx @@ -414,6 +414,23 @@ function evaluateVersionCompatibility(ver: string | number): void { } } } + + // Fix bugged NFG accumulation in owned augmentations + if (ver < 17) { + let ownedNFGs = [...Player.augmentations]; + ownedNFGs = ownedNFGs.filter((aug) => aug.name === AugmentationNames.NeuroFluxGovernor); + const newNFG = new PlayerOwnedAugmentation(AugmentationNames.NeuroFluxGovernor); + newNFG.level = 0; + + for (const nfg of ownedNFGs) { + newNFG.level += nfg.level; + } + + Player.augmentations = [ + ...Player.augmentations.filter((aug) => aug.name !== AugmentationNames.NeuroFluxGovernor), + newNFG, + ]; + } } } From 73f26e2ae3fb68fea9aef700ccf5262b078204c2 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 5 May 2022 01:02:05 -0500 Subject: [PATCH 3/3] Reapply boosts in migration --- src/SaveObject.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SaveObject.tsx b/src/SaveObject.tsx index d406b597b..f6943d774 100755 --- a/src/SaveObject.tsx +++ b/src/SaveObject.tsx @@ -430,6 +430,9 @@ function evaluateVersionCompatibility(ver: string | number): void { ...Player.augmentations.filter((aug) => aug.name !== AugmentationNames.NeuroFluxGovernor), newNFG, ]; + + Player.reapplyAllAugmentations(true); + Player.reapplyAllSourceFiles(); } } }