mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user