Skip to content

Commit

Permalink
[12049] Let PossessedSummons despawn on Channeled-Aura interrupt
Browse files Browse the repository at this point in the history
Maybe this mechanic should also be used for normal possessed mobs, but then their special handling must be removed
Also not entirely sure if this a great place for this code to be - but I didn't catch a better suiting one
  • Loading branch information
Schmoozerd committed Jul 16, 2012
1 parent e48eea3 commit 65d4f03
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
32 changes: 31 additions & 1 deletion src/game/Spell.cpp
Expand Up @@ -4358,8 +4358,38 @@ void Spell::SendInterrupted(uint8 result)

void Spell::SendChannelUpdate(uint32 time)
{
if(time == 0)
if (time == 0)
{
// Reset farsight for some possessing auras of possessed summoned (as they might work with different aura types)
if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_FARSIGHT) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetCharmGuid()
&& !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS) && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS_PET))
{
Player* player = (Player*)m_caster;
// These Auras are applied to self, so get the possessed first
Unit* possessed = player->GetCharm();

player->SetCharm(NULL);
if (possessed)
player->SetClientControl(possessed, 0);
player->SetMover(NULL);
player->GetCamera().ResetView();
player->RemovePetActionBar();

if (possessed)
{
possessed->clearUnitState(UNIT_STAT_CONTROLLED);
possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
possessed->SetCharmerGuid(ObjectGuid());
// TODO - Requires more specials for target?

// Some possessed might want to despawn?
if (possessed->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id && possessed->GetTypeId() == TYPEID_UNIT)
((Creature*)possessed)->ForcedDespawn();
}
}



m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid());

ObjectGuid target_guid = m_caster->GetChannelObjectGuid();
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12048"
#define REVISION_NR "12049"
#endif // __REVISION_NR_H__

0 comments on commit 65d4f03

Please sign in to comment.