Core/Creatures: Improved movement interruption while casting spells

Port From (https://github.com/TrinityCore/TrinityCore/commit/cc57c9dad59a2eded2f7ea0471aa79c89b390559)
This commit is contained in:
hondacrx
2023-04-05 08:03:07 -04:00
parent 6b8dc37d3c
commit 1cf184978e
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -1047,7 +1047,8 @@ namespace Game.Entities
Spell spell = GetCurrentSpell(CurrentSpellTypes.Generic);
if (spell != null)
if (CanCastSpellWhileMoving(spell.GetSpellInfo()))
if (CanCastSpellWhileMoving(spell.GetSpellInfo()) || spell.GetState() == SpellState.Finished ||
!spell.m_spellInfo.InterruptFlags.HasFlag(SpellInterruptFlags.Movement))
return false;
// channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
+6
View File
@@ -7809,6 +7809,12 @@ namespace Game.Spells
if (IsTriggered())
return SpellCastResult.SpellCastOk;
// Creatures (not controlled) give priority to spell casting over movement.
// We assume that the casting is always valid and the current movement
// is stopped by Unit:IsmovementPreventedByCasting to prevent casting interruption.
if (m_caster.IsCreature() && !m_caster.ToCreature().IsControlledByPlayer())
return SpellCastResult.SpellCastOk;
Unit unitCaster = m_caster.ToUnit();
if (unitCaster != null)
{