[Pets] Allow pet motion speed change like other mobs

This commit is contained in:
Olion 2015-09-23 22:31:28 +03:00 committed by Antz
parent 56578291d8
commit 9b0c737605

View File

@ -6889,23 +6889,23 @@ bool Unit::CanDetectInvisibilityOf(Unit const* u) const
void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio)
{ {
// not in combat pet have same speed as owner // not in combat pet have same speed as owner
switch (mtype) //switch (mtype)
{ //{
case MOVE_RUN: // case MOVE_RUN:
case MOVE_WALK: // case MOVE_WALK:
case MOVE_SWIM: // case MOVE_SWIM:
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet() && hasUnitState(UNIT_STAT_FOLLOW)) // if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsPet() && hasUnitState(UNIT_STAT_FOLLOW))
{ // {
if (Unit* owner = GetOwner()) // if (Unit* owner = GetOwner())
{ // {
SetSpeedRate(mtype, owner->GetSpeedRate(mtype), forced); // SetSpeedRate(mtype, owner->GetSpeedRate(mtype), forced);
return; // return;
} // }
} // }
break; // break;
default: // default:
break; // break;
} //}
int32 main_speed_mod = 0; int32 main_speed_mod = 0;
float stack_bonus = 1.0f; float stack_bonus = 1.0f;