Combat/Threat: Now set engaged state for all units on offline reference registration (vanished/invis'd units). For non-PASSIVE units, this will immediately cause an evade.

This fixes an exploit where creating the reference as offline (by vanishing while a spell was mid-flight) you could damage a creature further without it ever engaging you.

(cherry picked from commit 2402406228)
This commit is contained in:
Treeston
2018-01-29 03:07:43 +01:00
committed by Shauren
parent 75a3b2f122
commit fdc1c5b6c9

View File

@@ -380,13 +380,12 @@ 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);
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()))
if (!_ownerEngaged)
{
_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);