diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2018-01-29 23:14:46 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-06-19 01:35:41 +0200 |
| commit | 95fb6fe075f0cac7bc1822c7b5a0276a2276d897 (patch) | |
| tree | c3412db60e9eca09c32f13b607aee505e7f74dee /src | |
| parent | 39dff738e184a9da2644f140e20083fa3a4cbeb5 (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.
(cherry picked from commit 1acfefb973895b0e3df3c8d9b43b920d2a1b5392)
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 28a7a3c3bb2..1e8f3bd598a 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1213,32 +1213,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 @@ -1278,15 +1254,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()) { |
