Skip to content

Commit

Permalink
NPCBots: BotMgr::IsPartyInCombat() should only check owner's bots
Browse files Browse the repository at this point in the history
(cherry picked from commit 5b2578c49ffcd9619d7916830cc33aedbf30a874)

# Conflicts:
#	src/server/game/AI/NpcBots/botmgr.cpp
  • Loading branch information
trickerer committed Dec 5, 2024
1 parent ecd530d commit 51c1f04
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/server/game/AI/NpcBots/botmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,16 +1369,12 @@ bool BotMgr::RestrictBots(Creature const* bot, bool add) const

bool BotMgr::IsPartyInCombat(bool is_pvp) const
{
std::vector<Unit*> members = GetAllGroupMembers(_owner);
if (members.empty())
{
members.reserve(_bots.size() + std::size_t(1));
members.push_back(_owner);
for (BotMap::const_iterator itr = _bots.begin(); itr != _bots.end(); ++itr)
members.push_back(itr->second);
}

return std::ranges::any_of(members, [=](Unit const* unit) { return unit->IsInCombat() && (!is_pvp || unit->GetCombatTimer() > 0); });
if (_owner->IsInCombat() && (!is_pvp || _owner->GetCombatTimer() > 0))
return true;
for (BotMap::const_iterator citr = _bots.cbegin(); citr != _bots.cend(); ++citr)
if (citr->second->IsInCombat() && (!is_pvp || citr->second->GetCombatTimer() > 0))
return true;
return false;
}

bool BotMgr::HasBotClass(uint8 botclass) const
Expand Down

0 comments on commit 51c1f04

Please sign in to comment.