mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-19 21:10:12 +02:00
fix incorrect health calculation
This commit is contained in:
parent
5f74044d9a
commit
ca5471aa55
@ -636,7 +636,7 @@ void StackInfoBasicPanel::initializeData(const CStack * stack)
|
|||||||
auto attack = std::to_string(CGI->creatures()->getByIndex(stack->creatureIndex())->getAttack(stack->isShooter())) + "(" + std::to_string(stack->getAttack(stack->isShooter())) + ")";
|
auto attack = std::to_string(CGI->creatures()->getByIndex(stack->creatureIndex())->getAttack(stack->isShooter())) + "(" + std::to_string(stack->getAttack(stack->isShooter())) + ")";
|
||||||
auto defense = std::to_string(CGI->creatures()->getByIndex(stack->creatureIndex())->getDefense(stack->isShooter())) + "(" + std::to_string(stack->getDefense(stack->isShooter())) + ")";
|
auto defense = std::to_string(CGI->creatures()->getByIndex(stack->creatureIndex())->getDefense(stack->isShooter())) + "(" + std::to_string(stack->getDefense(stack->isShooter())) + ")";
|
||||||
auto damage = std::to_string(CGI->creatures()->getByIndex(stack->creatureIndex())->getMinDamage(stack->isShooter())) + "-" + std::to_string(stack->getMaxDamage(stack->isShooter()));
|
auto damage = std::to_string(CGI->creatures()->getByIndex(stack->creatureIndex())->getMinDamage(stack->isShooter())) + "-" + std::to_string(stack->getMaxDamage(stack->isShooter()));
|
||||||
auto health = CGI->creatures()->getByIndex(stack->creatureIndex())->getMaxHealth();
|
auto health = stack->getMaxHealth();
|
||||||
auto morale = stack->moraleVal();
|
auto morale = stack->moraleVal();
|
||||||
auto luck = stack->luckVal();
|
auto luck = stack->luckVal();
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ void BattleStacksController::showStackAmountBox(Canvas & canvas, const CStack *
|
|||||||
|
|
||||||
if(settings["battle"]["showHealthBar"].Bool())
|
if(settings["battle"]["showHealthBar"].Bool())
|
||||||
{
|
{
|
||||||
float health = CGI->creatures()->getByIndex(stack->creatureIndex())->getMaxHealth();
|
float health = stack->getMaxHealth();
|
||||||
float healthRemaining = std::max(stack->getAvailableHealth() - (stack->getCount() - 1) * health, .0f);
|
float healthRemaining = std::max(stack->getAvailableHealth() - (stack->getCount() - 1) * health, .0f);
|
||||||
Rect r(boxPosition.x, boxPosition.y - 3, amountBG->width(), 4);
|
Rect r(boxPosition.x, boxPosition.y - 3, amountBG->width(), 4);
|
||||||
canvas.drawColor(r, Colors::RED);
|
canvas.drawColor(r, Colors::RED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user