[9833] Allow TARGET_AREAEFFECT_CUSTOM to target invisible/not targetable npc if script target for them exists

This commit is contained in:
Laise 2010-05-04 15:04:23 +03:00
parent 92ab082fc6
commit 8a4b520979
3 changed files with 15 additions and 4 deletions

View file

@ -1716,14 +1716,14 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
break;
}
std::list<Unit*> tempTargetUnitMap;
UnitList tempTargetUnitMap;
SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
// fill real target list if no spell script target defined
FillAreaTargets(bounds.first != bounds.second ? tempTargetUnitMap : targetUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_ALL);
if (!tempTargetUnitMap.empty())
{
for (std::list<Unit*>::const_iterator iter = tempTargetUnitMap.begin(); iter != tempTargetUnitMap.end(); ++iter)
for (UnitList::const_iterator iter = tempTargetUnitMap.begin(); iter != tempTargetUnitMap.end(); ++iter)
{
if ((*iter)->GetTypeId() != TYPEID_UNIT)
continue;
@ -1742,6 +1742,17 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
}
}
}
else
{
// remove not targetable units if spell has no script targets
for (UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); )
{
if (!(*itr)->isTargetableForAttack(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD))
targetUnitMap.erase(itr++);
else
++itr;
}
}
break;
}
case TARGET_ALL_ENEMY_IN_AREA_INSTANT:

View file

@ -709,7 +709,7 @@ namespace MaNGOS
{
// there are still more spells which can be casted on dead, but
// they are no AOE and don't have such a nice SPELL_ATTR flag
if ( !itr->getSource()->isTargetableForAttack(i_spell.m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD)
if ( (i_TargetType != SPELL_TARGETS_ALL && !itr->getSource()->isTargetableForAttack(i_spell.m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD))
// mostly phase check
|| !itr->getSource()->IsInMap(i_originalCaster))
continue;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9832"
#define REVISION_NR "9833"
#endif // __REVISION_NR_H__