Skip to content

Commit

Permalink
Vehicle/Spell: Fix case of vehicle not entering same phase on phase c…
Browse files Browse the repository at this point in the history
…hange
  • Loading branch information
killerwife committed Nov 29, 2024
1 parent ff294a2 commit cac4393
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down

0 comments on commit cac4393

Please sign in to comment.