From f1104d531554a8ef661a8f83d7adf4c895526429 Mon Sep 17 00:00:00 2001 From: Revision Date: Mon, 22 Jul 2024 04:17:28 +0200 Subject: [PATCH] Optimize the check for PvP flag --- src/strategy/actions/AttackAction.cpp | 10 ---------- src/strategy/values/AttackersValue.cpp | 1 + 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/strategy/actions/AttackAction.cpp b/src/strategy/actions/AttackAction.cpp index 61efe14f..1ba9f4b5 100644 --- a/src/strategy/actions/AttackAction.cpp +++ b/src/strategy/actions/AttackAction.cpp @@ -95,16 +95,6 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) return false; } - if (target->IsPlayer() && !target->IsPvP() && !target->IsFFAPvP() && (!bot->duel || bot->duel->Opponent != target || bot->duel->StartTime)) - { - if (verbose) - { - botAI->TellError(Acore::StringFormat("%s is not flagged for pvp", target->GetName())); - } - - return false; - } - if (bot->IsMounted() && bot->IsWithinLOSInMap(target)) { WorldPacket emptyPacket; diff --git a/src/strategy/values/AttackersValue.cpp b/src/strategy/values/AttackersValue.cpp index 177ff89f..d99ebc38 100644 --- a/src/strategy/values/AttackersValue.cpp +++ b/src/strategy/values/AttackersValue.cpp @@ -180,6 +180,7 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range) !attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) && bot->CanSeeOrDetect(attacker) && !(sPlayerbotAIConfig->IsPvpProhibited(attacker->GetZoneId(), attacker->GetAreaId()) && (attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) && + !(attacker->IsPlayer() && !attacker->IsPvP() && !attacker->IsFFAPvP() && (!bot->duel || bot->duel->Opponent != attacker || bot->duel->StartTime)) && (!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) || leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) || (botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot))));