mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
Merge pull request #3613 from nickofolas/fix/nfg-level-application
AUGMENTATIONS: Fix NeuroFlux being applied improperly and migrate broken saves
This commit is contained in:
commit
22b6d0d5a0
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,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,
|
||||
|
@ -414,6 +414,26 @@ 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,
|
||||
];
|
||||
|
||||
Player.reapplyAllAugmentations(true);
|
||||
Player.reapplyAllSourceFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user