import { Construction, CheckBox, CheckBoxOutlineBlank } from "@mui/icons-material"; import { Box, Button, Container, List, ListItemButton, Paper, Typography } from "@mui/material"; import React, { useState, useEffect } from "react"; import { Augmentation } from "../../../Augmentation/Augmentation"; import { StaticAugmentations } from "../../../Augmentation/StaticAugmentations"; import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames"; import { CONSTANTS } from "../../../Constants"; import { hasAugmentationPrereqs } from "../../../Faction/FactionHelpers"; import { LocationName } from "../../../Locations/data/LocationNames"; import { Locations } from "../../../Locations/Locations"; import { Settings } from "../../../Settings/Settings"; import { IMap } from "../../../types"; import { use } from "../../../ui/Context"; import { ConfirmationModal } from "../../../ui/React/ConfirmationModal"; import { Money } from "../../../ui/React/Money"; import { convertTimeMsToTimeElapsedString, formatNumber } from "../../../utils/StringHelperFunctions"; import { IPlayer } from "../../IPlayer"; import { getGraftingAvailableAugs, calculateGraftingTimeWithBonus } from "../GraftingHelpers"; import { GraftableAugmentation } from "../GraftableAugmentation"; const GraftableAugmentations: IMap = {}; const canGraft = (player: IPlayer, aug: GraftableAugmentation): boolean => { if (player.money < aug.cost) { return false; } return hasAugmentationPrereqs(aug.augmentation); }; interface IProps { player: IPlayer; aug: Augmentation; } const AugPreReqsChecklist = (props: IProps): React.ReactElement => { const aug = props.aug, player = props.player; return ( Pre-Requisites:
{aug.prereqs.map((preAug) => ( {player.hasAugmentation(preAug) ? : } {preAug} ))}
); }; export const GraftingRoot = (): React.ReactElement => { const player = use.Player(); const router = use.Router(); for (const aug of Object.values(StaticAugmentations)) { const name = aug.name; const graftableAug = new GraftableAugmentation(aug); GraftableAugmentations[name] = graftableAug; } const [selectedAug, setSelectedAug] = useState(getGraftingAvailableAugs(player)[0]); const [graftOpen, setGraftOpen] = useState(false); const selectedAugmentation = StaticAugmentations[selectedAug]; const setRerender = useState(false)[1]; function rerender(): void { setRerender((old) => !old); } useEffect(() => { const id = setInterval(rerender, 200); return () => clearInterval(id); }, []); return ( Grafting Laboratory You find yourself in a secret laboratory, owned by a mysterious researcher.
The scientist explains that they've been studying Augmentation grafting, the process of applying Augmentations without requiring a body reset.

Through legally questionable connections, the scientist has access to a vast array of Augmentation blueprints, even private designs. They offer to build and graft the Augmentations to you, in exchange for both a hefty sum of money, and being a lab rat.
Graft Augmentations {getGraftingAvailableAugs(player).length > 0 ? ( {getGraftingAvailableAugs(player).sort((a, b) => GraftableAugmentations[a].cost - GraftableAugmentations[b].cost).map((k, i) => ( setSelectedAug(k)} selected={selectedAug === k}> {k} ))} {selectedAug} setGraftOpen(false)} onConfirm={() => { const graftableAug = GraftableAugmentations[selectedAug]; player.loseMoney(graftableAug.cost, "augmentations"); player.startGraftAugmentationWork(selectedAug, graftableAug.time); player.startFocusing(); router.toWork(); }} confirmationText={ <> Cancelling grafting will not save grafting progress, and the money you spend will not{" "} be returned. {!player.hasAugmentation(AugmentationNames.CongruityImplant) && ( <>

Additionally, grafting an Augmentation will increase the potency of the Entropy virus. )} } /> Time to Graft:{" "} {convertTimeMsToTimeElapsedString( calculateGraftingTimeWithBonus(player, GraftableAugmentations[selectedAug]), )} {/* Use formula so the displayed creation time is accurate to player bonus */} {selectedAugmentation.prereqs.length > 0 && ( )}
{(() => { const info = typeof selectedAugmentation.info === "string" ? ( {selectedAugmentation.info} ) : ( selectedAugmentation.info ); const tooltip = ( <> {info}

{selectedAugmentation.stats} ); return tooltip; })()}
) : ( All Augmentations owned )}
Entropy Virus Entropy strength: {player.entropy}
All multipliers decreased by:{" "} {formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropy) * 100, 3)}% (multiplicative)
When installed on an unconscious individual, Augmentations are scanned by the body on awakening, eliminating hidden malware. However, grafted Augmentations do not provide this security measure.

Individuals who tested Augmentation grafting have reported symptoms of an unknown virus, which they've dubbed "Entropy". This virus seems to grow more potent with each grafted Augmentation...
); };