aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Grids/Notifiers
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-11-19 15:43:22 -0300
committerjoschiwald <joschiwald.trinity@gmail.com>2018-01-21 14:51:49 +0100
commit2c022a5aa8123d12cfdc681000eeb62be039aff1 (patch)
treefb175272c335e108d80aed3c73d074f4438862e4 /src/server/game/Grids/Notifiers
parent771ec0b2256e0f88b365e47af5b8d837a3cae445 (diff)
Core/Entities: fix interaction of traps with ffa pvp and sanctuary flags
- Traps should select ATTACKABLE not UNFRIENDLY targets (it shouldn't attack unfriendly targets on sanctuary zones for example) - Made more readable the nasty oneliner in Unit::_IsValidAttackTarget Closes #6464 Closes #18271 (cherry picked from commit ef227d7e64a3dc62fbf0cba0209202310b1af00b)
Diffstat (limited to 'src/server/game/Grids/Notifiers')
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index 9c678db944e..f2611edab14 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -862,10 +862,10 @@ namespace Trinity
float i_range;
};
- class NearestUnfriendlyNoTotemUnitInObjectRangeCheck
+ class NearestAttackableNoTotemUnitInObjectRangeCheck
{
public:
- NearestUnfriendlyNoTotemUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) { }
+ NearestAttackableNoTotemUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) { }
bool operator()(Unit* u)
{
@@ -875,13 +875,13 @@ namespace Trinity
if (u->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
return false;
- if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsTotem())
+ if (u->GetTypeId() == TYPEID_UNIT && u->ToCreature()->IsTotem())
return false;
if (!u->isTargetableForAttack(false))
return false;
- if (!i_obj->IsWithinDistInMap(u, i_range) || i_funit->IsFriendlyTo(u))
+ if (!i_obj->IsWithinDistInMap(u, i_range) || !i_funit->_IsValidAttackTarget(u, nullptr, i_obj))
return false;
i_range = i_obj->GetDistance(*u);