Permalink
Browse files

PlayerBot: use new Relations API

  • Loading branch information...
cala committed Feb 20, 2018
1 parent 770ef0b commit 5a10031c089df33c730fc7d84340cac212681a72
Showing with 10 additions and 10 deletions.
  1. +9 −9 src/game/PlayerBot/Base/PlayerbotAI.cpp
  2. +1 −1 src/game/PlayerBot/Base/PlayerbotMgr.cpp
@@ -3175,7 +3175,7 @@ void PlayerbotAI::DoNextCombatManeuver()
Attack();
// clear orders if current target for attacks doesn't make sense anymore
if (!m_targetCombat || m_targetCombat->isDead() || !m_targetCombat->IsInWorld() || !m_bot->IsHostileTo(m_targetCombat) || !m_bot->IsInMap(m_targetCombat))
if (!m_targetCombat || m_targetCombat->isDead() || !m_targetCombat->IsInWorld() || !m_bot->CanAttack(m_targetCombat) || !m_bot->IsInMap(m_targetCombat))
{
m_bot->AttackStop();
m_bot->SetSelectionGuid(ObjectGuid());
@@ -5314,12 +5314,12 @@ bool PlayerbotAI::CastSpell(uint32 spellId)
if (IsPositiveSpell(spellId))
{
if (pTarget && !m_bot->IsFriendlyTo(pTarget))
if (pTarget && m_bot->CanAttack(pTarget))
pTarget = m_bot;
}
else
{
if (pTarget && m_bot->IsFriendlyTo(pTarget))
if (pTarget && m_bot->CanAssist(pTarget))
return false;
m_bot->SetInFront(pTarget);
@@ -5451,12 +5451,12 @@ bool PlayerbotAI::CastPetSpell(uint32 spellId, Unit* target)
if (IsPositiveSpell(spellId))
{
if (pTarget && !m_bot->IsFriendlyTo(pTarget))
if (pTarget && m_bot->CanAttack(pTarget))
pTarget = m_bot;
}
else
{
if (pTarget && m_bot->IsFriendlyTo(pTarget))
if (pTarget && m_bot->CanAssist(pTarget))
return false;
if (!pet->isInFrontInMap(pTarget, 10)) // distance probably should be calculated
@@ -7241,7 +7241,7 @@ void PlayerbotAI::findNearbyCorpse()
if (!corpse)
continue;
if (!corpse->IsCorpse() || corpse->IsDespawned() || m_bot->IsFriendlyTo(corpse))
if (!corpse->IsCorpse() || corpse->IsDespawned() || m_bot->CanAssist(corpse))
continue;
uint32 skillId = 0;
@@ -9328,7 +9328,7 @@ void PlayerbotAI::_HandleCommandAttack(std::string& text, Player& fromPlayer)
{
if (Unit* thingToAttack = ObjectAccessor::GetUnit(*m_bot, attackOnGuid))
{
if (!m_bot->IsFriendlyTo(thingToAttack))
if (m_bot->CanAttack(thingToAttack))
{
if (!m_bot->IsWithinLOSInMap(thingToAttack))
DoTeleport(*m_followTarget);
@@ -9386,7 +9386,7 @@ void PlayerbotAI::_HandleCommandPull(std::string& text, Player& fromPlayer)
return;
}
if (m_bot->IsFriendlyTo(thingToAttack))
if (m_bot->CanAssist(thingToAttack))
{
SendWhisper("Where I come from we don't attack our friends.", fromPlayer);
return;
@@ -9482,7 +9482,7 @@ void PlayerbotAI::_HandleCommandNeutralize(std::string& text, Player& fromPlayer
return;
}
if (m_bot->IsFriendlyTo(thingToNeutralize))
if (m_bot->CanAssist(thingToNeutralize))
{
SendWhisper("I can't neutralize that target: this is a friend to me.", fromPlayer);
return;
@@ -319,7 +319,7 @@ void PlayerbotMgr::HandleMasterIncomingPacket(const WorldPacket& packet)
for (PlayerBotMap::iterator itr = m_playerBots.begin(); itr != m_playerBots.end(); ++itr)
{
bot = itr->second;
if (!bot->IsFriendlyTo(thingToAttack))
if (bot->CanAttack(thingToAttack))
{
if (!bot->IsWithinLOSInMap(thingToAttack))
bot->GetPlayerbotAI()->DoTeleport(*m_master);

0 comments on commit 5a10031

Please sign in to comment.