Ejemplo n.º 1
0
        public TransformTimer(Mobile from, TransformationSpell spell)
            : base(TimeSpan.FromSeconds(spell.TickRate), TimeSpan.FromSeconds(spell.TickRate))
        {
            m_Mobile = from;
            m_Spell  = spell;

            Priority = TimerPriority.TwoFiftyMS;
        }
Ejemplo n.º 2
0
        public virtual double GetSlayerDamageScalar(Mobile defender)
        {
            Spellbook atkBook = Spellbook.FindEquippedSpellbook(m_Caster);

            double scalar = 1.0;

            if (atkBook != null)
            {
                SlayerEntry atkSlayer  = SlayerGroup.GetEntryByName(atkBook.Slayer);
                SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName(atkBook.Slayer2);

                if (atkSlayer != null && atkSlayer.Slays(defender) || atkSlayer2 != null && atkSlayer2.Slays(defender))
                {
                    defender.FixedEffect(0x37B9, 10, 5);                        //TODO: Confirm this displays on OSIs
                    scalar = 2.0;
                }


                TransformContext context = TransformationSpell.GetContext(defender);

                if ((atkBook.Slayer == SlayerName.Silver || atkBook.Slayer2 == SlayerName.Silver) && context != null && context.Type != typeof(HorrificBeastSpell))
                {
                    scalar += .25;                    // Every necromancer transformation other than horrific beast take an additional 25% damage
                }
                if (scalar != 1.0)
                {
                    return(scalar);
                }
            }

            ISlayer defISlayer = Spellbook.FindEquippedSpellbook(defender);

            if (defISlayer == null)
            {
                defISlayer = defender.Weapon as ISlayer;
            }

            if (defISlayer != null)
            {
                SlayerEntry defSlayer  = SlayerGroup.GetEntryByName(defISlayer.Slayer);
                SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName(defISlayer.Slayer2);

                if (defSlayer != null && defSlayer.Group.OppositionSuperSlays(m_Caster) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays(m_Caster))
                {
                    scalar = 2.0;
                }
            }

            return(scalar);
        }
