diff options
author | QAston <qaston@gmail.com> | 2011-09-17 00:56:59 +0200 |
---|---|---|
committer | QAston <qaston@gmail.com> | 2011-09-17 00:56:59 +0200 |
commit | fe25ce4fa3ce306beebc4c95b22cd14052a92566 (patch) | |
tree | e8bbe02f5b43e8d648230cb2532dd24780ff113e /src | |
parent | 580264b5a56f742e5eaf1eeb2ea3729740e36478 (diff) |
Core/AI: Replace many Unit::IsHostileTo with Unit::IsValidAttackTarget or Creature::canCreatureAttack.
Diffstat (limited to 'src')
27 files changed, 30 insertions, 49 deletions
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 16e04c363ea..2efe0eebee0 100755 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -58,7 +58,7 @@ void GuardAI::MoveInLineOfSight(Unit* unit) return; if (!me->getVictim() && me->IsValidAttackTarget(unit) && - (unit->IsHostileToPlayers() || me->IsHostileTo(unit) /*|| u->getVictim() && me->IsFriendlyTo(u->getVictim())*/) && + (unit->IsHostileToPlayers() || me->IsHostileTo(unit)) && unit->isInAccessiblePlaceFor(me)) { float attackRadius = me->GetAttackDistance(unit); diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 27e8706fa37..ec93c3c5580 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -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; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 388aa8df2aa..c5392a0e55b 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1462,9 +1462,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, const uint32 effectMask, bool if (m_spellInfo->Speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) return SPELL_MISS_EVADE; - // check for IsHostileTo() instead of !IsFriendlyTo() - // ex: spell 47463 needs to be casted by different units on the same neutral target - if (m_caster->IsHostileTo(unit)) + if (m_caster->IsValidAttackTarget(unit)) { unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL); //TODO: This is a hack. But we do not know what types of stealth should be interrupted by CC diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index e8a9a1dc95e..be6e16b30d2 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -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: 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)) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index d590bc5cfe2..aab3aaeef77 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -281,7 +281,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) + if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsValidAttackTarget(who)) AttackStart(who); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 477e0601d9e..35c81432d5f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -250,7 +250,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) + if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsValidAttackTarget(who)) AttackStart(who); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index a3d5e4886e0..6a7e6f71003 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -1437,7 +1437,7 @@ public: if (!who || me->getVictim()) return; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) + if (me->IsValidAttackTarget(who)) { //float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, 30)) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 6354d52cb6a..62d92c35489 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -294,7 +294,7 @@ struct boss_twinemperorsAI : public ScriptedAI if (!who || me->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + if (me->canCreatureAttack(who)) { float attackRadius = me->GetAttackDistance(who); if (attackRadius < PULL_RANGE) diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp index 7500abf3307..2e0e0661cf7 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -184,7 +184,7 @@ public: if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS || !bOnGround) return; - if (!me->getVictim() && who->isTargetableForAttack() && me->IsHostileTo(who) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index e5343e65711..ab6eae9a241 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -128,7 +128,7 @@ public: if (!who) return; - if (Phase == IDLE && who->isTargetableForAttack() && me->IsHostileTo(who) && me->IsWithinDistInMap(who, 40)) + if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40)) { Phase = INTRO; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp index bc1c4ee27b5..a77c0214730 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp @@ -93,7 +93,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { if (!Intro && me->IsWithinDistInMap(who, 100)) { diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index dffa245d0ba..df2693c7b86 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -254,7 +254,7 @@ public: { ScriptedAI::MoveInLineOfSight(who); - if (!Intro && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 100) && me->IsHostileTo(who)) + if (!Intro && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 100) && me->IsValidAttackTarget(who)) { DoScriptText(SAY_INTRO, me); Intro = true; diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index f346de0e859..0d3301ec29b 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -267,7 +267,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!Intro && who->GetTypeId() == TYPEID_PLAYER && who->isTargetableForAttack() && me->IsHostileTo(who) && who->isInAccessiblePlaceFor(me)) + if (!Intro && who->GetTypeId() == TYPEID_PLAYER && me->canCreatureAttack(who)) { if (me->IsWithinDistInMap(who, VISIBLE_RANGE) && me->IsWithinLOSInMap(who)) { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index b7c824f974d..817c38fef2e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -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)) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 5721f19044d..f3da63af38b 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -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; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index d5d3d8a81ba..7f84ce504e7 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -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); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp index 72415ce2b3a..a30b46c2346 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp @@ -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); diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp index 44a0225fc2c..f01f01b5bf8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp @@ -85,7 +85,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript void MoveInLineOfSight(Unit* who) { - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index ff3c3199d31..592c2a1190d 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -397,8 +397,7 @@ class boss_kaelthas : public CreatureScript void MoveInLineOfSight(Unit* who) { - if (!me->HasUnitState(UNIT_STAT_STUNNED) && who->isTargetableForAttack() && - me->IsHostileTo(who) && who->isInAccessiblePlaceFor(me)) + if (!me->HasUnitState(UNIT_STAT_STUNNED) && me->canCreatureAttack(who)) { if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 0cdcca1ae2f..adf71c8a25b 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -315,7 +315,7 @@ class npc_warden_mellichar : public CreatureScript if (IsRunning) return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp index 9cd408c38f2..8143ac528b5 100644 --- a/src/server/scripts/Outland/boss_doomwalker.cpp +++ b/src/server/scripts/Outland/boss_doomwalker.cpp @@ -91,7 +91,7 @@ class boss_doomwalker : public CreatureScript void MoveInLineOfSight(Unit* who) { - if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who)) + if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who)) if (who->HasAura(SPELL_MARK_DEATH, 0)) who->CastSpell(who, SPELL_AURA_DEATH, 1); } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index e95211412ff..392e20734a8 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -179,7 +179,7 @@ public: if (!SpawnAssoc) return; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) + if (me->IsValidAttackTarget(who)) { Player* playerTarget = who->ToPlayer(); @@ -1718,7 +1718,7 @@ public: //Redefined for random target selection: void MoveInLineOfSight(Unit* who) { - 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; |