Skip to content

Commit

Permalink
Merge pull request liyunfan1223#369 from noisiver/optimize-pvp-flag-c…
Browse files Browse the repository at this point in the history
…heck

Optimize the check for PvP flag
  • Loading branch information
noisiver authored Jul 23, 2024
2 parents b059efa + 3a4ebb7 commit 9b31802
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
10 changes: 0 additions & 10 deletions src/strategy/actions/AttackAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/strategy/values/AttackersValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) &&
(!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))));
Expand Down

0 comments on commit 9b31802

Please sign in to comment.