Core/Movement: reworked chase movement

* the destination prediction is now much more reliable
* the movement generator will now more frequently check for valid positions to match retail behavior
* the catch-up mechanic will now adapt its speed to the target's one when being close enough to hit it
* temporarily disabled backwards movement when being too close to a target to avoid some edge cases that need additional research
* fixed the pathfinding reaching behavior so that they no longer follow you to unreachable obstacles and return home when they can't reach you anymore

closes #345
closes #260
This commit is contained in:
Ovahlord committed 2023-08-24 20:16:41 +02:00
1 parent 63be5a888c
commit 0840143137
9 files changed
+204 -120

No files matched your search

@@ -156,7 +156,7 @@ void ScriptedAI::UpdateAI(uint32 /*diff*/)
DoMeleeAttackIfReady();
}
void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle)
void ScriptedAI::DoStartMovement(Unit* victim, Optional<float> distance /*= std::nullopt*/, Optional<float> angle /*= std::nullopt*/)
{
if (victim)
me->GetMotionMaster()->MoveChase(victim, distance, angle);
@@ -162,7 +162,7 @@ struct TC_GAME_API ScriptedAI : public CreatureAI
// *************
//Start movement toward victim
void DoStartMovement(Unit* target, float distance = 0.0f, float angle = 0.0f);
void DoStartMovement(Unit* target, Optional<float> distance = std::nullopt, Optional<float> angle = std::nullopt);
//Start no movement on victim
void DoStartNoMovement(Unit* target);