Core/Spells: Fixed logic related to movement while channeling
This commit is contained in:
@@ -1382,14 +1382,20 @@ namespace Game.Entities
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanMoveDuringChannel()
|
public bool IsMovementPreventedByCasting()
|
||||||
{
|
{
|
||||||
|
// can always move when not casting
|
||||||
|
if (!HasUnitState(UnitState.Casting))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
|
||||||
Spell spell = m_currentSpells.LookupByKey(CurrentSpellTypes.Channeled);
|
Spell spell = m_currentSpells.LookupByKey(CurrentSpellTypes.Channeled);
|
||||||
if (spell)
|
if (spell)
|
||||||
if (spell.getState() != SpellState.Finished && spell.IsChannelActive())
|
if (spell.getState() != SpellState.Finished && spell.IsChannelActive())
|
||||||
if (!spell.GetSpellInfo().IsMoveAllowedChannel())
|
if (spell.GetSpellInfo().IsMoveAllowedChannel())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// prohibit movement for all other spell casts
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Game.Movement
|
|||||||
if (owner.HasUnitState(UnitState.Root | UnitState.Stunned))
|
if (owner.HasUnitState(UnitState.Root | UnitState.Stunned))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (owner.HasUnitState(UnitState.Casting) && !owner.CanMoveDuringChannel())
|
if (owner.IsMovementPreventedByCasting())
|
||||||
{
|
{
|
||||||
owner.CastStop();
|
owner.CastStop();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Game.Movement
|
|||||||
|
|
||||||
public void _setRandomLocation(T creature)
|
public void _setRandomLocation(T creature)
|
||||||
{
|
{
|
||||||
if (creature.HasUnitState(UnitState.Casting) && !creature.CanMoveDuringChannel())
|
if (creature.IsMovementPreventedByCasting())
|
||||||
{
|
{
|
||||||
creature.CastStop();
|
creature.CastStop();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Game.Movement
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prevent movement while casting spells with cast time or channel time
|
// prevent movement while casting spells with cast time or channel time
|
||||||
if (owner.HasUnitState(UnitState.Casting) && !owner.CanMoveDuringChannel())
|
if (owner.IsMovementPreventedByCasting())
|
||||||
{
|
{
|
||||||
if (!owner.isStopped())
|
if (!owner.isStopped())
|
||||||
owner.StopMoving();
|
owner.StopMoving();
|
||||||
@@ -144,7 +144,7 @@ namespace Game.Movement
|
|||||||
if (owner.HasUnitState(UnitState.NotMove))
|
if (owner.HasUnitState(UnitState.NotMove))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (owner.HasUnitState(UnitState.Casting) && !owner.CanMoveDuringChannel())
|
if (owner.IsMovementPreventedByCasting())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (owner.IsTypeId(TypeId.Unit) && !target.isInAccessiblePlaceFor(owner.ToCreature()))
|
if (owner.IsTypeId(TypeId.Unit) && !target.isInAccessiblePlaceFor(owner.ToCreature()))
|
||||||
|
|||||||
Reference in New Issue
Block a user