From 522f537048189b40a12d68583485d1de7fcbf1d2 Mon Sep 17 00:00:00 2001 From: ariel- Date: Sun, 23 Apr 2017 20:40:23 -0300 Subject: Core/Movement: allow focused spells to not break movement if it's movement allowed spell - Core/Unit: made IsFocusing virtual Thanks to ccrs for suggestion --- src/server/game/Entities/Creature/Creature.h | 2 +- src/server/game/Entities/Unit/Unit.cpp | 3 +++ src/server/game/Entities/Unit/Unit.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/server/game/Entities') diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index fd1758562b2..f5cbf4c46c4 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -714,7 +714,7 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma void MustReacquireTarget() { m_shouldReacquireTarget = true; } // flags the Creature for forced (client displayed) target reacquisition in the next ::Update call void DoNotReacquireTarget() { m_shouldReacquireTarget = false; m_suppressedTarget = ObjectGuid::Empty; m_suppressedOrientation = 0.0f; } void FocusTarget(Spell const* focusSpell, WorldObject const* target); - bool IsFocusing(Spell const* focusSpell = nullptr, bool withDelay = false); + bool IsFocusing(Spell const* focusSpell = nullptr, bool withDelay = false) override; void ReleaseFocus(Spell const* focusSpell = nullptr, bool withDelay = true); // Part of Evade mechanics diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4b05bd4687d..3547ac558ce 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3324,6 +3324,9 @@ bool Unit::IsMovementPreventedByCasting() const if (spell->GetSpellInfo()->IsMoveAllowedChannel()) return false; + if (const_cast(this)->IsFocusing(nullptr, true)) + 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 cd7e6e6a13b..4fefa55816d 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1902,6 +1902,8 @@ class TC_GAME_API Unit : public WorldObject Spell* FindCurrentSpellBySpellId(uint32 spell_id) const; int32 GetCurrentSpellCastTime(uint32 spell_id) const; + virtual bool IsFocusing(Spell const* /*focusSpell*/ = nullptr, bool /*withDelay*/ = false) { return false; } + // Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING bool IsMovementPreventedByCasting() const; -- cgit v1.2.3