allbuild commit 2b4a1bb7

This commit is contained in:
Olivier Gagnon 2022-07-28 11:37:28 -04:00
parent 2b4a1bb7db
commit c8440ef268
11 changed files with 61 additions and 53 deletions

4
dist/main.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

28
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,7 +1,7 @@
import { IPlayer } from "../../IPlayer"; import { IPlayer } from "../../IPlayer";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve"; import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work"; import { applySleeveGains, Work, WorkType } from "./Work";
import { CONSTANTS } from "../../../Constants"; import { CONSTANTS } from "../../../Constants";
import { GeneralActions } from "../../../Bladeburner/data/GeneralActions"; import { GeneralActions } from "../../../Bladeburner/data/GeneralActions";
import { applyWorkStatsExp, WorkStats } from "../../../Work/WorkStats"; import { applyWorkStatsExp, WorkStats } from "../../../Work/WorkStats";
@ -42,7 +42,7 @@ export class SleeveBladeburnerWork extends Work {
if (this.actionType === "General") { if (this.actionType === "General") {
exp = GeneralActions[this.actionName]?.exp; exp = GeneralActions[this.actionName]?.exp;
if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`); if (!exp) throw new Error(`Somehow there was no exp for action ${this.actionType} ${this.actionName}`);
applyWorkStatsExp(sleeve, exp, 1); applySleeveGains(player, sleeve, exp, 1);
} }
this.cyclesWorked -= this.cyclesNeeded(player, sleeve); this.cyclesWorked -= this.cyclesNeeded(player, sleeve);
} }

@ -1,6 +1,6 @@
import { IPlayer } from "../../IPlayer"; import { IPlayer } from "../../IPlayer";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Work, WorkType } from "./Work"; import { applySleeveGains, Work, WorkType } from "./Work";
import { ClassType } from "../../../Work/ClassWork"; import { ClassType } from "../../../Work/ClassWork";
import { LocationName } from "../../../Locations/data/LocationNames"; import { LocationName } from "../../../Locations/data/LocationNames";
import { calculateClassEarnings } from "../../../Work/formulas/Class"; import { calculateClassEarnings } from "../../../Work/formulas/Class";
@ -39,11 +39,8 @@ export class SleeveClassWork extends Work {
} }
process(player: IPlayer, sleeve: Sleeve, cycles: number): number { process(player: IPlayer, sleeve: Sleeve, cycles: number): number {
let rate = this.calculateRates(player, sleeve); const rate = this.calculateRates(player, sleeve);
applyWorkStatsExp(sleeve, rate, cycles); applySleeveGains(player, sleeve, rate, cycles);
rate = scaleWorkStats(rate, sleeve.syncBonus(), false);
applyWorkStats(player, player, rate, cycles, "sleeves");
player.sleeves.filter((s) => s != sleeve).forEach((s) => applyWorkStatsExp(s, rate, cycles));
return 0; return 0;
} }
APICopy(): Record<string, unknown> { APICopy(): Record<string, unknown> {

@ -1,7 +1,7 @@
import { IPlayer } from "../../IPlayer"; import { IPlayer } from "../../IPlayer";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve"; import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work"; import { applySleeveGains, Work, WorkType } from "./Work";
import { LocationName } from "../../../Locations/data/LocationNames"; import { LocationName } from "../../../Locations/data/LocationNames";
import { Companies } from "../../../Company/Companies"; import { Companies } from "../../../Company/Companies";
import { Company } from "../../../Company/Company"; import { Company } from "../../../Company/Company";
@ -37,9 +37,7 @@ export class SleeveCompanyWork extends Work {
process(player: IPlayer, sleeve: Sleeve, cycles: number): number { process(player: IPlayer, sleeve: Sleeve, cycles: number): number {
const company = this.getCompany(); const company = this.getCompany();
const gains = this.getGainRates(player, sleeve); const gains = this.getGainRates(player, sleeve);
applyWorkStatsExp(sleeve, gains, cycles); applySleeveGains(player, sleeve, gains, cycles);
applyWorkStats(player, player, gains, cycles, "sleeves");
player.sleeves.filter((s) => s != sleeve).forEach((s) => applyWorkStatsExp(s, gains, cycles));
company.playerReputation += gains.reputation * cycles; company.playerReputation += gains.reputation * cycles;
influenceStockThroughCompanyWork(company, gains.reputation, cycles); influenceStockThroughCompanyWork(company, gains.reputation, cycles);
return 0; return 0;

@ -1,11 +1,11 @@
import { IPlayer } from "../../IPlayer"; import { IPlayer } from "../../IPlayer";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve"; import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work"; import { applySleeveGains, Work, WorkType } from "./Work";
import { CrimeType } from "../../../utils/WorkType"; import { CrimeType } from "../../../utils/WorkType";
import { Crimes } from "../../../Crime/Crimes"; import { Crimes } from "../../../Crime/Crimes";
import { Crime } from "../../../Crime/Crime"; import { Crime } from "../../../Crime/Crime";
import { applyWorkStats, newWorkStats, scaleWorkStats, WorkStats } from "../../../Work/WorkStats"; import { applyWorkStats, applyWorkStatsExp, newWorkStats, scaleWorkStats, WorkStats } from "../../../Work/WorkStats";
import { CONSTANTS } from "../../../Constants"; import { CONSTANTS } from "../../../Constants";
export const isSleeveCrimeWork = (w: Work | null): w is SleeveCrimeWork => w !== null && w.type === WorkType.CRIME; export const isSleeveCrimeWork = (w: Work | null): w is SleeveCrimeWork => w !== null && w.type === WorkType.CRIME;
@ -46,15 +46,15 @@ export class SleeveCrimeWork extends Work {
this.cyclesWorked += cycles; this.cyclesWorked += cycles;
const crime = this.getCrime(); const crime = this.getCrime();
const gains = this.getExp(); let gains = this.getExp();
if (this.cyclesWorked >= this.cyclesNeeded()) { if (this.cyclesWorked >= this.cyclesNeeded()) {
if (Math.random() < crime.successRate(sleeve)) { if (Math.random() < crime.successRate(sleeve)) {
applyWorkStats(player, sleeve, gains, 1, "sleeves");
player.karma -= crime.karma * sleeve.syncBonus(); player.karma -= crime.karma * sleeve.syncBonus();
} else { } else {
applyWorkStats(player, sleeve, scaleWorkStats(gains, 0.25), 1, "sleeves"); gains.money = 0;
gains = scaleWorkStats(gains, 0.25);
} }
applySleeveGains(player, sleeve, gains, cycles);
this.cyclesWorked -= this.cyclesNeeded(); this.cyclesWorked -= this.cyclesNeeded();
} }
return 0; return 0;

@ -1,7 +1,7 @@
import { IPlayer } from "../../IPlayer"; import { IPlayer } from "../../IPlayer";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve"; import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work"; import { applySleeveGains, Work, WorkType } from "./Work";
import { FactionWorkType } from "../../../Work/data/FactionWorkType"; import { FactionWorkType } from "../../../Work/data/FactionWorkType";
import { FactionNames } from "../../../Faction/data/FactionNames"; import { FactionNames } from "../../../Faction/data/FactionNames";
import { Factions } from "../../../Faction/Factions"; import { Factions } from "../../../Faction/Factions";
@ -60,11 +60,8 @@ export class SleeveFactionWork extends Work {
} }
} }
let exp = this.getExpRates(sleeve); const exp = this.getExpRates(sleeve);
applyWorkStatsExp(sleeve, exp, cycles); applySleeveGains(player, sleeve, exp, cycles);
exp = scaleWorkStats(exp, sleeve.syncBonus());
applyWorkStatsExp(player, exp, cycles);
player.sleeves.filter((s) => s != sleeve).forEach((s) => applyWorkStatsExp(s, exp, cycles));
const rep = this.getReputationRate(sleeve); const rep = this.getReputationRate(sleeve);
this.getFaction().playerReputation += rep; this.getFaction().playerReputation += rep;
return 0; return 0;

@ -1,6 +1,15 @@
import { IPlayer } from "../../IPlayer"; import { IPlayer } from "../../IPlayer";
import { IReviverValue } from "../../../utils/JSONReviver"; import { IReviverValue } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve"; import { Sleeve } from "../Sleeve";
import { applyWorkStats, applyWorkStatsExp, scaleWorkStats, WorkStats } from "../../../Work/WorkStats";
export const applySleeveGains = (player: IPlayer, sleeve: Sleeve, rawStats: WorkStats, cycles = 1): void => {
const shockedStats = scaleWorkStats(rawStats, sleeve.shockBonus(), rawStats.money > 0);
applyWorkStatsExp(sleeve, shockedStats, cycles);
const syncStats = scaleWorkStats(shockedStats, sleeve.syncBonus(), rawStats.money > 0);
applyWorkStats(player, player, syncStats, cycles, "sleeves");
player.sleeves.filter((s) => s != sleeve).forEach((s) => applyWorkStatsExp(s, syncStats, cycles));
};
export abstract class Work { export abstract class Work {
type: WorkType; type: WorkType;

@ -8,6 +8,7 @@ import { dialogBoxCreate } from "../ui/React/DialogBox";
import { CrimeType } from "../utils/WorkType"; import { CrimeType } from "../utils/WorkType";
import { Work, WorkType } from "./Work"; import { Work, WorkType } from "./Work";
import { newWorkStats, scaleWorkStats, WorkStats } from "./WorkStats"; import { newWorkStats, scaleWorkStats, WorkStats } from "./WorkStats";
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
enum newCrimeType { enum newCrimeType {
SHOPLIFT = "SHOPLIFT", SHOPLIFT = "SHOPLIFT",
@ -90,7 +91,8 @@ export class CrimeWork extends Work {
earnings(): WorkStats { earnings(): WorkStats {
const crime = this.getCrime(); const crime = this.getCrime();
return newWorkStats({ const gains = scaleWorkStats(
newWorkStats({
money: crime.money, money: crime.money,
hackExp: crime.hacking_exp * 2, hackExp: crime.hacking_exp * 2,
strExp: crime.strength_exp * 2, strExp: crime.strength_exp * 2,
@ -99,7 +101,12 @@ export class CrimeWork extends Work {
agiExp: crime.agility_exp * 2, agiExp: crime.agility_exp * 2,
chaExp: crime.charisma_exp * 2, chaExp: crime.charisma_exp * 2,
intExp: crime.intelligence_exp * 2, intExp: crime.intelligence_exp * 2,
}); }),
BitNodeMultipliers.CrimeExpGain,
false,
);
gains.money *= BitNodeMultipliers.CrimeMoney;
return gains;
} }
commit(player: IPlayer): void { commit(player: IPlayer): void {
@ -113,7 +120,7 @@ export class CrimeWork extends Work {
const focusPenalty = player.focusPenalty(); const focusPenalty = player.focusPenalty();
// exp times 2 because were trying to maintain the same numbers as before the conversion // exp times 2 because were trying to maintain the same numbers as before the conversion
// Technically the definition of Crimes should have the success numbers and failure should divide by 4 // Technically the definition of Crimes should have the success numbers and failure should divide by 4
let gains = scaleWorkStats(this.earnings(), focusPenalty); let gains = scaleWorkStats(this.earnings(), focusPenalty, false);
let karma = crime.karma; let karma = crime.karma;
const success = determineCrimeSuccess(player, crime.type); const success = determineCrimeSuccess(player, crime.type);
if (success) { if (success) {