Fix unintended behaviour where dispatched dimboost_x events may have wrong bulk

This commit is contained in:
Dys 2022-04-25 08:31:49 +08:00
parent 9d99625cb2
commit 6438ba5fb8

View File

@ -165,10 +165,11 @@ export class DimBoost {
}
}
export function softReset(bulk, forcedNDReset = false, forcedAMReset = false) {
export function softReset(tempBulk, forcedNDReset = false, forcedAMReset = false) {
if (Currency.antimatter.gt(Player.infinityLimit)) return;
const bulk = Math.min(tempBulk, DimBoost.maxBoosts - player.dimensionBoosts);
EventHub.dispatch(GAME_EVENT.DIMBOOST_BEFORE, bulk);
player.dimensionBoosts = Math.min(Math.max(0, player.dimensionBoosts + bulk), DimBoost.maxBoosts);
player.dimensionBoosts = Math.max(0, player.dimensionBoosts + bulk);
resetChallengeStuff();
if (
forcedNDReset ||