diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4b7ac7171..2008f1927 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -983,7 +983,8 @@ void Aura::_AddAura() for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr) { // allow use single slot only by auras from same caster - if(itr->second->GetCasterGUID()==GetCasterGUID()) + if(itr->second->GetCasterGUID()==GetCasterGUID() && + !isWeaponBuffCoexistableWith(itr->second)) { slot = itr->second->GetAuraSlot(); secondaura = true; @@ -1412,6 +1413,37 @@ void Aura::ReapplyAffectedPassiveAuras() ReapplyAffectedPassiveAuras(member, false); } +bool Aura::isWeaponBuffCoexistableWith(Aura* ref) +{ + // Exclude Debuffs + if (!IsPositive()) + return false; + + // Exclude Non-generic Buffs [ie: Runeforging] and Executioner-Enchant + if (GetSpellProto()->SpellFamilyName != SPELLFAMILY_GENERIC || GetId() == 42976) + return false; + + // Exclude Stackable Buffs [ie: Blood Reserve] + if (GetSpellProto()->StackAmount) + return false; + + // only self applied player buffs + if (m_target->GetTypeId() != TYPEID_PLAYER || m_target->GetGUID() != GetCasterGUID()) + return false; + + Item* castItem = ((Player*)m_target)->GetItemByGuid(GetCastItemGUID()); + if (!castItem) + return false; + + // Limit to Weapon-Slots + if (!castItem->IsEquipped() || + (castItem->GetSlot() != EQUIPMENT_SLOT_MAINHAND && castItem->GetSlot() != EQUIPMENT_SLOT_OFFHAND)) + return false; + + // form different weapons + return ref->GetCastItemGUID() != GetCastItemGUID(); +} + /*********************************************************/ /*** BASIC AURA FUNCTION ***/ /*********************************************************/ diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 9b93e09a9..62094763b 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -352,6 +352,7 @@ class MANGOS_DLL_SPEC Aura uint32 const *getAuraSpellClassMask() const { return m_spellProto->GetEffectSpellClassMask(m_effIndex); } bool isAffectedOnSpell(SpellEntry const *spell) const; + bool isWeaponBuffCoexistableWith(Aura* ref); protected: Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d2c596595..9b217b753 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3813,8 +3813,13 @@ bool Unit::AddAura(Aura *Aur) delete Aur; return false; } + + // Check for coexisting Weapon-proced Auras + if (Aur->isWeaponBuffCoexistableWith(aur2)) + continue; + // Carry over removed Aura's remaining damage if Aura still has ticks remaining - else if (aur2->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_STACK_DOT_MODIFIER && aurName == SPELL_AURA_PERIODIC_DAMAGE && aur2->GetAuraDuration() > 0) + if (aur2->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_STACK_DOT_MODIFIER && aurName == SPELL_AURA_PERIODIC_DAMAGE && aur2->GetAuraDuration() > 0) { int32 remainingTicks = aur2->GetAuraMaxTicks() - aur2->GetAuraTicks(); int32 remainingDamage = aur2->GetModifier()->m_amount * remainingTicks; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 30686d15e..be77d5e1a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9522" + #define REVISION_NR "9523" #endif // __REVISION_NR_H__