diff options
author | Treeston <treeston.mmoc@gmail.com> | 2018-01-29 23:14:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-29 23:14:46 +0100 |
commit | 1acfefb973895b0e3df3c8d9b43b920d2a1b5392 (patch) | |
tree | bff00abb119f1fe90b59581b7753cf314e7f70fa /src | |
parent | e45d54d80e3faf253d9f54d14866aacc8d019169 (diff) |
Core/Creature: Adjust SelectVictim behavior: (PR #21324)
- No more automatic combat -> threat promotion. This matches anecdotal retail behavior - spells already in transit will not cause mob to chase you if its primary target vanishes before the spell hits.
- Prevent mobbing by stopping creatures from auto-acquiring a nearby target just because the primary target vanished.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 37 |
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()) { |