Переглянути джерело

Clamp potential kills tooltip to target unit size

Ivan Savenko 2 роки тому
батько
коміт
4c311da21b
1 змінених файлів з 5 додано та 0 видалено
  1. 5 0
      client/battle/BattleActionsController.cpp

+ 5 - 0
client/battle/BattleActionsController.cpp

@@ -436,6 +436,9 @@ std::string BattleActionsController::actionGetStatusMessage(PossiblePlayerBattle
 			{
 				BattleHex attackFromHex = owner.fieldController->fromWhichHexAttack(targetHex);
 				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());
 			}
 
@@ -444,6 +447,8 @@ std::string BattleActionsController::actionGetStatusMessage(PossiblePlayerBattle
 			const auto * shooter = owner.stacksController->getActiveStack();
 
 			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());
 		}