mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 13:43:49 +01:00
BUGFIX: Fix wrong HP after calling applyEntropy (#1313)
This commit is contained in:
parent
c2a56a6150
commit
f439352438
@ -6,6 +6,9 @@ import { updateGoMults } from "../../Go/effects/effect";
|
||||
import type { PlayerObject } from "./PlayerObject";
|
||||
|
||||
export function applyEntropy(this: PlayerObject, stacks = 1): void {
|
||||
// Save the current HP ratio.
|
||||
const currentHpRatio = this.hp.current / this.hp.max;
|
||||
|
||||
// Re-apply all multipliers
|
||||
this.reapplyAllAugmentations();
|
||||
this.reapplyAllSourceFiles();
|
||||
@ -13,4 +16,10 @@ export function applyEntropy(this: PlayerObject, stacks = 1): void {
|
||||
this.mults = calculateEntropy(stacks);
|
||||
staneksGift.updateMults();
|
||||
updateGoMults();
|
||||
|
||||
/**
|
||||
* The ratio of (hp.current / hp.max) may be wrong after multiple function calls above. We need to recalculate
|
||||
* hp.current based on the saved value.
|
||||
*/
|
||||
this.hp.current = Math.round(this.hp.max * Math.min(currentHpRatio, 1));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user