mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 00:08:01 +00:00
fix(Core/Pets): Corrected pet speed catchup system. (#7131)
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user