Core/Spells: Removed unneeded phase check from spell casts, its already done in canSeeOrDetect for spells that need it. Probably more phase checks are not needed either
This commit is contained in:
@@ -1107,7 +1107,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
||||
break;
|
||||
case EVENT_T_RANGE:
|
||||
if (me->getVictim())
|
||||
if (me->IsInMap(me->getVictim()))
|
||||
if (me->IsInMap(me->getVictim()) && me->InSamePhase(me->getVictim()))
|
||||
if (me->IsInRange(me->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist))
|
||||
ProcessEvent(*i);
|
||||
break;
|
||||
|
||||
@@ -75,7 +75,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
|
||||
return false;
|
||||
|
||||
// not in same map or phase
|
||||
if (!hatedUnit->IsInMap(hatingUnit))
|
||||
if (!hatedUnit->IsInMap(hatingUnit) || !hatedUnit->InSamePhase(hatingUnit))
|
||||
return false;
|
||||
|
||||
// spell not causing threat
|
||||
@@ -182,6 +182,7 @@ void HostileReference::updateOnlineStatus()
|
||||
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster())
|
||||
&& !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT)
|
||||
&& getTarget()->IsInMap(getSourceUnit())
|
||||
&& getTarget()->InSamePhase(getSourceUnit())
|
||||
)
|
||||
{
|
||||
Creature* creature = getSourceUnit()->ToCreature();
|
||||
|
||||
@@ -685,7 +685,7 @@ class WorldObject : public Object, public WorldLocation
|
||||
bool IsInMap(const WorldObject* obj) const
|
||||
{
|
||||
if (obj)
|
||||
return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj);
|
||||
return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap());
|
||||
return false;
|
||||
}
|
||||
bool IsWithinDist3d(float x, float y, float z, float dist) const
|
||||
@@ -703,7 +703,7 @@ class WorldObject : public Object, public WorldLocation
|
||||
}
|
||||
bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const
|
||||
{
|
||||
return obj && IsInMap(obj) && _IsWithinDist(obj, dist2compare, is3D);
|
||||
return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D);
|
||||
}
|
||||
bool IsWithinLOS(float x, float y, float z) const;
|
||||
bool IsWithinLOSInMap(const WorldObject* obj) const;
|
||||
|
||||
@@ -460,7 +460,7 @@ void Unit::resetAttackTimer(WeaponAttackType type)
|
||||
|
||||
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
|
||||
{
|
||||
if (!obj || !IsInMap(obj))
|
||||
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
|
||||
return false;
|
||||
|
||||
float dx = GetPositionX() - obj->GetPositionX();
|
||||
@@ -476,7 +476,7 @@ bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
|
||||
|
||||
bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
|
||||
{
|
||||
if (!obj || !IsInMap(obj))
|
||||
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
|
||||
return false;
|
||||
|
||||
float dx = GetPositionX() - obj->GetPositionX();
|
||||
|
||||
@@ -1287,7 +1287,7 @@ namespace Trinity
|
||||
AllWorldObjectsInRange(const WorldObject* object, float maxRange) : m_pObject(object), m_fRange(maxRange) {}
|
||||
bool operator() (WorldObject* go)
|
||||
{
|
||||
return m_pObject->IsWithinDist(go, m_fRange, false);
|
||||
return m_pObject->IsWithinDist(go, m_fRange, false) && m_pObject->InSamePhase(go);
|
||||
}
|
||||
private:
|
||||
const WorldObject* m_pObject;
|
||||
|
||||
@@ -251,9 +251,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
|
||||
return;
|
||||
|
||||
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
@@ -263,9 +262,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
|
||||
return;
|
||||
|
||||
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
@@ -275,9 +273,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
|
||||
return;
|
||||
|
||||
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
@@ -287,9 +284,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
|
||||
return;
|
||||
|
||||
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
@@ -299,9 +295,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
|
||||
return;
|
||||
|
||||
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
// Gameobject searchers
|
||||
|
||||
Reference in New Issue
Block a user