diff options
author | Treeston <treeston.mmoc@gmail.com> | 2018-09-09 14:47:49 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-10-26 23:51:34 +0200 |
commit | 35e53839291c3782acca46d2f88f84b86d6e15b1 (patch) | |
tree | 13a32483dbc23c640e9083b990ab5857c8675333 /src/server/game/Combat/ThreatManager.cpp | |
parent | 26ca7b0fc2907f861d2cdbf1e8699b364518501b (diff) |
Core/Threat: Properly sequence checking offline state _after_ adding the reference to the threat list. This ensures IsEngagedWith reports consistent values for downstack calls in Creature. Closes #22406.
(cherry picked from commit 9f1755dbf13d475a26741690ec5d6a340a7f4230)
Diffstat (limited to 'src/server/game/Combat/ThreatManager.cpp')
-rw-r--r-- | src/server/game/Combat/ThreatManager.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 2f2351bb43f..d6d6378373e 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -397,9 +397,15 @@ void ThreatManager::AddThreat(Unit* target, float amount, SpellInfo const* spell } // ok, we're now in combat - create the threat list reference and push it to the respective managers - ThreatReference* ref = new ThreatReference(this, target, amount); + ThreatReference* ref = new ThreatReference(this, target); PutThreatListRef(target->GetGUID(), ref); target->GetThreatManager().PutThreatenedByMeRef(_owner->GetGUID(), ref); + + // afterwards, we evaluate whether this is an online reference (it might not be an acceptable target, but we need to add it to our threat list before we check!) + ref->UpdateOffline(); + if (ref->IsOnline()) // ...and if the ref is online it also gets the threat it should have + ref->AddThreat(amount); + if (!_ownerEngaged) { Creature* cOwner = ASSERT_NOTNULL(_owner->ToCreature()); // if we got here the owner can have a threat list, and must be a creature! |