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 { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work";
import { applySleeveGains, Work, WorkType } from "./Work";
import { CONSTANTS } from "../../../Constants";
import { GeneralActions } from "../../../Bladeburner/data/GeneralActions";
import { applyWorkStatsExp, WorkStats } from "../../../Work/WorkStats";
@ -42,7 +42,7 @@ export class SleeveBladeburnerWork extends Work {
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}`);
applyWorkStatsExp(sleeve, exp, 1);
applySleeveGains(player, sleeve, exp, 1);
}
this.cyclesWorked -= this.cyclesNeeded(player, sleeve);
}

@ -1,6 +1,6 @@
import { IPlayer } from "../../IPlayer";
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 { LocationName } from "../../../Locations/data/LocationNames";
import { calculateClassEarnings } from "../../../Work/formulas/Class";
@ -39,11 +39,8 @@ export class SleeveClassWork extends Work {
}
process(player: IPlayer, sleeve: Sleeve, cycles: number): number {
let rate = this.calculateRates(player, sleeve);
applyWorkStatsExp(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));
const rate = this.calculateRates(player, sleeve);
applySleeveGains(player, sleeve, rate, cycles);
return 0;
}
APICopy(): Record<string, unknown> {

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

@ -1,11 +1,11 @@
import { IPlayer } from "../../IPlayer";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { Work, WorkType } from "./Work";
import { applySleeveGains, Work, WorkType } from "./Work";
import { CrimeType } from "../../../utils/WorkType";
import { Crimes } from "../../../Crime/Crimes";
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";
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;
const crime = this.getCrime();
const gains = this.getExp();
let gains = this.getExp();
if (this.cyclesWorked >= this.cyclesNeeded()) {
if (Math.random() < crime.successRate(sleeve)) {
applyWorkStats(player, sleeve, gains, 1, "sleeves");
player.karma -= crime.karma * sleeve.syncBonus();
} 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();
}
return 0;

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

@ -1,6 +1,15 @@
import { IPlayer } from "../../IPlayer";
import { IReviverValue } from "../../../utils/JSONReviver";
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 {
type: WorkType;

@ -8,6 +8,7 @@ import { dialogBoxCreate } from "../ui/React/DialogBox";
import { CrimeType } from "../utils/WorkType";
import { Work, WorkType } from "./Work";
import { newWorkStats, scaleWorkStats, WorkStats } from "./WorkStats";
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
enum newCrimeType {
SHOPLIFT = "SHOPLIFT",
@ -90,16 +91,22 @@ export class CrimeWork extends Work {
earnings(): WorkStats {
const crime = this.getCrime();
return newWorkStats({
money: crime.money,
hackExp: crime.hacking_exp * 2,
strExp: crime.strength_exp * 2,
defExp: crime.defense_exp * 2,
dexExp: crime.dexterity_exp * 2,
agiExp: crime.agility_exp * 2,
chaExp: crime.charisma_exp * 2,
intExp: crime.intelligence_exp * 2,
});
const gains = scaleWorkStats(
newWorkStats({
money: crime.money,
hackExp: crime.hacking_exp * 2,
strExp: crime.strength_exp * 2,
defExp: crime.defense_exp * 2,
dexExp: crime.dexterity_exp * 2,
agiExp: crime.agility_exp * 2,
chaExp: crime.charisma_exp * 2,
intExp: crime.intelligence_exp * 2,
}),
BitNodeMultipliers.CrimeExpGain,
false,
);
gains.money *= BitNodeMultipliers.CrimeMoney;
return gains;
}
commit(player: IPlayer): void {
@ -113,7 +120,7 @@ export class CrimeWork extends Work {
const focusPenalty = player.focusPenalty();
// 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
let gains = scaleWorkStats(this.earnings(), focusPenalty);
let gains = scaleWorkStats(this.earnings(), focusPenalty, false);
let karma = crime.karma;
const success = determineCrimeSuccess(player, crime.type);
if (success) {