[Bots] Prevent medding in combat if any mob has bot targeted (#4707)

- Previously this only checked the bots target to med. It will now check the hatelist of the bot to ensure no mobs have the bot targeted before medding.
This commit is contained in:
nytmyr authored and GitHub committed 2025-02-21 23:12:29 -06:00
1 parent 878a5377ae
commit 21b7b6e7ab
1 file changed
+20 -4
+20 -4
View File
@@ -2746,11 +2746,26 @@ bool Bot::TryAutoDefend(Client* bot_owner, float leash_distance) {
bool Bot::TryMeditate() {
if (!IsMoving() && !spellend_timer.Enabled()) {
if (IsEngaged() && HasOrMayGetAggro(IsSitting())) {
if (IsSitting()) {
Stand();
if (IsEngaged()) {
if (HasOrMayGetAggro(IsSitting())) {
if (IsSitting()) {
Stand();
}
return false;
}
for (auto mob : hate_list.GetHateList()) {
auto tar = mob->entity_on_hatelist;
if (tar) {
Mob* tar_target = tar->GetTarget();
if (tar_target && tar_target == this) {
return false;
}
}
}
}
BotMeditate(IsSitting());
@@ -2758,6 +2773,7 @@ bool Bot::TryMeditate() {
if (!(GetPlayerState() & static_cast<uint32>(PlayerState::Aggressive))) {
SendAddPlayerState(PlayerState::Aggressive);
}
return true;
}
@@ -13193,4 +13209,4 @@ bool Bot::IsValidBotStance(uint8 stance) {
}
return false;
}
}