From 955bfae5efbb7cb0de367db539e03716691e75ba Mon Sep 17 00:00:00 2001 From: Nawuko Date: Mon, 25 Apr 2016 11:46:35 -0300 Subject: Core/Movement: Fix issues where creatures cancel spell casts chasing target and Implement SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING (cherry picked from commit bf2cee8cce39e64590dc68bc35e5d3d2dd19cbaf) --- src/server/game/Entities/Unit/Unit.cpp | 9 +++++++++ src/server/game/Entities/Unit/Unit.h | 3 +++ 2 files changed, 12 insertions(+) (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 871b04c46f5..6f23f57b3c7 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2983,6 +2983,15 @@ int32 Unit::GetCurrentSpellCastTime(uint32 spell_id) const return 0; } +bool Unit::CanMoveDuringChannel() const +{ + if (Spell* spell = m_currentSpells[CURRENT_CHANNELED_SPELL]) + if (spell->getState() != SPELL_STATE_FINISHED) + return spell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING) && spell->IsChannelActive(); + + return false; +} + bool Unit::isInFrontInMap(Unit const* target, float distance, float arc) const { return IsWithinDistInMap(target, distance) && HasInArc(arc, target); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 6e16f94422c..26bf7a56751 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1957,6 +1957,9 @@ class TC_GAME_API Unit : public WorldObject virtual SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const; uint32 GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) const; + // Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING + bool CanMoveDuringChannel() const; + SpellHistory* GetSpellHistory() { return _spellHistory; } SpellHistory const* GetSpellHistory() const { return _spellHistory; } -- cgit v1.2.3