From 6ca7f10fafe75707e466c7a74b888babe2cb3a42 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sun, 7 Mar 2021 16:48:48 -0500 Subject: [PATCH] Current stamina will scale as max stamina increases, this prevents players from having very high penalty when they gain huge amount of exp at the start of a reset. --- src/Bladeburner.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Bladeburner.js b/src/Bladeburner.js index 33dc06496..270baec13 100644 --- a/src/Bladeburner.js +++ b/src/Bladeburner.js @@ -992,12 +992,16 @@ Bladeburner.prototype.process = function() { } Bladeburner.prototype.calculateMaxStamina = function() { - var effAgility = Player.agility * this.skillMultipliers.effAgi; - var maxStamina = (Math.pow(effAgility, 0.8) + this.staminaBonus); - maxStamina *= this.skillMultipliers.stamina; - maxStamina *= Player.bladeburner_max_stamina_mult; + const effAgility = Player.agility * this.skillMultipliers.effAgi; + let maxStamina = (Math.pow(effAgility, 0.8) + this.staminaBonus) * + this.skillMultipliers.stamina * + Player.bladeburner_max_stamina_mult; + if (this.maxStamina !== maxStamina) { + const oldMax = this.maxStamina; + this.maxStamina = maxStamina; + this.stamina = this.maxStamina * this.stamina / oldMax; + } if (isNaN(maxStamina)) {throw new Error("Max Stamina calculated to be NaN in Bladeburner.calculateMaxStamina()");} - this.maxStamina = maxStamina; } Bladeburner.prototype.calculateStaminaGainPerSecond = function() {