From c5cbbb2fbd6e1e28c66644ec2a4433df95ac3c8a Mon Sep 17 00:00:00 2001 From: Mughur Date: Thu, 25 Aug 2022 16:03:03 +0300 Subject: [PATCH 1/7] fix sleeve bb --- .../Sleeve/Work/SleeveBladeburnerWork.ts | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts index 208592e45..5b8900eed 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts @@ -34,9 +34,26 @@ export class SleeveBladeburnerWork extends Work { process(player: IPlayer, sleeve: Sleeve, cycles: number): number { if (!player.bladeburner) throw new Error("sleeve doing blade work without being a member"); this.cyclesWorked += cycles; + const actionIdent = player.bladeburner.getActionIdFromTypeAndName(this.actionType, this.actionName); + if (!actionIdent) throw new Error(`Error getting ${this.actionName} action`); + if (this.actionType === "Contracts"){ + const action=player.bladeburner.getActionObject(actionIdent); + if (!action) throw new Error(`Error getting ${this.actionName} action object`); + if (action.count<=0){ + sleeve.stopWork(player); + return 0; + } + } + while (this.cyclesWorked > this.cyclesNeeded(player, sleeve)) { - const actionIdent = player.bladeburner.getActionIdFromTypeAndName(this.actionType, this.actionName); - if (!actionIdent) throw new Error(`Error getting ${this.actionName} action`); + if (this.actionType === "Contracts"){ + const action=player.bladeburner.getActionObject(actionIdent); + if (!action) throw new Error(`Error getting ${this.actionName} action object`); + if (action.count<=0){ + sleeve.stopWork(player); + return 0; + } + } player.bladeburner.completeAction(player, sleeve, actionIdent, false); let exp: WorkStats | undefined; if (this.actionType === "General") { From 2e4e7fadfcff32bf17241408a204e20557cf4b1f Mon Sep 17 00:00:00 2001 From: Mughur Date: Thu, 25 Aug 2022 18:18:01 +0300 Subject: [PATCH 2/7] fix Sleeve UI gains --- .../Sleeve/Work/SleeveFactionWork.ts | 1 + src/PersonObjects/Sleeve/ui/StatsElement.tsx | 55 ++++++++++--------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts index 0cc7b5bae..a18793e25 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts @@ -13,6 +13,7 @@ import { getHackingWorkRepGain, } from "../../../PersonObjects/formulas/reputation"; import { scaleWorkStats, WorkStats } from "../../../Work/WorkStats"; +import { BitNodeMultipliers } from "../../../BitNode/BitNodeMultipliers"; interface SleeveFactionWorkParams { factionWorkType: FactionWorkType; diff --git a/src/PersonObjects/Sleeve/ui/StatsElement.tsx b/src/PersonObjects/Sleeve/ui/StatsElement.tsx index 811647f01..34abeb3d0 100644 --- a/src/PersonObjects/Sleeve/ui/StatsElement.tsx +++ b/src/PersonObjects/Sleeve/ui/StatsElement.tsx @@ -16,6 +16,7 @@ import { isSleeveClassWork } from "../Work/SleeveClassWork"; import { isSleeveFactionWork } from "../Work/SleeveFactionWork"; import { isSleeveCompanyWork } from "../Work/SleeveCompanyWork"; import { isSleeveCrimeWork } from "../Work/SleeveCrimeWork"; +import { BitNodeMultipliers } from "../../../BitNode/BitNodeMultipliers"; interface IProps { sleeve: Sleeve; @@ -100,51 +101,51 @@ export function EarningsElement(props: IProps): React.ReactElement { if (isSleeveCrimeWork(props.sleeve.currentWork)) { const gains = props.sleeve.currentWork.getExp(); data = [ - [`Money:`, ], - [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * gains.hackExp)}`], - [`Strength Exp:`, `${numeralWrapper.formatExp(5 * gains.strExp)}`], - [`Defense Exp:`, `${numeralWrapper.formatExp(5 * gains.defExp)}`], - [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * gains.dexExp)}`], - [`Agility Exp:`, `${numeralWrapper.formatExp(5 * gains.agiExp)}`], - [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * gains.chaExp)}`], + [`Money:`, ], + [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * gains.hackExp * BitNodeMultipliers.CrimeExpGain)}`], + [`Strength Exp:`, `${numeralWrapper.formatExp(5 * gains.strExp * BitNodeMultipliers.CrimeExpGain)}`], + [`Defense Exp:`, `${numeralWrapper.formatExp(5 * gains.defExp * BitNodeMultipliers.CrimeExpGain)}`], + [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * gains.dexExp * BitNodeMultipliers.CrimeExpGain)}`], + [`Agility Exp:`, `${numeralWrapper.formatExp(5 * gains.agiExp * BitNodeMultipliers.CrimeExpGain)}`], + [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * gains.chaExp * BitNodeMultipliers.CrimeExpGain)}`], ]; } if (isSleeveClassWork(props.sleeve.currentWork)) { const rates = props.sleeve.currentWork.calculateRates(player, props.sleeve); data = [ [`Money:`, ], - [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`], - [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`], - [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`], - [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`], - [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`], - [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`], + [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], + [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], + [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], + [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], + [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], + [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], ]; } if (isSleeveFactionWork(props.sleeve.currentWork)) { const rates = props.sleeve.currentWork.getExpRates(props.sleeve); const repGain = props.sleeve.currentWork.getReputationRate(props.sleeve); data = [ - [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`], - [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`], - [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`], - [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`], - [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`], - [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`], - [`Reputation:`, ], + [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], + [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], + [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], + [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], + [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], + [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], + [`Reputation:`, ], ]; } if (isSleeveCompanyWork(props.sleeve.currentWork)) { const rates = props.sleeve.currentWork.getGainRates(player, props.sleeve); data = [ - [`Money:`, ], - [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`], - [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`], - [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`], - [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`], - [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`], - [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`], + [`Money:`, ], + [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], + [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], + [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], + [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], + [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], + [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], [`Reputation:`, ], ]; } From bf33734def6b8027d843e84edf17700f57381f73 Mon Sep 17 00:00:00 2001 From: Mughur Date: Thu, 25 Aug 2022 18:49:01 +0300 Subject: [PATCH 3/7] Sleeve shock goes down, but not to negative --- src/PersonObjects/Sleeve/Sleeve.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PersonObjects/Sleeve/Sleeve.ts b/src/PersonObjects/Sleeve/Sleeve.ts index cf40155a5..ef9031473 100644 --- a/src/PersonObjects/Sleeve/Sleeve.ts +++ b/src/PersonObjects/Sleeve/Sleeve.ts @@ -485,7 +485,7 @@ export class Sleeve extends Person { this.hp.current -= amt; if (this.hp.current <= 0) { - this.shock = Math.min(1, this.shock - 0.5); + this.shock = Math.max(0, this.shock - 0.5); this.hp.current = this.hp.max; return true; } else { From 1a1decf5fda74f4848f9b867ca20353365a06f29 Mon Sep 17 00:00:00 2001 From: Mughur Date: Thu, 25 Aug 2022 20:06:19 +0300 Subject: [PATCH 4/7] sleeve BB contracts now properly give money --- src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts index 5b8900eed..f99af453c 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts @@ -5,6 +5,8 @@ import { applySleeveGains, Work, WorkType } from "./Work"; import { CONSTANTS } from "../../../Constants"; import { GeneralActions } from "../../../Bladeburner/data/GeneralActions"; import { WorkStats } from "../../../Work/WorkStats"; +import { Contract } from "src/Bladeburner/Contract"; +import { Contracts } from "src/Bladeburner/data/Contracts"; interface SleeveBladeburnerWorkParams { type: string; @@ -54,13 +56,14 @@ export class SleeveBladeburnerWork extends Work { return 0; } } - player.bladeburner.completeAction(player, sleeve, actionIdent, false); + const retValue = player.bladeburner.completeAction(player, sleeve, actionIdent, false); let exp: WorkStats | undefined; if (this.actionType === "General") { exp = GeneralActions[this.actionName]?.exp; if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`); applySleeveGains(player, sleeve, exp, 1); } + if (retValue.money>0)player.gainMoney(retValue.money,"sleeves") this.cyclesWorked -= this.cyclesNeeded(player, sleeve); } return 0; From a6d4ef4147541a4e8abd5ccc9be4509a6f7c3cd0 Mon Sep 17 00:00:00 2001 From: Mughur Date: Thu, 25 Aug 2022 20:28:05 +0300 Subject: [PATCH 5/7] sleeve.getTask() retuns which crime name --- src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts index 5610af6f9..3c4dc435a 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts @@ -64,6 +64,7 @@ export class SleeveCrimeWork extends Work { APICopy(): Record { return { type: this.type, + name: this.crimeType }; } From 9d1b48e0762db04e105c6b1931ae0bc182a1cf53 Mon Sep 17 00:00:00 2001 From: Mughur Date: Fri, 26 Aug 2022 00:27:39 +0300 Subject: [PATCH 6/7] Fixing my previous mistakes --- src/NetscriptFunctions/CodingContract.ts | 2 +- .../Sleeve/Work/SleeveBladeburnerWork.ts | 16 ++++---- .../Sleeve/Work/SleeveCrimeWork.ts | 2 +- .../Sleeve/Work/SleeveFactionWork.ts | 6 ++- src/PersonObjects/Sleeve/ui/StatsElement.tsx | 40 +++++++++---------- 5 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/NetscriptFunctions/CodingContract.ts b/src/NetscriptFunctions/CodingContract.ts index 93cd1b7b2..a95dbe0ec 100644 --- a/src/NetscriptFunctions/CodingContract.ts +++ b/src/NetscriptFunctions/CodingContract.ts @@ -37,7 +37,7 @@ export function NetscriptCodingContract(): InternalAPI { throw new Error("The answer provided was not a number, string, or array"); // Convert answer to string. - const answerStr = typeof answer === 'string' ? answer : JSON.stringify(answer); + const answerStr = typeof answer === "string" ? answer : JSON.stringify(answer); const creward = contract.reward; if (creward === null) throw new Error("Somehow solved a contract that didn't have a reward"); diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts index f99af453c..c4478e361 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts @@ -5,8 +5,6 @@ import { applySleeveGains, Work, WorkType } from "./Work"; import { CONSTANTS } from "../../../Constants"; import { GeneralActions } from "../../../Bladeburner/data/GeneralActions"; import { WorkStats } from "../../../Work/WorkStats"; -import { Contract } from "src/Bladeburner/Contract"; -import { Contracts } from "src/Bladeburner/data/Contracts"; interface SleeveBladeburnerWorkParams { type: string; @@ -38,20 +36,20 @@ export class SleeveBladeburnerWork extends Work { this.cyclesWorked += cycles; const actionIdent = player.bladeburner.getActionIdFromTypeAndName(this.actionType, this.actionName); if (!actionIdent) throw new Error(`Error getting ${this.actionName} action`); - if (this.actionType === "Contracts"){ - const action=player.bladeburner.getActionObject(actionIdent); + if (this.actionType === "Contracts") { + const action = player.bladeburner.getActionObject(actionIdent); if (!action) throw new Error(`Error getting ${this.actionName} action object`); - if (action.count<=0){ + if (action.count <= 0) { sleeve.stopWork(player); return 0; } } while (this.cyclesWorked > this.cyclesNeeded(player, sleeve)) { - if (this.actionType === "Contracts"){ - const action=player.bladeburner.getActionObject(actionIdent); + if (this.actionType === "Contracts") { + const action = player.bladeburner.getActionObject(actionIdent); if (!action) throw new Error(`Error getting ${this.actionName} action object`); - if (action.count<=0){ + if (action.count <= 0) { sleeve.stopWork(player); return 0; } @@ -63,7 +61,7 @@ export class SleeveBladeburnerWork extends Work { if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`); applySleeveGains(player, sleeve, exp, 1); } - if (retValue.money>0)player.gainMoney(retValue.money,"sleeves") + if (retValue.money > 0) player.gainMoney(retValue.money, "sleeves"); this.cyclesWorked -= this.cyclesNeeded(player, sleeve); } return 0; diff --git a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts index 3c4dc435a..000f7b881 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts @@ -64,7 +64,7 @@ export class SleeveCrimeWork extends Work { APICopy(): Record { return { type: this.type, - name: this.crimeType + crimeType : this.crimeType, }; } diff --git a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts index a18793e25..398374f37 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts @@ -44,7 +44,11 @@ export class SleeveFactionWork extends Work { [FactionWorkType.FIELD]: getFactionFieldWorkRepGain, [FactionWorkType.SECURITY]: getFactionSecurityWorkRepGain, }; - return repFormulas[this.factionWorkType](sleeve, faction.favor) * sleeve.shockBonus(); + return ( + repFormulas[this.factionWorkType](sleeve, faction.favor) * + sleeve.shockBonus() * + BitNodeMultipliers.FactionWorkRepGain + ); } getFaction(): Faction { diff --git a/src/PersonObjects/Sleeve/ui/StatsElement.tsx b/src/PersonObjects/Sleeve/ui/StatsElement.tsx index 34abeb3d0..542988092 100644 --- a/src/PersonObjects/Sleeve/ui/StatsElement.tsx +++ b/src/PersonObjects/Sleeve/ui/StatsElement.tsx @@ -101,7 +101,7 @@ export function EarningsElement(props: IProps): React.ReactElement { if (isSleeveCrimeWork(props.sleeve.currentWork)) { const gains = props.sleeve.currentWork.getExp(); data = [ - [`Money:`, ], + [`Money:`, ], [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * gains.hackExp * BitNodeMultipliers.CrimeExpGain)}`], [`Strength Exp:`, `${numeralWrapper.formatExp(5 * gains.strExp * BitNodeMultipliers.CrimeExpGain)}`], [`Defense Exp:`, `${numeralWrapper.formatExp(5 * gains.defExp * BitNodeMultipliers.CrimeExpGain)}`], @@ -114,25 +114,25 @@ export function EarningsElement(props: IProps): React.ReactElement { const rates = props.sleeve.currentWork.calculateRates(player, props.sleeve); data = [ [`Money:`, ], - [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], - [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], - [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], - [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], - [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], - [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp * BitNodeMultipliers.ClassGymExpGain)} / sec`], + [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`], + [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`], + [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`], + [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`], + [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`], + [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`], ]; } if (isSleeveFactionWork(props.sleeve.currentWork)) { const rates = props.sleeve.currentWork.getExpRates(props.sleeve); const repGain = props.sleeve.currentWork.getReputationRate(props.sleeve); data = [ - [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], - [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], - [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], - [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], - [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], - [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp * BitNodeMultipliers.FactionWorkExpGain)} / sec`], - [`Reputation:`, ], + [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`], + [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`], + [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`], + [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`], + [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`], + [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`], + [`Reputation:`, ], ]; } @@ -140,12 +140,12 @@ export function EarningsElement(props: IProps): React.ReactElement { const rates = props.sleeve.currentWork.getGainRates(player, props.sleeve); data = [ [`Money:`, ], - [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], - [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], - [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], - [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], - [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], - [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp * BitNodeMultipliers.CompanyWorkExpGain)} / sec`], + [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * rates.hackExp)} / sec`], + [`Strength Exp:`, `${numeralWrapper.formatExp(5 * rates.strExp)} / sec`], + [`Defense Exp:`, `${numeralWrapper.formatExp(5 * rates.defExp)} / sec`], + [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * rates.dexExp)} / sec`], + [`Agility Exp:`, `${numeralWrapper.formatExp(5 * rates.agiExp)} / sec`], + [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * rates.chaExp)} / sec`], [`Reputation:`, ], ]; } From cf090578362b94440c1b6c7b36ed83a957ef303f Mon Sep 17 00:00:00 2001 From: Mughur Date: Sun, 28 Aug 2022 13:11:59 +0300 Subject: [PATCH 7/7] BB action rewards now tied to who does the action --- src/Bladeburner/Bladeburner.tsx | 10 +++++----- src/Bladeburner/IBladeburner.ts | 2 +- src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts | 3 ++- src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Bladeburner/Bladeburner.tsx b/src/Bladeburner/Bladeburner.tsx index c57e47beb..1b54b0a3d 100644 --- a/src/Bladeburner/Bladeburner.tsx +++ b/src/Bladeburner/Bladeburner.tsx @@ -994,7 +994,7 @@ export class Bladeburner implements IBladeburner { * @param action(Action obj) - Derived action class * @param success(bool) - Whether action was successful */ - getActionStats(action: IAction, success: boolean): ITaskTracker { + getActionStats(action: IAction, person: IPerson, success: boolean): ITaskTracker { const difficulty = action.getDifficulty(); /** @@ -1005,7 +1005,7 @@ export class Bladeburner implements IBladeburner { Math.pow(difficulty, BladeburnerConstants.DiffMultExponentialFactor) + difficulty / BladeburnerConstants.DiffMultLinearFactor; - const time = this.actionTimeToComplete; + const time = action.getActionTime(this, person); const successMult = success ? 1 : 0.5; const unweightedGain = time * BladeburnerConstants.BaseStatGain * successMult * difficultyMult; @@ -1283,7 +1283,7 @@ export class Bladeburner implements IBladeburner { // Process Contract/Operation success/failure if (action.attempt(this, person)) { - retValue = this.getActionStats(action, true); + retValue = this.getActionStats(action, person, true); ++action.successes; --action.count; @@ -1323,7 +1323,7 @@ export class Bladeburner implements IBladeburner { } isOperation ? this.completeOperation(true, player) : this.completeContract(true, actionIdent); } else { - retValue = this.getActionStats(action, false); + retValue = this.getActionStats(action, person, false); ++action.failures; let loss = 0, damage = 0; @@ -1386,7 +1386,7 @@ export class Bladeburner implements IBladeburner { let teamLossMax; if (action.attempt(this, person)) { - retValue = this.getActionStats(action, true); + retValue = this.getActionStats(action, person, true); action.count = 0; this.blackops[action.name] = true; let rankGain = 0; diff --git a/src/Bladeburner/IBladeburner.ts b/src/Bladeburner/IBladeburner.ts index cb78d3abc..f8113ef1c 100644 --- a/src/Bladeburner/IBladeburner.ts +++ b/src/Bladeburner/IBladeburner.ts @@ -116,6 +116,6 @@ export interface IBladeburner { calculateMaxStamina(player: IPlayer): void; create(): void; process(router: IRouter, player: IPlayer): void; - getActionStats(action: IAction, success: boolean): ITaskTracker; + getActionStats(action: IAction, person: IPerson, success: boolean): ITaskTracker; sleeveSupport(joining: boolean): void; } diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts index c4478e361..198357a98 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts @@ -61,7 +61,8 @@ export class SleeveBladeburnerWork extends Work { if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`); applySleeveGains(player, sleeve, exp, 1); } - if (retValue.money > 0) player.gainMoney(retValue.money, "sleeves"); + player.gainMoney(retValue.money, "sleeves"); + player.gainStats(retValue); this.cyclesWorked -= this.cyclesNeeded(player, sleeve); } return 0; diff --git a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts index 000f7b881..30aa8c847 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts @@ -64,7 +64,7 @@ export class SleeveCrimeWork extends Work { APICopy(): Record { return { type: this.type, - crimeType : this.crimeType, + crimeType: this.crimeType, }; }