private SpellCastResult Cast() { ExecutionState = SpellExecutionState.Casting; CastTime = Caster.Spells.ModifySpellCastTime(this, SpellInfo.CastTime); CastTimeLeft = CastTime; // cast if needed, if already casting launch instead, should only be possible with CanCastWhileCasting bool instantCast = CastTime <= 0.0f || Caster.SpellCast.IsCasting || spellValue.CastFlags.HasTargetFlag(SpellCastFlags.CastDirectly); if (casterMovementFlags.IsMoving() && !instantCast && !SpellInfo.HasAttribute(SpellAttributes.CastableWhileMoving)) { return(SpellCastResult.Moving); } if (!spellValue.CastFlags.HasTargetFlag(SpellCastFlags.IgnoreShapeShift) && SpellInfo.CanCancelForm(this)) { Caster.Auras.RemoveAurasWithEffect(AuraEffectType.ShapeShift); } Caster.SpellHistory.StartGlobalCooldown(SpellInfo); if (!spellValue.CastFlags.HasTargetFlag(SpellCastFlags.IgnoreAuraInterruptFlags) && !SpellInfo.HasAttribute(SpellCustomAttributes.DontBreakStealth)) { Caster.Auras.RemoveAurasWithInterrupt(AuraInterruptFlags.Cast); } if (instantCast) { Launch(); } return(SpellCastResult.Success); }
private SpellCastResult Cast() { ExecutionState = SpellExecutionState.Casting; CastTime = Caster.Spells.ModifySpellCastTime(this, SpellInfo.CastTime); CastTimeLeft = CastTime; // cast if needed, if already casting launch instead, should only be possible with CanCastWhileCasting bool instantCast = CastTime <= 0.0f || Caster.SpellCast.IsCasting || spellCastFlags.HasTargetFlag(SpellCastFlags.CastDirectly); if (casterMovementFlags.IsMoving() && !instantCast && !SpellInfo.HasAttribute(SpellAttributes.CastableWhileMoving)) { return(SpellCastResult.Moving); } Caster.SpellHistory.StartGlobalCooldown(SpellInfo); if (instantCast) { Launch(); } return(SpellCastResult.Success); }