예제 #1
0
        /// <summary>
        /// Called in Aos.cs, should include all damage types
        /// </summary>
        /// <param name="victim"></param>
        /// <param name="damager"></param>
        /// <param name="damage"></param>
        public static void OnDamage(Mobile victim, Mobile damager, DamageType type, ref int damage)
        {
            if (victim == null || damager == null)
            {
                return;
            }

            CheckTable(victim);

            foreach (SkillMasterySpell sp in EnumerateSpells(victim))
            {
                if (sp.DamageCanDisrupt && damage > sp.DamageThreshold)
                {
                    sp.Expire(true);
                }

                sp.OnDamaged(damager, victim, type, ref damage);
            }

            foreach (SkillMasterySpell sp in GetSpells(s => s.Target == victim))
            {
                sp.OnTargetDamaged(damager, victim, type, ref damage);
            }

            SkillMasteryMove move = SpecialMove.GetCurrentMove(victim) as SkillMasteryMove;

            if (move != null)
            {
                move.OnDamaged(damager, victim, type, ref damage);
            }

            PerseveranceSpell preserve = GetSpellForParty(victim, typeof(PerseveranceSpell)) as PerseveranceSpell;

            if (preserve != null)
            {
                preserve.AbsorbDamage(ref damage);
            }

            InspireSpell inspire = GetSpellForParty(damager, typeof(InspireSpell)) as InspireSpell;

            if (inspire != null)
            {
                inspire.DoDamage(ref damage);
            }

            CombatTrainingSpell.CheckDamage(damager, victim, type, ref damage);
        }
예제 #2
0
        public override bool Validate(Mobile from)
        {
            SkillMasteryMove move = SpecialMove.GetCurrentMove(from) as SkillMasteryMove;

            if ((move == null || move.GetType() != this.GetType()) && !CheckCooldown(from))
            {
                return(false);
            }

            if (from is PlayerMobile && from.Skills.CurrentMastery != MoveSkill)
            {
                from.SendLocalizedMessage(1115664); // You are not on the correct path for using this mastery ability.
                return(false);
            }

            return(base.Validate(from));
        }
예제 #3
0
        public virtual SpecialMove GetSpecialMove()
        {
            double skill = m_Mobile.Skills[SkillName.Ninjitsu].Value;

            SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile);

            if (special != null)
            {
                return(special);
            }

            if (skill < 30 || m_Mobile.Mana < 30)
            {
                return(null);
            }

            int avail = 1;

            if (skill < 80)
            {
                avail = 2;
            }

            if (skill >= 85)
            {
                avail = 3;
                Mobile combatant = m_Mobile.Combatant;

                if (combatant != null && (int)combatant.Hits < (Utility.Random(10) + 10))
                {
                    return(SpellRegistry.GetSpecialMove(501));
                }
            }

            switch (Utility.Random(avail))
            {
            case 0: return(SpellRegistry.GetSpecialMove(500));    //new FocusAttack();

            case 1: return(SpellRegistry.GetSpecialMove(503));    //new KiAttack();

            case 2: return(SpellRegistry.GetSpecialMove(501));    //new DeathStrike();
            }
            return(null);
        }
예제 #4
0
        public override bool DoActionCombat()
        {
            base.DoActionCombat();

            if (m_Mobile.Combatant == null)
            {
                return(true);
            }

            SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile);

            if (special == null && m_NextCastTime < DateTime.UtcNow && 0.05 > Utility.RandomDouble())
            {
                if (0.05 > Utility.RandomDouble())
                {
                    new MirrorImage(m_Mobile, null).Cast();
                }
                else
                {
                    if (m_Mobile.Hidden)
                    {
                        special = GetHiddenSpecialMove();
                    }
                    else
                    {
                        special = GetSpecialMove();
                    }

                    if (special != null)
                    {
                        SpecialMove.SetCurrentMove(m_Mobile, special);
                        m_NextCastTime = DateTime.UtcNow + GetCastDelay();
                    }
                }
            }

            if (m_NextRanged < DateTime.UtcNow && 0.08 > Utility.RandomDouble())
            {
                DoRangedAttack();
            }

            return(true);
        }
예제 #5
0
        public override bool DoActionCombat()
        {
            base.DoActionCombat();

            if (m_Mobile.Combatant is Mobile c)
            {
                if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CheckCanFlee())
                {
                    m_Mobile.DebugSay("I am going to flee from {0}", c.Name);
                    Action = ActionType.Flee;
                }
                else
                {
                    SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile);

                    if (special == null && m_NextCastTime < DateTime.UtcNow && 0.05 > Utility.RandomDouble())
                    {
                        if (0.05 > Utility.RandomDouble())
                        {
                            new MirrorImage(m_Mobile, null).Cast();
                        }
                        else
                        {
                            special = m_Mobile.Hidden ? GetHiddenSpecialMove() : GetSpecialMove();

                            if (special != null)
                            {
                                SpecialMove.SetCurrentMove(m_Mobile, special);
                                m_NextCastTime = DateTime.UtcNow + GetCastDelay();
                            }
                        }
                    }

                    if (m_NextRanged < DateTime.UtcNow && 0.08 > Utility.RandomDouble())
                    {
                        DoRangedAttack();
                    }
                }
            }

            return(true);
        }
