Core/AI: Replace many Unit::IsHostileTo with Unit::IsValidAttackTarget or Creature::canCreatureAttack.

This commit is contained in:
QAston
2011-09-17 00:56:59 +02:00
parent 580264b5a5
commit fe25ce4fa3
27 changed files with 30 additions and 49 deletions
@@ -902,12 +902,10 @@ namespace Trinity
bool operator()(Unit* u)
{
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (!u->isTargetableForAttack())
return false;
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem())
return false;
if ((i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u))&& i_obj->IsWithinDistInMap(u, i_range))
if (i_funit->IsValidAttackTarget(u) && i_obj->IsWithinDistInMap(u, i_range))
return true;
return false;