[10842] Allow fill DB table spell_script_target for TARGET_AREAEFFECT_INSTANT(7)

Without any database entries for spell, spell will work like before.
Valid targets filled to database can only be creature type (corpse or alive).

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-12-08 16:17:16 +01:00
parent 08b32d7d32
commit 1b4209699f
3 changed files with 42 additions and 2 deletions

View file

@ -1788,11 +1788,47 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
case TARGET_AREAEFFECT_INSTANT:
{
SpellTargets targetB = SPELL_TARGETS_AOE_DAMAGE;
// Select friendly targets for positive effect
if (IsPositiveEffect(m_spellInfo->Id, effIndex))
targetB = SPELL_TARGETS_FRIENDLY;
FillAreaTargets(targetUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_DEST_CENTER, targetB);
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_caster->GetPositionX(), m_caster->GetPositionY(), radius, PUSH_DEST_CENTER, bounds.first != bounds.second ? SPELL_TARGETS_ALL : targetB);
if (!tempTargetUnitMap.empty())
{
for (UnitList::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)
{
if (i_spellST->second.type == SPELL_TARGET_TYPE_DEAD && ((Creature*)(*iter))->IsCorpse())
{
targetUnitMap.push_back((*iter));
}
else if (i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE && (*iter)->isAlive())
{
targetUnitMap.push_back((*iter));
}
break;
}
}
}
}
// exclude caster
targetUnitMap.remove(m_caster);
@ -6348,6 +6384,8 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) &&
m_spellInfo->EffectImplicitTargetA[eff] != TARGET_SCRIPT &&
m_spellInfo->EffectImplicitTargetB[eff] != TARGET_SCRIPT &&
m_spellInfo->EffectImplicitTargetA[eff] != TARGET_AREAEFFECT_INSTANT &&
m_spellInfo->EffectImplicitTargetB[eff] != TARGET_AREAEFFECT_INSTANT &&
m_spellInfo->EffectImplicitTargetA[eff] != TARGET_AREAEFFECT_CUSTOM &&
m_spellInfo->EffectImplicitTargetB[eff] != TARGET_AREAEFFECT_CUSTOM )
return false;

View file

@ -2960,6 +2960,8 @@ void SpellMgr::LoadSpellScriptTarget()
spellProto->EffectImplicitTargetB[i] == TARGET_SCRIPT_COORDINATES ||
spellProto->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT ||
spellProto->EffectImplicitTargetB[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT ||
spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_INSTANT ||
spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_INSTANT ||
spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_CUSTOM ||
spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_CUSTOM)
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10841"
#define REVISION_NR "10842"
#endif // __REVISION_NR_H__