mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[8949] Implement proper support spell auras with maxstack > 1 and charges > 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)
This commit is contained in:
parent
c6bf3a2cdc
commit
dbd3177121
4 changed files with 59 additions and 48 deletions
|
|
@ -1418,7 +1418,10 @@ void Aura::HandleAddModifier(bool apply, bool Real)
|
||||||
|
|
||||||
mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32;
|
mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32;
|
||||||
mod->mask2= (uint64)ptr[2];
|
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;
|
m_spellmod = mod;
|
||||||
}
|
}
|
||||||
|
|
@ -2236,50 +2239,51 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
// AT APPLY
|
// AT APPLY
|
||||||
if(apply)
|
if(apply)
|
||||||
{
|
{
|
||||||
switch(GetId())
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(m_spellProto->SpellFamilyName)
|
switch(m_spellProto->SpellFamilyName)
|
||||||
{
|
{
|
||||||
|
case SPELLFAMILY_GENERIC:
|
||||||
|
switch(GetId())
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SPELLFAMILY_WARRIOR:
|
case SPELLFAMILY_WARRIOR:
|
||||||
// Overpower
|
// Overpower
|
||||||
if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004))
|
if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004))
|
||||||
|
|
@ -2317,7 +2321,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||||
break;
|
break;
|
||||||
case SPELLFAMILY_SHAMAN:
|
case SPELLFAMILY_SHAMAN:
|
||||||
// Earth Shield
|
// Earth Shield
|
||||||
if ((GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000)))
|
else if ((GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000)))
|
||||||
{
|
{
|
||||||
// prevent double apply bonuses
|
// prevent double apply bonuses
|
||||||
if(m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
|
if(m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
|
||||||
|
|
|
||||||
|
|
@ -268,6 +268,13 @@ class MANGOS_DLL_SPEC Aura
|
||||||
{
|
{
|
||||||
if (m_procCharges == 0)
|
if (m_procCharges == 0)
|
||||||
return false;
|
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--;
|
m_procCharges--;
|
||||||
SendAuraUpdate(false);
|
SendAuraUpdate(false);
|
||||||
return m_procCharges == 0;
|
return m_procCharges == 0;
|
||||||
|
|
|
||||||
|
|
@ -6471,7 +6471,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
|
||||||
uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()];
|
uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()];
|
||||||
CastSpell(this, spell, true, castItem, triggeredByAura);
|
CastSpell(this, spell, true, castItem, triggeredByAura);
|
||||||
if ((*itr)->DropAuraCharge())
|
if ((*itr)->DropAuraCharge())
|
||||||
RemoveAurasDueToSpell((*itr)->GetId());
|
RemoveSingleSpellAurasFromStack((*itr)->GetId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6573,7 +6573,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
|
||||||
}
|
}
|
||||||
CastSpell(target, spell, true, castItem, triggeredByAura);
|
CastSpell(target, spell, true, castItem, triggeredByAura);
|
||||||
if ((*itr)->DropAuraCharge())
|
if ((*itr)->DropAuraCharge())
|
||||||
RemoveAurasDueToSpell((*itr)->GetId());
|
RemoveSingleSpellAurasFromStack((*itr)->GetId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12039,7 +12039,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
||||||
removedSpells.unique();
|
removedSpells.unique();
|
||||||
// Remove auras from removedAuras
|
// Remove auras from removedAuras
|
||||||
for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();++i)
|
for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();++i)
|
||||||
RemoveAurasDueToSpell(*i);
|
RemoveSingleSpellAurasFromStack(*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8948"
|
#define REVISION_NR "8949"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue