Skip to content

Commit

Permalink
[8949] Implement proper support spell auras with maxstack > 1 and cha…
Browse files Browse the repository at this point in the history
…rges > 0.

* Like auras expected to be proccessed in spell proc event code (not lost charge at use in spellmods code).
  Exist examples for like spells that affect value in spellmods but have different expire requirements.
* Propertly work with stacked auras in spell proc event code
  - remove only one auras from stack
  - in case charges exist in same time not touch charges but return expire
    (all really used auars with maxstack>1 and charges have 1 in one from this values)
  • Loading branch information
VladimirMangos committed Dec 8, 2009
1 parent 4a6ab54 commit 4135b24
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 47 deletions.
90 changes: 47 additions & 43 deletions src/game/SpellAuras.cpp
Expand Up @@ -1418,7 +1418,10 @@ void Aura::HandleAddModifier(bool apply, bool Real)

mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32;
mod->mask2= (uint64)ptr[2];
mod->charges = m_procCharges;

// prevent expire spell mods with (charges > 0 && m_stackAmount > 1)
// all this spell expected expire not at use but at spell proc event check
mod->charges = m_spellProto->StackAmount > 1 ? 0 : m_procCharges;

m_spellmod = mod;
}
Expand Down Expand Up @@ -2236,50 +2239,51 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// AT APPLY
if(apply)
{
switch(GetId())
switch(m_spellProto->SpellFamilyName)
{
case 1515: // Tame beast
// FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
if (m_target->CanHaveThreatList())
if (Unit* caster = GetCaster())
m_target->AddThreat(caster, 10.0f, false, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
return;
case 13139: // net-o-matic
// root to self part of (root_target->charge->root_self sequence
if (Unit* caster = GetCaster())
caster->CastSpell(caster, 13138, true, NULL, this);
return;
case 39850: // Rocket Blast
if(roll_chance_i(20)) // backfire stun
m_target->CastSpell(m_target, 51581, true, NULL, this);
return;
case 43873: // Headless Horseman Laugh
m_target->PlayDistanceSound(11965);
return;
case 46354: // Blood Elf Illusion
if (Unit* caster = GetCaster())
case SPELLFAMILY_GENERIC:
switch(GetId())
{
switch(caster->getGender())
{
case GENDER_FEMALE:
caster->CastSpell(m_target, 46356, true, NULL, this);
break;
case GENDER_MALE:
caster->CastSpell(m_target, 46355, true, NULL, this);
break;
default:
break;
}
case 1515: // Tame beast
// FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
if (m_target->CanHaveThreatList())
if (Unit* caster = GetCaster())
m_target->AddThreat(caster, 10.0f, false, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
return;
case 13139: // net-o-matic
// root to self part of (root_target->charge->root_self sequence
if (Unit* caster = GetCaster())
caster->CastSpell(caster, 13138, true, NULL, this);
return;
case 39850: // Rocket Blast
if(roll_chance_i(20)) // backfire stun
m_target->CastSpell(m_target, 51581, true, NULL, this);
return;
case 43873: // Headless Horseman Laugh
m_target->PlayDistanceSound(11965);
return;
case 46354: // Blood Elf Illusion
if (Unit* caster = GetCaster())
{
switch(caster->getGender())
{
case GENDER_FEMALE:
caster->CastSpell(m_target, 46356, true, NULL, this);
break;
case GENDER_MALE:
caster->CastSpell(m_target, 46355, true, NULL, this);
break;
default:
break;
}
}
return;
case 46699: // Requires No Ammo
if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->RemoveAmmo(); // not use ammo and not allow use
return;
}
return;
case 46699: // Requires No Ammo
if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->RemoveAmmo(); // not use ammo and not allow use
return;
}

switch(m_spellProto->SpellFamilyName)
{
break;
case SPELLFAMILY_WARRIOR:
// Overpower
if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004))
Expand Down Expand Up @@ -2317,7 +2321,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
break;
case SPELLFAMILY_SHAMAN:
// Earth Shield
if ((GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000)))
else if ((GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000)))
{
// prevent double apply bonuses
if(m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
Expand Down
7 changes: 7 additions & 0 deletions src/game/SpellAuras.h
Expand Up @@ -268,6 +268,13 @@ class MANGOS_DLL_SPEC Aura
{
if (m_procCharges == 0)
return false;

// exist spells that have maxStack > 1 and m_procCharges > 0 (==1 in fact)
// all like stacks have 1 value in one from this fields
// so return true for allow remove one aura from stacks as expired
if (GetStackAmount() > 1)
return true;

m_procCharges--;
SendAuraUpdate(false);
return m_procCharges == 0;
Expand Down
6 changes: 3 additions & 3 deletions src/game/Unit.cpp
Expand Up @@ -6471,7 +6471,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()];
CastSpell(this, spell, true, castItem, triggeredByAura);
if ((*itr)->DropAuraCharge())
RemoveAurasDueToSpell((*itr)->GetId());
RemoveSingleSpellAurasFromStack((*itr)->GetId());
return true;
}
}
Expand Down Expand Up @@ -6573,7 +6573,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
}
CastSpell(target, spell, true, castItem, triggeredByAura);
if ((*itr)->DropAuraCharge())
RemoveAurasDueToSpell((*itr)->GetId());
RemoveSingleSpellAurasFromStack((*itr)->GetId());
return true;
}
}
Expand Down Expand Up @@ -12039,7 +12039,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
removedSpells.unique();
// Remove auras from removedAuras
for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();++i)
RemoveAurasDueToSpell(*i);
RemoveSingleSpellAurasFromStack(*i);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8948"
#define REVISION_NR "8949"
#endif // __REVISION_NR_H__

2 comments on commit 4135b24

@NetSky
Copy link

@NetSky NetSky commented on 4135b24 Dec 10, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProcDamageAndSpellFor there is need for special case handling Weapons of Maelstorm proc e.g. needs completely to be removed after casting one boosted spell

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, fixed in [8966]

Please sign in to comment.