From e67167e8cfe40de0077283cd448efc04cd75d52b Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Wed, 22 Apr 2020 00:40:48 +0200 Subject: [PATCH] Core/Creatures: uncontrolled minions such as Army of the Dead and totem elementals will now be stored in the player's controlled list as well to trigger aggro mechanics --- .../Entities/Creature/TemporarySummon.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index ba7fd7d8d68..76e7781d15b 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -267,9 +267,6 @@ void TempSummon::UnSummon(uint32 msTime) { if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled) owner->ToCreature()->AI()->SummonedCreatureDespawn(this); - - if (owner->IsTotem()) - owner->m_Controlled.erase(this); } AddObjectToRemoveList(); @@ -323,6 +320,15 @@ void Minion::InitStats(uint32 duration) // Only controlable guardians and companions get a owner guid if (HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) || (m_Properties && m_Properties->Title == AsUnderlyingType(SummonTitle::Companion))) GetOwner()->SetMinion(this, true); + else if (!HasUnitTypeMask(UNIT_MASK_PET | UNIT_MASK_HUNTER_PET)) + { + GetOwner()->m_Controlled.insert(this); + + // Store the totem elementals in players controlled list as well to trigger aggro mechanics + if (GetOwner()->IsTotem()) + if (Unit* totemOwner = GetOwner()->GetOwner()) + totemOwner->m_Controlled.insert(this); + } } void Minion::RemoveFromWorld() @@ -332,6 +338,14 @@ void Minion::RemoveFromWorld() if (HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) || (m_Properties && m_Properties->Title == AsUnderlyingType(SummonTitle::Companion))) GetOwner()->SetMinion(this, false); + else if (!HasUnitTypeMask(UNIT_MASK_PET | UNIT_MASK_HUNTER_PET)) + { + GetOwner()->m_Controlled.erase(this); + + if (GetOwner()->IsTotem()) + if (Unit* totemOwner = GetOwner()->GetOwner()) + totemOwner->m_Controlled.erase(this); + } TempSummon::RemoveFromWorld(); }