aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp37
1 files changed, 2 insertions, 35 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index ab8ec089b1c..c7b25d610a2 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1112,32 +1112,8 @@ Unit* Creature::SelectVictim()
{
Unit* target = nullptr;
- ThreatManager& mgr = GetThreatManager();
-
- if (mgr.CanHaveThreatList())
- {
- target = mgr.SelectVictim();
- while (!target)
- {
- Unit* newTarget = nullptr;
- // nothing found to attack - try to find something we're in combat with (but don't have a threat entry for yet) and start attacking it
- for (auto const& pair : GetCombatManager().GetPvECombatRefs())
- {
- newTarget = pair.second->GetOther(this);
- if (!mgr.IsThreatenedBy(newTarget, true))
- {
- mgr.AddThreat(newTarget, 0.0f, nullptr, true, true);
- ASSERT(mgr.IsThreatenedBy(newTarget, true), "%s tried to add combatant %s to threat list, but this failed - potential infinite loop", GetName().c_str(), newTarget->GetName().c_str()); // prevent potential infinite loop
- break;
- }
- else
- newTarget = nullptr;
- }
- if (!newTarget)
- break;
- target = mgr.SelectVictim();
- }
- }
+ if (CanHaveThreatList())
+ target = GetThreatManager().SelectVictim();
else if (!HasReactState(REACT_PASSIVE))
{
// We're a player pet, probably
@@ -1177,15 +1153,6 @@ Unit* Creature::SelectVictim()
if (GetVehicle())
return nullptr;
- // search nearby enemy before enter evade mode
- if (HasReactState(REACT_AGGRESSIVE))
- {
- target = SelectNearestTargetInAttackDistance(m_CombatDistance ? m_CombatDistance : ATTACK_DISTANCE);
-
- if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target))
- return target;
- }
-
Unit::AuraEffectList const& iAuras = GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY);
if (!iAuras.empty())
{