예제 #6
0
        /// <summary>
        /// Called in BaseWeapon, intended as a melee/ranged hit
        /// </summary>
        /// <param name="attacker"></param>
        /// <param name="defender"></param>
        /// <param name="damage"></param>
        public static void OnHit(Mobile attacker, Mobile defender, ref int damage)
        {
            foreach (SkillMasterySpell spell in EnumerateSpells(attacker))
            {
                spell.OnHit(defender, ref damage);
            }

            foreach (SkillMasterySpell spell in EnumerateSpells(defender))
            {
                spell.OnGotHit(defender, ref damage);
            }

            SkillMasteryMove move = SpecialMove.GetCurrentMove(defender) as SkillMasteryMove;

            if (move != null)
            {
                move.OnGotHit(attacker, defender, ref damage);
            }

            /*if(attacker is BaseCreature || defender is BaseCreature)
             *  CombatTrainingSpell.OnCreatureHit(attacker, defender, ref damage);*/
        }
예제 #7
0
        /// <summary>
        /// Called in Aos.cs, should include all damage types
        /// </summary>
        /// <param name="victim"></param>
        /// <param name="damager"></param>
        /// <param name="damage"></param>
        public static void OnCasterDamaged(Mobile victim, Mobile damager, ref int damage)
        {
            if (victim == null)
            {
                return;
            }

            if (m_Table.ContainsKey(victim))
            {
                if (m_Table[victim] == null || m_Table[victim].Count == 0)
                {
                    m_Table.Remove(victim);
                }
                else
                {
                    foreach (SkillMasterySpell sp in EnumerateSpells(victim))
                    {
                        if (sp.DamageCanDisrupt && damage > sp.DamageThreshold)
                        {
                            sp.Expire(true);
                        }

                        sp.OnDamaged(damager, damage);
                    }
                }
            }

            SkillMasteryMove move = SpecialMove.GetCurrentMove(victim) as SkillMasteryMove;

            if (move != null)
            {
                move.OnDamaged(damager, victim, damage);
            }

            //CombatTrainingSpell.CheckDamage(damager, victim, ref damage);
        }
예제 #8
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();
                }
            }
        }
예제 #9
0
        public virtual SpecialMove GetHiddenSpecialMove()
        {
            double skill = m_Mobile.Skills[SkillName.Ninjitsu].Value;

            SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile);

            if (special != null)
            {
                return(special);
            }

            if (skill < 20 || m_Mobile.Mana < 30)
            {
                return(null);
            }

            int avail = 1;

            if (m_Mobile.AllowedStealthSteps != 0)
            {
                if (skill >= 30)
                {
                    avail = 2;
                }
                Mobile combatant = m_Mobile.Combatant;
                if (skill >= 85)
                {
                    avail = 3;
                    //Mobile combatant = m_Mobile.Combatant;
                    if (combatant != null && (combatant.Hits < (Utility.Random(10) + 10) || !combatant.Warmode))
                    {
                        return(SpellRegistry.GetSpecialMove(501));
                    }
                }

                switch (Utility.Random(avail))
                {
                case 0: combatant.Say("Getting BackStab"); return(SpellRegistry.GetSpecialMove(505));                       //new Backstab(); skill = 20;

                case 1: combatant.Say("Getting SurpriseAttack"); return(SpellRegistry.GetSpecialMove(504));                 //new SurpriseAttack(); skill = 30;

                case 2: combatant.Say("Getting DeathStrike"); return(SpellRegistry.GetSpecialMove(501));                    //new DeathStrike(); skill = 85;
                }
            }
            else
            {
                if (skill < 30)
                {
                    return(null);
                }

                if (skill < 80)
                {
                    avail = 2;
                }

                if (skill >= 85)
                {
                    avail = 3;
                    Mobile combatant = m_Mobile.Combatant;

                    if (combatant != null && (int)combatant.Hits < (Utility.Random(10) + 10))
                    {
                        return(SpellRegistry.GetSpecialMove(501));
                    }
                }

                switch (Utility.Random(avail))
                {
                case 0: return(SpellRegistry.GetSpecialMove(500));                        //new FocusAttack();

                case 1: return(SpellRegistry.GetSpecialMove(503));                        //new KiAttack();

                case 2: return(SpellRegistry.GetSpecialMove(501));                        //new DeathStrike();
                }
            }
            return(null);
        }
