[9828] Fix TARGET_AREAEFFECT_CUSTOM

This commit is contained in:
Laise 2010-05-03 11:14:11 +03:00
parent d3f6a89313
commit 577812ff6e
4 changed files with 46 additions and 4 deletions

View file

@ -1496,7 +1496,6 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
case TARGET_TOTEM_FIRE:
case TARGET_SELF:
case TARGET_SELF2:
case TARGET_AREAEFFECT_CUSTOM:
case TARGET_AREAEFFECT_CUSTOM_2:
targetUnitMap.push_back(m_caster);
break;
@ -1707,6 +1706,44 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
targetUnitMap.remove(m_caster);
break;
}
case TARGET_AREAEFFECT_CUSTOM:
{
if (m_spellInfo->Effect[effIndex] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
break;
else if (m_spellInfo->Effect[effIndex] == SPELL_EFFECT_SUMMON)
{
targetUnitMap.push_back(m_caster);
break;
}
std::list<Unit*> 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)
{
if ((*iter)->GetTypeId() != TYPEID_UNIT)
continue;
for(SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST)
{
// only creature entries supported for this target type
if (i_spellST->second.type == SPELL_TARGET_TYPE_GAMEOBJECT)
continue;
if ((*iter)->GetEntry() == i_spellST->second.targetEntry)
{
targetUnitMap.push_back((*iter));
break;
}
}
}
}
break;
}
case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
{
// targets the ground, not the units in the area