From 2a875fb5e01b702a6984eb23b4f071e9ba3b5aa3 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 19 Apr 2009 11:42:16 -0500 Subject: [7686] Implement aura SPELL_AURA_ADD_CASTER_HIT_TRIGGER (111). Author: Lightguard --HG-- branch : trunk --- src/game/Spell.cpp | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) (limited to 'src/game/Spell.cpp') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 69ac197f6be..2656e1af3c5 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1569,6 +1569,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) break; } + if(!IsPositiveSpell(m_spellInfo->Id)) + if(Unit *magnet = m_caster->SelectMagnetTarget(target)) + if(magnet != target) + m_targets.setUnitTarget(magnet); + switch(cur) { case TARGET_UNIT_MINIPET: @@ -1577,7 +1582,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) break; case TARGET_UNIT_TARGET_ALLY: case TARGET_UNIT_TARGET_RAID: - case TARGET_UNIT_TARGET_ANY: // SelectMagnetTarget()? + case TARGET_UNIT_TARGET_ANY: case TARGET_UNIT_TARGET_PARTY: TagUnitMap.push_back(target); break; @@ -1586,8 +1591,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) break; case TARGET_UNIT_TARGET_ENEMY: if(EffectChainTarget <= 1) - TagUnitMap.push_back(SelectMagnetTarget()); - else if(SelectMagnetTarget()) //TODO: chain target should also use magnet target + TagUnitMap.push_back(target); + else SearchChainTarget(TagUnitMap, radius_h, EffectChainTarget, SPELL_TARGETS_ENEMY); break; case TARGET_UNIT_CHAINHEAL: @@ -5384,40 +5389,6 @@ bool Spell::CheckTarget( Unit* target, uint32 eff ) return true; } -Unit* Spell::SelectMagnetTarget() -{ - Unit* target = m_targets.getUnitTarget(); - - if(target && m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && target->HasAuraType(SPELL_AURA_SPELL_MAGNET)) //Attributes & 0x10 what is this? - { - Unit::AuraEffectList const& magnetAuras = target->GetAurasByType(SPELL_AURA_SPELL_MAGNET); - for(Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) - { - if(Unit* magnet = (*itr)->GetCaster()) - { - if((*itr)->GetParentAura()->DropAuraCharge()) - { - target = magnet; - m_targets.setUnitTarget(target); - AddUnitTarget(target, 0); - uint64 targetGUID = target->GetGUID(); - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) - { - if (targetGUID == ihit->targetGUID) // Found in list - { - (*ihit).damage = target->GetHealth(); - break; - } - } - break; - } - } - } - } - - return target; -} - bool Spell::IsNeedSendToClient() const { return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || IsChanneledSpell(m_spellInfo) || -- cgit v1.2.3