*Fix the bug that grounding totem cause client crash.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-12 21:37:42 -06:00
parent 55d9e4c01d
commit f088698922
3 changed files with 11 additions and 9 deletions
+1 -2
View File
@@ -906,8 +906,7 @@ enum SpellMissInfo
SPELL_MISS_IMMUNE2 = 8, SPELL_MISS_IMMUNE2 = 8,
SPELL_MISS_DEFLECT = 9, SPELL_MISS_DEFLECT = 9,
SPELL_MISS_ABSORB = 10, SPELL_MISS_ABSORB = 10,
SPELL_MISS_REFLECT = 11, SPELL_MISS_REFLECT = 11
SPELL_MISS_KILL = 12, // kill grounding totem
}; };
enum SpellHitType enum SpellHitType
+9 -7
View File
@@ -783,6 +783,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
target.targetGUID = targetGUID; // Store target GUID target.targetGUID = targetGUID; // Store target GUID
target.effectMask = 1<<effIndex; // Store index of effect target.effectMask = 1<<effIndex; // Store index of effect
target.processed = false; // Effects not apply on target target.processed = false; // Effects not apply on target
target.killTarget = false;
// Calculate hit result // Calculate hit result
if(m_originalCaster) if(m_originalCaster)
@@ -1007,6 +1008,13 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (!unit) if (!unit)
return; return;
if(target->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 // Get original caster (if exist) and calculate damage/healing from him data
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster; 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 if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
DoSpellHitOnUnit(m_caster, mask); 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 else //TODO: This is a hack. need fix
{ {
uint32 tempMask = 0; uint32 tempMask = 0;
@@ -5382,7 +5384,7 @@ Unit* Spell::SelectMagnetTarget()
{ {
if (targetGUID == ihit->targetGUID) // Found in list if (targetGUID == ihit->targetGUID) // Found in list
{ {
(*ihit).missCondition = SPELL_MISS_KILL; (*ihit).killTarget = true;
break; break;
} }
} }
+1
View File
@@ -504,6 +504,7 @@ class Spell
SpellMissInfo reflectResult:8; SpellMissInfo reflectResult:8;
uint8 effectMask:8; uint8 effectMask:8;
bool processed:1; bool processed:1;
bool killTarget:1;
}; };
std::list<TargetInfo> m_UniqueTargetInfo; std::list<TargetInfo> m_UniqueTargetInfo;
uint8 m_needAliveTargetMask; // Mask req. alive targets uint8 m_needAliveTargetMask; // Mask req. alive targets