From f088698922e1bc34ef0332dae5a4768f45115d3d Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 12 Dec 2008 21:37:42 -0600 Subject: *Fix the bug that grounding totem cause client crash. --HG-- branch : trunk --- src/game/SharedDefines.h | 3 +-- src/game/Spell.cpp | 16 +++++++++------- src/game/Spell.h | 1 + 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 52719b02ea8..94e11f52abd 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -906,8 +906,7 @@ enum SpellMissInfo SPELL_MISS_IMMUNE2 = 8, SPELL_MISS_DEFLECT = 9, SPELL_MISS_ABSORB = 10, - SPELL_MISS_REFLECT = 11, - SPELL_MISS_KILL = 12, // kill grounding totem + SPELL_MISS_REFLECT = 11 }; enum SpellHitType diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 96cf260adc5..c253c6a30b3 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -783,6 +783,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) target.targetGUID = targetGUID; // Store target GUID target.effectMask = 1<killTarget) + { + // remove spell_magnet aura after first spell redirect and destroy target if its totem + if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->isTotem()) + unit->Kill(unit); + } + // Get original caster (if exist) and calculate damage/healing from him data Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster; @@ -1036,12 +1044,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him DoSpellHitOnUnit(m_caster, mask); } - else if (missInfo == SPELL_MISS_KILL) - { - // remove spell_magnet aura after first spell redirect and destroy target if its totem - if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->isTotem()) - unit->Kill(unit); - } else //TODO: This is a hack. need fix { uint32 tempMask = 0; @@ -5382,7 +5384,7 @@ Unit* Spell::SelectMagnetTarget() { if (targetGUID == ihit->targetGUID) // Found in list { - (*ihit).missCondition = SPELL_MISS_KILL; + (*ihit).killTarget = true; break; } } diff --git a/src/game/Spell.h b/src/game/Spell.h index 509d65ad87e..8b5c3e6d7c6 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -504,6 +504,7 @@ class Spell SpellMissInfo reflectResult:8; uint8 effectMask:8; bool processed:1; + bool killTarget:1; }; std::list m_UniqueTargetInfo; uint8 m_needAliveTargetMask; // Mask req. alive targets -- cgit v1.2.3