Ejemplo n.º 3
0
        public bool canCast()
        {
            PlayerMobile pm = Caster as PlayerMobile;

            if (Caster.AccessLevel != AccessLevel.Player)
            {
                return(true);
            }
            else
            {
                if (!Caster.CheckAlive())
                {
                }
                else if (Caster.Spell != null && Caster.Spell.IsCasting)
                {
                    Caster.SendLocalizedMessage(502642); // You are already casting a spell.
                }
                else if (BlockedByHorrificBeast && TransformationSpell.UnderTransformation(Caster, typeof(HorrificBeastSpell)))
                {
                    Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
                }
                else if (Caster.Frozen)
                {
                    Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen.
                }
                else if (CheckNextSpellTime && Core.TickCount < Caster.NextSpellTime)
                {
                    Caster.SendLocalizedMessage(502644); // You must wait for that spell to have an effect.
                }
                else if (Caster.Skills[m_Info.skillForCasting].Value < m_Info.minSkillForCasting)
                {
                    Caster.SendMessage("Vous n'êtes pas assez doué dans votre école de magie pour lancer ce sort.");
                }
                else if (Caster.Mana < ManaCost)
                {
                    Caster.LocalOverheadMessage(MessageType.Regular, 0, true, "Vous n'avez pas assez de mana pour lancer ce sort.");
                }
                else if (BandageContext.IsHealingSelf(Caster))
                {
                    Caster.SendMessage("Vous ne pouvez pas lancer de sort tout en vous soignant avec des bandages.");
                }
                else if (Caster.Spell == null && Caster.CheckSpellCast(this) && CheckCast() && Caster.Region.OnBeginSpellCast(Caster, this))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
        public static void DoLeech(int damageGiven, Mobile from, Mobile target)
        {
            TransformContext context = TransformationSpell.GetContext(from);

            if (context != null && context.Type == typeof(WraithFormSpell))
            {
                int wraithLeech = (5 + (int)((15 * from.Skills.SpiritSpeak.Value) / 100));                        // Wraith form gives 5-20% mana leech
                int manaLeech   = Math.Min(target.Mana, AOS.Scale(damageGiven, wraithLeech));

                if (manaLeech != 0)
                {
                    // Mana leeched by the Wraith Form spell is actually stolen, not just leeched.
                    target.Mana -= manaLeech;
                    from.Mana   += manaLeech;
                    from.PlaySound(0x44D);
                }
            }
        }
Ejemplo n.º 5
0
        public virtual double GetSlayerDamageScalar(Mobile defender)
        {
            Spellbook atkBook = Spellbook.FindEquippedSpellbook(Caster);

            double scalar = 1.0;

            if (atkBook != null)
            {
                SlayerEntry atkSlayer  = SlayerGroup.GetEntryByName(atkBook.Slayer);
                SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName(atkBook.Slayer2);

                if (atkSlayer != null && atkSlayer.Slays(defender))
                {
                    defender.FixedEffect(0x37B9, 10, 5);
                    scalar = Math.Max(scalar, SlayerGroup.IsSuperSlayer(atkSlayer.Name) ? 2.0 : 3.0);
                }

                if (atkSlayer2 != null && atkSlayer2.Slays(defender))
                {
                    defender.FixedEffect(0x37B9, 10, 5);
                    scalar = Math.Max(scalar, SlayerGroup.IsSuperSlayer(atkSlayer2.Name) ? 2.0 : 3.0);
                }

                TransformContext context = TransformationSpell.GetContext(defender);

                if ((atkBook.Slayer == SlayerName.Undead || atkBook.Slayer2 == SlayerName.Undead) && context != null && context.Type != typeof(HorrificBeastSpell))
                {
                    scalar += .25;                     // Every necromancer transformation other than horrific beast take an additional 25% damage
                }
                if (scalar != 1.0)
                {
                    return(scalar);
                }
            }

            #region Opposite Slayer
            if (defender.GetSlayerEntries().Any(e => e.Group.OppositionSuperSlays(Caster)))
            {
                scalar = 2.0;
            }
            #endregion

            return(scalar);
        }
Ejemplo n.º 6
0
        public override bool CheckCast()
        {
            if (Caster.Mounted)
            {
                Caster.SendLocalizedMessage(1042561); // Please dismount first.
                return(false);
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
            {
                Caster.SendMessage("Vous ne pouvez faire ce sort en étant sous l'effet de l'incognito.");
                return(false);
            }
            else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                Caster.BodyMod = 0;
                Caster.EndAction(typeof(PolymorphSpell));

                if (Caster is PlayerMobile)
                {
                    ((PlayerMobile)Caster).CheckRaceSkin();
                }
                /*Caster.SendLocalizedMessage(1005559); // This spell is already in effect.*/
                return(false);
            }
            else if (TransformationSpell.UnderTransformation(Caster))
            {
                Caster.SendMessage("Vous ne pouvez faire ce sort en étant transformé.");
                return(false);
            }

            /*else if (!Caster.CanBeginAction(typeof(ChauveSouris)))
             * {
             *  Caster.SendMessage("Vous ne pouvez vous transformer en étant sous la forme d'une chauve-souris.");
             *  return false;
             * }*/
            else if (m_NewBody == 0)
            {
                Caster.SendGump(new PolymorphGump(Caster, Scroll));
                return(false);
            }

            return(true);
        }
Ejemplo n.º 7
0
        public override bool CheckCast()
        {
            if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
            {
                Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
                return(false);
            }
            else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                Caster.SendMessage("Vous ne pouvez faire ce sort en étant transformé.");
                return(false);
            }
            else if (TransformationSpell.UnderTransformation(Caster))
            {
                Caster.SendMessage("Vous ne pouvez faire ce sort en étant transformé.");
                return(false);
            }

            /*else if (!Caster.CanBeginAction(typeof(ChauveSouris)))
             * {
             *  Caster.SendMessage("Vous ne pouvez vous transformer en étant sous la forme d'une chauve-souris.");
             *  return false;
             * }*/
            else if (m_Name == null || m_Name == "")
            {
                if (Caster is PlayerMobile)
                {
                    //((PlayerMobile)Caster).Incognito = true;
                }
                else
                {
                    Caster.SendMessage("Entrez le nouveau nom que vous désirez avoir (Minimum 3 lettres, ESC pour annuler).");
                    Caster.Prompt = new NamePrompt(Scroll);
                }
                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
        public static void DoLeech(int damageGiven, Mobile from, Mobile target)
        {
            TransformContext context = TransformationSpell.GetContext(from);

            if (context != null)               /* cleanup */
            {
                if (context.Type == typeof(WraithFormSpell))
                {
                    int wraithLeech = (5 + (int)((15 * from.Skills.SpiritSpeak.Value) / 100));                           // Wraith form gives 5-20% mana leech
                    int manaLeech   = AOS.Scale(damageGiven, wraithLeech);
                    if (manaLeech != 0)
                    {
                        from.Mana += manaLeech;
                        from.PlaySound(0x44D);
                    }
                }
                else if (context.Type == typeof(VampiricEmbraceSpell))
                {
                    from.Hits += AOS.Scale(damageGiven, 20);
                    from.PlaySound(0x44D);
                }
            }
        }
Ejemplo n.º 9
0
        public virtual bool CheckSequence()
        {
            int mana = ScaleMana(GetMana());

            if (m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing)
            {
                DoFizzle();
            }
            else if (m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster))))
            {
                DoFizzle();
            }
            else if (!ConsumeReagents())
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502630);                   // More reagents are needed for this spell.
            }
            else if (m_Caster.Mana < mana)
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                   // Insufficient mana for this spell.
            }
            else if (Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed))
            {
                m_Caster.SendLocalizedMessage(502646);                   // You cannot cast a spell while frozen.
                DoFizzle();
            }
            else if (CheckFizzle())
            {
                m_Caster.Mana -= mana;

                if (m_Scroll is SpellScroll)
                {
                    m_Scroll.Consume();
                }
                else if (m_Scroll is BaseWand)
                {
                    ((BaseWand)m_Scroll).ConsumeCharge(m_Caster);
                }

                if (m_Scroll is BaseWand)
                {
                    bool m = m_Scroll.Movable;

                    m_Scroll.Movable = false;

                    if (ClearHandsOnCast)
                    {
                        m_Caster.ClearHands();
                    }

                    m_Scroll.Movable = m;
                }
                else
                {
                    if (ClearHandsOnCast)
                    {
                        m_Caster.ClearHands();
                    }
                }

                int karma = ComputeKarmaAward();

                if (karma != 0)
                {
                    Misc.Titles.AwardKarma(Caster, karma, true);
                }

                if (TransformationSpell.UnderTransformation(m_Caster, typeof(VampiricEmbraceSpell)))
                {
                    bool garlic = false;

                    for (int i = 0; !garlic && i < m_Info.Reagents.Length; ++i)
                    {
                        garlic = (m_Info.Reagents[i] == Reagent.Garlic);
                    }

                    if (garlic)
                    {
                        m_Caster.SendLocalizedMessage(1061651);                           // The garlic burns you!
                        AOS.Damage(m_Caster, Utility.RandomMinMax(17, 23), 100, 0, 0, 0, 0);
                    }
                }

                return(true);
            }
            else
            {
                DoFizzle();
            }

            return(false);
        }
