From 27cdd4b257d01005d9e342b39a4fdf76567d13cf Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 24 Nov 2016 20:22:47 +0100 Subject: Core/Spells: Fixed logic related to movement while channeling Closes #18289 (cherry picked from commit 90a58117017a93fa33864fe1892e7304e2f3bbf4) --- src/server/game/Entities/Unit/Unit.cpp | 12 ++++++++---- src/server/game/Entities/Unit/Unit.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/server/game/Entities/Unit') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f4242061c78..b31e46473ab 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3018,15 +3018,19 @@ int32 Unit::GetCurrentSpellCastTime(uint32 spell_id) const return 0; } -bool Unit::CanMoveDuringChannel() const +bool Unit::IsMovementPreventedByCasting() const { + // can always move when not casting + if (!HasUnitState(UNIT_STATE_CASTING)) + return false; + + // channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL]) - { if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive()) - if (!spell->GetSpellInfo()->IsMoveAllowedChannel()) + if (spell->GetSpellInfo()->IsMoveAllowedChannel()) return false; - } + // prohibit movement for all other spell casts return true; } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index db8bcfe6b2c..41a091c36e4 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1556,7 +1556,7 @@ class TC_GAME_API Unit : public WorldObject uint32 GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) const; // Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING - bool CanMoveDuringChannel() const; + bool IsMovementPreventedByCasting() const; SpellHistory* GetSpellHistory() { return _spellHistory; } SpellHistory const* GetSpellHistory() const { return _spellHistory; } -- cgit v1.2.3