diff options
author | tobmaps <spambot42@yandex.ru> | 2011-05-19 22:01:01 +0700 |
---|---|---|
committer | tobmaps <spambot42@yandex.ru> | 2011-05-19 22:01:01 +0700 |
commit | a8c784b50cc4de2adc7411e1467879e500d6f78b (patch) | |
tree | a10d401272a0e2c0f3a1aa89c74c9e1782de709c /src | |
parent | 9a7720e1845fe094ff1c7f05f5096394932dcb32 (diff) |
Core/Spells: Properly fix talent Torment the Weak
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 24 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.h | 1 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4fcabd3c80c..508246439f7 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4320,6 +4320,28 @@ bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid) return false; } +bool Unit::HasAurasWithMechanic(uint32 mechanic_mask) +{ + 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<<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 false; +} + AuraEffect * Unit::IsScriptOverriden(SpellEntry const * spell, int32 script) const { AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); @@ -10422,7 +10444,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 // Torment the weak if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000) - if (pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || pVictim->HasAuraType(SPELL_AURA_MOD_MELEE_HASTE)) + if (pVictim->HasAurasWithMechanic((1<<MECHANIC_SNARE)|(1<<MECHANIC_SLOW_ATTACK))) { AuraEffectList const& mDumyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY); for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 93c290927bc..d077666ed2e 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1697,6 +1697,7 @@ class Unit : public WorldObject bool HasAuraTypeWithValue(AuraType auratype, int32 value) const; bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0); bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0); + bool HasAurasWithMechanic(uint32 mechanic_mask); AuraEffect * IsScriptOverriden(SpellEntry const * spell, int32 script) const; uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false); |