diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 15 | ||||
-rw-r--r-- | src/game/SpellHandler.cpp | 48 | ||||
-rw-r--r-- | src/game/Unit.cpp | 16 |
3 files changed, 28 insertions, 51 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 59d019800ed..9f2a0cd33e0 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -48,6 +48,7 @@ #include "VMapFactory.h" #include "BattleGround.h" #include "Util.h" +#include "TemporarySummon.h" #define SPELL_CHANNEL_UPDATE_INTERVAL 1000 @@ -2187,6 +2188,20 @@ void Spell::cancel() } break; } + // Unsummon summon as possessed creatures on spell cancel + for (int i = 0; i < 3; i++) + { + if (m_spellInfo->Effect[i] == SPELL_EFFECT_SUMMON && + (m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || + m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 || + m_spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) + { + // Possession is removed in the UnSummon function + if (m_caster->GetCharm()) + ((TemporarySummon*)m_caster->GetCharm())->UnSummon(); + } + } + finish(false); m_caster->RemoveDynObject(m_spellInfo->Id); m_caster->RemoveGameObject(m_spellInfo->Id,true); diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 6caab76e061..f0d004a0329 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -358,49 +358,27 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) if (!spellInfo) return; - // Remove possess/charm/sight aura from the possessed/charmed as well - // TODO: Remove this once the ability to cancel aura sets at once is implemented - if(_player->GetCharm() || _player->GetFarsightTarget()) + // not allow remove non positive spells and spells with attr SPELL_ATTR_CANT_CANCEL + if(!IsPositiveSpell(spellId) || (spellInfo->Attributes & SPELL_ATTR_CANT_CANCEL)) + return; + + // channeled spell case (it currently casted then) + if(IsChanneledSpell(spellInfo)) { - for (int i = 0; i < 3; ++i) + if(Spell* spell = _player->m_currentSpells[CURRENT_CHANNELED_SPELL]) { - if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_POSSESS || - spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_POSSESS_PET || - spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_CHARM || - spellInfo->EffectApplyAuraName[i] == SPELL_AURA_BIND_SIGHT) + if(spell->m_spellInfo->Id==spellId) { - // Fix me: creature may be killed during player aura cancel - _player->RemoveAurasDueToSpellByCancel(spellId); - if (_player->GetCharm()) - _player->GetCharm()->RemoveAurasDueToSpellByCancel(spellId); - else if (_player->GetFarsightTarget() && _player->GetFarsightTarget()->GetTypeId() != TYPEID_DYNAMICOBJECT) - ((Unit*)_player->GetFarsightTarget())->RemoveAurasDueToSpellByCancel(spellId); - return; - } - else if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON && - (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || - spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 || - spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) - { - // Possession is removed in the UnSummon function - ((TemporarySummon*)_player->GetCharm())->UnSummon(); + spell->cancel(); + spell->SetReferencedFromCurrent(false); + _player->m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL; } } - } - - // not allow remove non positive spells and spells with attr SPELL_ATTR_CANT_CANCEL - if(!IsPositiveSpell(spellId) || (spellInfo->Attributes & SPELL_ATTR_CANT_CANCEL)) return; + } + // non channeled case _player->RemoveAurasDueToSpellByCancel(spellId); - - if (spellId == 2584) // Waiting to resurrect spell cancel, we must remove player from resurrect queue - { - BattleGround *bg = _player->GetBattleGround(); - if(!bg) - return; - bg->RemovePlayerFromResurrectQueue(_player->GetGUID()); - } } void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e0fa1b0fc89..cd88d938693 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -46,7 +46,6 @@ #include "GridNotifiersImpl.h" #include "CellImpl.h" #include "Path.h" -#include "TemporarySummon.h" #include <math.h> @@ -3412,21 +3411,6 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id) // channeled spells are interrupted if they are not finished, even if they are delayed if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) { - // Unsummon any summoned as possessed creatures on channel interrupt - SpellEntry const *spellInfo = m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo; - for (int i = 0; i < 3; i++) - { - if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON && - (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || - spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 || - spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) - { - // Possession is removed in the UnSummon function - if (GetCharm()) - ((TemporarySummon*)GetCharm())->UnSummon(); - } - } - if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false); |