[11748] Replace SpellModifier struct by direct aura access (this should fix charge drops of 36032) also revert [11740]

This commit is contained in:
Laise 2011-07-20 15:41:01 +03:00
parent c9a9179d89
commit e178c79d51
10 changed files with 131 additions and 267 deletions

View file

@ -372,7 +372,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE };
Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem) :
m_spellmod(NULL), m_periodicTimer(0), m_periodicTick(0), m_removeMode(AURA_REMOVE_BY_DEFAULT),
m_periodicTimer(0), m_periodicTick(0), m_removeMode(AURA_REMOVE_BY_DEFAULT),
m_effIndex(eff), m_positive(false), m_isPeriodic(false), m_isAreaAura(false),
m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder)
{
@ -855,7 +855,7 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
return spell->IsFitToFamily(SpellFamily(GetSpellProto()->SpellFamilyName), GetAuraSpellClassMask());
}
bool Aura::CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const
bool Aura::CanProcFrom(SpellEntry const *spell, uint32 procFlag, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const
{
// Check EffectClassMask
ClassFamilyMask const& mask = GetAuraSpellClassMask();
@ -865,6 +865,16 @@ bool Aura::CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procE
{
if (!(EventProcEx & PROC_EX_EX_TRIGGER_ALWAYS))
{
// modifier aura procs by default are not active and only allowed with non zero charges
// procEx == PROC_EX_NORMAL_HIT only for real "on cast" cases
if (!active && procEx == PROC_EX_NORMAL_HIT && (procFlag & SPELL_CAST_TRIGGER_MASK))
{
if (GetHolder()->GetAuraCharges() > 0)
return true;
else
return false;
}
// Check for extra req (if none) and hit/crit
if (EventProcEx == PROC_EX_NONE)
{
@ -1015,30 +1025,24 @@ void Aura::HandleAddModifier(bool apply, bool Real)
break;
}
m_spellmod = new SpellModifier(
SpellModOp(m_modifier.m_miscvalue),
SpellModType(m_modifier.m_auraname), // SpellModType value == spell aura types
m_modifier.m_amount,
this,
// prevent expire spell mods with (charges > 0 && m_stackAmount > 1)
// all this spell expected expire not at use but at spell proc event check
GetSpellProto()->StackAmount > 1 ? 0 : GetHolder()->GetAuraCharges());
// Everlasting Affliction, overwrite wrong data, if will need more better restore support of spell_affect table
if (spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && spellProto->SpellIconID == 3169)
{
// Corruption and Unstable Affliction
m_spellmod->mask = ClassFamilyMask(UI64LIT(0x0000010000000002));
// TODO: drop when override will be possible
SpellEntry *entry = (SpellEntry*)(&(*spellProto));
entry->EffectSpellClassMask[GetEffIndex()].Flags = UI64LIT(0x0000010000000002);
}
// Improved Flametongue Weapon, overwrite wrong data, maybe time re-add table
else if (spellProto->Id == 37212)
{
// Flametongue Weapon (Passive)
m_spellmod->mask = ClassFamilyMask(UI64LIT(0x0000000000200000));
// TODO: drop when override will be possible
SpellEntry *entry = (SpellEntry*)(&(*spellProto));
entry->EffectSpellClassMask[GetEffIndex()].Flags = UI64LIT(0x0000000000200000);
}
}
((Player*)GetTarget())->AddSpellMod(m_spellmod, apply);
((Player*)GetTarget())->AddSpellMod(this, apply);
ReapplyAffectedPassiveAuras();
}
@ -2840,39 +2844,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
break;
}
case SPELLFAMILY_PRIEST:
{
// Pain and Suffering
if (GetSpellProto()->SpellIconID == 2874 && target->GetTypeId()==TYPEID_PLAYER)
{
if (apply)
{
// Reduce backfire damage (dot damage) from Shadow Word: Death
// aura have wrong effectclassmask, so use hardcoded value
m_spellmod = new SpellModifier(SPELLMOD_DOT,SPELLMOD_PCT,m_modifier.m_amount,GetId(),UI64LIT(0x0000200000000000));
}
((Player*)target)->AddSpellMod(m_spellmod, apply);
return;
}
break;
}
case SPELLFAMILY_DRUID:
{
switch(GetId())
{
case 34246: // Idol of the Emerald Queen
case 60779: // Idol of Lush Moss
{
if (target->GetTypeId() != TYPEID_PLAYER)
return;
if (apply)
// dummy not have proper effectclassmask
m_spellmod = new SpellModifier(SPELLMOD_DOT,SPELLMOD_FLAT,m_modifier.m_amount/7,GetId(),UI64LIT(0x001000000000));
((Player*)target)->AddSpellMod(m_spellmod, apply);
return;
}
case 52610: // Savage Roar
{
if (apply)