Core/AI: Replace many Unit::IsHostileTo with Unit::IsValidAttackTarget or Creature::canCreatureAttack.
This commit is contained in:
@@ -282,7 +282,7 @@ public:
|
||||
if (!who || me->getVictim())
|
||||
return;
|
||||
|
||||
if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who))
|
||||
if (me->canCreatureAttack(who))
|
||||
{
|
||||
float attackRadius = me->GetAttackDistance(who);
|
||||
if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who))
|
||||
|
||||
+1
-1
@@ -253,7 +253,7 @@ public:
|
||||
if (me->HasAura(AURA_BANISH))
|
||||
return;
|
||||
|
||||
if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me))
|
||||
if (!me->getVictim() && me->canCreatureAttack(who))
|
||||
{
|
||||
if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
{
|
||||
if (!CanStartEvent)//boss is invisible, don't attack
|
||||
return;
|
||||
if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)))
|
||||
if (!me->getVictim() && who->IsValidAttackTarget(me))
|
||||
{
|
||||
float attackRadius = me->GetAttackDistance(who);
|
||||
if (me->IsWithinDistInMap(who, attackRadius))
|
||||
@@ -424,7 +424,7 @@ public:
|
||||
{
|
||||
if (!who || me->getVictim()) return;
|
||||
|
||||
if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who) && me->IsWithinDistInMap(who, 45))
|
||||
if (who->isInAccessiblePlaceFor(me) && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 45))
|
||||
{
|
||||
AttackStart(who);
|
||||
}
|
||||
|
||||
+1
-1
@@ -316,7 +316,7 @@ public:
|
||||
if (!who || me->getVictim())
|
||||
return;
|
||||
|
||||
if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who))
|
||||
if (me->canCreatureAttack(who))
|
||||
{
|
||||
//no attack radius check - it attacks the first target that moves in his los
|
||||
//who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
||||
|
||||
Reference in New Issue
Block a user