mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 13:47:23 +01:00
Core/Spells: Fix DynamicObject AoE effects for invisible targets e.g Flare. Original patch by Elron
Closes #5898
This commit is contained in:
@@ -927,13 +927,15 @@ namespace Trinity
|
||||
{
|
||||
public:
|
||||
AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range)
|
||||
: i_obj(obj), i_funit(funit), i_range(range)
|
||||
: i_obj(obj), i_funit(funit), _spellInfo(NULL), i_range(range)
|
||||
{
|
||||
Unit const* check = i_funit;
|
||||
Unit const* owner = i_funit->GetOwner();
|
||||
if (owner)
|
||||
check = owner;
|
||||
i_targetForPlayer = (check->GetTypeId() == TYPEID_PLAYER);
|
||||
if (i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT)
|
||||
_spellInfo = sSpellMgr->GetSpellInfo(((DynamicObject*)i_obj)->GetSpellId());
|
||||
}
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
@@ -941,7 +943,7 @@ namespace Trinity
|
||||
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
|
||||
return false;
|
||||
|
||||
if (i_funit->IsValidAttackTarget(u) && i_obj->IsWithinDistInMap(u, i_range))
|
||||
if (i_funit->_IsValidAttackTarget(u, _spellInfo) && i_obj->IsWithinDistInMap(u, i_range))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -950,6 +952,7 @@ namespace Trinity
|
||||
bool i_targetForPlayer;
|
||||
WorldObject const* i_obj;
|
||||
Unit const* i_funit;
|
||||
SpellInfo const* _spellInfo;
|
||||
float i_range;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user