1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

fix health bar for commander

This commit is contained in:
Laserlicht
2025-04-11 01:08:25 +02:00
committed by GitHub
parent 0b437e8b1d
commit 4ee3cda9d8

View File

@@ -321,7 +321,7 @@ void BattleStacksController::showStackAmountBox(Canvas & canvas, const CStack *
{
double healthMaxType = stack->unitType()->getMaxHealth();
double healthMaxStack = stack->getMaxHealth();
double healthMaxRatio = healthMaxStack / healthMaxType;
double healthMaxRatio = std::min(healthMaxStack / healthMaxType, 1.0);
double healthRemaining = std::max(stack->getAvailableHealth() - (stack->getCount() - 1) * healthMaxStack, .0) * healthMaxRatio;
Rect r(boxPosition.x, boxPosition.y - 3, amountBG->width(), 4);
canvas.drawColor(r, Colors::RED);