Explorar o código

fix health bar edge case

Laserlicht hai 7 meses
pai
achega
ff2d45673b
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      client/battle/BattleStacksController.cpp

+ 1 - 1
client/battle/BattleStacksController.cpp

@@ -320,7 +320,7 @@ void BattleStacksController::showStackAmountBox(Canvas & canvas, const CStack *
 	if(settings["battle"]["showHealthBar"].Bool())
 	{
 		float health = stack->getMaxHealth();
-		float healthRemaining = std::max(stack->getAvailableHealth() - (stack->getCount() - 1) * health, .0f);
+		float healthRemaining = std::min(std::max(stack->getAvailableHealth() - (stack->getCount() - 1) * health, .0f), health);
 		Rect r(boxPosition.x, boxPosition.y - 3, amountBG->width(), 4);
 		canvas.drawColor(r, Colors::RED);
 		canvas.drawColor(Rect(r.x, r.y, (r.w / health) * healthRemaining, r.h), Colors::GREEN);