Skip to content

Commit 3b5a395

Browse files
authored
Target: Fix Banish in immune to damage check. (#235)
1 parent 3fe1bcb commit 3b5a395

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

playerbot/strategy/values/PossibleAttackTargetsValue.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,23 +173,25 @@ bool PossibleAttackTargetsValue::IsImmuneToDamage(Unit* target, Player* player)
173173

174174
// Immune to damage
175175
PlayerbotAI* ai = player->GetPlayerbotAI();
176-
if (ai)
176+
if (!ai)
177+
return false;
178+
179+
for (const Aura* aura : ai->GetAuras(target))
177180
{
178-
for (const Aura* aura : ai->GetAuras(target))
179-
{
180-
if (!aura->IsPositive())
181-
continue;
181+
const SpellEntry* spellInfo = aura->GetSpellProto();
182+
if (!spellInfo)
183+
continue;
182184

183-
const SpellEntry* spellInfo = aura->GetSpellProto();
184-
if (!spellInfo)
185-
continue;
185+
if (spellInfo->Mechanic == MECHANIC_BANISH)
186+
return true;
186187

187-
if (spellInfo->Mechanic == MECHANIC_BANISH ||
188-
spellInfo->Mechanic == MECHANIC_INVULNERABILITY ||
189-
spellInfo->Mechanic == MECHANIC_IMMUNE_SHIELD)
190-
{
191-
return true;
192-
}
188+
if (!aura->IsPositive())
189+
continue;
190+
191+
if (spellInfo->Mechanic == MECHANIC_INVULNERABILITY ||
192+
spellInfo->Mechanic == MECHANIC_IMMUNE_SHIELD)
193+
{
194+
return true;
193195
}
194196
}
195197

0 commit comments

Comments
 (0)