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)
This commit is contained in:
@@ -4320,25 +4320,20 @@ bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid)
|
|||||||
return false;
|
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)
|
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
|
||||||
{
|
{
|
||||||
SpellEntry const* spellInfo = iter->second->GetBase()->GetSpellProto();
|
SpellEntry const* spellInfo = iter->second->GetBase()->GetSpellProto();
|
||||||
|
if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic)))
|
||||||
if (IsImmunedToSpell(spellInfo))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
uint32 mask = 0;
|
|
||||||
if (spellInfo->Mechanic)
|
|
||||||
mask |= 1<<spellInfo->Mechanic;
|
|
||||||
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
|
||||||
if (spellInfo->Effect[i] && spellInfo->EffectMechanic[i] && !IsImmunedToSpellEffect(spellInfo, i))
|
|
||||||
mask |= 1<<spellInfo->EffectMechanic[i];
|
|
||||||
|
|
||||||
if (mask & mechanic_mask)
|
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10444,7 +10439,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
|||||||
|
|
||||||
// Torment the weak
|
// Torment the weak
|
||||||
if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000)
|
if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000)
|
||||||
if (pVictim->HasAurasWithMechanic((1<<MECHANIC_SNARE)|(1<<MECHANIC_SLOW_ATTACK)))
|
if (pVictim->HasAuraWithMechanic((1<<MECHANIC_SNARE)|(1<<MECHANIC_SLOW_ATTACK)))
|
||||||
{
|
{
|
||||||
AuraEffectList const& mDumyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
|
AuraEffectList const& mDumyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
|
||||||
for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
|
for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
|
||||||
|
|||||||
@@ -1697,7 +1697,7 @@ class Unit : public WorldObject
|
|||||||
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
|
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
|
||||||
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
|
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
|
||||||
bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0);
|
bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0);
|
||||||
bool HasAurasWithMechanic(uint32 mechanic_mask);
|
bool HasAuraWithMechanic(uint32 mechanicMask);
|
||||||
|
|
||||||
AuraEffect * IsScriptOverriden(SpellEntry const * spell, int32 script) const;
|
AuraEffect * IsScriptOverriden(SpellEntry const * spell, int32 script) const;
|
||||||
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
|
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
|
||||||
|
|||||||
Reference in New Issue
Block a user