mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
UI: change time elapsed to time remaining for programs and grafting (#1328)
This commit is contained in:
parent
d9f04203cf
commit
e622b9b904
@ -21,10 +21,11 @@ export class CreateProgramWork extends Work {
|
||||
programName: CompletedProgramName;
|
||||
// amount of effective work completed on the program (time boosted by skills).
|
||||
unitCompleted: number;
|
||||
|
||||
unitRate: number;
|
||||
constructor(params?: CreateProgramWorkParams) {
|
||||
super(WorkType.CREATE_PROGRAM, params?.singularity ?? true);
|
||||
this.unitCompleted = 0;
|
||||
this.unitRate = 0;
|
||||
this.programName = params?.programName ?? CompletedProgramName.bruteSsh;
|
||||
|
||||
if (params) {
|
||||
@ -63,7 +64,8 @@ export class CreateProgramWork extends Work {
|
||||
skillMult *= focusBonus;
|
||||
//Skill multiplier directly applied to "time worked"
|
||||
this.cyclesWorked += cycles;
|
||||
this.unitCompleted += CONSTANTS.MilliPerCycle * cycles * skillMult;
|
||||
this.unitRate = CONSTANTS.MilliPerCycle * cycles * skillMult;
|
||||
this.unitCompleted += this.unitRate;
|
||||
|
||||
if (this.unitCompleted >= this.unitNeeded()) {
|
||||
return true;
|
||||
|
@ -21,10 +21,12 @@ interface GraftingWorkParams {
|
||||
export class GraftingWork extends Work {
|
||||
augmentation: AugmentationName;
|
||||
unitCompleted: number;
|
||||
unitRate: number;
|
||||
|
||||
constructor(params?: GraftingWorkParams) {
|
||||
super(WorkType.GRAFTING, params?.singularity ?? true);
|
||||
this.unitCompleted = 0;
|
||||
this.unitRate = 0;
|
||||
this.augmentation = params?.augmentation ?? AugmentationName.Targeting1;
|
||||
const gAugs = GraftableAugmentations();
|
||||
if (params) Player.loseMoney(gAugs[this.augmentation].cost, "augmentations");
|
||||
@ -37,8 +39,8 @@ export class GraftingWork extends Work {
|
||||
process(cycles: number): boolean {
|
||||
const focusBonus = Player.focusPenalty();
|
||||
this.cyclesWorked += cycles;
|
||||
this.unitCompleted += CONSTANTS.MilliPerCycle * cycles * graftingIntBonus() * focusBonus;
|
||||
|
||||
this.unitRate = CONSTANTS.MilliPerCycle * cycles * graftingIntBonus() * focusBonus;
|
||||
this.unitCompleted += this.unitRate;
|
||||
return this.unitCompleted >= this.unitNeeded();
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
if (isCreateProgramWork(Player.currentWork)) {
|
||||
const create = Player.currentWork;
|
||||
const completion = (create.unitCompleted / create.unitNeeded()) * 100;
|
||||
|
||||
const remainingTime = ((create.unitNeeded() - create.unitCompleted) / create.unitRate) * CONSTANTS.MilliPerCycle;
|
||||
workInfo = {
|
||||
buttons: {
|
||||
cancel: () => {
|
||||
@ -305,7 +305,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
),
|
||||
|
||||
progress: {
|
||||
elapsed: create.cyclesWorked * CONSTANTS.MilliPerCycle,
|
||||
remaining: remainingTime,
|
||||
percentage: completion,
|
||||
},
|
||||
|
||||
@ -316,7 +316,8 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
|
||||
if (isGraftingWork(Player.currentWork)) {
|
||||
const graftWork = Player.currentWork;
|
||||
|
||||
const remainingTime =
|
||||
((graftWork.unitNeeded() - graftWork.unitCompleted) / graftWork.unitRate) * CONSTANTS.MilliPerCycle;
|
||||
workInfo = {
|
||||
buttons: {
|
||||
cancel: () => {
|
||||
@ -335,7 +336,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
),
|
||||
|
||||
progress: {
|
||||
elapsed: graftWork.cyclesWorked * CONSTANTS.MilliPerCycle,
|
||||
remaining: remainingTime,
|
||||
percentage: (graftWork.unitCompleted / graftWork.unitNeeded()) * 100,
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user