Ejemplo n.º 1
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();
                }
            }
        }
Ejemplo n.º 2
0
        public static void OnMasteryChanged(Mobile m, SkillName oldMastery)
        {
            List <SkillMasterySpell> list = SkillMasterySpell.GetSpells(m);

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

                list.Clear();
                list.TrimExcess();
            }

            RemovePassiveBuffs(m);

            foreach (MasteryInfo info in Infos.Where(i => i.Passive))
            {
                if (IsActivePassive(m, info.PassiveSpell))
                {
                    if (info.PassiveSpell == PassiveSpell.AnticipateHit)
                    {
                        continue;
                    }

                    //Console.WriteLine("Toggling {0} passive spell", info.PassiveSpell.ToString());

                    switch (info.PassiveSpell)
                    {
                    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:
                        BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SavingThrow, 1155922, 1156032, 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.UpdateResistances();
                    PassiveTable[m] = info.SpellID;

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

                    break;
                }
            }

            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();
                }
            }
        }