public bool Cast()
{
m_StartCastTime = DateTime.Now;
if (Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing)
{
((Spell)m_Caster.Spell).Disturb(DisturbType.NewCast);
}
if (!m_Caster.CheckAlive())
{
return(false);
}
#region Mondain's Legacy
else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).Peaced)
{
m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
}
#endregion
else if (m_Caster.Spell != null && m_Caster.Spell.IsCasting)
{
m_Caster.SendLocalizedMessage(502642); // You are already casting a spell.
}
else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)) || (BlockedByAnimalForm && AnimalForm.UnderTransformation(m_Caster)))
{
m_Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
}
else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen))
{
m_Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen.
}
else if (CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime)
{
m_Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell.
}
else if (m_Caster.Mana >= ScaleMana(GetMana()))
{
if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this))
{
m_State = SpellState.Casting;
m_Caster.Spell = this;
if (RevealOnCast)
{
m_Caster.RevealingAction();
}
SayMantra();
TimeSpan castDelay = this.GetCastDelay();
if (ShowHandMovement && m_Caster.Body.IsHuman)
{
int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);
if (count != 0)
{
m_AnimTimer = new AnimTimer(this, count);
m_AnimTimer.Start();
}
if (m_Info.LeftHandEffect > 0)
{
Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand);
}
if (m_Info.RightHandEffect > 0)
{
Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand);
}
}
if (ClearHandsOnCast)
{
m_Caster.ClearHands();
}
m_CastTimer = new CastTimer(this, castDelay);
m_CastTimer.Start();
OnBeginCast();
return(true);
}
else
{
return(false);
}
}
else
{
m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana
}
return(false);
}