fix(Core/Pets): Corrected pet speed catchup system. (#7131)

This commit is contained in:
UltraNix
2021-08-04 07:05:27 +02:00
committed by GitHub
parent 075185e961
commit d0b994496f
2 changed files with 3 additions and 27 deletions

View File

@@ -198,7 +198,6 @@ Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject),
m_rootTimes = 0; m_rootTimes = 0;
m_state = 0; m_state = 0;
m_petCatchUp = false;
m_deathState = ALIVE; m_deathState = ALIVE;
for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
@@ -13579,32 +13578,10 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
} }
else else
{ {
// special treatment for player pets in order to avoid stuttering
float ownerSpeed = followed->GetSpeedRate(mtype); float ownerSpeed = followed->GetSpeedRate(mtype);
float distOwner = GetDistance(followed); if (speed < ownerSpeed || IsWithinDist3d(followed, 10.0f))
float minDist = 2.5f; speed = ownerSpeed;
speed *= std::min(std::max(1.0f, 0.75f + (GetDistance(followed) - PET_FOLLOW_DIST) * 0.05f), 1.3f);
if (ToCreature()->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
{
// different minimum distance for vanity pets
minDist = 5.0f;
if (mtype == MOVE_FLIGHT)
mtype = MOVE_RUN; // vanity pets use run speed for flight
}
float maxDist = ownerSpeed >= 1.0f ? minDist * ownerSpeed * 1.5f : minDist * 1.5f;
if (distOwner < minDist && m_petCatchUp)
m_petCatchUp = false;
if (distOwner > maxDist && !m_petCatchUp)
m_petCatchUp = true;
if (m_petCatchUp)
speed = ownerSpeed * 1.05f;
else
speed = ownerSpeed * 0.95f;
} }
} }
else else

View File

@@ -2625,7 +2625,6 @@ private:
bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world
uint32 _oldFactionId; ///< faction before charm uint32 _oldFactionId; ///< faction before charm
bool m_petCatchUp;
float processDummyAuras(float TakenTotalMod) const; float processDummyAuras(float TakenTotalMod) const;
}; };