mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-27 08:27:32 +01:00
Implement entropy accumulation system
This commit is contained in:
parent
c33c23700e
commit
c92b159580
@ -111,6 +111,7 @@ export const CONSTANTS: {
|
||||
CodingContractBaseMoneyGain: number;
|
||||
AugmentationCraftingCostMult: number;
|
||||
AugmentationCraftingTimeMult: number;
|
||||
EntropyEffect: number;
|
||||
TotalNumBitNodes: number;
|
||||
LatestUpdate: string;
|
||||
} = {
|
||||
@ -276,7 +277,9 @@ export const CONSTANTS: {
|
||||
// Augmentation crafting multipliers
|
||||
// TODO: Get these right
|
||||
AugmentationCraftingCostMult: 1.2,
|
||||
AugmentationCraftingTimeMult: 1,
|
||||
AugmentationCraftingTimeMult: 0.01,
|
||||
|
||||
EntropyEffect: 0.99,
|
||||
|
||||
// BitNode/Source-File related stuff
|
||||
TotalNumBitNodes: 24,
|
||||
|
52
src/PersonObjects/Grafting/EntropyAccumulation.ts
Normal file
52
src/PersonObjects/Grafting/EntropyAccumulation.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import { IMap } from "../../types";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
|
||||
import { IPlayer } from "../IPlayer";
|
||||
|
||||
export const applyEntropy = (player: IPlayer, stacks = 1): IMap<number> => {
|
||||
const multipliers: IMap<number> = {
|
||||
hacking_chance_mult: player.hacking_chance_mult,
|
||||
hacking_speed_mult: player.hacking_speed_mult,
|
||||
hacking_money_mult: player.hacking_money_mult,
|
||||
hacking_grow_mult: player.hacking_grow_mult,
|
||||
|
||||
hacking_mult: player.hacking_mult,
|
||||
strength_mult: player.strength_mult,
|
||||
defense_mult: player.defense_mult,
|
||||
dexterity_mult: player.dexterity_mult,
|
||||
agility_mult: player.agility_mult,
|
||||
charisma_mult: player.charisma_mult,
|
||||
|
||||
hacking_exp_mult: player.hacking_exp_mult,
|
||||
strength_exp_mult: player.strength_exp_mult,
|
||||
defense_exp_mult: player.defense_exp_mult,
|
||||
dexterity_exp_mult: player.dexterity_exp_mult,
|
||||
agility_exp_mult: player.agility_exp_mult,
|
||||
charisma_exp_mult: player.charisma_exp_mult,
|
||||
|
||||
company_rep_mult: player.company_rep_mult,
|
||||
faction_rep_mult: player.faction_rep_mult,
|
||||
|
||||
crime_money_mult: player.crime_money_mult,
|
||||
crime_success_mult: player.crime_success_mult,
|
||||
|
||||
hacknet_node_money_mult: player.hacknet_node_money_mult,
|
||||
hacknet_node_purchase_cost_mult: player.hacknet_node_purchase_cost_mult,
|
||||
hacknet_node_ram_cost_mult: player.hacknet_node_ram_cost_mult,
|
||||
hacknet_node_core_cost_mult: player.hacknet_node_core_cost_mult,
|
||||
hacknet_node_level_cost_mult: player.hacknet_node_level_cost_mult,
|
||||
|
||||
work_money_mult: player.work_money_mult,
|
||||
|
||||
bladeburner_max_stamina_mult: player.bladeburner_max_stamina_mult,
|
||||
bladeburner_stamina_gain_mult: player.bladeburner_stamina_gain_mult,
|
||||
bladeburner_analysis_mult: player.bladeburner_analysis_mult,
|
||||
bladeburner_success_chance_mult: player.bladeburner_success_chance_mult,
|
||||
}
|
||||
|
||||
for (const [mult, val] of Object.entries(multipliers)) {
|
||||
multipliers[mult] = val * (CONSTANTS.EntropyEffect ** stacks);
|
||||
}
|
||||
|
||||
return multipliers;
|
||||
}
|
@ -127,9 +127,10 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
</Box>
|
||||
|
||||
<Box sx={{ my: 5 }}>
|
||||
<Typography variant="h5">name tbd</Typography>
|
||||
<Typography variant="h5">Entropy Accumulation</Typography>
|
||||
<Typography>
|
||||
probably some info about the cumulative negative effects here
|
||||
probably some info about the cumulative negative effects here<br />
|
||||
{player.entropyStacks} accumulated entropy
|
||||
</Typography>
|
||||
</Box>
|
||||
</Container>
|
||||
|
@ -160,6 +160,8 @@ export interface IPlayer {
|
||||
workChaExpGainRate: number;
|
||||
workMoneyLossRate: number;
|
||||
|
||||
entropyStacks: number;
|
||||
|
||||
// Methods
|
||||
work(numCycles: number): boolean;
|
||||
workPartTime(numCycles: number): boolean;
|
||||
@ -289,4 +291,5 @@ export interface IPlayer {
|
||||
startCraftAugmentationWork(augmentationName: string, time: number): void;
|
||||
craftAugmentationWork(numCycles: number): boolean;
|
||||
finishCraftAugmentationWork(cancelled: boolean): string;
|
||||
applyEntropy(stacks?: number): void;
|
||||
}
|
||||
|
@ -169,6 +169,8 @@ export class PlayerObject implements IPlayer {
|
||||
workChaExpGainRate: number;
|
||||
workMoneyLossRate: number;
|
||||
|
||||
entropyStacks: number;
|
||||
|
||||
// Methods
|
||||
work: (numCycles: number) => boolean;
|
||||
workPartTime: (numCycles: number) => boolean;
|
||||
@ -299,6 +301,7 @@ export class PlayerObject implements IPlayer {
|
||||
startCraftAugmentationWork: (augmentationName: string, time: number) => void;
|
||||
craftAugmentationWork: (numCycles: number) => boolean;
|
||||
finishCraftAugmentationWork: (cancelled: boolean) => string;
|
||||
applyEntropy: (stacks?: number) => void;
|
||||
|
||||
constructor() {
|
||||
//Skills and stats
|
||||
@ -467,6 +470,8 @@ export class PlayerObject implements IPlayer {
|
||||
//bitnode
|
||||
this.bitNodeN = 1;
|
||||
|
||||
this.entropyStacks = 0;
|
||||
|
||||
//Used to store the last update time.
|
||||
this.lastUpdate = 0;
|
||||
this.lastSave = 0;
|
||||
@ -619,6 +624,8 @@ export class PlayerObject implements IPlayer {
|
||||
|
||||
this.canAccessCotMG = generalMethods.canAccessCotMG;
|
||||
this.sourceFileLvl = generalMethods.sourceFileLvl;
|
||||
|
||||
this.applyEntropy = augmentationMethods.applyEntropy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,8 @@ import { IPlayer } from "../IPlayer";
|
||||
|
||||
import { Augmentation } from "../../Augmentation/Augmentation";
|
||||
|
||||
import { applyEntropy as calculateEntropy } from "../Grafting/EntropyAccumulation";
|
||||
|
||||
export function hasAugmentation(this: IPlayer, aug: string | Augmentation, installed = false): boolean {
|
||||
const augName: string = aug instanceof Augmentation ? aug.name : aug;
|
||||
|
||||
@ -24,3 +26,10 @@ export function hasAugmentation(this: IPlayer, aug: string | Augmentation, insta
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function applyEntropy(this: IPlayer, stacks = 1): void {
|
||||
const newMultipliers = calculateEntropy(this, stacks);
|
||||
for (const [mult, val] of Object.entries(newMultipliers)) {
|
||||
this.setMult(mult, val);
|
||||
}
|
||||
}
|
||||
|
@ -180,6 +180,7 @@ export function prestigeAugmentation(this: PlayerObject): void {
|
||||
}
|
||||
|
||||
export function prestigeSourceFile(this: IPlayer): void {
|
||||
this.entropyStacks = 0;
|
||||
this.prestigeAugmentation();
|
||||
this.karma = 0;
|
||||
// Duplicate sleeves are reset to level 1 every Bit Node (but the number of sleeves you have persists)
|
||||
@ -1373,6 +1374,8 @@ export function finishCraftAugmentationWork(this: IPlayer, cancelled: boolean):
|
||||
dialogBoxCreate(`You've finished crafting ${augName}.<br>The augmentation has been grafted to your body, but you feel a bit off.`)
|
||||
|
||||
applyAugmentation(Augmentations[augName]);
|
||||
this.entropyStacks += 1;
|
||||
this.applyEntropy();
|
||||
} else {
|
||||
dialogBoxCreate(`You cancelled the crafting of ${augName}.<br>Your money was not returned to you.`)
|
||||
}
|
||||
@ -1561,20 +1564,20 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
|
||||
if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) {
|
||||
ws.scriptRef.log(
|
||||
"SUCCESS: Crime successful! Gained " +
|
||||
numeralWrapper.formatMoney(this.workMoneyGained) +
|
||||
", " +
|
||||
numeralWrapper.formatExp(this.workHackExpGained) +
|
||||
" hack exp, " +
|
||||
numeralWrapper.formatExp(this.workStrExpGained) +
|
||||
" str exp, " +
|
||||
numeralWrapper.formatExp(this.workDefExpGained) +
|
||||
" def exp, " +
|
||||
numeralWrapper.formatExp(this.workDexExpGained) +
|
||||
" dex exp, " +
|
||||
numeralWrapper.formatExp(this.workAgiExpGained) +
|
||||
" agi exp, " +
|
||||
numeralWrapper.formatExp(this.workChaExpGained) +
|
||||
" cha exp.",
|
||||
numeralWrapper.formatMoney(this.workMoneyGained) +
|
||||
", " +
|
||||
numeralWrapper.formatExp(this.workHackExpGained) +
|
||||
" hack exp, " +
|
||||
numeralWrapper.formatExp(this.workStrExpGained) +
|
||||
" str exp, " +
|
||||
numeralWrapper.formatExp(this.workDefExpGained) +
|
||||
" def exp, " +
|
||||
numeralWrapper.formatExp(this.workDexExpGained) +
|
||||
" dex exp, " +
|
||||
numeralWrapper.formatExp(this.workAgiExpGained) +
|
||||
" agi exp, " +
|
||||
numeralWrapper.formatExp(this.workChaExpGained) +
|
||||
" cha exp.",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@ -1613,18 +1616,18 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
|
||||
if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) {
|
||||
ws.scriptRef.log(
|
||||
"FAIL: Crime failed! Gained " +
|
||||
numeralWrapper.formatExp(this.workHackExpGained) +
|
||||
" hack exp, " +
|
||||
numeralWrapper.formatExp(this.workStrExpGained) +
|
||||
" str exp, " +
|
||||
numeralWrapper.formatExp(this.workDefExpGained) +
|
||||
" def exp, " +
|
||||
numeralWrapper.formatExp(this.workDexExpGained) +
|
||||
" dex exp, " +
|
||||
numeralWrapper.formatExp(this.workAgiExpGained) +
|
||||
" agi exp, " +
|
||||
numeralWrapper.formatExp(this.workChaExpGained) +
|
||||
" cha exp.",
|
||||
numeralWrapper.formatExp(this.workHackExpGained) +
|
||||
" hack exp, " +
|
||||
numeralWrapper.formatExp(this.workStrExpGained) +
|
||||
" str exp, " +
|
||||
numeralWrapper.formatExp(this.workDefExpGained) +
|
||||
" def exp, " +
|
||||
numeralWrapper.formatExp(this.workDexExpGained) +
|
||||
" dex exp, " +
|
||||
numeralWrapper.formatExp(this.workAgiExpGained) +
|
||||
" agi exp, " +
|
||||
numeralWrapper.formatExp(this.workChaExpGained) +
|
||||
" cha exp.",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
@ -108,6 +108,9 @@ export function prestigeAugmentation(): void {
|
||||
// Messages
|
||||
initMessages();
|
||||
|
||||
// Apply entropy from grafting
|
||||
Player.applyEntropy(Player.entropyStacks);
|
||||
|
||||
// Gang
|
||||
const gang = Player.gang;
|
||||
if (Player.inGang() && gang !== null) {
|
||||
|
@ -259,6 +259,9 @@ const Engine: {
|
||||
initSymbolToStockMap();
|
||||
}
|
||||
|
||||
// Apply penalty for entropy accumulation
|
||||
Player.applyEntropy(Player.entropyStacks);
|
||||
|
||||
// Calculate the number of cycles have elapsed while offline
|
||||
Engine._lastUpdate = new Date().getTime();
|
||||
const lastUpdate = Player.lastUpdate;
|
||||
|
Loading…
Reference in New Issue
Block a user