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 7ac618b commit 64cea46
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 @@ -4391,11 +4391,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, VMAP::ModelIgnoreFlags::M2, LINEOFSIGHT_ALL_CHECKS)));
(master->GetDistance(mytar) > foldist || (master->GetDistance(mytar) > foldist * 0.75f && !mytar->IsWithinLOSInMap(me, VMAP::ModelIgnoreFlags::M2, LINEOFSIGHT_ALL_CHECKS))));
}
if (dropTarget)
{
Expand Down

0 comments on commit 64cea46

Please sign in to comment.