Core/Spells: make Spell::CheckMovement respect the current spell state

Port From (https://github.com/TrinityCore/TrinityCore/commit/ad2df01b2c25ca6264096b8b8324dc8136ebd48b)
This commit is contained in:
hondacrx
2022-10-03 20:42:04 -04:00
parent 0c4e5802cd
commit d21624fd87
+4 -8
View File
@@ -7827,17 +7827,13 @@ namespace Game.Spells
{
if (!unitCaster.CanCastSpellWhileMoving(m_spellInfo))
{
if (m_casttime != 0)
if (GetState() == SpellState.Preparing)
{
if (m_spellInfo.InterruptFlags.HasFlag(SpellInterruptFlags.Movement))
return SpellCastResult.Moving;
}
else
{
// only fail channeled casts if they are instant but cannot be channeled while moving
if (m_spellInfo.IsChanneled() && !m_spellInfo.IsMoveAllowedChannel())
if (m_casttime > 0 && m_spellInfo.InterruptFlags.HasFlag(SpellInterruptFlags.Movement))
return SpellCastResult.Moving;
}
else if (GetState() == SpellState.Casting && !m_spellInfo.IsMoveAllowedChannel())
return SpellCastResult.Moving;
}
}