diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SharedDefines.h | 1 | ||||
-rw-r--r-- | src/game/Spell.cpp | 33 | ||||
-rw-r--r-- | src/game/Spell.h | 1 |
3 files changed, 19 insertions, 16 deletions
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 0d40b4c50dc..3f04e510b20 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -908,6 +908,7 @@ enum SpellMissInfo SPELL_MISS_DEFLECT = 9, SPELL_MISS_ABSORB = 10, SPELL_MISS_REFLECT = 11, + SPELL_MISS_KILL = 12, // kill grounding totem }; enum SpellHitType diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 199e6386b32..916bc984883 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -286,8 +286,6 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi m_caster = Caster; m_selfContainer = NULL; m_triggeringContainer = triggeringContainer; - m_magnetPair.first = false; - m_magnetPair.second = NULL; m_referencedFromCurrentSpell = false; m_executedCurrently = false; 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 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; @@ -1169,14 +1173,6 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if(!unit || !effectMask) 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) if( m_spellInfo->speed && !(m_spellInfo->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) @@ -5310,7 +5306,7 @@ CurrentSpellTypes Spell::GetCurrentContainer() 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) - if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF && !m_magnetPair.first) + if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF) { if (!CheckTargetCreatureType(target)) return false; @@ -5391,14 +5387,21 @@ Unit* Spell::SelectMagnetTarget() { 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); - m_magnetPair.first = true; - m_magnetPair.second = magnet; - target = magnet; 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; } } diff --git a/src/game/Spell.h b/src/game/Spell.h index 1bdb7154177..79cfe0a2a62 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -364,7 +364,6 @@ class Spell void SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap); Unit* SelectMagnetTarget(); - std::pair <bool,Unit *> m_magnetPair; bool CheckTarget( Unit* target, uint32 eff, bool hitPhase ); void SendCastResult(uint8 result); |