Ejemplo n.º 1
0
        public virtual TimeSpan GetCastDelay()
        {
            if (m_Scroll is BaseWand)
            {
                return(TimeSpan.Zero);
            }

            double fc = 0;

            if (m_Caster.Player)
            {
                Arcanite acr = Perk.GetByType <Arcanite>((Player)m_Caster);

                if (acr != null)
                {
                    fc += acr.GetFCBonus();
                }
            }

            TimeSpan delay = TimeSpan.FromSeconds(0.75) + TimeSpan.FromSeconds(-fc);

            if (delay <= TimeSpan.FromSeconds(0.10))
            {
                delay = TimeSpan.FromSeconds(0.10);
            }

            return(delay);
        }
Ejemplo n.º 2
0
        public virtual int ScaleMana(int mana)
        {
            double scalar = 1.0;

            if (!Necromancy.MindRotSpell.GetMindRotScalar(Caster, ref scalar))
            {
                scalar = 1.0;
            }

            // Lower Mana Cost = 40%
            int lmc = AosAttributes.GetValue(m_Caster, AosAttribute.LowerManaCost);

            if (lmc > 40)
            {
                lmc = 40;
            }

            if (m_Caster.Player)
            {
                Arcanite arc = Perk.GetByType <Arcanite>((Player)m_Caster);

                if (arc != null)
                {
                    lmc = arc.GetLMCBonus();
                }
            }

            scalar -= (double)lmc / 100;

            return((int)(mana * scalar));
        }
Ejemplo n.º 3
0
        public virtual void SayMantra()
        {
            if (m_Scroll is BaseWand)
            {
                return;
            }

            if (m_Info.Mantra != null && m_Info.Mantra.Length > 0 && m_Caster.Player)
            {
                Arcanite arc = Perk.GetByType <Arcanite>((Player)m_Caster);

                if (arc != null)
                {
                    if (!arc.SayMantra)
                    {
                        return;
                    }
                }

                m_Caster.PublicOverheadMessage(MessageType.Spell, m_Caster.SpeechHue, true, m_Info.Mantra, false);
            }
        }
Ejemplo n.º 4
0
        public virtual TimeSpan GetCastRecovery()
        {
            double fcr = 0;

            if (m_Caster.Player)
            {
                Arcanite arc = Perk.GetByType <Arcanite>((Player)m_Caster);

                if (arc != null)
                {
                    fcr += arc.GetFCRBonus();
                }
            }

            TimeSpan next = (NextSpellDelay + TimeSpan.FromSeconds(-fcr));

            if (next <= TimeSpan.FromSeconds(0.10))
            {
                next = TimeSpan.FromSeconds(0.10);
            }

            return(next);
        }
Ejemplo n.º 5
0
        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);
            }
            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 is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.Now)
            {
                m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
            }
            else if (m_Caster.Mana >= ScaleMana(GetMana()))
            {
                if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this))
                {
                    if (m_Caster.Player)
                    {
                        SpellCastEventArgs args = new SpellCastEventArgs((Player)Caster, this);
                        EventDispatcher.InvokeSpellCast(args);

                        if (args.Blocked)
                        {
                            return(false);
                        }
                    }

                    m_State        = SpellState.Casting;
                    m_Caster.Spell = this;

                    if (!(m_Scroll is BaseWand) && RevealOnCast)
                    {
                        m_Caster.RevealingAction();
                    }

                    SayMantra();

                    TimeSpan castDelay = this.GetCastDelay();

                    if (ShowHandMovement && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster)))
                    {
                        int  count   = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);
                        bool animate = true;

                        if (m_Caster is Player)
                        {
                            Arcanite arc = Perk.GetByType <Arcanite>((Player)m_Caster);

                            if (arc != null)
                            {
                                if (arc.EtherealKenetics())
                                {
                                    animate = false;
                                }
                            }
                        }

                        if (count != 0 && animate)
                        {
                            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();

                    if (castDelay > TimeSpan.Zero)
                    {
                        m_CastTimer.Start();
                    }
                    else
                    {
                        m_CastTimer.Tick();
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana
            }

            return(false);
        }