public static bool SetCurrentAbility(Mobile m, WeaponAbility a)
        {
            if (!Core.AOS)
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (!IsWeaponAbility(m, a))
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (a != null && !a.Validate(m))
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (a == null)
            {
                m_Table.Remove(m);
            }
            else
            {
                SpecialMove.ClearCurrentMove(m);

                m_Table[m] = a;
            }

            return(true);
        }
Example #2
0
        public static bool SetCurrentAbility(Mobile m, WeaponAbility a)
        {
            if (!IsWeaponAbility(m, a))
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (m.Spell != null)
            {
                m.SendLocalizedMessage(1063024);                   // You cannot perform this special move right now.

                ClearCurrentAbility(m);
                return(false);
            }

            if (a != null && !a.Validate(m))
            {
                ClearCurrentAbility(m);
                return(false);
            }

            if (a == null)
            {
                m_Table.Remove(m);
            }
            else
            {
                SpecialMove.ClearCurrentMove(m);

                m_Table[m] = a;
            }

            return(true);
        }
Example #3
0
        public override bool CheckCast()
        {
            int mana = ScaleMana(RequiredMana);

            if (!base.CheckCast())
            {
                return(false);
            }

            if (IsInCooldown(Caster, this.GetType()))
            {
                return(false);
            }

            if (Caster.Player && Caster.Skills[CastSkill].Value < RequiredSkill)
            {
                Caster.SendLocalizedMessage(1115709); // Your skills are not high enough to invoke this mastery ability.
            }
            else if (Caster is PlayerMobile && Caster.Skills.CurrentMastery != CastSkill)
            {
                Caster.SendLocalizedMessage(1115664); // You are not on the correct path for using this mastery ability.
            }
            else if (Caster is PlayerMobile && !MasteryInfo.HasLearned(Caster, CastSkill))
            {
                Caster.SendLocalizedMessage(1115664); // You are not on the correct path for using this mastery ability.
            }
            else if (Caster.Mana < mana)
            {
                Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
            }
            else
            {
                if (CancelsWeaponAbility)
                {
                    WeaponAbility.ClearCurrentAbility(Caster);
                }

                if (CancelsSpecialMove)
                {
                    SpecialMove.ClearCurrentMove(Caster);
                }

                return(true);
            }

            return(false);
        }
Example #4
0
        public static void OnMasteryChanged(Mobile m, SkillName oldMastery)
        {
            PassiveSpell passive    = GetActivePassive(m);
            SkillName    newMastery = m.Skills.CurrentMastery;

            if (oldMastery != newMastery)
            {
                List <SkillMasterySpell> list = SkillMasterySpell.GetSpells(m);

                if (list != null)
                {
                    list.ForEach(spell =>
                    {
                        spell.Expire();
                    });

                    ColUtility.Free(list);
                }

                if (m is PlayerMobile && oldMastery == SkillName.Necromancy)
                {
                    ((PlayerMobile)m).AllFollowers.IterateReverse(mob =>
                    {
                        if (mob is BaseCreature && CommandUndeadSpell.ValidateTarget((BaseCreature)mob))
                        {
                            ((BaseCreature)mob).SetControlMaster(null);
                        }
                    });
                }

                SpecialMove move = SpecialMove.GetCurrentMove(m);

                if (move is SkillMasteryMove)
                {
                    SpecialMove.ClearCurrentMove(m);
                }

                m.RemoveStatMod("SavingThrow_Str");

                ColUtility.Free(list);
                RemovePassiveBuffs(m);
            }

            if (passive != PassiveSpell.None && passive != PassiveSpell.AnticipateHit)
            {
                switch (passive)
                {
                case PassiveSpell.EnchantedSummoning:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EnchantedSummoning, 1155904, 1156090, String.Format("{0}\t{0}", EnchantedSummoningBonus(m).ToString()), true));     // +~1_STAMINA~ Stamina Regeneration and +~2_HP~% Hit Points for summoned pets.<br>Increased difficulty for summoned pets to be dispelled.
                    break;

                case PassiveSpell.Intuition:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Intuition, 1155907, 1156089, IntuitionBonus(m).ToString(), true));     // Mana Increase ~1_VAL~
                    break;

                case PassiveSpell.SavingThrow:
                {
                    string args = null;

                    switch (GetMasteryLevel(m, newMastery))
                    {
                    default: args = "5\t0\t0\t0"; break;

                    case 2: args = "5\t5\t0\t0"; break;

                    case 3: args = "5\t5\t5\t5"; break;
                    }

                    m.AddStatMod(new StatMod(StatType.Str, "SavingThrow_Str", 5, TimeSpan.Zero));
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SavingThrow, 1156031, 1156032, args, true));         // Provides a chance to block disarm attempts based on Mastery level, weapon skill level and tactics skill level.
                }
                break;

                case PassiveSpell.Potency:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Potency, 1155928, 1156195, NonPoisonConsumeChance(m).ToString(), true));     // ~1_VAL~% chance to not consume poison charges when using infecting strike or injected strike.
                    break;

                case PassiveSpell.Knockout:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Knockout, 1155931, 1156030, String.Format("{0}\t{1}", GetKnockoutModifier(m).ToString(), GetKnockoutModifier(m, true).ToString(), true)));     // Wrestling Damage Bonus:<br>+~1_VAL~% PvM<br>+~2_VAL~% PvP
                    break;

                case PassiveSpell.Boarding:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Boarding, 1155934, 1156194, BoardingSlotIncrease(m).ToString(), true));     // Your number of stable slots has been increased by ~1_VAL~.
                    break;
                }

                m.Delta(MobileDelta.WeaponDamage);
                m.UpdateResistances();

                if (m.Mana > m.ManaMax)
                {
                    m.Mana = m.ManaMax;
                }
            }

            if (m.Backpack != null)
            {
                foreach (Item item in m.Backpack.FindItemsByType(typeof(BookOfMasteries)))
                {
                    BookOfMasteries book = item as BookOfMasteries;

                    if (book != null)
                    {
                        book.InvalidateProperties();
                    }
                }
            }

            foreach (Item item in m.Items.Where(i => i is BookOfMasteries))
            {
                BookOfMasteries book = item as BookOfMasteries;

                if (book != null)
                {
                    book.InvalidateProperties();
                }
            }
        }