diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-11-27 16:36:04 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-11-27 16:36:04 +0100 |
commit | 9174281b9253712982273b9b703d9fbac5cef9cd (patch) | |
tree | 575e9e7a5e68f08327c908c8125fb290b9e1c7a4 /src | |
parent | ef4c878d260c0e01a6ab2f4391af46c261d04785 (diff) |
Core/Auras: Properly clean up partial charm applications
Ref #24876
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 23b977ee0c8..eda7b604fe6 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11574,7 +11574,13 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au // charm is set by aura, and aura effect remove handler was called during apply handler execution // prevent undefined behaviour if (aurApp && aurApp->GetRemoveMode()) + { + // properly clean up charm changes up to this point to avoid leaving the unit in partially charmed state + SetFaction(_oldFactionId); + GetMotionMaster()->InitializeDefault(); + charmer->SetCharm(this, false); return false; + } // Pets already have a properly initialized CharmInfo, don't overwrite it. if (type != CHARM_TYPE_VEHICLE && !GetCharmInfo()) |