diff --git a/src/strategy/actions/AttackAction.cpp b/src/strategy/actions/AttackAction.cpp index 0ff90ba7..3600ce66 100644 --- a/src/strategy/actions/AttackAction.cpp +++ b/src/strategy/actions/AttackAction.cpp @@ -74,6 +74,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) { return false; } + std::ostringstream msg; msg << target->GetName(); @@ -88,9 +89,11 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) if (!bot->IsWithinLOSInMap(target)) { - msg << " is not on my sight"; + msg << " is not in my sight"; if (verbose) botAI->TellError(msg.str()); + + return false; } if (target->isDead()) @@ -102,6 +105,14 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) return false; } + if (!bot->IsValidAttackTarget(target) && sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId())) + { + if (verbose) + botAI->TellError("I cannot attack others in PvP prohibited zones"); + + return false; + } + // if (bot->IsMounted() && bot->IsWithinLOSInMap(target)) // { // WorldPacket emptyPacket;