mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-04 22:59:42 +02:00
commit1
This commit is contained in:
@@ -1,47 +1,47 @@
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
|
||||
import { IPlayer } from "../IPlayer";
|
||||
import { Player } from "../../Player";
|
||||
import { Multipliers } from "../Multipliers";
|
||||
|
||||
export const calculateEntropy = (player: IPlayer, stacks = 1): Multipliers => {
|
||||
export const calculateEntropy = (stacks = 1): Multipliers => {
|
||||
const nerf = CONSTANTS.EntropyEffect ** stacks;
|
||||
return {
|
||||
hacking_chance: player.mults.hacking_chance * nerf,
|
||||
hacking_speed: player.mults.hacking_speed * nerf,
|
||||
hacking_money: player.mults.hacking_money * nerf,
|
||||
hacking_grow: player.mults.hacking_grow * nerf,
|
||||
hacking_chance: Player.mults.hacking_chance * nerf,
|
||||
hacking_speed: Player.mults.hacking_speed * nerf,
|
||||
hacking_money: Player.mults.hacking_money * nerf,
|
||||
hacking_grow: Player.mults.hacking_grow * nerf,
|
||||
|
||||
hacking: player.mults.hacking * nerf,
|
||||
strength: player.mults.strength * nerf,
|
||||
defense: player.mults.defense * nerf,
|
||||
dexterity: player.mults.dexterity * nerf,
|
||||
agility: player.mults.agility * nerf,
|
||||
charisma: player.mults.charisma * nerf,
|
||||
hacking: Player.mults.hacking * nerf,
|
||||
strength: Player.mults.strength * nerf,
|
||||
defense: Player.mults.defense * nerf,
|
||||
dexterity: Player.mults.dexterity * nerf,
|
||||
agility: Player.mults.agility * nerf,
|
||||
charisma: Player.mults.charisma * nerf,
|
||||
|
||||
hacking_exp: player.mults.hacking_exp * nerf,
|
||||
strength_exp: player.mults.strength_exp * nerf,
|
||||
defense_exp: player.mults.defense_exp * nerf,
|
||||
dexterity_exp: player.mults.dexterity_exp * nerf,
|
||||
agility_exp: player.mults.agility_exp * nerf,
|
||||
charisma_exp: player.mults.charisma_exp * nerf,
|
||||
hacking_exp: Player.mults.hacking_exp * nerf,
|
||||
strength_exp: Player.mults.strength_exp * nerf,
|
||||
defense_exp: Player.mults.defense_exp * nerf,
|
||||
dexterity_exp: Player.mults.dexterity_exp * nerf,
|
||||
agility_exp: Player.mults.agility_exp * nerf,
|
||||
charisma_exp: Player.mults.charisma_exp * nerf,
|
||||
|
||||
company_rep: player.mults.company_rep * nerf,
|
||||
faction_rep: player.mults.faction_rep * nerf,
|
||||
company_rep: Player.mults.company_rep * nerf,
|
||||
faction_rep: Player.mults.faction_rep * nerf,
|
||||
|
||||
crime_money: player.mults.crime_money * nerf,
|
||||
crime_success: player.mults.crime_success * nerf,
|
||||
crime_money: Player.mults.crime_money * nerf,
|
||||
crime_success: Player.mults.crime_success * nerf,
|
||||
|
||||
hacknet_node_money: player.mults.hacknet_node_money * nerf,
|
||||
hacknet_node_purchase_cost: player.mults.hacknet_node_purchase_cost * nerf,
|
||||
hacknet_node_ram_cost: player.mults.hacknet_node_ram_cost * nerf,
|
||||
hacknet_node_core_cost: player.mults.hacknet_node_core_cost * nerf,
|
||||
hacknet_node_level_cost: player.mults.hacknet_node_level_cost * nerf,
|
||||
hacknet_node_money: Player.mults.hacknet_node_money * nerf,
|
||||
hacknet_node_purchase_cost: Player.mults.hacknet_node_purchase_cost * nerf,
|
||||
hacknet_node_ram_cost: Player.mults.hacknet_node_ram_cost * nerf,
|
||||
hacknet_node_core_cost: Player.mults.hacknet_node_core_cost * nerf,
|
||||
hacknet_node_level_cost: Player.mults.hacknet_node_level_cost * nerf,
|
||||
|
||||
work_money: player.mults.work_money * nerf,
|
||||
work_money: Player.mults.work_money * nerf,
|
||||
|
||||
bladeburner_max_stamina: player.mults.bladeburner_max_stamina * nerf,
|
||||
bladeburner_stamina_gain: player.mults.bladeburner_stamina_gain * nerf,
|
||||
bladeburner_analysis: player.mults.bladeburner_analysis * nerf,
|
||||
bladeburner_success_chance: player.mults.bladeburner_success_chance * nerf,
|
||||
bladeburner_max_stamina: Player.mults.bladeburner_max_stamina * nerf,
|
||||
bladeburner_stamina_gain: Player.mults.bladeburner_stamina_gain * nerf,
|
||||
bladeburner_analysis: Player.mults.bladeburner_analysis * nerf,
|
||||
bladeburner_success_chance: Player.mults.bladeburner_success_chance * nerf,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { StaticAugmentations } from "../../Augmentation/StaticAugmentations";
|
||||
import { GraftableAugmentation } from "./GraftableAugmentation";
|
||||
import { IPlayer } from "../IPlayer";
|
||||
import { Player } from "../../Player";
|
||||
|
||||
export const getGraftingAvailableAugs = (player: IPlayer): string[] => {
|
||||
export const getGraftingAvailableAugs = (): string[] => {
|
||||
const augs: string[] = [];
|
||||
|
||||
for (const [augName, aug] of Object.entries(StaticAugmentations)) {
|
||||
@@ -10,14 +10,14 @@ export const getGraftingAvailableAugs = (player: IPlayer): string[] => {
|
||||
augs.push(augName);
|
||||
}
|
||||
|
||||
return augs.filter((augmentation: string) => !player.hasAugmentation(augmentation));
|
||||
return augs.filter((augmentation: string) => !Player.hasAugmentation(augmentation));
|
||||
};
|
||||
|
||||
export const graftingIntBonus = (player: IPlayer): number => {
|
||||
return 1 + (player.getIntelligenceBonus(3) - 1) / 3;
|
||||
export const graftingIntBonus = (): number => {
|
||||
return 1 + (Player.getIntelligenceBonus(3) - 1) / 3;
|
||||
};
|
||||
|
||||
export const calculateGraftingTimeWithBonus = (player: IPlayer, aug: GraftableAugmentation): number => {
|
||||
export const calculateGraftingTimeWithBonus = (aug: GraftableAugmentation): number => {
|
||||
const baseTime = aug.time;
|
||||
return baseTime / graftingIntBonus(player);
|
||||
return baseTime / graftingIntBonus();
|
||||
};
|
||||
|
||||
@@ -11,11 +11,11 @@ import { LocationName } from "../../../Locations/data/LocationNames";
|
||||
import { Locations } from "../../../Locations/Locations";
|
||||
import { PurchaseAugmentationsOrderSetting } from "../../../Settings/SettingEnums";
|
||||
import { Settings } from "../../../Settings/Settings";
|
||||
import { use } from "../../../ui/Context";
|
||||
import { Router } from "../../../ui/GameRoot";
|
||||
import { ConfirmationModal } from "../../../ui/React/ConfirmationModal";
|
||||
import { Money } from "../../../ui/React/Money";
|
||||
import { convertTimeMsToTimeElapsedString, formatNumber } from "../../../utils/StringHelperFunctions";
|
||||
import { IPlayer } from "../../IPlayer";
|
||||
import { Player } from "../../../Player";
|
||||
import { GraftableAugmentation } from "../GraftableAugmentation";
|
||||
import { calculateGraftingTimeWithBonus, getGraftingAvailableAugs } from "../GraftingHelpers";
|
||||
|
||||
@@ -29,21 +29,19 @@ export const GraftableAugmentations = (): Record<string, GraftableAugmentation>
|
||||
return gAugs;
|
||||
};
|
||||
|
||||
const canGraft = (player: IPlayer, aug: GraftableAugmentation): boolean => {
|
||||
if (player.money < aug.cost) {
|
||||
const canGraft = (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;
|
||||
const aug = props.aug;
|
||||
|
||||
return (
|
||||
<Typography color={Settings.theme.money}>
|
||||
@@ -51,7 +49,7 @@ const AugPreReqsChecklist = (props: IProps): React.ReactElement => {
|
||||
<br />
|
||||
{aug.prereqs.map((preAug) => (
|
||||
<span style={{ display: "flex", alignItems: "center" }}>
|
||||
{player.hasAugmentation(preAug) ? <CheckBox sx={{ mr: 1 }} /> : <CheckBoxOutlineBlank sx={{ mr: 1 }} />}
|
||||
{Player.hasAugmentation(preAug) ? <CheckBox sx={{ mr: 1 }} /> : <CheckBoxOutlineBlank sx={{ mr: 1 }} />}
|
||||
{preAug}
|
||||
</span>
|
||||
))}
|
||||
@@ -60,12 +58,9 @@ const AugPreReqsChecklist = (props: IProps): React.ReactElement => {
|
||||
};
|
||||
|
||||
export const GraftingRoot = (): React.ReactElement => {
|
||||
const player = use.Player();
|
||||
const router = use.Router();
|
||||
|
||||
const graftableAugmentations = useState(GraftableAugmentations())[0];
|
||||
|
||||
const [selectedAug, setSelectedAug] = useState(getGraftingAvailableAugs(player)[0]);
|
||||
const [selectedAug, setSelectedAug] = useState(getGraftingAvailableAugs()[0]);
|
||||
const [graftOpen, setGraftOpen] = useState(false);
|
||||
const selectedAugmentation = StaticAugmentations[selectedAug];
|
||||
|
||||
@@ -75,7 +70,7 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
}
|
||||
|
||||
const getAugsSorted = (): string[] => {
|
||||
const augs = getGraftingAvailableAugs(player);
|
||||
const augs = getGraftingAvailableAugs();
|
||||
switch (Settings.PurchaseAugmentationsOrder) {
|
||||
case PurchaseAugmentationsOrderSetting.Cost:
|
||||
return augs.sort((a, b) => graftableAugmentations[a].cost - graftableAugmentations[b].cost);
|
||||
@@ -96,7 +91,7 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
|
||||
return (
|
||||
<Container disableGutters maxWidth="lg" sx={{ mx: 0 }}>
|
||||
<Button onClick={() => router.toLocation(Locations[LocationName.NewTokyoVitaLife])}>Back</Button>
|
||||
<Button onClick={() => Router.toLocation(Locations[LocationName.NewTokyoVitaLife])}>Back</Button>
|
||||
<Typography variant="h4">Grafting Laboratory</Typography>
|
||||
<Typography>
|
||||
You find yourself in a secret laboratory, owned by a mysterious researcher.
|
||||
@@ -122,14 +117,14 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
</Button>
|
||||
</Box>
|
||||
</Paper>
|
||||
{getGraftingAvailableAugs(player).length > 0 ? (
|
||||
{getGraftingAvailableAugs().length > 0 ? (
|
||||
<Paper sx={{ mb: 1, width: "fit-content", display: "grid", gridTemplateColumns: "1fr 3fr" }}>
|
||||
<List sx={{ height: 400, overflowY: "scroll", borderRight: `1px solid ${Settings.theme.welllight}` }}>
|
||||
{getAugsSorted().map((k, i) => (
|
||||
<ListItemButton key={i + 1} onClick={() => setSelectedAug(k)} selected={selectedAug === k}>
|
||||
<Typography
|
||||
sx={{
|
||||
color: canGraft(player, graftableAugmentations[k])
|
||||
color: canGraft(graftableAugmentations[k])
|
||||
? Settings.theme.primary
|
||||
: Settings.theme.disabled,
|
||||
}}
|
||||
@@ -146,11 +141,11 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
<Button
|
||||
onClick={() => setGraftOpen(true)}
|
||||
sx={{ width: "100%" }}
|
||||
disabled={!canGraft(player, graftableAugmentations[selectedAug])}
|
||||
disabled={!canGraft(graftableAugmentations[selectedAug])}
|
||||
>
|
||||
Graft Augmentation (
|
||||
<Typography>
|
||||
<Money money={graftableAugmentations[selectedAug].cost} player={player} />
|
||||
<Money money={graftableAugmentations[selectedAug].cost} forPurchase={true} />
|
||||
</Typography>
|
||||
)
|
||||
</Button>
|
||||
@@ -158,21 +153,20 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
open={graftOpen}
|
||||
onClose={() => setGraftOpen(false)}
|
||||
onConfirm={() => {
|
||||
player.startWork(
|
||||
Player.startWork(
|
||||
new GraftingWork({
|
||||
augmentation: selectedAug,
|
||||
singularity: false,
|
||||
player: player,
|
||||
}),
|
||||
);
|
||||
player.startFocusing();
|
||||
router.toWork();
|
||||
Player.startFocusing();
|
||||
Router.toWork();
|
||||
}}
|
||||
confirmationText={
|
||||
<>
|
||||
Cancelling grafting will <b>not</b> save grafting progress, and the money you spend will <b>not</b>{" "}
|
||||
be returned.
|
||||
{!player.hasAugmentation(AugmentationNames.CongruityImplant) && (
|
||||
{!Player.hasAugmentation(AugmentationNames.CongruityImplant) && (
|
||||
<>
|
||||
<br />
|
||||
<br />
|
||||
@@ -186,14 +180,12 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
<Typography color={Settings.theme.info}>
|
||||
<b>Time to Graft:</b>{" "}
|
||||
{convertTimeMsToTimeElapsedString(
|
||||
calculateGraftingTimeWithBonus(player, graftableAugmentations[selectedAug]),
|
||||
calculateGraftingTimeWithBonus(graftableAugmentations[selectedAug]),
|
||||
)}
|
||||
{/* Use formula so the displayed creation time is accurate to player bonus */}
|
||||
</Typography>
|
||||
|
||||
{selectedAugmentation.prereqs.length > 0 && (
|
||||
<AugPreReqsChecklist player={player} aug={selectedAugmentation} />
|
||||
)}
|
||||
{selectedAugmentation.prereqs.length > 0 && <AugPreReqsChecklist aug={selectedAugmentation} />}
|
||||
|
||||
<br />
|
||||
|
||||
@@ -229,10 +221,10 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
|
||||
<Paper sx={{ my: 1, p: 1, width: "fit-content" }}>
|
||||
<Typography>
|
||||
<b>Entropy strength:</b> {player.entropy}
|
||||
<b>Entropy strength:</b> {Player.entropy}
|
||||
<br />
|
||||
<b>All multipliers decreased by:</b>{" "}
|
||||
{formatNumber((1 - CONSTANTS.EntropyEffect ** player.entropy) * 100, 3)}% (multiplicative)
|
||||
{formatNumber((1 - CONSTANTS.EntropyEffect ** Player.entropy) * 100, 3)}% (multiplicative)
|
||||
</Typography>
|
||||
</Paper>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user