1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
Tomasz Zieliński 2024-07-09 06:50:00 +02:00
parent bfa93be765
commit 5eabadd7db

View File

@ -79,13 +79,13 @@ public:
DamageEstimation dmg = cb->getBattle(battleID)->battleEstimateDamage(ourStack, s, 0, &retal);
// Clip damage dealt to total stack health
auto totalHealth = s->getTotalHealth();
dmg.damage.min = std::min<int64_t>(totalHealth, dmg.damage.min);
dmg.damage.max = std::min<int64_t>(totalHealth, dmg.damage.max);
vstd::amin(dmg.damage.min, totalHealth);
vstd::amin(dmg.damage.max, totalHealth);
auto ourHealth = s->getTotalHealth();
retal.damage.min = std::min<int64_t>(ourHealth, retal.damage.min);
retal.damage.max = std::min<int64_t>(ourHealth, retal.damage.max);
vstd::amin(retal.damage.min, ourHealth);
vstd::amin(retal.damage.max, ourHealth);
adi = static_cast<int>((dmg.damage.min + dmg.damage.max) / 2);
adr = static_cast<int>((retal.damage.min + retal.damage.max) / 2);
}