mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 08:13:50 +02:00
post-grafting changes
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { sum } from "lodash";
|
||||
|
||||
import { Augmentation } from "../../Augmentation/Augmentation";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
|
||||
export interface IConstructorParams {
|
||||
augmentation: Augmentation;
|
||||
readonly cost: number;
|
||||
readonly time: number;
|
||||
}
|
||||
|
||||
export class GraftableAugmentation {
|
||||
// The augmentation that this craftable corresponds to
|
||||
augmentation: Augmentation;
|
||||
|
||||
constructor(augmentation: Augmentation) {
|
||||
this.augmentation = augmentation;
|
||||
}
|
||||
|
||||
get cost(): number {
|
||||
return this.augmentation.startingCost * CONSTANTS.AugmentationGraftingCostMult;
|
||||
}
|
||||
|
||||
get time(): number {
|
||||
// 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.AugmentationGraftingTimeBase * mult + CONSTANTS.MillisecondsPerHalfHour;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user