diff options
author | Treeston <treeston.mmoc@gmail.com> | 2016-02-27 15:59:43 +0100 |
---|---|---|
committer | Treeston <treeston.mmoc@gmail.com> | 2016-02-27 15:59:43 +0100 |
commit | 79a945d5e573b48733ee5094a3c738a5d8904dbc (patch) | |
tree | 1cba6d8f712d2fae986abba7ef33f0026270fbdc /src/server/game/Combat/ThreatManager.cpp | |
parent | 31cd082833926539c56569ff6faabc139f5f3223 (diff) | |
parent | b5b7ce44cfeb98bf47eb6c9e0c926994ad53ede8 (diff) |
Merge pull request #16666 from Treeston/3.3.5-bodypull
[3.3.5] Fix bosses losing interest in the person running at them
Diffstat (limited to 'src/server/game/Combat/ThreatManager.cpp')
-rw-r--r-- | src/server/game/Combat/ThreatManager.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 588e7b1a93b..9767d69e2aa 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -335,7 +335,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR { // current victim is a second choice target, so don't compare threat with it below if (currentRef == currentVictim) - currentVictim = NULL; + currentVictim = nullptr; ++iter; continue; } @@ -437,12 +437,15 @@ void ThreatManager::_addThreat(Unit* victim, float threat) if (!ref) // there was no ref => create a new one { + bool isFirst = iThreatContainer.empty(); // threat has to be 0 here HostileReference* hostileRef = new HostileReference(victim, this, 0); iThreatContainer.addReference(hostileRef); hostileRef->addThreat(threat); // now we add the real threat if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->IsGameMaster()) hostileRef->setOnlineOfflineState(false); // GM is always offline + else if (isFirst) + setCurrentVictim(hostileRef); } } |