1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +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,12 +79,12 @@ public:
DamageEstimation dmg = cb->getBattle(battleID)->battleEstimateDamage(ourStack, s, 0, &retal); DamageEstimation dmg = cb->getBattle(battleID)->battleEstimateDamage(ourStack, s, 0, &retal);
// Clip damage dealt to total stack health // Clip damage dealt to total stack health
auto totalHealth = s->getTotalHealth(); auto totalHealth = s->getTotalHealth();
dmg.damage.min = std::min<int64_t>(totalHealth, dmg.damage.min); vstd::amin(dmg.damage.min, totalHealth);
dmg.damage.max = std::min<int64_t>(totalHealth, dmg.damage.max); vstd::amin(dmg.damage.max, totalHealth);
auto ourHealth = s->getTotalHealth(); auto ourHealth = s->getTotalHealth();
retal.damage.min = std::min<int64_t>(ourHealth, retal.damage.min); vstd::amin(retal.damage.min, ourHealth);
retal.damage.max = std::min<int64_t>(ourHealth, retal.damage.max); vstd::amin(retal.damage.max, ourHealth);
adi = static_cast<int>((dmg.damage.min + dmg.damage.max) / 2); adi = static_cast<int>((dmg.damage.min + dmg.damage.max) / 2);
adr = static_cast<int>((retal.damage.min + retal.damage.max) / 2); adr = static_cast<int>((retal.damage.min + retal.damage.max) / 2);