[7686] Implement aura SPELL_AURA_ADD_CASTER_HIT_TRIGGER (111).

Fixed bug with triggering SPELL_AURA_SPELL_MAGNET at non-magic casts (special weapon attacks).

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Lightguard 2009-04-19 00:38:30 +04:00 committed by VladimirMangos
parent b3c4e38409
commit f97735f519
6 changed files with 47 additions and 34 deletions

View file

@ -1542,9 +1542,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
{
if (EffectChainTarget <= 1)
{
Unit* pUnitTarget = SelectMagnetTarget();
if(pUnitTarget)
if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), m_spellInfo))
{
m_targets.setUnitTarget(pUnitTarget);
TagUnitMap.push_back(pUnitTarget);
}
}
else
{
@ -1871,9 +1873,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
}
else
{
Unit* pUnitTarget = SelectMagnetTarget();
if(pUnitTarget)
if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), m_spellInfo))
{
m_targets.setUnitTarget(pUnitTarget);
TagUnitMap.push_back(pUnitTarget);
}
}
}
}break;
@ -1905,9 +1909,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap)
}break;
case TARGET_SINGLE_ENEMY:
{
Unit* pUnitTarget = SelectMagnetTarget();
if(pUnitTarget)
if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), m_spellInfo))
{
m_targets.setUnitTarget(pUnitTarget);
TagUnitMap.push_back(pUnitTarget);
}
}break;
case TARGET_AREAEFFECT_PARTY:
{
@ -5419,30 +5425,6 @@ bool Spell::CheckTarget( Unit* target, uint32 eff )
return true;
}
Unit* Spell::SelectMagnetTarget()
{
Unit* target = m_targets.getUnitTarget();
if(target && target->HasAuraType(SPELL_AURA_SPELL_MAGNET) && !(m_spellInfo->Attributes & 0x10))
{
Unit::AuraList const& magnetAuras = target->GetAurasByType(SPELL_AURA_SPELL_MAGNET);
for(Unit::AuraList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
{
if(Unit* magnet = (*itr)->GetCaster())
{
if(magnet->IsWithinLOSInMap(m_caster))
{
target = magnet;
m_targets.setUnitTarget(target);
break;
}
}
}
}
return target;
}
bool Spell::IsNeedSendToClient() const
{
return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || IsChanneledSpell(m_spellInfo) ||