[11993] Fix some spell targeting

* Implement Target Type 51 as TARGET_AREAEFFECT_GO_AROUND_SOURCE
* Support spells that fill AoE targets based on source location
Thanks to Reamer for discussing these changes

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2012-05-10 19:13:13 +02:00
parent 5dbef19097
commit 74e3e55668
4 changed files with 39 additions and 8 deletions

View file

@ -1249,6 +1249,7 @@ enum Targets
TARGET_DYNAMIC_OBJECT_BEHIND = 48,
TARGET_DYNAMIC_OBJECT_LEFT_SIDE = 49,
TARGET_DYNAMIC_OBJECT_RIGHT_SIDE = 50,
TARGET_AREAEFFECT_GO_AROUND_SOURCE = 51,
TARGET_AREAEFFECT_GO_AROUND_DEST = 52, // gameobject around destination, select by spell_script_target
TARGET_CURRENT_ENEMY_COORDINATES = 53, // set unit coordinates as dest, only 16 target B imlemented
TARGET_LARGE_FRONTAL_CONE = 54,

View file

@ -2177,8 +2177,28 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
}
break;
}
case TARGET_AREAEFFECT_GO_AROUND_SOURCE:
case TARGET_AREAEFFECT_GO_AROUND_DEST:
{
float x, y, z;
if (targetMode == TARGET_AREAEFFECT_GO_AROUND_SOURCE)
{
if (m_targets.m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
x = m_targets.m_srcX;
y = m_targets.m_srcY;
z = m_targets.m_srcZ;
}
else
m_caster->GetPosition(x, y, z);
}
else
{
x = m_targets.m_destX;
y = m_targets.m_destY;
z = m_targets.m_destZ;
}
// It may be possible to fill targets for some spell effects
// automatically (SPELL_EFFECT_WMO_REPAIR(88) for example) but
// for some/most spells we clearly need/want to limit with spell_target_script
@ -2186,13 +2206,12 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
// Some spells untested, for affected GO type 33. May need further adjustments for spells related.
SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
for(SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST)
for (SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST)
{
if (i_spellST->second.type == SPELL_TARGET_TYPE_GAMEOBJECT)
{
// search all GO's with entry, within range of m_destN
MaNGOS::GameObjectEntryInPosRangeCheck go_check(*m_caster, i_spellST->second.targetEntry, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, radius);
MaNGOS::GameObjectEntryInPosRangeCheck go_check(*m_caster, i_spellST->second.targetEntry, x, y, z, radius);
MaNGOS::GameObjectListSearcher<MaNGOS::GameObjectEntryInPosRangeCheck> checker(tempTargetGOList, go_check);
Cell::VisitGridObjects(m_caster, checker, radius);
}

View file

@ -659,7 +659,7 @@ enum ReplenishType
namespace MaNGOS
{
struct MANGOS_DLL_DECL SpellNotifierPlayer
struct MANGOS_DLL_DECL SpellNotifierPlayer // Currently unused. When put to use this one requires handling for source-location (smilar to below)
{
Spell::UnitList &i_data;
Spell &i_spell;
@ -706,6 +706,7 @@ namespace MaNGOS
bool i_playerControlled;
float i_centerX;
float i_centerY;
float i_centerZ;
float GetCenterX() const { return i_centerX; }
float GetCenterY() const { return i_centerY; }
@ -734,8 +735,18 @@ namespace MaNGOS
}
break;
case PUSH_DEST_CENTER:
if (i_spell.m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
i_centerX = i_spell.m_targets.m_destX;
i_centerY = i_spell.m_targets.m_destY;
i_centerZ = i_spell.m_targets.m_destZ;
}
else
{
i_centerX = i_spell.m_targets.m_srcX;
i_centerY = i_spell.m_targets.m_srcY;
i_centerZ = i_spell.m_targets.m_srcZ;
}
break;
case PUSH_TARGET_CENTER:
if (Unit* target = i_spell.m_targets.getUnitTarget())
@ -833,7 +844,7 @@ namespace MaNGOS
i_data->push_back(itr->getSource());
break;
case PUSH_DEST_CENTER:
if (itr->getSource()->IsWithinDist3d(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ,i_radius))
if (itr->getSource()->IsWithinDist3d(i_centerX, i_centerY, i_centerZ, i_radius))
i_data->push_back(itr->getSource());
break;
case PUSH_TARGET_CENTER:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11992"
#define REVISION_NR "11993"
#endif // __REVISION_NR_H__