mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Clamp potential kills tooltip to target unit size
This commit is contained in:
@@ -436,6 +436,9 @@ std::string BattleActionsController::actionGetStatusMessage(PossiblePlayerBattle
|
|||||||
{
|
{
|
||||||
BattleHex attackFromHex = owner.fieldController->fromWhichHexAttack(targetHex);
|
BattleHex attackFromHex = owner.fieldController->fromWhichHexAttack(targetHex);
|
||||||
DamageEstimation estimation = owner.curInt->cb->battleEstimateDamage(owner.stacksController->getActiveStack(), targetStack, attackFromHex);
|
DamageEstimation estimation = owner.curInt->cb->battleEstimateDamage(owner.stacksController->getActiveStack(), targetStack, attackFromHex);
|
||||||
|
estimation.kills.max = std::min<int64_t>(estimation.kills.max, targetStack->getCount());
|
||||||
|
estimation.kills.min = std::min<int64_t>(estimation.kills.min, targetStack->getCount());
|
||||||
|
|
||||||
return formatMeleeAttack(estimation, targetStack->getName());
|
return formatMeleeAttack(estimation, targetStack->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,6 +447,8 @@ std::string BattleActionsController::actionGetStatusMessage(PossiblePlayerBattle
|
|||||||
const auto * shooter = owner.stacksController->getActiveStack();
|
const auto * shooter = owner.stacksController->getActiveStack();
|
||||||
|
|
||||||
DamageEstimation estimation = owner.curInt->cb->battleEstimateDamage(shooter, targetStack, shooter->getPosition());
|
DamageEstimation estimation = owner.curInt->cb->battleEstimateDamage(shooter, targetStack, shooter->getPosition());
|
||||||
|
estimation.kills.max = std::min<int64_t>(estimation.kills.max, targetStack->getCount());
|
||||||
|
estimation.kills.min = std::min<int64_t>(estimation.kills.min, targetStack->getCount());
|
||||||
|
|
||||||
return formatRangedAttack(estimation, targetStack->getName(), shooter->shots.available());
|
return formatRangedAttack(estimation, targetStack->getName(), shooter->shots.available());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user