From b409e584474b96ad383cd28ce192a64bd5d6db18 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 19 Jul 2022 13:09:56 -0400 Subject: [PATCH] fix exp not loading, kinda --- src/Constants.ts | 2 +- .../Grafting/EntropyAccumulation.ts | 73 +++++++++---------- .../Player/PlayerObjectAugmentationMethods.ts | 5 +- .../Player/PlayerObjectGeneralMethods.ts | 10 ++- src/engine.tsx | 1 + src/ui/CharacterStats.tsx | 1 - 6 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/Constants.ts b/src/Constants.ts index aa149e6a1..64609ad87 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -104,7 +104,7 @@ export const CONSTANTS: { MilliPerCycle: 200, // How much reputation is needed to join a megacorporation's faction - CorpFactionRepRequirement: 200e3, + CorpFactionRepRequirement: 400e3, // Base RAM costs BaseCostFor1GBOfRamHome: 32000, diff --git a/src/PersonObjects/Grafting/EntropyAccumulation.ts b/src/PersonObjects/Grafting/EntropyAccumulation.ts index b1f7ea78f..08c5855ca 100644 --- a/src/PersonObjects/Grafting/EntropyAccumulation.ts +++ b/src/PersonObjects/Grafting/EntropyAccumulation.ts @@ -1,52 +1,47 @@ -import { IMap } from "../../types"; import { CONSTANTS } from "../../Constants"; import { IPlayer } from "../IPlayer"; +import { Multipliers } from "../Multipliers"; -export const calculateEntropy = (player: IPlayer, stacks = 1): IMap => { - const multipliers: Record = { - hacking_chance: player.mults.hacking_chance, - hacking_speed: player.mults.hacking_speed, - hacking_money: player.mults.hacking_money, - hacking_grow: player.mults.hacking_grow, +export const calculateEntropy = (player: IPlayer, stacks = 1): Multipliers => { + const nerf = CONSTANTS.EntropyEffect ** stacks; + return { + hacking_chance: player.mults.hacking_chance * nerf, + hacking_speed: player.mults.hacking_speed * nerf, + hacking_money: player.mults.hacking_money * nerf, + hacking_grow: player.mults.hacking_grow * nerf, - hacking: player.mults.hacking, - strength: player.mults.strength, - defense: player.mults.defense, - dexterity: player.mults.dexterity, - agility: player.mults.agility, - charisma: player.mults.charisma, + hacking: player.mults.hacking * nerf, + strength: player.mults.strength * nerf, + defense: player.mults.defense * nerf, + dexterity: player.mults.dexterity * nerf, + agility: player.mults.agility * nerf, + charisma: player.mults.charisma * nerf, - hacking_exp: player.mults.hacking_exp, - strength_exp: player.mults.strength_exp, - defense_exp: player.mults.defense_exp, - dexterity_exp: player.mults.dexterity_exp, - agility_exp: player.mults.agility_exp, - charisma_exp: player.mults.charisma_exp, + hacking_exp: player.mults.hacking_exp * nerf, + strength_exp: player.mults.strength_exp * nerf, + defense_exp: player.mults.defense_exp * nerf, + dexterity_exp: player.mults.dexterity_exp * nerf, + agility_exp: player.mults.agility_exp * nerf, + charisma_exp: player.mults.charisma_exp * nerf, - company_rep: player.mults.company_rep, - faction_rep: player.mults.faction_rep, + company_rep: player.mults.company_rep * nerf, + faction_rep: player.mults.faction_rep * nerf, - crime_money: player.mults.crime_money, - crime_success: player.mults.crime_success, + crime_money: player.mults.crime_money * nerf, + crime_success: player.mults.crime_success * nerf, - hacknet_node_money: player.mults.hacknet_node_money, - hacknet_node_purchase_cost: player.mults.hacknet_node_purchase_cost, - hacknet_node_ram_cost: player.mults.hacknet_node_ram_cost, - hacknet_node_core_cost: player.mults.hacknet_node_core_cost, - hacknet_node_level_cost: player.mults.hacknet_node_level_cost, + hacknet_node_money: player.mults.hacknet_node_money * nerf, + hacknet_node_purchase_cost: player.mults.hacknet_node_purchase_cost * nerf, + hacknet_node_ram_cost: player.mults.hacknet_node_ram_cost * nerf, + hacknet_node_core_cost: player.mults.hacknet_node_core_cost * nerf, + hacknet_node_level_cost: player.mults.hacknet_node_level_cost * nerf, - work_money: player.mults.work_money, + work_money: player.mults.work_money * nerf, - bladeburner_max_stamina: player.mults.bladeburner_max_stamina, - bladeburner_stamina_gain: player.mults.bladeburner_stamina_gain, - bladeburner_analysis: player.mults.bladeburner_analysis, - bladeburner_success_chance: player.mults.bladeburner_success_chance, + bladeburner_max_stamina: player.mults.bladeburner_max_stamina * nerf, + bladeburner_stamina_gain: player.mults.bladeburner_stamina_gain * nerf, + bladeburner_analysis: player.mults.bladeburner_analysis * nerf, + bladeburner_success_chance: player.mults.bladeburner_success_chance * nerf, }; - - for (const [mult, val] of Object.entries(multipliers)) { - multipliers[mult] = val * CONSTANTS.EntropyEffect ** stacks; - } - - return multipliers; }; diff --git a/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts b/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts index e2d5aa2ad..58accbe73 100644 --- a/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts @@ -32,8 +32,5 @@ export function applyEntropy(this: IPlayer, stacks = 1): void { this.reapplyAllAugmentations(); this.reapplyAllSourceFiles(); - const newMultipliers = calculateEntropy(this, stacks); - for (const [mult, val] of Object.entries(newMultipliers)) { - this.setMult(mult, val); - } + this.mults = calculateEntropy(this, stacks); } diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts b/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts index ee1c96235..0581c6a41 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts @@ -53,6 +53,7 @@ import { Player } from "../../Player"; import { isCompanyWork } from "../../Work/CompanyWork"; import { defaultMultipliers } from "../Multipliers"; +import { serverMetadata } from "../../Server/data/servers"; export function init(this: IPlayer): void { /* Initialize Player's home computer */ @@ -842,8 +843,13 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] { // the requirements for the specified company. There are two requirements: // 1. High enough reputation // 2. Player is employed at the company - function checkMegacorpRequirements(companyName: string, repNeeded = CONSTANTS.CorpFactionRepRequirement): boolean { - return allCompanies.includes(companyName) && getCompanyRep(companyName) > repNeeded; + function checkMegacorpRequirements(companyName: string): boolean { + const serverMeta = serverMetadata.find((s) => s.specialName === companyName); + const server = GetServer(serverMeta ? serverMeta.hostname : ""); + const bonus = (server as Server).backdoorInstalled ? -100e3 : 0; + return ( + allCompanies.includes(companyName) && getCompanyRep(companyName) > CONSTANTS.CorpFactionRepRequirement + bonus + ); } //Illuminati diff --git a/src/engine.tsx b/src/engine.tsx index 7bace0775..ecb280a7a 100644 --- a/src/engine.tsx +++ b/src/engine.tsx @@ -250,6 +250,7 @@ const Engine: { startExploits(); setupUncaughtPromiseHandler(); // Load game from save or create new game + if (loadGame(saveString)) { ThemeEvents.emit(); diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index ac2a0e38e..e77fc5017 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -232,7 +232,6 @@ export function CharacterStats(): React.ReactElement { const mults = getBitNodeMultipliers(n, Math.min(player.sourceFileLvl(n) + 1, maxSfLevel)); showBitNodeMults = !isEqual(mults, defaultMultipliers); } - return ( Stats