mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
hotfix broken spring water
This commit is contained in:
parent
db26d054fc
commit
e03a366f12
@ -423,19 +423,18 @@ export class Division {
|
|||||||
|
|
||||||
// Make our materials if they are producable
|
// Make our materials if they are producable
|
||||||
if (producableFrac > 0 && prod > 0) {
|
if (producableFrac > 0 && prod > 0) {
|
||||||
|
const requiredMatsEntries = getRecordEntries(this.requiredMaterials);
|
||||||
let avgQlt = 0;
|
let avgQlt = 0;
|
||||||
let divider = 0;
|
let divider = requiredMatsEntries.length;
|
||||||
for (const [reqMatName, reqMat] of getRecordEntries(this.requiredMaterials)) {
|
for (const [reqMatName, reqMat] of requiredMatsEntries) {
|
||||||
const reqMatQtyNeeded = reqMat * prod * producableFrac;
|
const reqMatQtyNeeded = reqMat * prod * producableFrac;
|
||||||
warehouse.materials[reqMatName].stored -= reqMatQtyNeeded;
|
warehouse.materials[reqMatName].stored -= reqMatQtyNeeded;
|
||||||
warehouse.materials[reqMatName].productionAmount = 0;
|
warehouse.materials[reqMatName].productionAmount = 0;
|
||||||
warehouse.materials[reqMatName].productionAmount -=
|
warehouse.materials[reqMatName].productionAmount -=
|
||||||
reqMatQtyNeeded / (corpConstants.secondsPerMarketCycle * marketCycles);
|
reqMatQtyNeeded / (corpConstants.secondsPerMarketCycle * marketCycles);
|
||||||
|
|
||||||
avgQlt += warehouse.materials[reqMatName].quality;
|
avgQlt += warehouse.materials[reqMatName].quality / divider;
|
||||||
divider++;
|
|
||||||
}
|
}
|
||||||
avgQlt /= divider;
|
|
||||||
avgQlt = Math.max(avgQlt, 1);
|
avgQlt = Math.max(avgQlt, 1);
|
||||||
for (let j = 0; j < this.producedMaterials.length; ++j) {
|
for (let j = 0; j < this.producedMaterials.length; ++j) {
|
||||||
let tempQlt =
|
let tempQlt =
|
||||||
|
@ -31,7 +31,7 @@ export const IndustriesData: Record<IndustryType, CorpIndustryData> = {
|
|||||||
aiCoreFactor: 0.1,
|
aiCoreFactor: 0.1,
|
||||||
advertisingFactor: 0.03,
|
advertisingFactor: 0.03,
|
||||||
requiredMaterials: {},
|
requiredMaterials: {},
|
||||||
producedMaterials: ["Plants", "Food"],
|
producedMaterials: ["Water"],
|
||||||
},
|
},
|
||||||
[IndustryType.Refinery]: {
|
[IndustryType.Refinery]: {
|
||||||
startingCost: 50e9,
|
startingCost: 50e9,
|
||||||
|
@ -131,11 +131,9 @@ export class Material {
|
|||||||
|
|
||||||
// Initializes a Material object from a JSON save state.
|
// Initializes a Material object from a JSON save state.
|
||||||
static fromJSON(value: IReviverValue): Material {
|
static fromJSON(value: IReviverValue): Material {
|
||||||
// Gracefully load save files from when Scientific Research was considered a Material (pre 2.2).
|
const material = Generic_fromJSON(Material, value.data);
|
||||||
if (value.data.name === "Scientific Research") return value.data.qty;
|
if (isNaN(material.quality)) material.quality = 1;
|
||||||
if (value.data.name === "RealEstate") value.data.name = "Real Estate";
|
return material;
|
||||||
if (value.data.name === "AICores") value.data.name = "AI Cores";
|
|
||||||
return Generic_fromJSON(Material, value.data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,8 +133,8 @@ export class Product {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @param industry - Industry object. Reference to industry that makes this Product
|
// @param division - Division object. Reference to division that makes this Product
|
||||||
finishProduct(industry: Division): void {
|
finishProduct(division: Division): void {
|
||||||
this.finished = true;
|
this.finished = true;
|
||||||
|
|
||||||
// Calculate properties
|
// Calculate properties
|
||||||
@ -147,7 +147,7 @@ export class Product {
|
|||||||
|
|
||||||
const designMult = 1 + Math.pow(this.designInvestment, 0.1) / 100;
|
const designMult = 1 + Math.pow(this.designInvestment, 0.1) / 100;
|
||||||
const balanceMult = 1.2 * engrRatio + 0.9 * mgmtRatio + 1.3 * rndRatio + 1.5 * opsRatio + busRatio;
|
const balanceMult = 1.2 * engrRatio + 0.9 * mgmtRatio + 1.3 * rndRatio + 1.5 * opsRatio + busRatio;
|
||||||
const sciMult = 1 + Math.pow(industry.researchPoints, industry.researchFactor) / 800;
|
const sciMult = 1 + Math.pow(division.researchPoints, division.researchFactor) / 800;
|
||||||
const totalMult = balanceMult * designMult * sciMult;
|
const totalMult = balanceMult * designMult * sciMult;
|
||||||
|
|
||||||
this.stats.quality =
|
this.stats.quality =
|
||||||
@ -192,7 +192,7 @@ export class Product {
|
|||||||
0.02 * this.creationJobFactors[CorpEmployeeJob.RandD] +
|
0.02 * this.creationJobFactors[CorpEmployeeJob.RandD] +
|
||||||
0.05 * this.creationJobFactors[CorpEmployeeJob.Operations] +
|
0.05 * this.creationJobFactors[CorpEmployeeJob.Operations] +
|
||||||
0.05 * this.creationJobFactors[CorpEmployeeJob.Business]);
|
0.05 * this.creationJobFactors[CorpEmployeeJob.Business]);
|
||||||
this.calculateRating(industry);
|
this.calculateRating(division);
|
||||||
const advMult = 1 + Math.pow(this.advertisingInvestment, 0.1) / 100;
|
const advMult = 1 + Math.pow(this.advertisingInvestment, 0.1) / 100;
|
||||||
const busmgtgRatio = Math.max(busRatio + mgmtRatio, 1 / totalProd);
|
const busmgtgRatio = Math.max(busRatio + mgmtRatio, 1 / totalProd);
|
||||||
this.markup = 100 / (advMult * Math.pow(this.stats.quality + 0.001, 0.65) * busmgtgRatio);
|
this.markup = 100 / (advMult * Math.pow(this.stats.quality + 0.001, 0.65) * busmgtgRatio);
|
||||||
@ -202,12 +202,12 @@ export class Product {
|
|||||||
if (this.markup === 0 || !isFinite(this.markup)) this.markup = 1;
|
if (this.markup === 0 || !isFinite(this.markup)) this.markup = 1;
|
||||||
|
|
||||||
this.demand =
|
this.demand =
|
||||||
industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));
|
division.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (division.popularity / division.awareness)));
|
||||||
this.competition = getRandomInt(0, 70);
|
this.competition = getRandomInt(0, 70);
|
||||||
|
|
||||||
//Calculate the product's required materials and size
|
//Calculate the product's required materials and size
|
||||||
this.size = 0;
|
this.size = 0;
|
||||||
for (const [matName, reqQty] of getRecordEntries(industry.requiredMaterials)) {
|
for (const [matName, reqQty] of getRecordEntries(division.requiredMaterials)) {
|
||||||
this.requiredMaterials[matName] = reqQty;
|
this.requiredMaterials[matName] = reqQty;
|
||||||
this.size += MaterialInfo[matName].size * reqQty;
|
this.size += MaterialInfo[matName].size * reqQty;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Division } from "../Division";
|
import { Division } from "../Division";
|
||||||
import { MathJax } from "better-react-mathjax";
|
import { MathJax } from "better-react-mathjax";
|
||||||
import { CorpMaterialName } from "@nsdefs";
|
import { getRecordEntries } from "../../Types/Record";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
division: Division;
|
division: Division;
|
||||||
@ -9,9 +9,8 @@ interface IProps {
|
|||||||
|
|
||||||
export function IndustryProductEquation(props: IProps): React.ReactElement {
|
export function IndustryProductEquation(props: IProps): React.ReactElement {
|
||||||
const reqs = [];
|
const reqs = [];
|
||||||
for (const reqMat of Object.keys(props.division.requiredMaterials) as CorpMaterialName[]) {
|
for (const [reqMat, reqAmt] of getRecordEntries(props.division.requiredMaterials)) {
|
||||||
const reqAmt = props.division.requiredMaterials[reqMat];
|
if (!reqAmt) continue;
|
||||||
if (reqAmt === undefined) continue;
|
|
||||||
reqs.push(String.raw`${reqAmt}\text{ }${reqMat}`);
|
reqs.push(String.raw`${reqAmt}\text{ }${reqMat}`);
|
||||||
}
|
}
|
||||||
const prod = props.division.producedMaterials.map((p) => `1\\text{ }${p}`);
|
const prod = props.division.producedMaterials.map((p) => `1\\text{ }${p}`);
|
||||||
|
@ -23,6 +23,7 @@ import Box from "@mui/material/Box";
|
|||||||
import { LimitMaterialProductionModal } from "./modals/LimitMaterialProductionModal";
|
import { LimitMaterialProductionModal } from "./modals/LimitMaterialProductionModal";
|
||||||
import { CityName } from "../../Enums";
|
import { CityName } from "../../Enums";
|
||||||
import { CorpUnlockName } from "../data/Enums";
|
import { CorpUnlockName } from "../data/Enums";
|
||||||
|
import { getRecordKeys } from "../../Types/Record";
|
||||||
|
|
||||||
interface IMaterialProps {
|
interface IMaterialProps {
|
||||||
warehouse: Warehouse;
|
warehouse: Warehouse;
|
||||||
@ -57,10 +58,7 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement {
|
|||||||
// Flag that determines whether this industry is "new" and the current material should be
|
// Flag that determines whether this industry is "new" and the current material should be
|
||||||
// marked with flashing-red lights
|
// marked with flashing-red lights
|
||||||
const tutorial =
|
const tutorial =
|
||||||
division.newInd &&
|
division.newInd && mat.name in division.requiredMaterials && mat.buyAmount === 0 && mat.importAmount === 0;
|
||||||
Object.keys(division.requiredMaterials).includes(mat.name) &&
|
|
||||||
mat.buyAmount === 0 &&
|
|
||||||
mat.importAmount === 0;
|
|
||||||
|
|
||||||
// Purchase material button
|
// Purchase material button
|
||||||
const purchaseButtonText = `Buy (${formatBigNumber(mat.buyAmount)})`;
|
const purchaseButtonText = `Buy (${formatBigNumber(mat.buyAmount)})`;
|
||||||
|
@ -9,8 +9,8 @@ import Typography from "@mui/material/Typography";
|
|||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import Switch from "@mui/material/Switch";
|
import Switch from "@mui/material/Switch";
|
||||||
import { CorpMaterialName } from "@nsdefs";
|
import { CorpMaterialName } from "@nsdefs";
|
||||||
import { materialNames } from "../../data/Constants";
|
|
||||||
import { useRerender } from "../../../ui/React/hooks";
|
import { useRerender } from "../../../ui/React/hooks";
|
||||||
|
import { getRecordKeys } from "../../../Types/Record";
|
||||||
|
|
||||||
interface ISSoptionProps {
|
interface ISSoptionProps {
|
||||||
matName: CorpMaterialName;
|
matName: CorpMaterialName;
|
||||||
@ -80,9 +80,8 @@ export function SmartSupplyModal(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
// Create React components for materials
|
// Create React components for materials
|
||||||
const mats = [];
|
const mats = [];
|
||||||
for (const matName of Object.values(materialNames)) {
|
for (const matName of getRecordKeys(division.requiredMaterials)) {
|
||||||
if (!props.warehouse.materials[matName]) continue;
|
if (!props.warehouse.materials[matName]) continue;
|
||||||
if (!Object.keys(division.requiredMaterials).includes(matName)) continue;
|
|
||||||
mats.push(<SSoption key={matName} warehouse={props.warehouse} matName={matName} />);
|
mats.push(<SSoption key={matName} warehouse={props.warehouse} matName={matName} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user