Server.Items.Firebomb.OnFirebombTimerTick C# (CSharp) Méthode

OnFirebombTimerTick() private méthode

private OnFirebombTimerTick ( ) : void
Résultat void
        private void OnFirebombTimerTick()
        {
            if (Deleted)
            {
                m_Timer.Stop();
                return;
            }

            if (Map == Map.Internal && HeldBy == null)
                return;

            switch (m_Ticks)
            {
                case 0:
                case 1:
                case 2:
                    {
                        ++m_Ticks;

                        if (HeldBy != null)
                            HeldBy.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString());
                        else if (RootParent == null)
                            PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString());
                        else if (RootParent is Mobile)
                            ((Mobile)RootParent).PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString());

                        break;
                    }
                default:
                    {
                        if (HeldBy != null)
                            HeldBy.DropHolding();

                        if (m_Users != null)
                        {
                            foreach (Mobile m in m_Users)
                            {
                                ThrowTarget targ = m.Target as ThrowTarget;

                                if (targ != null && targ.Bomb == this)
                                    Target.Cancel(m);
                            }

                            m_Users.Clear();
                            m_Users = null;
                        }

                        if (RootParent is Mobile)
                        {
                            Mobile parent = (Mobile)RootParent;
                            parent.SendLocalizedMessage(1060583); // The firebomb explodes in your hand!
                            parent.Damage(Utility.Random(3) + 4);
                        }
                        else if (RootParent == null)
                        {
                            List<Mobile> toDamage = new List<Mobile>();
                            IPooledEnumerable eable = Map.GetMobilesInRange(Location, 1);

                            foreach (Mobile m in eable)
                            {
                                toDamage.Add(m);
                            }
                            eable.Free();

                            Mobile victim;
                            for (int i = 0; i < toDamage.Count; ++i)
                            {
                                victim = toDamage[i];

                                if (m_LitBy == null || (SpellHelper.ValidIndirectTarget(m_LitBy, victim) && m_LitBy.CanBeHarmful(victim, false)))
                                {
                                    if (m_LitBy != null)
                                        m_LitBy.DoHarmful(victim);
                                    m_LitBy.Damage(Utility.Random(3) + 4, victim);
                                }
                            }
                        (new FirebombField(m_LitBy, toDamage)).MoveToWorld(Location, Map);
                        }

                        m_Timer.Stop();
                        Delete();
                        break;
                    }
            }
        }