mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[9212] Implement pet speed synchronization with owner only for follow mode.
* This allow pet use own speed (and all speed affects appiedto pet itself) in combat. * Apply this speed synhronization to minipets/guardians also. * Also rename Unit::SetSpeed to SetSpeedRate as more close to real functionality.
This commit is contained in:
parent
a6a5935406
commit
eaecc467d5
8 changed files with 73 additions and 22 deletions
|
|
@ -243,6 +243,7 @@ void FollowMovementGenerator<Player>::Initialize(Player &owner)
|
|||
{
|
||||
owner.addUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
|
||||
_updateWalkMode(owner);
|
||||
_updateSpeed(owner);
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
||||
|
|
@ -251,6 +252,7 @@ void FollowMovementGenerator<Creature>::Initialize(Creature &owner)
|
|||
{
|
||||
owner.addUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
|
||||
_updateWalkMode(owner);
|
||||
_updateSpeed(owner);
|
||||
|
||||
if (((Creature*)&owner)->canFly())
|
||||
owner.AddMonsterMoveFlag(MONSTER_MOVE_FLY);
|
||||
|
|
@ -263,6 +265,7 @@ void FollowMovementGenerator<T>::Finalize(T &owner)
|
|||
{
|
||||
owner.clearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
|
||||
_updateWalkMode(owner);
|
||||
_updateSpeed(owner);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
|
@ -270,6 +273,7 @@ void FollowMovementGenerator<T>::Interrupt(T &owner)
|
|||
{
|
||||
owner.clearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE);
|
||||
_updateWalkMode(owner);
|
||||
_updateSpeed(owner);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
|
@ -278,6 +282,24 @@ void FollowMovementGenerator<T>::Reset(T &owner)
|
|||
Initialize(owner);
|
||||
}
|
||||
|
||||
template<>
|
||||
void FollowMovementGenerator<Player>::_updateSpeed(Player &u)
|
||||
{
|
||||
// nothing to do for Player
|
||||
}
|
||||
|
||||
template<>
|
||||
void FollowMovementGenerator<Creature>::_updateSpeed(Creature &u)
|
||||
{
|
||||
// pet only sync speed with owner
|
||||
if (!((Creature&)u).isPet() || !i_target.isValid() || i_target->GetGUID() != u.GetOwnerGUID())
|
||||
return;
|
||||
|
||||
u.UpdateSpeed(MOVE_RUN,true);
|
||||
u.UpdateSpeed(MOVE_WALK,true);
|
||||
u.UpdateSpeed(MOVE_SWIM,true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------//
|
||||
template void TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Player> >::_setTargetLocation(Player &);
|
||||
template void TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::_setTargetLocation(Player &);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue