mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +01:00
BLADEBURNER: Remove obsolete fix (#1367)
This commit is contained in:
parent
ebf08d5d1f
commit
abcd6c545a
@ -117,7 +117,6 @@ export class Bladeburner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculateStaminaPenalty(): number {
|
calculateStaminaPenalty(): number {
|
||||||
if (this.stamina === this.maxStamina) return 1;
|
|
||||||
return Math.min(1, this.stamina / (0.5 * this.maxStamina));
|
return Math.min(1, this.stamina / (0.5 * this.maxStamina));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1286,13 +1285,16 @@ export class Bladeburner {
|
|||||||
|
|
||||||
calculateMaxStamina(): void {
|
calculateMaxStamina(): void {
|
||||||
const baseStamina = Math.pow(this.getEffectiveSkillLevel(Player, "agility"), 0.8);
|
const baseStamina = Math.pow(this.getEffectiveSkillLevel(Player, "agility"), 0.8);
|
||||||
|
// Min value of maxStamina is an arbitrarily small positive value. It must not be 0 to avoid NaN stamina penalty.
|
||||||
const maxStamina = clampNumber(
|
const maxStamina = clampNumber(
|
||||||
(baseStamina + this.staminaBonus) *
|
(baseStamina + this.staminaBonus) *
|
||||||
this.getSkillMult(BladeMultName.stamina) *
|
this.getSkillMult(BladeMultName.stamina) *
|
||||||
Player.mults.bladeburner_max_stamina,
|
Player.mults.bladeburner_max_stamina,
|
||||||
0,
|
1e-9,
|
||||||
);
|
);
|
||||||
if (this.maxStamina === maxStamina) return;
|
if (this.maxStamina === maxStamina) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// If max stamina changed, adjust stamina accordingly
|
// If max stamina changed, adjust stamina accordingly
|
||||||
const oldMax = this.maxStamina;
|
const oldMax = this.maxStamina;
|
||||||
this.maxStamina = maxStamina;
|
this.maxStamina = maxStamina;
|
||||||
@ -1459,6 +1461,16 @@ export class Bladeburner {
|
|||||||
loadOperationsData(operationsData, bladeburner.operations);
|
loadOperationsData(operationsData, bladeburner.operations);
|
||||||
// Regenerate skill multiplier data, which is not included in savedata
|
// Regenerate skill multiplier data, which is not included in savedata
|
||||||
bladeburner.updateSkillMultipliers();
|
bladeburner.updateSkillMultipliers();
|
||||||
|
// If stamina or maxStamina is invalid, we set both of them to 1 and recalculate them.
|
||||||
|
if (
|
||||||
|
!Number.isFinite(bladeburner.stamina) ||
|
||||||
|
!Number.isFinite(bladeburner.maxStamina) ||
|
||||||
|
bladeburner.maxStamina === 0
|
||||||
|
) {
|
||||||
|
bladeburner.stamina = 1;
|
||||||
|
bladeburner.maxStamina = 1;
|
||||||
|
bladeburner.calculateMaxStamina();
|
||||||
|
}
|
||||||
return bladeburner;
|
return bladeburner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user