remove unused fields on sleeves

This commit is contained in:
Olivier Gagnon
2022-07-28 03:08:39 -04:00
parent 4549b0d467
commit 3b35b07860
9 changed files with 142 additions and 445 deletions
@@ -5,7 +5,6 @@ import { Work, WorkType } from "./Work";
import { CONSTANTS } from "../../../Constants";
import { GeneralActions } from "../../../Bladeburner/data/GeneralActions";
import { applyWorkStatsExp, WorkStats } from "../../../Work/WorkStats";
import { Contracts } from "src/Bladeburner/data/Contracts";
interface SleeveBladeburnerWorkParams {
type: string;
@@ -38,12 +38,16 @@ export class SleeveCrimeWork extends Work {
});
}
cyclesNeeded(): number {
return this.getCrime().time / CONSTANTS._idleSpeed;
}
process(player: IPlayer, sleeve: Sleeve, cycles: number): number {
this.cyclesWorked += cycles;
const crime = this.getCrime();
const gains = this.getExp();
if (this.cyclesWorked >= crime.time / CONSTANTS._idleSpeed) {
if (this.cyclesWorked >= this.cyclesNeeded()) {
if (Math.random() < crime.successRate(sleeve)) {
applyWorkStats(player, sleeve, gains, 1, "sleeves");
@@ -51,7 +55,7 @@ export class SleeveCrimeWork extends Work {
} else {
applyWorkStats(player, sleeve, scaleWorkStats(gains, 0.25), 1, "sleeves");
}
this.cyclesWorked -= crime.time / CONSTANTS._idleSpeed;
this.cyclesWorked -= this.cyclesNeeded();
}
return 0;
}