[11766] fix spell redirection and totem destruction on hit by redirected spell

This commit is contained in:
Laise 2011-08-04 19:33:43 +03:00
parent 61f31980cf
commit c60425c6bd
11 changed files with 73 additions and 26 deletions

View file

@ -6042,7 +6042,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, Spell* spell, SpellEffectIndex eff)
return NULL;
// Magic case
if (spell && (spell->m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE || spell->m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC))
if (spell && spell->m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC)
{
Unit::AuraList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET);
for(Unit::AuraList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
@ -6050,12 +6050,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, Spell* spell, SpellEffectIndex eff)
if (Unit* magnet = (*itr)->GetCaster())
{
if (magnet->isAlive() && magnet->IsWithinLOSInMap(this) && spell->CheckTarget(magnet, eff))
{
if (SpellAuraHolder *holder = (*itr)->GetHolder())
if (holder->DropAuraCharge())
victim->RemoveSpellAuraHolder(holder);
return magnet;
}
}
}
}
@ -6070,12 +6065,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, Spell* spell, SpellEffectIndex eff)
if (magnet->isAlive() && magnet->IsWithinLOSInMap(this) && (!spell || spell->CheckTarget(magnet, eff)))
{
if (roll_chance_i((*i)->GetModifier()->m_amount))
{
if (SpellAuraHolder *holder = (*i)->GetHolder())
if (holder->DropAuraCharge())
victim->RemoveSpellAuraHolder(holder);
return magnet;
}
}
}
}
@ -9739,8 +9729,6 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
if (!triggeredByAura)
continue;
Modifier *auraModifier = triggeredByAura->GetModifier();
if (procSpell)
{
if (spellProcEvent)
@ -9769,7 +9757,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
continue;
}
SpellAuraProcResult procResult = (*this.*AuraProcHandler[auraModifier->m_auraname])(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown);
SpellAuraProcResult procResult = (*this.*AuraProcHandler[triggeredByHolder->GetSpellProto()->EffectApplyAuraName[i]])(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown);
switch (procResult)
{
case SPELL_AURA_PROC_CANT_TRIGGER: