From fe25ce4fa3ce306beebc4c95b22cd14052a92566 Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 17 Sep 2011 00:56:59 +0200 Subject: Core/AI: Replace many Unit::IsHostileTo with Unit::IsValidAttackTarget or Creature::canCreatureAttack. --- src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp | 2 +- .../EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp | 2 +- src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp | 2 +- .../scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp | 3 +-- src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/server/scripts/EasternKingdoms') diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index d308db1459a..2f7fde7ec60 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -487,7 +487,7 @@ public: if (!who) return; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) + if (me->IsValidAttackTarget(who)) if (me->IsWithinDistInMap(who, 20) && me->IsWithinLOSInMap(who)) AttackStart(who); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index e99f2c2a387..80cbcedda7c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -800,7 +800,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!who || !who->isTargetableForAttack() || !me->IsHostileTo(who) || me->getVictim()) + if (!who || !me->IsValidAttackTarget(who) || me->getVictim()) return; me->AddThreat(who, 0.0f); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index ade340d7abb..5123bd2c0ec 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -269,7 +269,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!who->isTargetableForAttack() || !me->IsHostileTo(who)) + if (!me->IsValidAttackTarget(who)) return; if (pInstance && Intro) pInstance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 638bbb2f0d9..644c0eacde5 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -437,9 +437,8 @@ 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)) { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index fb6e44eaf36..39aa4f6f6f3 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -331,7 +331,7 @@ public: if (bJustReset)//boss is invisible, don't attack return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) + if (!me->getVictim() && me->IsValidAttackTarget(who)) { float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius)) -- cgit v1.2.3