Skip to content

Commit

Permalink
NPCBots: Fix a bug where bot would not stop attacking stealthed target
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Nov 7, 2024
1 parent 09dcb8e commit 15fbddf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/game/AI/NpcBots/bot_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4388,11 +4388,11 @@ std::tuple<Unit*, Unit*> bot_ai::_getTargets(bool byspell, bool ranged, bool &re
bool dropTarget = followdist == 0 && master->IsAlive();
if (!dropTarget && (!u || IAmFree()) && master->IsAlive() && mytar && mytar == opponent)
{
dropTarget = IAmFree() ?
dropTarget = !me->CanSeeOrDetect(mytar) || (IAmFree() ?
me->GetDistance(mytar) > (IsWanderer() ? float(followdist + 10) : foldist) :
HasBotCommandState(BOT_COMMAND_STAY) ?
(!IsRanged() ? !me->IsWithinMeleeRange(mytar) : me->GetDistance(mytar) > foldist) :
(master->GetDistance(mytar) > foldist || (master->GetDistance(mytar) > foldist * 0.75f && !mytar->IsWithinLOSInMap(me, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2)));
(master->GetDistance(mytar) > foldist || (master->GetDistance(mytar) > foldist * 0.75f && !mytar->IsWithinLOSInMap(me, LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags::M2))));
}
if (dropTarget)
{
Expand Down

0 comments on commit 15fbddf

Please sign in to comment.