From 69376d0e1ce027f3abaf8e1c8757d786789b379e Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 May 2011 17:46:36 +0200 Subject: [PATCH] Core/Units: Removed calculating complete mechanic mask when checking if unit has aura with such mechanic, instead return result immediately (immunities don't need to be checked, unit won't have such aura if immune) --- src/server/game/Entities/Unit/Unit.cpp | 23 +++++++++-------------- src/server/game/Entities/Unit/Unit.h | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 508246439f..7e1b2df493 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4320,25 +4320,20 @@ bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid) return false; } -bool Unit::HasAurasWithMechanic(uint32 mechanic_mask) +bool Unit::HasAuraWithMechanic(uint32 mechanicMask) { for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter) { SpellEntry const* spellInfo = iter->second->GetBase()->GetSpellProto(); - - if (IsImmunedToSpell(spellInfo)) - continue; - - uint32 mask = 0; - if (spellInfo->Mechanic) - mask |= 1<Mechanic; - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (spellInfo->Effect[i] && spellInfo->EffectMechanic[i] && !IsImmunedToSpellEffect(spellInfo, i)) - mask |= 1<EffectMechanic[i]; - - if (mask & mechanic_mask) + if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic))) return true; + + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (iter->second->HasEffect(i) && spellInfo->Effect[i] && spellInfo->EffectMechanic[i]) + if (mechanicMask & (1 << spellInfo->EffectMechanic[i])) + return true; } + return false; } @@ -10444,7 +10439,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 // Torment the weak if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000) - if (pVictim->HasAurasWithMechanic((1<HasAuraWithMechanic((1<