mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 09:33:47 +00:00
fix(Core/Spells): only include the targets size for some GroundEffects (#23478)
This commit is contained in:
@@ -182,7 +182,7 @@ void CreatureAI::MoveInLineOfSight(Unit* who)
|
||||
if (me->IsMoveInLineOfSightDisabled())
|
||||
if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || // nothing more to do, return
|
||||
!who->IsInCombat() || // if not in combat, nothing more to do
|
||||
!me->IsWithinDist(who, ATTACK_DISTANCE, true, false)) // if in combat and in dist - neutral to all can actually assist other creatures
|
||||
!me->IsWithinDist(who, ATTACK_DISTANCE, true, false, false)) // if in combat and in dist - neutral to all can actually assist other creatures
|
||||
return;
|
||||
|
||||
if (me->HasReactState(REACT_AGGRESSIVE) && me->CanStartAttack(who))
|
||||
|
||||
@@ -566,7 +566,7 @@ Player* ScriptedAI::SelectTargetFromPlayerList(float maxdist, uint32 excludeAura
|
||||
std::vector<Player*> tList;
|
||||
for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
||||
{
|
||||
if (!me->IsWithinDistInMap(itr->GetSource(), maxdist, true, false) || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster())
|
||||
if (!me->IsWithinDistInMap(itr->GetSource(), maxdist, true, false, false) || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster())
|
||||
continue;
|
||||
if (excludeAura && itr->GetSource()->HasAura(excludeAura))
|
||||
continue;
|
||||
|
||||
@@ -218,10 +218,10 @@ bool npc_escortAI::IsPlayerOrGroupInRange()
|
||||
{
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
||||
if (Player* member = groupRef->GetSource())
|
||||
if (me->IsWithinDistInMap(member, GetMaxPlayerDistance(), true, false))
|
||||
if (me->IsWithinDistInMap(member, GetMaxPlayerDistance(), true, false, false))
|
||||
return true;
|
||||
}
|
||||
else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance(), true, false))
|
||||
else if (me->IsWithinDistInMap(player, GetMaxPlayerDistance(), true, false, false))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff)
|
||||
{
|
||||
Player* member = groupRef->GetSource();
|
||||
|
||||
if (member && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE, true, false))
|
||||
if (member && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE, true, false, false))
|
||||
{
|
||||
bIsMaxRangeExceeded = false;
|
||||
break;
|
||||
@@ -211,7 +211,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (me->IsWithinDistInMap(player, MAX_PLAYER_DISTANCE, true, false))
|
||||
if (me->IsWithinDistInMap(player, MAX_PLAYER_DISTANCE, true, false, false))
|
||||
bIsMaxRangeExceeded = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,7 +771,7 @@ void Creature::Update(uint32 diff)
|
||||
}
|
||||
|
||||
Unit* owner = GetCharmerOrOwner();
|
||||
if (IsCharmed() && !IsWithinDistInMap(owner, GetMap()->GetVisibilityRange(), true, false))
|
||||
if (IsCharmed() && !IsWithinDistInMap(owner, GetMap()->GetVisibilityRange(), true, false, false))
|
||||
{
|
||||
RemoveCharmAuras();
|
||||
}
|
||||
@@ -1944,7 +1944,7 @@ bool Creature::CanStartAttack(Unit const* who) const
|
||||
if (!_IsTargetAcceptable(who))
|
||||
return false;
|
||||
|
||||
if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false)) // pussywizard: +m_combatDistance for turrets and similar
|
||||
if (IsNeutralToAll() || !IsWithinDistInMap(who, GetAggroRange(who) + m_CombatDistance, true, false, false)) // pussywizard: +m_combatDistance for turrets and similar
|
||||
return false;
|
||||
|
||||
if (!CanCreatureAttack(who))
|
||||
|
||||
@@ -414,7 +414,7 @@ private:
|
||||
void UpdatePackedRotation();
|
||||
|
||||
//! Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size.
|
||||
bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/, bool /*useBoundingRadius = true*/) const override
|
||||
bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/, bool /*incOwnRadius = true*/, bool /*incTargetRadius = true*/) const override
|
||||
{
|
||||
//! Following check does check 3d distance
|
||||
dist2compare += obj->GetObjectSize();
|
||||
|
||||
@@ -1232,10 +1232,14 @@ float WorldObject::GetDistanceZ(WorldObject const* obj) const
|
||||
return (dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool useBoundingRadius) const
|
||||
bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius, bool incTargetRadius) const
|
||||
{
|
||||
float sizefactor = useBoundingRadius ? GetObjectSize() + obj->GetObjectSize() : 0.0f;
|
||||
float maxdist = dist2compare + sizefactor;
|
||||
float maxdist = dist2compare;
|
||||
if (incOwnRadius)
|
||||
maxdist += GetObjectSize();
|
||||
|
||||
if (incTargetRadius)
|
||||
maxdist += obj->GetObjectSize();
|
||||
|
||||
if (m_transport && obj->GetTransport() && obj->GetTransport()->GetGUID() == m_transport->GetGUID())
|
||||
{
|
||||
@@ -1342,14 +1346,14 @@ bool WorldObject::IsWithinDist2d(const Position* pos, float dist) const
|
||||
}
|
||||
|
||||
// use only if you will sure about placing both object at same map
|
||||
bool WorldObject::IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool useBoundingRadius) const
|
||||
bool WorldObject::IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius, bool incTargetRadius) const
|
||||
{
|
||||
return obj && _IsWithinDist(obj, dist2compare, is3D, useBoundingRadius);
|
||||
return obj && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius);
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D, bool useBoundingRadius) const
|
||||
bool WorldObject::IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius, bool incTargetRadius) const
|
||||
{
|
||||
return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, useBoundingRadius);
|
||||
return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D, incOwnRadius, incTargetRadius);
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinLOS(float ox, float oy, float oz, VMAP::ModelIgnoreFlags ignoreFlags, LineOfSightChecks checks) const
|
||||
|
||||
@@ -541,8 +541,8 @@ public:
|
||||
[[nodiscard]] bool IsWithinDist2d(float x, float y, float dist) const;
|
||||
bool IsWithinDist2d(const Position* pos, float dist) const;
|
||||
// use only if you will sure about placing both object at same map
|
||||
bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true, bool useBoundingRadius = true) const;
|
||||
bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true, bool useBoundingRadius = true) const;
|
||||
bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true, bool incOwnRadius = true, bool incTargetRadius = true) const;
|
||||
bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true, bool incOwnRadius = true, bool incTargetRadius = true) const;
|
||||
[[nodiscard]] bool IsWithinLOS(float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags = VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS) const;
|
||||
[[nodiscard]] bool IsWithinLOSInMap(WorldObject const* obj, VMAP::ModelIgnoreFlags ignoreFlags = VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS, Optional<float> collisionHeight = { }, Optional<float> combatReach = { }) const;
|
||||
[[nodiscard]] Position GetHitSpherePointFor(Position const& dest, Optional<float> collisionHeight = { }, Optional<float> combatReach = { }) const;
|
||||
@@ -770,7 +770,7 @@ private:
|
||||
uint16 m_notifyflags;
|
||||
uint16 m_executed_notifies;
|
||||
|
||||
virtual bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool useBoundingRadius = true) const;
|
||||
virtual bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius = true, bool incTargetRadius = true) const;
|
||||
|
||||
bool CanNeverSee(WorldObject const* obj) const;
|
||||
virtual bool CanAlwaysSee(WorldObject const* /*obj*/) const { return false; }
|
||||
|
||||
@@ -1092,10 +1092,9 @@ namespace Acore
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->IsDynamicObject() ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false))
|
||||
if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->IsDynamicObject() ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range,true,false, true))
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1192,7 +1191,7 @@ namespace Acore
|
||||
}
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if (!me->IsWithinDistInMap(u, m_range, true, false))
|
||||
if (!me->IsWithinDistInMap(u, m_range, true, false, false))
|
||||
return false;
|
||||
|
||||
if (!me->IsValidAttackTarget(u))
|
||||
@@ -1218,7 +1217,7 @@ namespace Acore
|
||||
explicit NearestHostileUnitInAttackDistanceCheck(Creature const* creature, float dist) : me(creature), m_range(dist) {}
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if (!me->IsWithinDistInMap(u, m_range, true, false))
|
||||
if (!me->IsWithinDistInMap(u, m_range, true, false, false))
|
||||
return false;
|
||||
|
||||
if (!me->CanStartAttack(u))
|
||||
|
||||
@@ -266,7 +266,7 @@ public:
|
||||
std::vector<Player*> tList;
|
||||
for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
||||
{
|
||||
if (!me->IsWithinDistInMap(itr->GetSource(), 200.0f, true, false) || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster())
|
||||
if (!me->IsWithinDistInMap(itr->GetSource(), 200.0f, true, false, false) || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user