From 0ef71e7aa3f1c33b1d65160aa152d11d39d974fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sr=C4=91an=20Pani=C4=87?= Date: Sun, 5 Sep 2021 12:00:39 +0200 Subject: [PATCH] fix(Core/pathing): incorrect pathing of caster mobs when their casts fail due to LOS (#7472) * Fix incorrect pathing of caster mobs when their casts fail due to LOS The original problem was that the casters, when their casts were blocked by a los of line of sight, would not run directly towards the player, but would rather run around within the spell range until a clear line of sight was found. This made it near impossible to make casters stop their casts and force them into melee range by using an obstacle. This fix makes caster mobs run directly into melee until a clear line of sight is reached whenever a player hides behind an obstacle regardless of whether the mob is within spell range or not. * Cleaning up whitespace * Tidying up --- .../MovementGenerators/TargetedMovementGenerator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index c9feb3b58..38284064b 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -114,7 +114,13 @@ bool ChaseMovementGenerator::DoUpdate(T* owner, uint32 time_diff) if (PositionOkay(owner, target, maxRange, angle) && !owner->HasUnitState(UNIT_STATE_CHASE_MOVE)) return true; - bool moveToward = !owner->IsInDist(target, maxRange); + float tarX, tarY, tarZ; + target->GetPosition(tarX, tarY, tarZ); + + bool withinRange = owner->IsInDist(target, maxRange); + bool withinLOS = owner->IsWithinLOS(tarX, tarY, tarZ); + bool moveToward = !(withinRange && withinLOS); + _mutualChase = mutualChase; if (owner->HasUnitState(UNIT_STATE_CHASE_MOVE))