Core/Threat: Passive creatures now properly become engaged when adding an offline threat entry. Fixes RoS and Thaddius, maybe more. Closes #21269.

(cherry picked from commit a373275612)
This commit is contained in:
Treeston
2018-01-21 01:16:16 +01:00
committed by Shauren
parent 85ffcd9826
commit 9f91cf23ab

View File

@@ -380,12 +380,13 @@ void ThreatManager::AddThreat(Unit* target, float amount, SpellInfo const* spell
ThreatReference* ref = new ThreatReference(this, target, amount);
PutThreatListRef(target->GetGUID(), ref);
target->GetThreatManager().PutThreatenedByMeRef(_owner->GetGUID(), ref);
if (!ref->IsOffline() && !_ownerEngaged)
Creature* cOwner = _owner->ToCreature();
ASSERT(cOwner); // if we got here the owner can have a threat list, and must be a creature!
if (!_ownerEngaged && (cOwner->HasReactState(REACT_PASSIVE) || !ref->IsOffline()))
{
_ownerEngaged = true;
Creature* cOwner = _owner->ToCreature();
assert(cOwner); // if we got here the owner can have a threat list, and must be a creature!
SaveCreatureHomePositionIfNeed(cOwner);
if (cOwner->IsAIEnabled)
cOwner->AI()->JustEngagedWith(target);