BUGFIX: SleeveCrimeWork.ts works through all cyclesWorked if its greater than cyclesNeeded (#881)

This commit is contained in:
TheAimMan 2023-10-23 05:31:11 -04:00 committed by GitHub
parent 5d266e01a6
commit 848fc9905a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,15 +38,17 @@ export class SleeveCrimeWork extends SleeveWorkClass {
this.cyclesWorked += cycles;
if (this.cyclesWorked < this.cyclesNeeded()) return;
const crime = this.getCrime();
const gains = this.getExp(sleeve);
const success = Math.random() < crime.successRate(sleeve);
if (success) {
Player.karma -= crime.karma * sleeve.syncBonus();
Player.numPeopleKilled += crime.kills;
} else gains.money = 0;
applySleeveGains(sleeve, gains, success ? 1 : 0.25);
this.cyclesWorked -= this.cyclesNeeded();
while (this.cyclesWorked > this.cyclesNeeded()) {
const crime = this.getCrime();
const gains = this.getExp(sleeve);
const success = Math.random() < crime.successRate(sleeve);
if (success) {
Player.karma -= crime.karma * sleeve.syncBonus();
Player.numPeopleKilled += crime.kills;
} else gains.money = 0;
applySleeveGains(sleeve, gains, success ? 1 : 0.25);
this.cyclesWorked -= this.cyclesNeeded();
}
}
APICopy() {