Skip to content

Commit

Permalink
Merge pull request #566 from EricksOliveira/patch-2
Browse files Browse the repository at this point in the history
Update PlayerbotAI.cpp
  • Loading branch information
liyunfan1223 authored Oct 3, 2024
2 parents d81da0c + 1a796be commit d64e65d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/PlayerbotAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,15 +355,18 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
return;

if (!bot->InBattleground() && !bot->inRandomLfgDungeon() && bot->GetGroup())
{
Player* leader = bot->GetGroup()->GetLeader();
PlayerbotAI* leaderAI = GET_PLAYERBOT_AI(leader);
if (leaderAI && !leaderAI->IsRealPlayer())
{
bot->RemoveFromGroup();
ResetStrategies();
}
}
{
Player* leader = bot->GetGroup()->GetLeader();
if (leader && leader != bot) // Checks if the leader is valid and is not the bot itself
{
PlayerbotAI* leaderAI = GET_PLAYERBOT_AI(leader);
if (leaderAI && !leaderAI->IsRealPlayer())
{
bot->RemoveFromGroup();
ResetStrategies();
}
}
}

bool min = minimal;
UpdateAIInternal(elapsed, min);
Expand Down Expand Up @@ -5959,4 +5962,4 @@ float PlayerbotAI::GetItemScoreMultiplier(ItemQualities quality)
break;
}
return 1.0f;
}
}

0 comments on commit d64e65d

Please sign in to comment.