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
+2 -15
View File
@@ -701,26 +701,13 @@ namespace Trinity
case SPELL_TARGETS_ENEMY:
if (target->isTotem())
continue;
// can't be checked in SpellInfo::CheckTarget - needs more research
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
if (!i_source->_IsValidAttackTarget(target, i_spellProto))
continue;
if (target->HasUnitState(UNIT_STAT_UNATTACKABLE))
continue;
if (i_source->IsControlledByPlayer())
{
if (i_source->IsFriendlyTo(target))
continue;
}
else
{
if (!i_source->IsHostileTo(target))
continue;
}
break;
case SPELL_TARGETS_ALLY:
if (target->isTotem())
continue;
if (!i_source->IsFriendlyTo(target))
if (!i_source->_IsValidAssistTarget(target, i_spellProto))
continue;
break;
case SPELL_TARGETS_ENTRY: