Exemple #1
0
            public ForceArrowTimer(ForceArrowInfo info)
                : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1))
            {
                _info    = info;
                _expires = Core.Now + TimeSpan.FromSeconds(10);

                Start();
            }
Exemple #2
0
            public ForceArrowTimer(ForceArrowInfo info)
                : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1))
            {
                m_Info   = info;
                Priority = TimerPriority.OneSecond;

                m_Expires = DateTime.UtcNow + TimeSpan.FromSeconds(10);

                Start();
            }
Exemple #3
0
        public static void BeginForceArrow(Mobile attacker, Mobile defender)
        {
            ForceArrowInfo info = new ForceArrowInfo(attacker, defender);
            info.Timer = new ForceArrowTimer(info);

            if (!m_Table.ContainsKey(attacker))
                m_Table[attacker] = new List<ForceArrowInfo>();

            m_Table[attacker].Add(info);

            BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.ForceArrow, 1151285, 1151286, info.DefenseChanceMalus.ToString()));
        }
Exemple #4
0
        public static void BeginForceArrow(Mobile attacker, Mobile defender)
        {
            ForceArrowInfo info = new ForceArrowInfo(attacker, defender);

            info.Timer = new ForceArrowTimer(info);

            if (!m_Table.ContainsKey(attacker))
            {
                m_Table[attacker] = new List <ForceArrowInfo>();
            }

            m_Table[attacker].Add(info);

            BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.ForceArrow, 1151285, 1151286, info.DefenseChanceMalus.ToString()));
        }
Exemple #5
0
        public static void EndForceArrow(ForceArrowInfo info)
        {
            if (info == null)
            {
                return;
            }

            Mobile attacker = info.Attacker;

            if (_table.TryGetValue(attacker, out var list) && list.Remove(info) && list.Count == 0)
            {
                _table.Remove(attacker);
            }

            BuffInfo.RemoveBuff(info.Defender, BuffIcon.ForceArrow);
        }
Exemple #6
0
        public static void EndForceArrow(ForceArrowInfo info)
        {
            if (info == null)
                return;

            Mobile attacker = info.Attacker;

            if (m_Table.ContainsKey(attacker) && m_Table[attacker].Contains(info))
            {
                m_Table[attacker].Remove(info);

                if (m_Table[attacker].Count == 0)
                    m_Table.Remove(attacker);
            }

            BuffInfo.RemoveBuff(info.Defender, BuffIcon.ForceArrow);
        }
Exemple #7
0
        public static void BeginForceArrow(Mobile attacker, Mobile defender)
        {
            ForceArrowInfo info = new ForceArrowInfo(attacker, defender);

            info.Timer = new ForceArrowTimer(info);

            if (_table.TryGetValue(attacker, out var list))
            {
                list.Add(info);
            }
            else
            {
                _table.Add(attacker, new List <ForceArrowInfo> {
                    info
                });
            }

            BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.ForceArrow, 1151285, 1151286, info.DefenseChanceMalus.ToString()));
        }
Exemple #8
0
        public static bool HasForceArrow(Mobile attacker, Mobile defender)
        {
            if (!m_Table.ContainsKey(attacker))
            {
                return(false);
            }

            for (var index = 0; index < m_Table[attacker].Count; index++)
            {
                ForceArrowInfo info = m_Table[attacker][index];

                if (info.Defender == defender)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #9
0
        public static ForceArrowInfo GetInfo(Mobile attacker, Mobile defender)
        {
            if (!m_Table.ContainsKey(attacker))
            {
                return(null);
            }

            for (var index = 0; index < m_Table[attacker].Count; index++)
            {
                ForceArrowInfo info = m_Table[attacker][index];

                if (info.Defender == defender)
                {
                    return(info);
                }
            }

            return(null);
        }
Exemple #10
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            attacker.SendLocalizedMessage(1074381); // You fire an arrow of pure force.
            defender.SendLocalizedMessage(1074382); // You are struck by a force arrow!

            if (.4 > Utility.RandomDouble())
            {
                defender.Combatant = null;
                defender.Warmode   = false;
            }

            ForceArrowInfo info = GetInfo(attacker, defender);

            if (info == null)
            {
                BeginForceArrow(attacker, defender);
            }
            else
            {
                if (info.Timer != null && info.Timer.Running)
                {
                    info.Timer.IncreaseExpiration();

                    BuffInfo.RemoveBuff(defender, BuffIcon.ForceArrow);
                    BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.ForceArrow, 1151285, 1151286, info.DefenseChanceMalus.ToString()));
                }
            }

            Spell spell = defender.Spell as Spell;

            if (spell != null && spell.IsCasting)
            {
                spell.Disturb(DisturbType.Hurt, false, true);
            }
        }
Exemple #11
0
        public static void EndForceArrow(ForceArrowInfo info)
        {
            if (info == null)
            {
                return;
            }

            Mobile attacker = info.Attacker;

            if (m_Table.ContainsKey(attacker) && m_Table[attacker].Contains(info))
            {
                m_Table[attacker].Remove(info);

                if (m_Table[attacker].Count == 0)
                {
                    m_Table.Remove(attacker);
                }
            }

            BuffInfo.RemoveBuff(info.Defender, BuffIcon.ForceArrow);
        }
Exemple #12
0
            public ForceArrowTimer(ForceArrowInfo info)
                : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1))
            {
                m_Info = info;
                Priority = TimerPriority.OneSecond;

                m_Expires = DateTime.Now + TimeSpan.FromSeconds(10);

                Start();
            }