Ejemplo n.º 10
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 && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)))
            {
                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 must wait for that spell to have an effect.
            }
            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 (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);
        }
Ejemplo n.º 11
0
        public bool Cast()
        {
            m_StartCastTime = DateTime.Now;
            Spellbook book = Caster.FindItemOnLayer(Layer.OneHanded) as Spellbook;

            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.SendAsciiMessage("You are already casting a spell.");
            }
            else if (BlockedByHorrificBeast && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)))
            {
                m_Caster.SendAsciiMessage("You cannot cast that spell in this form.");
            }
            else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen))
            {
                m_Caster.SendAsciiMessage("You can not cast a spell while frozen.");
            }
            else if (CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime)
            {
                m_Caster.SendAsciiMessage("You must wait for that spell to have an effect.");
            }
            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 (Caster.Player == true && book != null && CheckSpellbook == true || Caster.Player == false || CheckSpellbook == false || (m_Scroll is BaseWand) || (m_Scroll is Items.IceStaff) || (m_Scroll is Runebook))
                    {
                        m_State        = SpellState.Casting;
                        m_Caster.Spell = this;

                        if (RevealOnCast)
                        {
                            m_Caster.RevealingAction();
                        }

                        SayMantra();

                        TimeSpan castDelay = this.GetCastDelay();

                        if (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 if (Caster.Player == true)
                    {
                        Container backpack = Caster.Backpack;

                        Spellbook spbook = (Spellbook)backpack.FindItemByType(typeof(Spellbook));
                        if (spbook != null)
                        {
                            m_Caster.ClearHands();
                            Caster.EquipItem(spbook);
                            Cast();
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                   // Insufficient mana
            }

            return(false);
        }
Ejemplo n.º 12
0
        public override void OnCast()
        {
            if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
            {
                Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
            }
            else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                Caster.SendMessage("Vous ne pouvez faire ce sort en étant transformé.");
            }

            /*else if (Caster is PlayerMobile && ((PlayerMobile)Caster).Disguised)
             * {
             *  Caster.SendMessage("Vous ne pouvez faire ce sort en étant déguisé.");
             * }*/
            else if (TransformationSpell.UnderTransformation(Caster))
            {
                Caster.SendMessage("Vous ne pouvez faire ce sort en étant transformé.");
            }

            /*else if (!Caster.CanBeginAction(typeof(ChauveSouris)))
             * {
             *  Caster.SendMessage("Vous ne pouvez vous transformer en étant sous la forme d'une chauve-souris.");
             * }*/
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(IncognitoSpell)))
                {
                    Caster.NameMod = m_Name;

                    /*PlayerMobile pm = Caster as PlayerMobile;
                     *
                     * if ( pm != null )
                     * {
                     *      if ( pm.Body.IsFemale )
                     *              pm.SetHairMods( Utility.RandomList( m_HairIDs ), 0 );
                     *      else
                     *              pm.SetHairMods( Utility.RandomList( m_HairIDs ), Utility.RandomList( m_BeardIDs ) );
                     *
                     *      Item hair = pm.FindItemOnLayer( Layer.Hair );
                     *
                     *      if ( hair != null )
                     *              hair.Hue = Utility.RandomHairHue();
                     *
                     *      hair = pm.FindItemOnLayer( Layer.FacialHair );
                     *
                     *      if ( hair != null )
                     *              hair.Hue = Utility.RandomHairHue();
                     * }*/

                    Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head);
                    Caster.PlaySound(0x3BD);

                    StopTimer(Caster);

                    Timer t = new InternalTimer(Caster);

                    m_Timers[Caster] = t;

                    t.Start();
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559);                       // This spell is already in effect.
                }
            }

            FinishSequence();
        }
