mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-03 14:27:03 +02:00
Formulas
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { sum } from "lodash";
|
||||
|
||||
import { Augmentation } from "../../Augmentation/Augmentation";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
|
||||
@@ -20,7 +22,10 @@ export class CraftableAugmentation {
|
||||
}
|
||||
|
||||
get time(): number {
|
||||
// CONSTANTS.AugmentationCraftingTimeMult
|
||||
return 15000;
|
||||
// Time = 1 hour * log_2(sum(aug multipliers) || 1) + 30 minutes
|
||||
const antiLog = Math.max(sum(Object.values(this.augmentation.mults)), 1);
|
||||
|
||||
const mult = Math.log2(antiLog);
|
||||
return CONSTANTS.AugmentationCraftingTimeBase * mult + CONSTANTS.MillisecondsPerHalfHour;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,11 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
}
|
||||
/>
|
||||
<Typography color={Settings.theme.info}>
|
||||
<b>Time to Craft:</b> {convertTimeMsToTimeElapsedString(CraftableAugmentations[selectedAug].time)}
|
||||
<b>Time to Craft:</b>{" "}
|
||||
{convertTimeMsToTimeElapsedString(
|
||||
CraftableAugmentations[selectedAug].time / (1 + (player.getIntelligenceBonus(3) - 1) / 3),
|
||||
)}
|
||||
{/* Use formula so the displayed creation time is accurate to player bonus */}
|
||||
</Typography>
|
||||
<Typography sx={{ maxHeight: 305, overflowY: "scroll" }}>
|
||||
{(() => {
|
||||
|
||||
@@ -1354,8 +1354,7 @@ export function craftAugmentationWork(this: IPlayer, numCycles: number): boolean
|
||||
focusBonus = this.focus ? 1 : CONSTANTS.BaseFocusBonus;
|
||||
}
|
||||
|
||||
// TODO: formula logic here (focus bonus and stuff)
|
||||
let skillMult = 1;
|
||||
let skillMult = 1 + (this.getIntelligenceBonus(3) - 1) / 3;
|
||||
skillMult *= focusBonus;
|
||||
|
||||
this.timeWorked += CONSTANTS._idleSpeed * numCycles;
|
||||
@@ -1380,7 +1379,11 @@ export function finishCraftAugmentationWork(this: IPlayer, cancelled: boolean):
|
||||
dialogBoxCreate(`You cancelled the crafting of ${augName}.<br>Your money was not returned to you.`)
|
||||
}
|
||||
|
||||
// TODO: intelligence EXP stuff here later
|
||||
// Intelligence gain
|
||||
if (!cancelled) {
|
||||
this.gainIntelligenceExp((CONSTANTS.IntelligenceCraftBaseExpGain * this.timeWorked) / 10000);
|
||||
}
|
||||
|
||||
this.isWorking = false;
|
||||
this.resetWorkStatus();
|
||||
return `Crafting of ${augName} has ended.`
|
||||
|
||||
Reference in New Issue
Block a user