From cac4393e9aa8686ac4474c9f4402d0d6fce77394 Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 29 Nov 2024 20:03:16 +0100 Subject: [PATCH] Vehicle/Spell: Fix case of vehicle not entering same phase on phase change --- src/game/Entities/Unit.cpp | 7 ++++--- src/game/Spells/SpellAuras.cpp | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index ed006d479ae..24496fc5b10 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -6067,7 +6067,8 @@ void Unit::RemoveNotOwnTrackedTargetAuras(uint32 newPhase) continue; } Unit* itr_target = GetMap()->GetUnit(itr_targetGuid); - if (!itr_target || !itr_target->InSamePhase(newPhase)) + // vehicles follow owner into phase + if (!itr_target || (type != TRACK_AURA_TYPE_CONTROL_VEHICLE && !itr_target->InSamePhase(newPhase))) { scTargets.erase(itr); // remove for caster in any case @@ -11814,10 +11815,10 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update) if (IsInWorld()) { - RemoveNotOwnTrackedTargetAuras(newPhaseMask); // we can lost access to caster or target - // all controlled except not owned charmed units CallForAllControlledUnits(SetPhaseMaskHelper(newPhaseMask), CONTROLLED_PET | CONTROLLED_GUARDIANS | CONTROLLED_MINIPET | CONTROLLED_TOTEMS); + + RemoveNotOwnTrackedTargetAuras(newPhaseMask); // we can lost access to caster or target } WorldObject::SetPhaseMask(newPhaseMask, update); diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index ad8e37b1ece..c4b86547b6e 100755 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -9454,7 +9454,7 @@ void Aura::HandlePhase(bool apply, bool Real) for (auto itr = phases.begin(); itr != phases.end(); ++itr) newPhase |= (*itr)->GetMiscValue(); - target->SetPhaseMask(newPhase ? newPhase : uint32(PHASEMASK_NORMAL), true); + target->SetPhaseMask(newPhase ? newPhase : uint32(PHASEMASK_NORMAL), false); if (apply) { @@ -9475,6 +9475,9 @@ void Aura::HandlePhase(bool apply, bool Real) itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false); } } + + if (target->IsInWorld()) + target->UpdateVisibilityAndView(); } void Aura::HandleAuraDetaunt(bool /*Apply*/, bool Real)