diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index ff3c9d246..785b48baf 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -270,7 +270,7 @@ void MotionMaster::MoveTargetedHome(bool walk /*= false*/) if (target) { LOG_DEBUG("movement.motionmaster", "Following {} ({})", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); - Mutate(new FollowMovementGenerator(target, PET_FOLLOW_DIST, _owner->GetFollowAngle()), MOTION_SLOT_ACTIVE); + Mutate(new FollowMovementGenerator(target, PET_FOLLOW_DIST, _owner->GetFollowAngle(),true), MOTION_SLOT_ACTIVE); } } else @@ -391,7 +391,7 @@ void MotionMaster::MoveCircleTarget(Unit* target) init.Launch(); } -void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slot) +void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slot, bool inheritWalkState) { // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE // ignore movement request if target not exist @@ -405,13 +405,13 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo { LOG_DEBUG("movement.motionmaster", "Player ({}) follow to {} ({})", _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); - Mutate(new FollowMovementGenerator(target, dist, angle), slot); + Mutate(new FollowMovementGenerator(target, dist, angle, inheritWalkState), slot); } else { LOG_DEBUG("movement.motionmaster", "Creature ({}) follow to {} ({})", _owner->GetGUID().ToString(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetGUID().ToString()); - Mutate(new FollowMovementGenerator(target, dist, angle), slot); + Mutate(new FollowMovementGenerator(target, dist, angle, inheritWalkState), slot); } } diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 21b76a0f5..1c3d16c39 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -199,7 +199,7 @@ public: void MoveIdle(); void MoveTargetedHome(bool walk = false); void MoveRandom(float wanderDistance = 0.0f); - void MoveFollow(Unit* target, float dist, float angle, MovementSlot slot = MOTION_SLOT_ACTIVE); + void MoveFollow(Unit* target, float dist, float angle, MovementSlot slot = MOTION_SLOT_ACTIVE, bool inheritWalkState = true); void MoveChase(Unit* target, std::optional dist = {}, std::optional angle = {}); void MoveChase(Unit* target, float dist, float angle) { MoveChase(target, ChaseRange(dist), ChaseAngle(angle)); } void MoveChase(Unit* target, float dist) { MoveChase(target, ChaseRange(dist)); } diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index 2bf83ac14..a2ef923f6 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -520,7 +520,9 @@ bool FollowMovementGenerator::DoUpdate(T* owner, uint32 time_diff) Movement::MoveSplineInit init(owner); init.MovebyPath(i_path->GetPath()); - init.SetWalk(target->IsWalking() || target->movespline->isWalking()); + if (_inheritWalkState) + init.SetWalk(target->IsWalking() || target->movespline->isWalking()); + if (Optional velocity = GetVelocity(owner, target, i_path->GetActualEndPosition(), owner->IsGuardian())) init.SetVelocity(*velocity); init.Launch(); diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h index d6b13516e..41678c471 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h @@ -74,8 +74,8 @@ template class FollowMovementGenerator : public MovementGeneratorMedium>, public TargetedMovementGeneratorBase { public: - FollowMovementGenerator(Unit* target, float range, ChaseAngle angle) - : TargetedMovementGeneratorBase(target), i_path(nullptr), i_recheckPredictedDistanceTimer(0), i_recheckPredictedDistance(false), _range(range), _angle(angle) {} + FollowMovementGenerator(Unit* target, float range, ChaseAngle angle, bool inheritWalkState) + : TargetedMovementGeneratorBase(target), i_path(nullptr), i_recheckPredictedDistanceTimer(0), i_recheckPredictedDistance(false), _range(range), _angle(angle),_inheritWalkState(inheritWalkState) {} ~FollowMovementGenerator() { } MovementGeneratorType GetMovementGeneratorType() { return FOLLOW_MOTION_TYPE; } @@ -106,6 +106,7 @@ private: Optional _lastPredictedPosition; float _range; ChaseAngle _angle; + bool _inheritWalkState; }; #endif diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 7ecc204b5..b1521fe2f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -132,21 +132,22 @@ struct boss_lady_vashj : public BossAI void JustSummoned(Creature* summon) override { summons.Summon(summon); - if (summon->GetEntry() == WORLD_TRIGGER) - { - summon->CastSpell(summon, SPELL_MAGIC_BARRIER); - } - else if (summon->GetEntry() == NPC_TOXIC_SPOREBAT) - { - summon->GetMotionMaster()->MoveRandom(30.0f); - } - else if (summon->GetEntry() == NPC_ENCHANTED_ELEMENTAL) - { - summon->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); - } - else if (summon->GetEntry() != NPC_TAINTED_ELEMENTAL) - { - summon->GetMotionMaster()->MovePoint(POINT_HOME, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, true); + switch(summon->GetEntry()) { + case(WORLD_TRIGGER): + summon->CastSpell(summon, SPELL_MAGIC_BARRIER); + break; + case(NPC_ENCHANTED_ELEMENTAL): + summon->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f, MOTION_SLOT_ACTIVE, false); + summon->SetWalk(true); + summon->SetReactState(REACT_PASSIVE); + break; + case(NPC_TAINTED_ELEMENTAL): + break; + case(NPC_TOXIC_SPOREBAT): + summon->GetMotionMaster()->MoveRandom(30.0f); + break; + default: + summon->GetMotionMaster()->MovePoint(POINT_HOME, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, true); } }