Merge branch 'dev' into FIX#3366

This commit is contained in:
hydroflame
2022-07-21 16:17:08 -04:00
committed by GitHub
365 changed files with 11259 additions and 11460 deletions
+48 -49
View File
@@ -28,15 +28,15 @@ import { CONSTANTS } from "../../Constants";
import { Faction } from "../../Faction/Faction";
import { Factions } from "../../Faction/Factions";
import { FactionWorkType } from "../../Faction/FactionWorkTypeEnum";
import { CityName } from "../../Locations/data/CityNames";
import { LocationName } from "../../Locations/data/LocationNames";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviver";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../utils/JSONReviver";
import { BladeburnerConstants } from "../../Bladeburner/data/Constants";
import { numeralWrapper } from "../../ui/numeralFormat";
import { capitalizeFirstLetter, capitalizeEachWord } from "../../utils/StringHelperFunctions";
import { FactionWorkType } from "../../Work/data/FactionWorkType";
export class Sleeve extends Person {
/**
@@ -94,7 +94,7 @@ export class Sleeve extends Person {
/**
* Keeps track of what type of work sleeve is doing for faction, if applicable
*/
factionWorkType: FactionWorkType = FactionWorkType.None;
factionWorkType: FactionWorkType = FactionWorkType.HACKING;
/**
* Records experience gain rate for the current task
@@ -169,14 +169,14 @@ export class Sleeve extends Person {
this.resetTaskStatus(p);
}
this.gainRatesForTask.hack = crime.hacking_exp * this.hacking_exp_mult * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.str = crime.strength_exp * this.strength_exp_mult * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.def = crime.defense_exp * this.defense_exp_mult * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.dex = crime.dexterity_exp * this.dexterity_exp_mult * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.agi = crime.agility_exp * this.agility_exp_mult * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.cha = crime.charisma_exp * this.charisma_exp_mult * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.hack = crime.hacking_exp * this.mults.hacking_exp * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.str = crime.strength_exp * this.mults.strength_exp * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.def = crime.defense_exp * this.mults.defense_exp * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.dex = crime.dexterity_exp * this.mults.dexterity_exp * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.agi = crime.agility_exp * this.mults.agility_exp * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.cha = crime.charisma_exp * this.mults.charisma_exp * BitNodeMultipliers.CrimeExpGain;
this.gainRatesForTask.int = crime.intelligence_exp;
this.gainRatesForTask.money = crime.money * this.crime_money_mult * BitNodeMultipliers.CrimeMoney;
this.gainRatesForTask.money = crime.money * this.mults.crime_money * BitNodeMultipliers.CrimeMoney;
this.currentTaskLocation = String(this.gainRatesForTask.money);
@@ -444,11 +444,11 @@ export class Sleeve extends Person {
}
switch (this.factionWorkType) {
case FactionWorkType.Hacking:
case FactionWorkType.HACKING:
return this.getFactionHackingWorkRepGain() * (this.shock / 100) * favorMult;
case FactionWorkType.Field:
case FactionWorkType.FIELD:
return this.getFactionFieldWorkRepGain() * (this.shock / 100) * favorMult;
case FactionWorkType.Security:
case FactionWorkType.SECURITY:
return this.getFactionSecurityWorkRepGain() * (this.shock / 100) * favorMult;
default:
console.warn(`Invalid Sleeve.factionWorkType property in Sleeve.getRepGain(): ${this.factionWorkType}`);
@@ -478,7 +478,7 @@ export class Sleeve extends Person {
);
const favorMult = 1 + company.favor / 100;
return jobPerformance * this.company_rep_mult * favorMult;
return jobPerformance * this.mults.company_rep * favorMult;
} else {
return 0;
}
@@ -660,7 +660,7 @@ export class Sleeve extends Person {
this.currentTask = SleeveTaskType.Idle;
this.currentTaskTime = 0;
this.currentTaskMaxTime = 0;
this.factionWorkType = FactionWorkType.None;
this.factionWorkType = FactionWorkType.HACKING;
this.crimeType = "";
this.currentTaskLocation = "";
this.gymStatType = "";
@@ -804,22 +804,22 @@ export class Sleeve extends Person {
switch (this.className.toLowerCase()) {
case "study computer science":
this.gainRatesForTask.hack =
CONSTANTS.ClassStudyComputerScienceBaseExp * totalExpMult * this.hacking_exp_mult;
CONSTANTS.ClassStudyComputerScienceBaseExp * totalExpMult * this.mults.hacking_exp;
break;
case "data structures":
this.gainRatesForTask.hack = CONSTANTS.ClassDataStructuresBaseExp * totalExpMult * this.hacking_exp_mult;
this.gainRatesForTask.hack = CONSTANTS.ClassDataStructuresBaseExp * totalExpMult * this.mults.hacking_exp;
break;
case "networks":
this.gainRatesForTask.hack = CONSTANTS.ClassNetworksBaseExp * totalExpMult * this.hacking_exp_mult;
this.gainRatesForTask.hack = CONSTANTS.ClassNetworksBaseExp * totalExpMult * this.mults.hacking_exp;
break;
case "algorithms":
this.gainRatesForTask.hack = CONSTANTS.ClassAlgorithmsBaseExp * totalExpMult * this.hacking_exp_mult;
this.gainRatesForTask.hack = CONSTANTS.ClassAlgorithmsBaseExp * totalExpMult * this.mults.hacking_exp;
break;
case "management":
this.gainRatesForTask.cha = CONSTANTS.ClassManagementBaseExp * totalExpMult * this.charisma_exp_mult;
this.gainRatesForTask.cha = CONSTANTS.ClassManagementBaseExp * totalExpMult * this.mults.charisma_exp;
break;
case "leadership":
this.gainRatesForTask.cha = CONSTANTS.ClassLeadershipBaseExp * totalExpMult * this.charisma_exp_mult;
this.gainRatesForTask.cha = CONSTANTS.ClassLeadershipBaseExp * totalExpMult * this.mults.charisma_exp;
break;
default:
break;
@@ -911,37 +911,37 @@ export class Sleeve extends Person {
this.gainRatesForTask.money =
companyPosition.baseSalary *
company.salaryMultiplier *
this.work_money_mult *
this.mults.work_money *
BitNodeMultipliers.CompanyWorkMoney;
this.gainRatesForTask.hack =
companyPosition.hackingExpGain *
company.expMultiplier *
this.hacking_exp_mult *
this.mults.hacking_exp *
BitNodeMultipliers.CompanyWorkExpGain;
this.gainRatesForTask.str =
companyPosition.strengthExpGain *
company.expMultiplier *
this.strength_exp_mult *
this.mults.strength_exp *
BitNodeMultipliers.CompanyWorkExpGain;
this.gainRatesForTask.def =
companyPosition.defenseExpGain *
company.expMultiplier *
this.defense_exp_mult *
this.mults.defense_exp *
BitNodeMultipliers.CompanyWorkExpGain;
this.gainRatesForTask.dex =
companyPosition.dexterityExpGain *
company.expMultiplier *
this.dexterity_exp_mult *
this.mults.dexterity_exp *
BitNodeMultipliers.CompanyWorkExpGain;
this.gainRatesForTask.agi =
companyPosition.agilityExpGain *
company.expMultiplier *
this.agility_exp_mult *
this.mults.agility_exp *
BitNodeMultipliers.CompanyWorkExpGain;
this.gainRatesForTask.cha =
companyPosition.charismaExpGain *
company.expMultiplier *
this.charisma_exp_mult *
this.mults.charisma_exp *
BitNodeMultipliers.CompanyWorkExpGain;
this.currentTaskLocation = companyName;
@@ -974,29 +974,29 @@ export class Sleeve extends Person {
if (!factionInfo.offerHackingWork) {
return false;
}
this.factionWorkType = FactionWorkType.Hacking;
this.gainRatesForTask.hack = 0.15 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.factionWorkType = FactionWorkType.HACKING;
this.gainRatesForTask.hack = 0.15 * this.mults.hacking_exp * BitNodeMultipliers.FactionWorkExpGain;
} else if (sanitizedWorkType.includes("field")) {
if (!factionInfo.offerFieldWork) {
return false;
}
this.factionWorkType = FactionWorkType.Field;
this.gainRatesForTask.hack = 0.1 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.str = 0.1 * this.strength_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.def = 0.1 * this.defense_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.dex = 0.1 * this.dexterity_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.agi = 0.1 * this.agility_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.cha = 0.1 * this.charisma_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.factionWorkType = FactionWorkType.FIELD;
this.gainRatesForTask.hack = 0.1 * this.mults.hacking_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.str = 0.1 * this.mults.strength_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.def = 0.1 * this.mults.defense_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.dex = 0.1 * this.mults.dexterity_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.agi = 0.1 * this.mults.agility_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.cha = 0.1 * this.mults.charisma_exp * BitNodeMultipliers.FactionWorkExpGain;
} else if (sanitizedWorkType.includes("security")) {
if (!factionInfo.offerSecurityWork) {
return false;
}
this.factionWorkType = FactionWorkType.Security;
this.gainRatesForTask.hack = 0.1 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.str = 0.15 * this.strength_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.def = 0.15 * this.defense_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.dex = 0.15 * this.dexterity_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.agi = 0.15 * this.agility_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
this.factionWorkType = FactionWorkType.SECURITY;
this.gainRatesForTask.hack = 0.1 * this.mults.hacking_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.str = 0.15 * this.mults.strength_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.def = 0.15 * this.mults.defense_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.dex = 0.15 * this.mults.dexterity_exp * BitNodeMultipliers.FactionWorkExpGain;
this.gainRatesForTask.agi = 0.15 * this.mults.agility_exp * BitNodeMultipliers.FactionWorkExpGain;
} else {
return false;
}
@@ -1115,8 +1115,8 @@ export class Sleeve extends Person {
switch (action) {
case "Field analysis":
time = this.getBladeburnerActionTime(p, "General", action);
this.gainRatesForTask.hack = 20 * this.hacking_exp_mult;
this.gainRatesForTask.cha = 20 * this.charisma_exp_mult;
this.gainRatesForTask.hack = 20 * this.mults.hacking_exp;
this.gainRatesForTask.cha = 20 * this.mults.charisma_exp;
break;
case "Recruitment":
time = this.getBladeburnerActionTime(p, "General", action);
@@ -1234,7 +1234,7 @@ export class Sleeve extends Person {
this.hp -= amt;
if (this.hp <= 0) {
this.shock += 0.5;
this.shock = Math.min(1, this.shock - 0.5);
this.hp = this.max_hp;
return true;
} else {
@@ -1249,15 +1249,14 @@ export class Sleeve extends Person {
/**
* Serialize the current object to a JSON save state.
*/
toJSON(): any {
toJSON(): IReviverValue {
return Generic_toJSON("Sleeve", this);
}
/**
* Initiatizes a Sleeve object from a JSON save state.
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
static fromJSON(value: any): Sleeve {
static fromJSON(value: IReviverValue): Sleeve {
return Generic_fromJSON(Sleeve, value.data);
}
}
+1 -1
View File
@@ -104,7 +104,7 @@ export function FAQModal({ open, onClose }: IProps): React.ReactElement {
<Typography variant="h4">What is Memory?</Typography>
<br />
<Typography>
Sleeve memory dictates what a sleeve's synchronization will be when its reset by switching BitNodes. For
Sleeve memory dictates what a sleeve's synchronization will be when it's reset by switching BitNodes. For
example, if a sleeve has a memory of 25, then when you switch BitNodes its synchronization will initially be
set to 25, rather than 1.
</Typography>
+23 -17
View File
@@ -54,32 +54,38 @@ export function MoreStatsModal(props: IProps): React.ReactElement {
<br />
<StatsTable
rows={[
[<>Hacking Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.hacking_mult)],
[<>Hacking Experience multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.hacking_exp_mult)],
[<>Strength Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.strength_mult)],
[<>Strength Experience multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.strength_exp_mult)],
[<>Defense Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.defense_mult)],
[<>Defense Experience multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.defense_exp_mult)],
[<>Dexterity Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.dexterity_mult)],
[<>Hacking Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.hacking)],
[<>Hacking Experience multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.hacking_exp)],
[<>Strength Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.strength)],
[
<>Strength Experience multiplier:&nbsp;</>,
numeralWrapper.formatPercentage(props.sleeve.mults.strength_exp),
],
[<>Defense Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.defense)],
[<>Defense Experience multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.defense_exp)],
[<>Dexterity Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.dexterity)],
[
<>Dexterity Experience multiplier:&nbsp;</>,
numeralWrapper.formatPercentage(props.sleeve.dexterity_exp_mult),
numeralWrapper.formatPercentage(props.sleeve.mults.dexterity_exp),
],
[<>Agility Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.agility)],
[<>Agility Experience multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.agility_exp)],
[<>Charisma Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.charisma)],
[
<>Charisma Experience multiplier:&nbsp;</>,
numeralWrapper.formatPercentage(props.sleeve.mults.charisma_exp),
],
[<>Agility Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.agility_mult)],
[<>Agility Experience multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.agility_exp_mult)],
[<>Charisma Level multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.charisma_mult)],
[<>Charisma Experience multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.charisma_exp_mult)],
[
<>Faction Reputation Gain multiplier:&nbsp;</>,
numeralWrapper.formatPercentage(props.sleeve.faction_rep_mult),
numeralWrapper.formatPercentage(props.sleeve.mults.faction_rep),
],
[
<>Company Reputation Gain multiplier:&nbsp;</>,
numeralWrapper.formatPercentage(props.sleeve.company_rep_mult),
numeralWrapper.formatPercentage(props.sleeve.mults.company_rep),
],
[<>Salary multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.work_money_mult)],
[<>Crime Money multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.crime_money_mult)],
[<>Crime Success multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.crime_success_mult)],
[<>Salary multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.work_money)],
[<>Crime Money multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.crime_money)],
[<>Crime Success multiplier:&nbsp;</>, numeralWrapper.formatPercentage(props.sleeve.mults.crime_success)],
]}
title="Multipliers:"
/>
@@ -54,7 +54,7 @@ export function SleeveAugmentationsModal(props: IProps): React.ReactElement {
canPurchase={(player, aug) => {
return player.money > aug.baseCost;
}}
purchaseAugmentation={(player, aug, _showModal) => {
purchaseAugmentation={(player, aug) => {
props.sleeve.tryBuyAugmentation(player, aug);
rerender();
}}
+4 -4
View File
@@ -1,8 +1,8 @@
import { Box, Button, Paper, Tooltip, Typography } from "@mui/material";
import React, { useState } from "react";
import { FactionWorkType } from "../../../Work/data/FactionWorkType";
import { CONSTANTS } from "../../../Constants";
import { Crimes } from "../../../Crime/Crimes";
import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
import { use } from "../../../ui/Context";
import { numeralWrapper } from "../../../ui/numeralFormat";
import { ProgressBar } from "../../../ui/React/Progress";
@@ -75,13 +75,13 @@ export function SleeveElem(props: IProps): React.ReactElement {
case SleeveTaskType.Faction: {
let doing = "nothing";
switch (props.sleeve.factionWorkType) {
case FactionWorkType.Field:
case FactionWorkType.FIELD:
doing = "Field work";
break;
case FactionWorkType.Hacking:
case FactionWorkType.HACKING:
doing = "Hacking contracts";
break;
case FactionWorkType.Security:
case FactionWorkType.SECURITY:
doing = "Security work";
break;
}
+1 -1
View File
@@ -91,7 +91,7 @@ export function EarningsElement(props: IProps): React.ReactElement {
const classes = useStyles();
const player = use.Player();
let data: any[][] = [];
let data: (string | JSX.Element)[][] = [];
if (props.sleeve.currentTask === SleeveTaskType.Crime) {
data = [
[
+7 -12
View File
@@ -6,10 +6,10 @@ import { Crimes } from "../../../Crime/Crimes";
import { LocationName } from "../../../Locations/data/LocationNames";
import { CityName } from "../../../Locations/data/CityNames";
import { Factions } from "../../../Faction/Factions";
import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
import Select, { SelectChangeEvent } from "@mui/material/Select";
import MenuItem from "@mui/material/MenuItem";
import { FactionNames } from "../../../Faction/data/FactionNames";
import { FactionWorkType } from "../../../Work/data/FactionWorkType";
const universitySelectorOptions: string[] = [
"Study Computer Science",
@@ -44,7 +44,7 @@ interface ITaskDetails {
function possibleJobs(player: IPlayer, sleeve: Sleeve): string[] {
// Array of all companies that other sleeves are working at
const forbiddenCompanies = [];
const forbiddenCompanies: string[] = [];
for (const otherSleeve of player.sleeves) {
if (sleeve === otherSleeve) {
continue;
@@ -54,13 +54,8 @@ function possibleJobs(player: IPlayer, sleeve: Sleeve): string[] {
}
}
const allJobs: string[] = Object.keys(player.jobs);
for (let i = 0; i < allJobs.length; ++i) {
if (!forbiddenCompanies.includes(allJobs[i])) {
allJobs[i];
}
}
return allJobs;
return allJobs.filter((company) => !forbiddenCompanies.includes(company));
}
function possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {
@@ -240,7 +235,7 @@ const canDo: {
[CityName.Aevum, CityName.Sector12, CityName.Volhaven].includes(sleeve.city),
"Workout at Gym": (player: IPlayer, sleeve: Sleeve) =>
[CityName.Aevum, CityName.Sector12, CityName.Volhaven].includes(sleeve.city),
"Perform Bladeburner Actions": (player: IPlayer, _: Sleeve) => player.inBladeburner(),
"Perform Bladeburner Actions": (player: IPlayer) => player.inBladeburner(),
"Shock Recovery": (player: IPlayer, sleeve: Sleeve) => sleeve.shock < 100,
Synchronize: (player: IPlayer, sleeve: Sleeve) => sleeve.sync < 100,
};
@@ -254,13 +249,13 @@ function getABC(sleeve: Sleeve): [string, string, string] {
case SleeveTaskType.Faction: {
let workType = "";
switch (sleeve.factionWorkType) {
case FactionWorkType.Hacking:
case FactionWorkType.HACKING:
workType = "Hacking Contracts";
break;
case FactionWorkType.Field:
case FactionWorkType.FIELD:
workType = "Field Work";
break;
case FactionWorkType.Security:
case FactionWorkType.SECURITY:
workType = "Security Work";
break;
}