mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #369 from noisiver/optimize-pvp-flag-check
Optimize the check for PvP flag
This commit is contained in:
@@ -95,16 +95,6 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
|||||||
return false;
|
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))
|
if (bot->IsMounted() && bot->IsWithinLOSInMap(target))
|
||||||
{
|
{
|
||||||
WorldPacket emptyPacket;
|
WorldPacket emptyPacket;
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range)
|
|||||||
!attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) &&
|
!attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) &&
|
||||||
bot->CanSeeOrDetect(attacker) &&
|
bot->CanSeeOrDetect(attacker) &&
|
||||||
!(sPlayerbotAIConfig->IsPvpProhibited(attacker->GetZoneId(), attacker->GetAreaId()) && (attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) &&
|
!(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)) ||
|
(!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())) ||
|
leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) ||
|
||||||
(botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot))));
|
(botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot))));
|
||||||
|
|||||||
Reference in New Issue
Block a user