mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
fix(Core/Pets): Pets should update speed out of combat only if are following their owner. (#6207)
- Closes #5250 - Closes chromiecraft/chromiecraft#406
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "TargetedMovementGenerator.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "Totem.h"
|
||||
#include "TotemAI.h"
|
||||
@@ -13583,19 +13584,24 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
{
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
Unit* pOwner = GetCharmerOrOwner();
|
||||
if (pOwner && !IsInCombat() && !IsVehicle() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) && (IsPet() || IsGuardian() || GetGUID() == pOwner->GetCritterGUID() || GetCharmerGUID() == pOwner->GetGUID()))
|
||||
Unit* followed = nullptr;
|
||||
if (GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
|
||||
{
|
||||
if (pOwner->GetTypeId() != TYPEID_PLAYER)
|
||||
followed = static_cast<FollowMovementGenerator<Creature>const*>(GetMotionMaster()->top())->GetTarget();
|
||||
}
|
||||
|
||||
if (followed && !IsInCombat() && !IsVehicle() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) && (IsPet() || IsGuardian() || GetGUID() == followed->GetCritterGUID() || GetCharmerOrOwnerGUID() == followed->GetGUID()))
|
||||
{
|
||||
if (followed->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
if (speed < pOwner->GetSpeedRate(mtype) + 0.1f)
|
||||
speed = pOwner->GetSpeedRate(mtype) + 0.1f; // pets derive speed from owner when not in combat
|
||||
if (speed < followed->GetSpeedRate(mtype) + 0.1f)
|
||||
speed = followed->GetSpeedRate(mtype) + 0.1f; // pets derive speed from owner when not in combat
|
||||
}
|
||||
else
|
||||
{
|
||||
// special treatment for player pets in order to avoid stuttering
|
||||
float ownerSpeed = pOwner->GetSpeedRate(mtype);
|
||||
float distOwner = GetDistance(pOwner);
|
||||
float ownerSpeed = followed->GetSpeedRate(mtype);
|
||||
float distOwner = GetDistance(followed);
|
||||
float minDist = 2.5f;
|
||||
|
||||
if (ToCreature()->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
|
||||
|
||||
Reference in New Issue
Block a user