Example #1
0
        public static void RemoveFromList(Mobile from)
        {
            if (m_Table.ContainsKey(from) && m_Table[from].Count > 0)
            {
                Mobile caster = m_Table[from][0].Caster;

                m_Table[from].Remove(m_Table[from][0]);

                if (m_Table[from].Count == 0)
                {
                    m_Table.Remove(from);
                    BuffInfo.RemoveBuff(from, BuffIcon.SpellPlague);
                }

                foreach (KeyValuePair <Mobile, List <SpellPlagueTimer> > kvp in m_Table)
                {
                    for (var index = 0; index < kvp.Value.Count; index++)
                    {
                        SpellPlagueTimer Ttimer = kvp.Value[index];

                        if (Ttimer.Caster == caster)
                        {
                            return;
                        }
                    }
                }

                BuffInfo.RemoveBuff(caster, BuffIcon.SpellPlague);
            }
        }
Example #2
0
        public static bool HasSpellPlague(Mobile from)
        {
            foreach (KeyValuePair <Mobile, List <SpellPlagueTimer> > kvp in m_Table)
            {
                if (kvp.Value != null)
                {
                    for (var index = 0; index < kvp.Value.Count; index++)
                    {
                        SpellPlagueTimer timer = kvp.Value[index];

                        if (timer.Caster == from)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Example #3
0
        public static void OnMobileDamaged(Mobile from)
        {
            if (m_Table.ContainsKey(from) && m_Table[from].Count > 0 && m_Table[from][0].NextUse < DateTime.UtcNow)
            {
                int    amount      = m_Table[from][0].Amount;
                bool   doExplosion = false;
                double mod         = from.Skills[SkillName.MagicResist].Value >= 70.0 ? (from.Skills[SkillName.MagicResist].Value / 1000 * 3) : 0.0;

                if (mod < 0)
                {
                    mod = .01;
                }

                if (amount == 0 && .90 - mod > Utility.RandomDouble())
                {
                    doExplosion = true;
                }
                else if (amount == 1 && .60 - mod > Utility.RandomDouble())
                {
                    doExplosion = true;
                }
                else if (amount == 2 && .30 - mod > Utility.RandomDouble())
                {
                    doExplosion = true;
                }

                if (doExplosion)
                {
                    SpellPlagueTimer timer = m_Table[from][0];

                    timer.NextUse = DateTime.UtcNow + TimeSpan.FromSeconds(1.5);

                    DoExplosion(from, timer.Caster, false, amount);
                    timer.Amount++;
                }
            }
        }