예제 #10
0
        public MonkStrikeGump(Mobile from) : base(150, 600)
        {
            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddPage(0);

            AddBackground(0, 0, 325, 110, 9250);

            #region Current
            AddLabel(15, 20, 0, "Monk Combo:");

            if (MonkSystem.ComboChain.ContainsKey(from))
            {
                if (MonkSystem.ComboChain[from].First != MonkElement.None)
                {
                    AddImage(105, 15, 30055, Hues[(int)MonkSystem.ComboChain[from].First]);
                }

                if (MonkSystem.ComboChain[from].Second != MonkElement.None)
                {
                    AddImage(140, 15, 30055, Hues[(int)MonkSystem.ComboChain[from].Second]);
                }

                if (MonkSystem.ComboChain[from].Third != MonkElement.None)
                {
                    AddImage(175, 15, 30055, Hues[(int)MonkSystem.ComboChain[from].Third]);
                }
            }
            #endregion

            #region Moves
            MonkElement litup = MonkElement.None;
            MonkStrike  ms    = SpecialMove.GetCurrentMove(from) as MonkStrike;

            if (ms != null)
            {
                litup = ms.m_Element;
            }

            if (litup == MonkElement.Air)
            {
                AddImage(15, 50, 2269, 33);
            }
            else
            {
                AddButton(15, 50, 2269, 2269, (int)MonkElement.Air, GumpButtonType.Reply, 0);
            }

            if (litup == MonkElement.Earth)
            {
                AddImage(65, 50, 2296, 33);
            }
            else
            {
                AddButton(65, 50, 2296, 2296, (int)MonkElement.Earth, GumpButtonType.Reply, 0);
            }

            if (litup == MonkElement.Fire)
            {
                AddImage(115, 50, 2282, 33);
            }
            else
            {
                AddButton(115, 50, 2282, 2282, (int)MonkElement.Fire, GumpButtonType.Reply, 0);
            }

            if (litup == MonkElement.Water)
            {
                AddImage(165, 50, 2291, 33);
            }
            else
            {
                AddButton(165, 50, 2291, 2291, (int)MonkElement.Water, GumpButtonType.Reply, 0);
            }

            if (litup == MonkElement.Light)
            {
                AddImage(215, 50, 2298, 33);
            }
            else
            {
                AddButton(215, 50, 2298, 2298, (int)MonkElement.Light, GumpButtonType.Reply, 0);
            }

            if (litup == MonkElement.Dark)
            {
                AddImage(265, 50, 2283, 33);
            }
            else
            {
                AddButton(265, 50, 2283, 2283, (int)MonkElement.Dark, GumpButtonType.Reply, 0);
            }

            #endregion

            #region Finisher
            MonkElement finisher = MonkSystem.GetCombo(from);

            if ((int)finisher > 7)
            {
                AddBackground(325, 45, 65, 65, 9250);
                int itemid = 0;

                switch (finisher)
                {
                case MonkElement.AirCombo: itemid = 2289; break;

                case MonkElement.EarthCombo: itemid = 2273; break;

                case MonkElement.FireCombo: itemid = 2267; break;

                case MonkElement.WaterCombo: itemid = 2286; break;

                case MonkElement.LightCombo: itemid = 23012; break;

                case MonkElement.DarkCombo: itemid = 23013; break;

                case MonkElement.LightAirCombo: itemid = 20494; break;

                case MonkElement.LightEarthCombo: itemid = 21008; break;

                case MonkElement.LightFireCombo: itemid = 20736; break;

                case MonkElement.LightWaterCombo: itemid = 21280; break;

                case MonkElement.DarkAirCombo: itemid = 23004; break;

                case MonkElement.DarkFireCombo: itemid = 24011; break;

                case MonkElement.DarkEarthCombo: itemid = 23009; break;

                case MonkElement.DarkWaterCombo: itemid = 24015; break;
                }

                if ((int)litup > 7)
                {
                    AddImage(335, 55, itemid, 33);
                }
                else
                {
                    AddButton(335, 55, itemid, itemid, (int)finisher, GumpButtonType.Reply, 0);
                }
            }
            #endregion

            MonkFists mf = from.FindItemOnLayer(Layer.Gloves) as MonkFists;

            #region Wholeness
            if (mf != null && mf.Teir > 1)
            {
                AddBackground(325, 0, 65, 45, 9250);

                if (from.CanBeginAction(typeof(MonkCombos.WholenessOfBodyTimer)))
                {
                    AddButton(344, 8, 30035, 30035, 999, GumpButtonType.Reply, 0);
                }
                else
                {
                    AddImage(344, 8, 30035, 1000);
                }
            }
            #endregion

            #region Dark/Light Special
            if (mf != null && mf.Teir > 2)
            {
                if (mf.LightEnergy > 95)
                {
                    AddButton(284, 12, 30115, 30102, (int)MonkElement.LightSpecialOne, GumpButtonType.Reply, 0);
                    AddButton(245, 12, 30105, 30105, (int)MonkElement.LightSpecialTwo, GumpButtonType.Reply, 0);
                }
                else if (mf.DarkEnergy > 95)
                {
                    AddButton(284, 12, 30115, 30102, (int)MonkElement.DarkSpecialOne, GumpButtonType.Reply, 0);
                    AddButton(245, 12, 30105, 30105, (int)MonkElement.DarkSpecialTwo, GumpButtonType.Reply, 0);
                }
                else
                {
                    AddImage(215, 15, 9750);
                    AddImage(215, 35, 9750);

                    AddImageTiled(215, 15, (mf.LightEnergy), 7, 9753);
                    AddImageTiled(215, 35, (mf.DarkEnergy), 7, 9751);
                }
            }
            #endregion

            #region Void
            if (mf != null && mf.Teir > 3)
            {
            }
            #endregion
        }