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
|
||||
if (producableFrac > 0 && prod > 0) {
|
||||
const requiredMatsEntries = getRecordEntries(this.requiredMaterials);
|
||||
let avgQlt = 0;
|
||||
let divider = 0;
|
||||
for (const [reqMatName, reqMat] of getRecordEntries(this.requiredMaterials)) {
|
||||
let divider = requiredMatsEntries.length;
|
||||
for (const [reqMatName, reqMat] of requiredMatsEntries) {
|
||||
const reqMatQtyNeeded = reqMat * prod * producableFrac;
|
||||
warehouse.materials[reqMatName].stored -= reqMatQtyNeeded;
|
||||
warehouse.materials[reqMatName].productionAmount = 0;
|
||||
warehouse.materials[reqMatName].productionAmount -=
|
||||
reqMatQtyNeeded / (corpConstants.secondsPerMarketCycle * marketCycles);
|
||||
|
||||
avgQlt += warehouse.materials[reqMatName].quality;
|
||||
divider++;
|
||||
avgQlt += warehouse.materials[reqMatName].quality / divider;
|
||||
}
|
||||
avgQlt /= divider;
|
||||
avgQlt = Math.max(avgQlt, 1);
|
||||
for (let j = 0; j < this.producedMaterials.length; ++j) {
|
||||
let tempQlt =
|
||||
|
@ -31,7 +31,7 @@ export const IndustriesData: Record<IndustryType, CorpIndustryData> = {
|
||||
aiCoreFactor: 0.1,
|
||||
advertisingFactor: 0.03,
|
||||
requiredMaterials: {},
|
||||
producedMaterials: ["Plants", "Food"],
|
||||
producedMaterials: ["Water"],
|
||||
},
|
||||
[IndustryType.Refinery]: {
|
||||
startingCost: 50e9,
|
||||
|
@ -131,11 +131,9 @@ export class Material {
|
||||
|
||||
// Initializes a Material object from a JSON save state.
|
||||
static fromJSON(value: IReviverValue): Material {
|
||||
// Gracefully load save files from when Scientific Research was considered a Material (pre 2.2).
|
||||
if (value.data.name === "Scientific Research") return value.data.qty;
|
||||
if (value.data.name === "RealEstate") value.data.name = "Real Estate";
|
||||
if (value.data.name === "AICores") value.data.name = "AI Cores";
|
||||
return Generic_fromJSON(Material, value.data);
|
||||
const material = Generic_fromJSON(Material, value.data);
|
||||
if (isNaN(material.quality)) material.quality = 1;
|
||||
return material;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,8 +133,8 @@ export class Product {
|
||||
}
|
||||
}
|
||||
|
||||
// @param industry - Industry object. Reference to industry that makes this Product
|
||||
finishProduct(industry: Division): void {
|
||||
// @param division - Division object. Reference to division that makes this Product
|
||||
finishProduct(division: Division): void {
|
||||
this.finished = true;
|
||||
|
||||
// Calculate properties
|
||||
@ -147,7 +147,7 @@ export class Product {
|
||||
|
||||
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 sciMult = 1 + Math.pow(industry.researchPoints, industry.researchFactor) / 800;
|
||||
const sciMult = 1 + Math.pow(division.researchPoints, division.researchFactor) / 800;
|
||||
const totalMult = balanceMult * designMult * sciMult;
|
||||
|
||||
this.stats.quality =
|
||||
@ -192,7 +192,7 @@ export class Product {
|
||||
0.02 * this.creationJobFactors[CorpEmployeeJob.RandD] +
|
||||
0.05 * this.creationJobFactors[CorpEmployeeJob.Operations] +
|
||||
0.05 * this.creationJobFactors[CorpEmployeeJob.Business]);
|
||||
this.calculateRating(industry);
|
||||
this.calculateRating(division);
|
||||
const advMult = 1 + Math.pow(this.advertisingInvestment, 0.1) / 100;
|
||||
const busmgtgRatio = Math.max(busRatio + mgmtRatio, 1 / totalProd);
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
//Calculate the product's required materials and size
|
||||
this.size = 0;
|
||||
for (const [matName, reqQty] of getRecordEntries(industry.requiredMaterials)) {
|
||||
for (const [matName, reqQty] of getRecordEntries(division.requiredMaterials)) {
|
||||
this.requiredMaterials[matName] = reqQty;
|
||||
this.size += MaterialInfo[matName].size * reqQty;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import { Division } from "../Division";
|
||||
import { MathJax } from "better-react-mathjax";
|
||||
import { CorpMaterialName } from "@nsdefs";
|
||||
import { getRecordEntries } from "../../Types/Record";
|
||||
|
||||
interface IProps {
|
||||
division: Division;
|
||||
@ -9,9 +9,8 @@ interface IProps {
|
||||
|
||||
export function IndustryProductEquation(props: IProps): React.ReactElement {
|
||||
const reqs = [];
|
||||
for (const reqMat of Object.keys(props.division.requiredMaterials) as CorpMaterialName[]) {
|
||||
const reqAmt = props.division.requiredMaterials[reqMat];
|
||||
if (reqAmt === undefined) continue;
|
||||
for (const [reqMat, reqAmt] of getRecordEntries(props.division.requiredMaterials)) {
|
||||
if (!reqAmt) continue;
|
||||
reqs.push(String.raw`${reqAmt}\text{ }${reqMat}`);
|
||||
}
|
||||
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 { CityName } from "../../Enums";
|
||||
import { CorpUnlockName } from "../data/Enums";
|
||||
import { getRecordKeys } from "../../Types/Record";
|
||||
|
||||
interface IMaterialProps {
|
||||
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
|
||||
// marked with flashing-red lights
|
||||
const tutorial =
|
||||
division.newInd &&
|
||||
Object.keys(division.requiredMaterials).includes(mat.name) &&
|
||||
mat.buyAmount === 0 &&
|
||||
mat.importAmount === 0;
|
||||
division.newInd && mat.name in division.requiredMaterials && mat.buyAmount === 0 && mat.importAmount === 0;
|
||||
|
||||
// Purchase material button
|
||||
const purchaseButtonText = `Buy (${formatBigNumber(mat.buyAmount)})`;
|
||||
|
@ -9,8 +9,8 @@ import Typography from "@mui/material/Typography";
|
||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||
import Switch from "@mui/material/Switch";
|
||||
import { CorpMaterialName } from "@nsdefs";
|
||||
import { materialNames } from "../../data/Constants";
|
||||
import { useRerender } from "../../../ui/React/hooks";
|
||||
import { getRecordKeys } from "../../../Types/Record";
|
||||
|
||||
interface ISSoptionProps {
|
||||
matName: CorpMaterialName;
|
||||
@ -80,9 +80,8 @@ export function SmartSupplyModal(props: IProps): React.ReactElement {
|
||||
|
||||
// Create React components for materials
|
||||
const mats = [];
|
||||
for (const matName of Object.values(materialNames)) {
|
||||
for (const matName of getRecordKeys(division.requiredMaterials)) {
|
||||
if (!props.warehouse.materials[matName]) continue;
|
||||
if (!Object.keys(division.requiredMaterials).includes(matName)) continue;
|
||||
mats.push(<SSoption key={matName} warehouse={props.warehouse} matName={matName} />);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user