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

This commit is contained in:
Treeston
2018-01-21 01:16:16 +01:00
committed by Ovahlord
parent 24482e1398
commit 2d14f744dd

View File

@@ -22,6 +22,7 @@
#include "ThreatManager.h"
#include "Unit.h"
#include "UnitAI.h"
#include "UnitDefines.h"
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
@@ -371,12 +372,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);