diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 6db405ca84..c4848c2ce6 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -192,6 +192,10 @@ void ThreatReference::HeapNotifyDecreased() if (tWho->GetSummonerGUID().IsPlayer()) return false; + // accessories are fully treated as components of the parent and cannot have threat + if (cWho->HasUnitTypeMask(UNIT_MASK_ACCESSORY)) + return false; + return true; } @@ -381,18 +385,12 @@ void ThreatManager::AddThreat(Unit* target, float amount, SpellInfo const* spell return; } - // while riding a vehicle, all threat goes to the vehicle, not the pilot - if (Unit* vehicle = target->GetVehicleBase()) - { - AddThreat(vehicle, amount, spell, ignoreModifiers, ignoreRedirects); - if (target->HasUnitTypeMask(UNIT_MASK_ACCESSORY)) // accessories are fully treated as components of the parent and cannot have threat - return; - amount = 0.0f; - } - // if we cannot actually have a threat list, we instead just set combat state and avoid creating threat refs altogether if (!CanHaveThreatList()) { + if (ignoreRedirects) + return; + CombatManager& combatMgr = _owner->GetCombatManager(); if (!combatMgr.SetInCombatWith(target)) return; diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 7d5366f00f..0858f97ccb 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -434,7 +434,10 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ ASSERT(accessory); if (minion) + { accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); + accessory->GetThreatManager().Initialize(); // reinitialize CanHaveThreatList cached value + } (void)_me->HandleSpellClick(accessory, seatId); @@ -979,7 +982,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32) Passenger->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_SLOT_CONTROLLED); for (auto const& [guid, threatRef] : Passenger->GetThreatManager().GetThreatenedByMeList()) - threatRef->GetOwner()->GetThreatManager().AddThreat(Target->GetBase(), threatRef->GetThreat(), nullptr, true, true); + threatRef->GetOwner()->GetThreatManager().AddThreat(Target->GetBase(), 0.0f, nullptr, true, true); if (Creature* creature = Target->GetBase()->ToCreature()) {