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;
|
break;
|
||||||
case EVENT_T_RANGE:
|
case EVENT_T_RANGE:
|
||||||
if (me->getVictim())
|
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))
|
if (me->IsInRange(me->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist))
|
||||||
ProcessEvent(*i);
|
ProcessEvent(*i);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// not in same map or phase
|
// not in same map or phase
|
||||||
if (!hatedUnit->IsInMap(hatingUnit))
|
if (!hatedUnit->IsInMap(hatingUnit) || !hatedUnit->InSamePhase(hatingUnit))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// spell not causing threat
|
// spell not causing threat
|
||||||
@@ -182,6 +182,7 @@ void HostileReference::updateOnlineStatus()
|
|||||||
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster())
|
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster())
|
||||||
&& !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT)
|
&& !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT)
|
||||||
&& getTarget()->IsInMap(getSourceUnit())
|
&& getTarget()->IsInMap(getSourceUnit())
|
||||||
|
&& getTarget()->InSamePhase(getSourceUnit())
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Creature* creature = getSourceUnit()->ToCreature();
|
Creature* creature = getSourceUnit()->ToCreature();
|
||||||
|
|||||||
@@ -685,7 +685,7 @@ class WorldObject : public Object, public WorldLocation
|
|||||||
bool IsInMap(const WorldObject* obj) const
|
bool IsInMap(const WorldObject* obj) const
|
||||||
{
|
{
|
||||||
if (obj)
|
if (obj)
|
||||||
return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj);
|
return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool IsWithinDist3d(float x, float y, float z, float dist) const
|
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
|
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 IsWithinLOS(float x, float y, float z) const;
|
||||||
bool IsWithinLOSInMap(const WorldObject* obj) 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
|
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
|
||||||
{
|
{
|
||||||
if (!obj || !IsInMap(obj))
|
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float dx = GetPositionX() - obj->GetPositionX();
|
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
|
bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
|
||||||
{
|
{
|
||||||
if (!obj || !IsInMap(obj))
|
if (!obj || !IsInMap(obj) || !InSamePhase(obj))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float dx = GetPositionX() - obj->GetPositionX();
|
float dx = GetPositionX() - obj->GetPositionX();
|
||||||
|
|||||||
@@ -1287,7 +1287,7 @@ namespace Trinity
|
|||||||
AllWorldObjectsInRange(const WorldObject* object, float maxRange) : m_pObject(object), m_fRange(maxRange) {}
|
AllWorldObjectsInRange(const WorldObject* object, float maxRange) : m_pObject(object), m_fRange(maxRange) {}
|
||||||
bool operator() (WorldObject* go)
|
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:
|
private:
|
||||||
const WorldObject* m_pObject;
|
const WorldObject* m_pObject;
|
||||||
|
|||||||
@@ -251,9 +251,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
if (i_check(itr->getSource()))
|
||||||
if (i_check(itr->getSource()))
|
i_objects.push_back(itr->getSource());
|
||||||
i_objects.push_back(itr->getSource());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Check>
|
template<class Check>
|
||||||
@@ -263,9 +262,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
if (i_check(itr->getSource()))
|
||||||
if (i_check(itr->getSource()))
|
i_objects.push_back(itr->getSource());
|
||||||
i_objects.push_back(itr->getSource());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Check>
|
template<class Check>
|
||||||
@@ -275,9 +273,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
if (i_check(itr->getSource()))
|
||||||
if (i_check(itr->getSource()))
|
i_objects.push_back(itr->getSource());
|
||||||
i_objects.push_back(itr->getSource());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Check>
|
template<class Check>
|
||||||
@@ -287,9 +284,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
if (i_check(itr->getSource()))
|
||||||
if (i_check(itr->getSource()))
|
i_objects.push_back(itr->getSource());
|
||||||
i_objects.push_back(itr->getSource());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Check>
|
template<class Check>
|
||||||
@@ -299,9 +295,8 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
if (i_check(itr->getSource()))
|
||||||
if (i_check(itr->getSource()))
|
i_objects.push_back(itr->getSource());
|
||||||
i_objects.push_back(itr->getSource());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gameobject searchers
|
// Gameobject searchers
|
||||||
|
|||||||
Reference in New Issue
Block a user