From c511fa644d37c4a64994606175a0cc1a924550d7 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 30 Mar 2022 20:58:09 -0400 Subject: [PATCH] Re-add augs in gangs but randomly based on BNx.y --- src/Augmentation/AugmentationCreator.tsx | 2 +- src/Augmentation/AugmentationHelpers.tsx | 2 - src/BitNode/BitNode.tsx | 65 +++++++++++++++--------- src/BitNode/BitNodeMultipliers.ts | 6 +++ src/Casino/RNG.ts | 32 ++++++++++++ src/Faction/FactionHelpers.tsx | 22 ++++++-- 6 files changed, 98 insertions(+), 31 deletions(-) diff --git a/src/Augmentation/AugmentationCreator.tsx b/src/Augmentation/AugmentationCreator.tsx index 1cc19578e..d8429d0db 100644 --- a/src/Augmentation/AugmentationCreator.tsx +++ b/src/Augmentation/AugmentationCreator.tsx @@ -706,7 +706,7 @@ export const generalAugmentations = [ "so that the brain doesn't have to.", hacking_speed_mult: 1.01, hacking_mult: 1.05, - factions: [FactionNames.CyberSec], + factions: [FactionNames.CyberSec, FactionNames.NiteSec], }), new Augmentation({ name: AugmentationNames.CranialSignalProcessorsG2, diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx index 1d0c52d35..f610a407f 100644 --- a/src/Augmentation/AugmentationHelpers.tsx +++ b/src/Augmentation/AugmentationHelpers.tsx @@ -91,14 +91,12 @@ function updateNeuroFluxGovernorCosts(neuroFluxGovernorAugmentation: Augmentatio } export function updateAugmentationCosts(): void { - console.log(Player.queuedAugmentations); for (const name of Object.keys(Augmentations)) { if (Augmentations.hasOwnProperty(name)) { const augmentationToUpdate = Augmentations[name]; if (augmentationToUpdate.name === AugmentationNames.NeuroFluxGovernor) { updateNeuroFluxGovernorCosts(augmentationToUpdate); } else { - console.log(augmentationToUpdate.baseCost); augmentationToUpdate.baseCost = augmentationToUpdate.startingCost * getGenericAugmentationPriceMultiplier(); } } diff --git a/src/BitNode/BitNode.tsx b/src/BitNode/BitNode.tsx index 95dc6cdc5..9a42f1eb2 100644 --- a/src/BitNode/BitNode.tsx +++ b/src/BitNode/BitNode.tsx @@ -82,7 +82,9 @@ BitNodes["BitNode2"] = new BitNode(
The amount of money gained from crimes and Infiltration is tripled
- Certain Factions ({FactionNames.SlumSnakes}, {FactionNames.Tetrads}, {FactionNames.TheSyndicate}, {FactionNames.TheDarkArmy}, {FactionNames.SpeakersForTheDead}, {FactionNames.NiteSec}, {FactionNames.TheBlackHand}) give the player the ability to form and manage their own gangs. These gangs will earn the player money and + Certain Factions ({FactionNames.SlumSnakes}, {FactionNames.Tetrads}, {FactionNames.TheSyndicate},{" "} + {FactionNames.TheDarkArmy}, {FactionNames.SpeakersForTheDead}, {FactionNames.NiteSec}, {FactionNames.TheBlackHand} + ) give the player the ability to form and manage their own gangs. These gangs will earn the player money and reputation with the corresponding Faction
Every Augmentation in the game will be available through the Factions listed above @@ -225,15 +227,15 @@ BitNodes["BitNode6"] = new BitNode( "Like Tears in Rain", ( <> - In the middle of the 21st century, {FactionNames.OmniTekIncorporated} began designing and manufacturing advanced synthetic - androids, or Synthoids for short. They achieved a major technological breakthrough in the sixth generation of - their Synthoid design, called MK-VI, by developing a hyperintelligent AI. Many argue that this was the first - sentient AI ever created. This resulted in Synthoid models that were stronger, faster, and more intelligent than - the humans that had created them. + In the middle of the 21st century, {FactionNames.OmniTekIncorporated} began designing and manufacturing advanced + synthetic androids, or Synthoids for short. They achieved a major technological breakthrough in the sixth + generation of their Synthoid design, called MK-VI, by developing a hyperintelligent AI. Many argue that this was + the first sentient AI ever created. This resulted in Synthoid models that were stronger, faster, and more + intelligent than the humans that had created them.

- In this BitNode you will be able to access the {FactionNames.Bladeburners} Division at the NSA, which provides a new mechanic for - progression. Furthermore: + In this BitNode you will be able to access the {FactionNames.Bladeburners} Division at the NSA, which provides a + new mechanic for progression. Furthermore:

Hacking and Hacknet Nodes will be less profitable @@ -250,9 +252,9 @@ BitNodes["BitNode6"] = new BitNode(

Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade its - level up to a maximum of 3. This Source-File allows you to access the NSA's {FactionNames.Bladeburners} Division in other - BitNodes. In addition, this Source-File will raise both the level and experience gain rate of all your combat - stats by: + level up to a maximum of 3. This Source-File allows you to access the NSA's {FactionNames.Bladeburners} Division + in other BitNodes. In addition, this Source-File will raise both the level and experience gain rate of all your + combat stats by:

Level 1: 8% @@ -270,14 +272,15 @@ BitNodes["BitNode7"] = new BitNode( "More human than humans", ( <> - In the middle of the 21st century, you were doing cutting-edge work at {FactionNames.OmniTekIncorporated} as part of the AI - design team for advanced synthetic androids, or Synthoids for short. You helped achieve a major technological - breakthrough in the sixth generation of the company's Synthoid design, called MK-VI, by developing a + In the middle of the 21st century, you were doing cutting-edge work at {FactionNames.OmniTekIncorporated} as part + of the AI design team for advanced synthetic androids, or Synthoids for short. You helped achieve a major + technological breakthrough in the sixth generation of the company's Synthoid design, called MK-VI, by developing a hyperintelligent AI. Many argue that this was the first sentient AI ever created. This resulted in Synthoid models that were stronger, faster, and more intelligent than the humans that had created them.

- In this BitNode you will be able to access the {FactionNames.Bladeburners} API, which allows you to access {FactionNames.Bladeburners} + In this BitNode you will be able to access the {FactionNames.Bladeburners} API, which allows you to access{" "} + {FactionNames.Bladeburners} functionality through Netscript. Furthermore:

The rank you gain from {FactionNames.Bladeburners} contracts/operations is reduced by 40% @@ -300,8 +303,9 @@ BitNodes["BitNode7"] = new BitNode(

Destroying this BitNode will give you Source-File 7, or if you already have this Source-File it will upgrade its - level up to a maximum of 3. This Source-File allows you to access the {FactionNames.Bladeburners} Netscript API in other BitNodes. - In addition, this Source-File will increase all of your {FactionNames.Bladeburners} multipliers by: + level up to a maximum of 3. This Source-File allows you to access the {FactionNames.Bladeburners} Netscript API in + other BitNodes. In addition, this Source-File will increase all of your {FactionNames.Bladeburners} multipliers + by:

Level 1: 8% @@ -364,10 +368,10 @@ BitNodes["BitNode9"] = new BitNode( "Hacknet Unleashed", ( <> - When {FactionNames.FulcrumSecretTechnologies} released their open-source Linux distro Chapeau, it quickly became the OS of choice for - the underground hacking community. Chapeau became especially notorious for powering the Hacknet, a global, - decentralized network used for nefarious purposes. {FactionNames.FulcrumSecretTechnologies} quickly abandoned the project and dissociated - themselves from it. + When {FactionNames.FulcrumSecretTechnologies} released their open-source Linux distro Chapeau, it quickly became + the OS of choice for the underground hacking community. Chapeau became especially notorious for powering the + Hacknet, a global, decentralized network used for nefarious purposes. {FactionNames.FulcrumSecretTechnologies}{" "} + quickly abandoned the project and dissociated themselves from it.

This BitNode unlocks the Hacknet Server, an upgraded version of the Hacknet Node. Hacknet Servers generate hashes, @@ -538,8 +542,8 @@ BitNodes["BitNode13"] = new BitNode( "1 step back, 2 steps forward", ( <> - With the invention of Augmentations in the 2040s a religious group known as the {FactionNames.ChurchOfTheMachineGod} has - rallied far more support than anyone would have hoped. + With the invention of Augmentations in the 2040s a religious group known as the{" "} + {FactionNames.ChurchOfTheMachineGod} has rallied far more support than anyone would have hoped.

Their leader, Allison "Mother" Stanek is said to have created her own Augmentation whose power goes beyond any @@ -555,7 +559,8 @@ BitNodes["BitNode13"] = new BitNode(

Destroying this BitNode will give you Source-File 13, or if you already have this Source-File it will upgrade its - level up to a maximum of 3. This Source-File lets the {FactionNames.ChurchOfTheMachineGod} appear in other BitNodes. + level up to a maximum of 3. This Source-File lets the {FactionNames.ChurchOfTheMachineGod} appear in other + BitNodes.

Each level of this Source-File increases the size of Stanek's Gift. @@ -624,6 +629,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.PurchasedServerSoftcap = 1.3; BitNodeMultipliers.GangSoftcap = 0.9; BitNodeMultipliers.WorldDaemonDifficulty = 2; + BitNodeMultipliers.GangUniqueAugs = 0.5; break; case 4: // The Singularity BitNodeMultipliers.ServerMaxMoney = 0.15; @@ -642,6 +648,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.StaneksGiftExtraSize = 0; BitNodeMultipliers.PurchasedServerSoftcap = 1.2; BitNodeMultipliers.WorldDaemonDifficulty = 3; + BitNodeMultipliers.GangUniqueAugs = 0.5; break; case 5: // Artificial intelligence BitNodeMultipliers.ServerMaxMoney = 2; @@ -659,6 +666,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.StaneksGiftExtraSize = 0; BitNodeMultipliers.PurchasedServerSoftcap = 1.2; BitNodeMultipliers.WorldDaemonDifficulty = 1.5; + BitNodeMultipliers.GangUniqueAugs = 0.5; break; case 6: // Bladeburner BitNodeMultipliers.HackingLevelMultiplier = 0.35; @@ -679,6 +687,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.GangSoftcap = 0.7; BitNodeMultipliers.CorporationSoftCap = 0.9; BitNodeMultipliers.WorldDaemonDifficulty = 2; + BitNodeMultipliers.GangUniqueAugs = 0.2; break; case 7: // Bladeburner 2079 BitNodeMultipliers.BladeburnerRank = 0.6; @@ -704,6 +713,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.GangSoftcap = 0.7; BitNodeMultipliers.CorporationSoftCap = 0.9; BitNodeMultipliers.WorldDaemonDifficulty = 2; + BitNodeMultipliers.GangUniqueAugs = 0.2; break; case 8: // Ghost of Wall Street BitNodeMultipliers.ScriptHackMoney = 0.3; @@ -720,6 +730,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.PurchasedServerSoftcap = 4; BitNodeMultipliers.GangSoftcap = 0; BitNodeMultipliers.CorporationSoftCap = 0; + BitNodeMultipliers.GangUniqueAugs = 0; break; case 9: // Hacktocracy BitNodeMultipliers.HackingLevelMultiplier = 0.5; @@ -746,6 +757,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.GangSoftcap = 0.8; BitNodeMultipliers.CorporationSoftCap = 0.7; BitNodeMultipliers.WorldDaemonDifficulty = 2; + BitNodeMultipliers.GangUniqueAugs = 0.25; break; case 10: // Digital Carbon BitNodeMultipliers.HackingLevelMultiplier = 0.35; @@ -775,6 +787,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.GangSoftcap = 0.9; BitNodeMultipliers.CorporationSoftCap = 0.9; BitNodeMultipliers.WorldDaemonDifficulty = 2; + BitNodeMultipliers.GangUniqueAugs = 0.25; break; case 11: //The Big Crash BitNodeMultipliers.HackingLevelMultiplier = 0.6; @@ -796,6 +809,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.PurchasedServerSoftcap = 2; BitNodeMultipliers.CorporationSoftCap = 0.9; BitNodeMultipliers.WorldDaemonDifficulty = 1.5; + BitNodeMultipliers.GangUniqueAugs = 0.75; break; case 12: { //The Recursion @@ -870,6 +884,8 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.GangSoftcap = 0.8; BitNodeMultipliers.CorporationSoftCap = 0.8; BitNodeMultipliers.WorldDaemonDifficulty = inc; + + BitNodeMultipliers.GangUniqueAugs = dec; break; } case 13: { @@ -912,6 +928,7 @@ export function initBitNodeMultipliers(p: IPlayer): void { BitNodeMultipliers.GangSoftcap = 0.3; BitNodeMultipliers.CorporationSoftCap = 0.3; BitNodeMultipliers.WorldDaemonDifficulty = 3; + BitNodeMultipliers.GangUniqueAugs = 0.1; break; } default: diff --git a/src/BitNode/BitNodeMultipliers.ts b/src/BitNode/BitNodeMultipliers.ts index ac78815b8..d4132fee8 100644 --- a/src/BitNode/BitNodeMultipliers.ts +++ b/src/BitNode/BitNodeMultipliers.ts @@ -114,6 +114,11 @@ interface IBitNodeMultipliers { */ GangSoftcap: number; + /** + * Percentage of unique augs that the gang has. + */ + GangUniqueAugs: number; + /** * Influences the experienced gained when hacking a server. */ @@ -300,6 +305,7 @@ export const BitNodeMultipliers: IBitNodeMultipliers = { BladeburnerSkillCost: 1, GangSoftcap: 1, + GangUniqueAugs: 1, DaedalusAugsRequirement: 1, diff --git a/src/Casino/RNG.ts b/src/Casino/RNG.ts index 8c15aeabd..c575bd6a8 100644 --- a/src/Casino/RNG.ts +++ b/src/Casino/RNG.ts @@ -61,3 +61,35 @@ export class WHRNG implements RNG { return (this.s1 / 30269.0 + this.s2 / 30307.0 + this.s3 / 30323.0) % 1.0; } } + +export function SFC32RNG(seed: string): () => number { + let h = 1779033703 ^ seed.length; + for (let i = 0; i < seed.length; i++) { + h = Math.imul(h ^ seed.charCodeAt(i), 3432918353); + h = (h << 13) | (h >>> 19); + } + const genSeed = (): number => { + h = Math.imul(h ^ (h >>> 16), 2246822507); + h = Math.imul(h ^ (h >>> 13), 3266489909); + return (h ^= h >>> 16) >>> 0; + }; + + let a = genSeed(); + let b = genSeed(); + let c = genSeed(); + let d = genSeed(); + return (): number => { + a >>>= 0; + b >>>= 0; + c >>>= 0; + d >>>= 0; + let t = (a + b) | 0; + a = b ^ (b >>> 9); + b = (c + (c << 3)) | 0; + c = (c << 21) | (c >>> 11); + d = (d + 1) | 0; + t = (t + d) | 0; + c = (c + t) | 0; + return (t >>> 0) / 4294967296; + }; +} diff --git a/src/Faction/FactionHelpers.tsx b/src/Faction/FactionHelpers.tsx index b32d49f76..fe70b2472 100644 --- a/src/Faction/FactionHelpers.tsx +++ b/src/Faction/FactionHelpers.tsx @@ -20,6 +20,7 @@ import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; import { dialogBoxCreate } from "../ui/React/DialogBox"; import { InvitationEvent } from "./ui/InvitationModal"; import { FactionNames } from "./data/FactionNames"; +import { SFC32RNG } from "../Casino/RNG"; export function inviteToFaction(faction: Faction): void { Player.receiveInvite(faction.name); @@ -194,7 +195,7 @@ export function processPassiveFactionRepGain(numCycles: number): void { } } -export const getFactionAugmentationsFiltered = (player: IPlayer, faction: Faction) => { +export const getFactionAugmentationsFiltered = (player: IPlayer, faction: Faction): string[] => { // If player has a gang with this faction, return (almost) all augmentations if (player.hasGangWith(faction.name)) { let augs = Object.values(Augmentations); @@ -205,13 +206,26 @@ export const getFactionAugmentationsFiltered = (player: IPlayer, faction: Factio const blacklist: string[] = [AugmentationNames.NeuroFluxGovernor]; if (player.bitNodeN !== 2) { - // Remove faction-unique augs that don't belong to this faction - augs = augs.filter((a) => a.factions.length > 1 || faction.augmentations.includes(a.name)); - // TRP is not available outside of BN2 for Gangs blacklist.push(AugmentationNames.TheRedPill); } + const rng = SFC32RNG(`BN${player.bitNodeN}.${player.sourceFileLvl(player.bitNodeN)}`); + // Remove faction-unique augs that don't belong to this faction + const uniqueFilter = (a: Augmentation): boolean => { + // Keep all the non-unique one + if (a.factions.length > 1) { + return true; + } + // Keep all the ones that this faction has anyway. + if (faction.augmentations.includes(a.name)) { + return true; + } + + return rng() >= 1 - BitNodeMultipliers.GangUniqueAugs; + }; + augs = augs.filter(uniqueFilter); + // Remove blacklisted augs augs = augs.filter((a) => !blacklist.includes(a.name));