[9523] Stacking Auras from dual wild weapons.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Sarjuuk 2010-03-05 08:36:20 +03:00 committed by VladimirMangos
parent da30ea5ed8
commit 0ca87c50a6
4 changed files with 41 additions and 3 deletions

View file

@ -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 ***/
/*********************************************************/

View file

@ -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);

View file

@ -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;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9522"
#define REVISION_NR "9523"
#endif // __REVISION_NR_H__