Ejemplo n.º 13
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 && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)))
            {
                m_Caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (!(this is Shadowjump || this is MirrorImage || this is AnimalForm) && AnimalForm.UnderEffect(m_Caster))
            {
                // TODO: Revealing action and mantra should be before this ( at least for palading spell)
                if (this is PaladinSpell)
                {
                    m_Caster.SendLocalizedMessage(1063218);                       // You cannot use that ability in this form.
                }
                else if (this is SamuraiSpell)
                {
                    if (this is MomentumStrike || this is LightningStrike || this is HonorableExecution)
                    {
                        m_Caster.SendLocalizedMessage(1063024);                           // You cannot perform this special move right now.
                    }
                    else
                    {
                        m_Caster.SendLocalizedMessage(1063218);                           // You cannot use that ability in this form.
                    }
                }
                else if (this is NinjaSpell)
                {
                    m_Caster.SendLocalizedMessage(1063024);                       // You cannot perform this special move right now.
                }
                else
                {
                    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 must wait for that spell to have an effect.
            }
            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 (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);
        }
Ejemplo n.º 14
0
        public bool Cast()
        {
            if (Caster.Spell is Spell && ((Spell)Caster.Spell).State == SpellState.Sequencing)
            {
                ((Spell)Caster.Spell).Disturb(DisturbType.NewCast);
            }

            if (!Caster.CheckAlive())
            {
                return(false);
            }
            else if (Caster.Spell != null && Caster.Spell.IsCasting)
            {
                Caster.SendLocalizedMessage(502642);                   // You are already casting a spell.
            }
            else if (BlockedByHorrificBeast && TransformationSpell.UnderTransformation(Caster, typeof(HorrificBeastSpell)))
            {
                Caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (BlockedByAnimalForm && AnimalForm.UnderTransformation(Caster))
            {
                Caster.SendLocalizedMessage(1061091);                   // You cannot cast that spell in this form.
            }
            else if (!(Scroll is BaseWand) && (Caster.Paralyzed || Caster.Frozen))
            {
                Caster.SendLocalizedMessage(502643);                   // You can not cast a spell while frozen.
            }
            else if (CheckNextSpellTime && DateTime.UtcNow < Caster.NextSpellTime)
            {
                Caster.SendLocalizedMessage(502644);                   // You have not yet recovered from casting a spell.
            }
            else if (BaseBardCreature.IsCalmed(Caster))
            {
                Caster.SendLocalizedMessage(1072060);                   // You cannot cast a spell while calmed.
            }
            else if (Caster.Mana >= ScaleMana(GetMana()))
            {
                if (Caster.Spell == null && Caster.CheckSpellCast(this) && CheckCast() && Caster.Region.OnBeginSpellCast(Caster, this))
                {
                    State        = SpellState.Casting;
                    Caster.Spell = this;

                    if (RevealOnCast)
                    {
                        Caster.RevealingAction();
                    }

                    SayMantra();

                    TimeSpan castDelay = this.GetCastDelay();

                    /*
                     * OSI cast delay is computed with a global timer based on ticks. There is
                     * one tick per 0.25 seconds, so every tick the timer computes all the
                     * spells ready to cast. This introduces a random additional delay of 0-0.25
                     * seconds due to fact that the first tick is always incomplete. We add this
                     * manually here to enhance the gameplay to get the real OSI feeling.
                     */
                    castDelay += TimeSpan.FromSeconds(0.25 * Utility.RandomDouble());

                    if (ShowHandMovement && Caster.Body.IsHuman && !(Scroll is SpellStone))
                    {
                        int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);

                        if (count != 0)
                        {
                            m_AnimTimer = new AnimTimer(this, count);
                            m_AnimTimer.Start();
                        }

                        if (Info.LeftHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, Info.LeftHandEffect, EffectLayer.LeftHand);
                        }

                        if (Info.RightHandEffect > 0)
                        {
                            Caster.FixedParticles(0, 10, 5, Info.RightHandEffect, EffectLayer.RightHand);
                        }
                    }

                    if (ClearHandsOnCast)
                    {
                        Caster.ClearHands();
                    }

                    m_CastTimer = new CastTimer(this, castDelay);
                    m_CastTimer.Start();

                    SpecialMove.ClearCurrentMove(Caster);
                    WeaponAbility.ClearCurrentAbility(Caster);

                    OnBeginCast();

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

            return(false);
        }
Ejemplo n.º 15
0
        public bool Cast()
        {
            bool GoblinHarm   = false;
            bool TalathasHarm = false;

            if (m_Caster.Player)
            {
                TeiravonMobile m_Person = (TeiravonMobile)m_Caster;

                if (this is HarmSpell && m_Person.Faith == TeiravonMobile.Deity.Jareth)
                {
                    GoblinHarm = true;
                }

                if (this is HarmSpell && m_Person.Faith == TeiravonMobile.Deity.Talathas)
                {
                    TalathasHarm = true;
                }
                //m_Person.SendMessage( "Type: {0}", this /*, m_Caster.Spell.GetType() */ );

                if (!m_Person.Magicable && !(m_Scroll is BaseWand) && !m_Person.HasFeat(TeiravonMobile.Feats.UseMagicDevice))
                {
                    m_Caster.SendMessage("You cannot cast spells.");
                    return(false);
                }
//				else if ( (this is NecromancerSpell) && !m_Person.IsNecromancer() )
//				{
//					m_Caster.SendMessage( "Only necromancers can cast that." );
//					return false;
//				}
                else if ((this is PaladinSpell) && m_Person.Skills.Chivalry.Base < 25.0)
                {
                    m_Caster.SendMessage("Only a true paladin can cast that.");
                    return(false);
                }
                else if ((this is NecromancerSpell) && !m_Person.HasFeat(TeiravonMobile.Feats.NecroSpellbook))
                {
                    m_Caster.SendMessage("You have not learned advanced necromancy.");
                    return(false);
                }
                else if (!(this is NecromancerSpell) && !(this is PaladinSpell) && !m_Person.CanCast(m_Info.Name) && !m_Person.HasFeat(TeiravonMobile.Feats.UseMagicDevice))
                {
                    m_Caster.SendMessage("You cannot cast this spell!");
                    return(false);
                }

                if (m_Person.Mounted)
                {
                    int fallchance = 0;

                    if (m_Person.RidingSkill == 0)
                    {
                        fallchance = 20;
                    }
                    else if (m_Person.RidingSkill == 1)
                    {
                        fallchance = 10;
                    }
                    else if (m_Person.RidingSkill == 2)
                    {
                        fallchance = 5;
                    }

                    if (fallchance > Utility.RandomMinMax(1, 100))
                    {
                        m_Person.OnDoubleClick(m_Person);
                        m_Person.Damage(Utility.RandomMinMax(1, 10), m_Person);
                        m_Person.SendMessage("You fall off your mount while casting");
                    }
                }
            }

            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 (XmlAttach.FindAttachmentOnMobile(m_Caster, typeof(XmlData), "silenced") != null)
            {
                m_Caster.SendMessage("You cannot cast spells right now.");
                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 && TransformationSpell.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)))
            {
                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 must wait for that spell to have an effect.
            }
            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 (GoblinHarm)
                    {
                        castDelay = TimeSpan.FromSeconds(.25);
                    }

                    if (TalathasHarm)
                    {
                        castDelay = TimeSpan.FromSeconds(.5);
                    }

                    if (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);
        }
