Core/Movement: do no predict follow destinations when the follower is faster than its target outside of catchup and formation mechanics

This commit is contained in:
Ovahlord committed 2020-07-09 22:02:42 +02:00
1 parent 1dd44ab9b9
commit d7a4a6dad1
4 files changed
+14 -8

No files matched your search

@@ -334,9 +334,15 @@ void FollowMovementGenerator::LaunchMovement(Unit* owner)
if (velocity <= 0.1f)
return;
// Predicting our follow destination
dest.m_positionX += std::cos(Position::NormalizeOrientation(_target->GetOrientation() + offset)) * velocity;
dest.m_positionY += std::sin(Position::NormalizeOrientation(_target->GetOrientation() + offset)) * velocity;
// Predicting our follow destination if the owner is slower or equally as fast as the target
bool predictDestination = (!_joinFormation && !_catchUpToTarget && velocity < _target->GetSpeed(SelectSpeedType(_target->m_movementInfo.GetMovementFlags())))
|| (_joinFormation || _catchUpToTarget);
if (predictDestination)
{
dest.m_positionX += std::cos(Position::NormalizeOrientation(_target->GetOrientation() + offset)) * velocity;
dest.m_positionY += std::sin(Position::NormalizeOrientation(_target->GetOrientation() + offset)) * velocity;
}
// Now we calculate our actual destination data
if (!owner->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING))
@@ -1815,7 +1815,7 @@ class npc_ascendant_council_frozen_orb : public CreatureScript
Talk(SAY_ANNOUNCE_PURSUE_PLAYER, target);
DoCast(target, SPELL_FROST_BEACON);
me->ClearUnitState(UNIT_STATE_CASTING);
me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f);
me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f, false, false, true);
_events.ScheduleEvent(EVENT_INCREASE_SPEED, 1s);
}
break;
@@ -274,7 +274,7 @@ struct boss_atramedes : public BossAI
if (Unit* summoner = summon->ToTempSummon()->GetSummoner())
{
summon->CastSpell(summoner, SPELL_TRACKING);
summon->GetMotionMaster()->MoveFollow(summoner, 0.f, 0.f);
summon->GetMotionMaster()->MoveFollow(summoner, 0.f, 0.f, false, false, true);
me->SetFacingToObject(summon);
DoCast(summon, SPELL_SONIC_BREATH_CAST);
}
@@ -288,7 +288,7 @@ struct boss_atramedes : public BossAI
summon->CastSpell(summon, SPELL_ROARING_FLAME_BREATH_REVERSE_CAST);
summon->CastSpell(summon, SPELL_AGGRO_CREATOR);
summon->CastSpell(summoner, SPELL_TRACKING);
summon->GetMotionMaster()->MoveFollow(summoner, 0.0f, 0.f);
summon->GetMotionMaster()->MoveFollow(summoner, 0.0f, 0.f, false, false, true);
_reverberatingFlameGUID = summon->GetGUID();
}
break;
@@ -492,7 +492,7 @@ struct boss_atramedes : public BossAI
{
flame->CastSpell(flame, SPELL_SONIC_FLAMES);
flame->CastSpell(target, SPELL_TRACKING);
flame->GetMotionMaster()->MoveFollow(target, 0.0f, 0.f);
flame->GetMotionMaster()->MoveFollow(target, 0.0f, 0.f, false, false, true);
}
}
break;
@@ -722,7 +722,7 @@ class boss_the_lich_king : public CreatureScript
summon->CastSpell(summon, SPELL_ICE_SPHERE, false);
summon->CastSpell(summon, SPELL_ICE_BURST_TARGET_SEARCH, false);
summon->CastSpell(target, SPELL_ICE_PULSE, false);
summon->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f);
summon->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f, false, false, true);
}
else
summon->DespawnOrUnsummon();