Polish entropy

- Also adds DevMenu entry
This commit is contained in:
nickofolas 2022-03-19 13:59:34 -05:00
parent c92b159580
commit 4c422347d4
4 changed files with 81 additions and 9 deletions

@ -23,6 +23,7 @@ import { Sleeves } from "./DevMenu/ui/Sleeves";
import { Stanek } from "./DevMenu/ui/Stanek";
import { TimeSkip } from "./DevMenu/ui/TimeSkip";
import { Achievements } from "./DevMenu/ui/Achievements";
import { Entropy } from "./DevMenu/ui/Entropy";
import Typography from "@mui/material/Typography";
import { Exploit } from "./Exploits/Exploit";
@ -63,6 +64,7 @@ export function DevMenuRoot(props: IProps): React.ReactElement {
<TimeSkip player={props.player} engine={props.engine} />
<Achievements player={props.player} engine={props.engine} />
<Entropy player={props.player} engine={props.engine} />
</>
);
}

@ -0,0 +1,50 @@
import React from "react";
import Accordion from "@mui/material/Accordion";
import AccordionSummary from "@mui/material/AccordionSummary";
import AccordionDetails from "@mui/material/AccordionDetails";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import Typography from "@mui/material/Typography";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { Adjuster } from "./Adjuster";
import { IEngine } from "../../IEngine";
// Update as additional BitNodes get implemented
interface IProps {
player: IPlayer;
engine: IEngine;
}
export function Entropy(props: IProps): React.ReactElement {
return (
<Accordion TransitionProps={{ unmountOnExit: true }}>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<Typography>Entropy</Typography>
</AccordionSummary>
<AccordionDetails>
<Adjuster
label="Set entropy"
placeholder="entropy"
add={num => {
props.player.entropyStacks += num;
props.player.applyEntropy(props.player.entropyStacks);
}}
subtract={num => {
props.player.entropyStacks -= num;
props.player.applyEntropy(props.player.entropyStacks);
}}
tons={() => {
props.player.entropyStacks += 1e12;
props.player.applyEntropy(props.player.entropyStacks);
}}
reset={() => {
props.player.entropyStacks = 0;
props.player.applyEntropy(props.player.entropyStacks);
}}
/>
</AccordionDetails>
</Accordion>
);
}

@ -19,9 +19,13 @@ import { Augmentations } from "../../../Augmentation/Augmentations";
import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames"
import { Settings } from "../../../Settings/Settings";
import { IMap } from "../../../types";
import { convertTimeMsToTimeElapsedString } from "../../../utils/StringHelperFunctions";
import {
convertTimeMsToTimeElapsedString,
formatNumber
} from "../../../utils/StringHelperFunctions";
import { LocationName } from "../../../Locations/data/LocationNames";
import { Locations } from "../../../Locations/Locations";
import { CONSTANTS } from "../../../Constants";
import { IPlayer } from "../../IPlayer";
@ -73,12 +77,8 @@ export const GraftingRoot = (): React.ReactElement => {
Illum velit takimata et aliquyam takimata labore vel dolor dolores duo amet lorem elitr facer invidunt.
</Typography>
<Box sx={{ my: 5 }}>
<Box sx={{ my: 3 }}>
<Typography variant="h5">Craft Augmentations</Typography>
<Typography>
here goes a list with available augmentations with a purchase button (with price shown) to the side of it <br />
getAvailableAugs function to the rescue
</Typography>
<Paper sx={{ my: 1, width: 'fit-content', display: 'grid', gridTemplateColumns: '1fr 3fr' }}>
<List sx={{ maxHeight: 400, overflowY: 'scroll', borderRight: `1px solid ${Settings.theme.welllight}` }}>
{getAvailableAugs(player).map((k, i) => (
@ -126,12 +126,28 @@ export const GraftingRoot = (): React.ReactElement => {
</Paper>
</Box>
<Box sx={{ my: 5 }}>
<Box sx={{ my: 3 }}>
<Typography variant="h5">Entropy Accumulation</Typography>
<Paper sx={{ my: 1, p: 1, width: 'fit-content' }}>
<Typography>
<b>Accumulated Entropy:</b> {player.entropyStacks}
<br />
<b>All multipliers decreased by:</b> {formatNumber((1 - (CONSTANTS.EntropyEffect ** player.entropyStacks)) * 100, 3)}%
</Typography>
</Paper>
<Typography>
probably some info about the cumulative negative effects here<br />
{player.entropyStacks} accumulated entropy
Augmenting causes signficant physical and psychological changes to the affected
individual, and the best way for the body to deal with these effects is to undergo
a full shutdown process.
<br /><br />
Grafting Augmentations to a semi-conscious host is extremely experimental and dangerous.
<br /><br />
Scientists don't fully understand the consequences, but some have hypothesized that there's
a buildup of unknown irregularities that impair the user...
</Typography>
</Box>
</Container>
</>

@ -28,6 +28,10 @@ export function hasAugmentation(this: IPlayer, aug: string | Augmentation, insta
}
export function applyEntropy(this: IPlayer, stacks = 1): void {
// Re-apply all multipliers
this.reapplyAllAugmentations();
this.reapplyAllSourceFiles();
const newMultipliers = calculateEntropy(this, stacks);
for (const [mult, val] of Object.entries(newMultipliers)) {
this.setMult(mult, val);