Ejemplo n.º 16
0
        public override void OnCast()
        {
            if (Caster.Mounted)
            {
                Caster.SendLocalizedMessage(1042561);                   //Please dismount first.
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
            {
                Caster.SendMessage("Vous ne pouvez faire ce sort en étant sous l'effet de l'incognito.");
            }

            /*else if (Caster is PlayerMobile && ((PlayerMobile)Caster).Disguised)
             * {
             *  Caster.SendMessage("Vous ne pouvez faire ce sort en étant déguisé.");
             * }*/
            else if (TransformationSpell.UnderTransformation(Caster))
            {
                Caster.SendMessage("Vous ne pouvez faire ce sort en étant transformé.");
            }

            /*else if (!Caster.CanBeginAction(typeof(ChauveSouris)))
             * {
             *  Caster.SendMessage("Vous ne pouvez vous transformer en étant sous la forme d'une chauve-souris.");
             * }*/
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(PolymorphSpell)))
                {
                    if (m_NewBody != 0)
                    {
                        /*if ( !((Body)m_NewBody).IsHuman )
                         * {
                         *      Mobiles.IMount mt = Caster.Mount;
                         *
                         *      if ( mt != null )
                         *              mt.Rider = null;
                         * }*/

                        Caster.BodyMod = m_NewBody;

                        /*if ( m_NewBody == 400 || m_NewBody == 401 )
                         *      Caster.HueMod = Utility.RandomSkinHue();
                         * else
                         *      Caster.HueMod = 0;
                         *
                         * BaseArmor.ValidateMobile( Caster );*/

                        StopTimer(Caster);

                        Timer t = new InternalTimer(Caster);

                        m_Timers[Caster] = t;

                        t.Start();
                    }
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559);                       // This spell is already in effect.
                }
            }

            FinishSequence();
        }