[10855] Add TARGET_AREAEFFECT_GO_AROUND_DEST(52) (renamed from TARGET_AREAEFFECT_CUSTOM_2)

Target selects all gameobject around destination, limited by adding spell with a corresponding gameobject entry in database table spell_script_target.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-12-11 10:27:34 +01:00
parent 052e210dac
commit 7751579303
6 changed files with 100 additions and 6 deletions

View file

@ -687,6 +687,68 @@ namespace MaNGOS
NearestGameObjectEntryInObjectRangeCheck(NearestGameObjectEntryInObjectRangeCheck const&);
};
// Success at gameobject in range of xyz, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO)
class NearestGameObjectEntryInPosRangeCheck
{
public:
NearestGameObjectEntryInPosRangeCheck(WorldObject const& obj, uint32 entry, float x, float y, float z, float range)
: i_obj(obj), i_x(x), i_y(y), i_z(z), i_entry(entry), i_range(range) {}
WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(GameObject* go)
{
if (go->GetEntry() == i_entry && go->IsWithinDist3d(i_x, i_y, i_z, i_range))
{
// use found GO range as new range limit for next check
i_range = go->GetDistance(i_x,i_y,i_z);
return true;
}
return false;
}
float GetLastRange() const { return i_range; }
private:
WorldObject const& i_obj;
uint32 i_entry;
float i_x, i_y, i_z;
float i_range;
// prevent clone this object
NearestGameObjectEntryInPosRangeCheck(NearestGameObjectEntryInPosRangeCheck const&);
};
// Success at gameobject with entry in range of provided xyz
class GameObjectEntryInPosRangeCheck
{
public:
GameObjectEntryInPosRangeCheck(WorldObject const& obj, uint32 entry, float x, float y, float z, float range)
: i_obj(obj), i_x(x), i_y(y), i_z(z), i_entry(entry), i_range(range) {}
WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(GameObject* go)
{
if (go->GetEntry() == i_entry && go->IsWithinDist3d(i_x, i_y, i_z, i_range))
return true;
return false;
}
float GetLastRange() const { return i_range; }
private:
WorldObject const& i_obj;
uint32 i_entry;
float i_x, i_y, i_z;
float i_range;
// prevent clone this object
GameObjectEntryInPosRangeCheck(GameObjectEntryInPosRangeCheck const&);
};
class GameObjectWithDbGUIDCheck
{
public:

View file

@ -1076,7 +1076,7 @@ enum Targets
TARGET_DYNAMIC_OBJECT_BEHIND = 48,
TARGET_DYNAMIC_OBJECT_LEFT_SIDE = 49,
TARGET_DYNAMIC_OBJECT_RIGHT_SIDE = 50,
TARGET_AREAEFFECT_CUSTOM_2 = 52,
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,
TARGET_ALL_RAID_AROUND_CASTER = 56,

View file

@ -1588,7 +1588,6 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
case TARGET_TOTEM_FIRE:
case TARGET_SELF:
case TARGET_SELF2:
case TARGET_AREAEFFECT_CUSTOM_2:
targetUnitMap.push_back(m_caster);
break;
case TARGET_RANDOM_ENEMY_CHAIN_IN_AREA:
@ -1891,6 +1890,37 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
}
break;
}
case TARGET_AREAEFFECT_GO_AROUND_DEST:
{
// 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
// Some spells untested, for affected GO type 33. May need further adjustments for spells related.
SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
std::list<GameObject*> tempTargetGOList;
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::GameObjectListSearcher<MaNGOS::GameObjectEntryInPosRangeCheck> checker(tempTargetGOList, go_check);
Cell::VisitGridObjects(m_caster, checker, radius);
}
}
if (!tempTargetGOList.empty())
{
for(std::list<GameObject*>::iterator iter = tempTargetGOList.begin(); iter != tempTargetGOList.end(); ++iter)
AddGOTarget(*iter, effIndex);
}
break;
}
case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
{
// targets the ground, not the units in the area

View file

@ -2964,7 +2964,9 @@ void SpellMgr::LoadSpellScriptTarget()
spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_INSTANT ||
spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_INSTANT ||
spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_CUSTOM ||
spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_CUSTOM)
spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_CUSTOM ||
spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_GO_AROUND_DEST ||
spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_GO_AROUND_DEST)
{
targetfound = true;
break;

View file

@ -266,7 +266,7 @@ inline bool IsCasterSourceTarget(uint32 target)
case TARGET_TOTEM_WATER:
case TARGET_TOTEM_AIR:
case TARGET_TOTEM_FIRE:
case TARGET_AREAEFFECT_CUSTOM_2:
case TARGET_AREAEFFECT_GO_AROUND_DEST:
case TARGET_ALL_RAID_AROUND_CASTER:
case TARGET_SELF2:
case TARGET_DIRECTLY_FORWARD:
@ -358,7 +358,7 @@ inline bool IsAreaEffectTarget( Targets target )
case TARGET_ALL_PARTY:
case TARGET_ALL_PARTY_AROUND_CASTER_2:
case TARGET_AREAEFFECT_PARTY:
case TARGET_AREAEFFECT_CUSTOM_2:
case TARGET_AREAEFFECT_GO_AROUND_DEST:
case TARGET_ALL_RAID_AROUND_CASTER:
case TARGET_AREAEFFECT_PARTY_AND_CLASS:
case TARGET_IN_FRONT_OF_CASTER_30:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10854"
#define REVISION_NR "10855"
#endif // __REVISION_NR_H__