1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

move checks for invincible bonus to UnitState & cache

This commit is contained in:
Ivan Savenko
2025-01-10 21:15:37 +00:00
parent 5cff9af236
commit 48473b18f6
12 changed files with 24 additions and 9 deletions

View File

@ -298,7 +298,7 @@ BattleHexArray CStack::meleeAttackHexes(const battle::Unit * attacker, const bat
bool CStack::isMeleeAttackPossible(const battle::Unit * attacker, const battle::Unit * defender, BattleHex attackerPos, BattleHex defenderPos)
{
if(defender->hasBonusOfType(BonusType::INVINCIBLE))
if(defender->isInvincible())
return false;
return !meleeAttackHexes(attacker, defender, attackerPos, defenderPos).empty();