*Use another way to kill magnet totem.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-10 11:19:50 -06:00
parent c2b217a1c1
commit ac822bb616
3 changed files with 19 additions and 16 deletions
+1
View File
@@ -908,6 +908,7 @@ enum SpellMissInfo
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
+18 -15
View File
@@ -286,8 +286,6 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_caster = Caster; m_caster = Caster;
m_selfContainer = NULL; m_selfContainer = NULL;
m_triggeringContainer = triggeringContainer; m_triggeringContainer = triggeringContainer;
m_magnetPair.first = false;
m_magnetPair.second = NULL;
m_referencedFromCurrentSpell = false; m_referencedFromCurrentSpell = false;
m_executedCurrently = false; m_executedCurrently = false;
m_delayAtDamageCount = 0; m_delayAtDamageCount = 0;
@@ -1037,6 +1035,12 @@ 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;
@@ -1169,14 +1173,6 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(!unit || !effectMask) if(!unit || !effectMask)
return; return;
// remove spell_magnet aura after first spell redirect and destroy target if its totem
if(m_magnetPair.first && m_magnetPair.second && m_magnetPair.second == unit)
{
if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->isTotem())
unit->DealDamage(unit,unit->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
}
// Recheck immune (only for delayed spells) // Recheck immune (only for delayed spells)
if( m_spellInfo->speed && if( m_spellInfo->speed &&
!(m_spellInfo->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) !(m_spellInfo->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)
@@ -5310,7 +5306,7 @@ CurrentSpellTypes Spell::GetCurrentContainer()
bool Spell::CheckTarget( Unit* target, uint32 eff, bool hitPhase ) bool Spell::CheckTarget( Unit* target, uint32 eff, bool hitPhase )
{ {
// Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets) // Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets)
if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF && !m_magnetPair.first) if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF)
{ {
if (!CheckTargetCreatureType(target)) if (!CheckTargetCreatureType(target))
return false; return false;
@@ -5391,14 +5387,21 @@ Unit* Spell::SelectMagnetTarget()
{ {
if(Unit* magnet = (*itr)->GetCaster()) if(Unit* magnet = (*itr)->GetCaster())
{ {
if((*itr)->m_procCharges>0 && magnet->IsWithinLOSInMap(m_caster)) if((*itr)->m_procCharges>0)
{ {
(*itr)->SetAuraProcCharges((*itr)->m_procCharges-1); (*itr)->SetAuraProcCharges((*itr)->m_procCharges-1);
m_magnetPair.first = true;
m_magnetPair.second = magnet;
target = magnet; target = magnet;
m_targets.setUnitTarget(target); m_targets.setUnitTarget(target);
AddUnitTarget(target, 0);
uint64 targetGUID = target->GetGUID();
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
{
if (targetGUID == ihit->targetGUID) // Found in list
{
(*ihit).missCondition = SPELL_MISS_KILL;
break;
}
}
break; break;
} }
} }
-1
View File
@@ -364,7 +364,6 @@ class Spell
void SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap); void SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap);
Unit* SelectMagnetTarget(); Unit* SelectMagnetTarget();
std::pair <bool,Unit *> m_magnetPair;
bool CheckTarget( Unit* target, uint32 eff, bool hitPhase ); bool CheckTarget( Unit* target, uint32 eff, bool hitPhase );
void SendCastResult(uint8 result); void SendCastResult(uint8 result);