diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-04-23 20:40:23 -0300 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2020-04-28 12:35:23 +0200 |
commit | 9ef39fa5d2f76459e3e529a0877655b0f69b98d6 (patch) | |
tree | f08e41a9a1b3d45fd469f6377292a2acf4506c40 /src | |
parent | 52ab2707682f37bbf35a0d384e81c79e8b064ebf (diff) |
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
(cherry picked from commit 522f537048189b40a12d68583485d1de7fcbf1d2)
Diffstat (limited to 'src')
4 files changed, 8 insertions, 5 deletions
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 1be3e00e39a..b4eaf0e4cfa 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -328,7 +328,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, 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 2c8cf177669..f15294e8054 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3133,6 +3133,9 @@ bool Unit::IsMovementPreventedByCasting() const if (spell->GetSpellInfo()->IsMoveAllowedChannel()) return false; + if (const_cast<Unit*>(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 d0a246d6b90..c61146e063b 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1659,6 +1659,8 @@ class TC_GAME_API Unit : public WorldObject virtual SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const; uint32 GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) 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; diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index a4efd581a4e..5c8eb721e18 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -40,8 +40,7 @@ bool TargetedMovementGenerator<T, D>::DoUpdate(T* owner, uint32 diff) if (!owner || !owner->IsAlive()) return false; - if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting() || HasLostTarget(owner) - || (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsFocusing(nullptr, true))) + if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting() || HasLostTarget(owner)) { _interrupt = true; owner->StopMoving(); @@ -111,8 +110,7 @@ void TargetedMovementGenerator<T, D>::SetTargetLocation(T* owner, bool updateDes if (!owner || !owner->IsAlive()) return; - if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting() || HasLostTarget(owner) - || (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsFocusing(nullptr, true))) + if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting() || HasLostTarget(owner)) { _interrupt = true; owner->StopMoving(); |