コード例 #1
0
        public void OnTimer()
        {
            try
            {
                if (!IsValid || !m_tKeep.ToNextTime())
                {
                    return;
                }

                if (m_pOwner != null)
                {
                    int nLoseLife;

                    switch (m_nStatus)
                    {
                    case FlagInt.POISONED:     // poison
                        if (!m_pOwner.IsAlive)
                        {
                            return;
                        }

                        nLoseLife = (int)Calculations.CutOverflow(m_nData, m_pOwner.Life - 1);
                        m_pOwner.AddAttribute(ClientUpdateType.HITPOINTS, -1 * nLoseLife, true);

                        var msg2 = new MsgMagicEffect
                        {
                            Identity      = m_pOwner.Identity,
                            SkillIdentity = 10010
                        };
                        msg2.AppendTarget(m_pOwner.Identity, (uint)nLoseLife, true, 0, 0);
                        m_pOwner.Map.SendToRange(msg2, m_pOwner.MapX, m_pOwner.MapY);

                        if (!m_pOwner.IsAlive)
                        {
                            m_pOwner.BeKill(null);
                        }
                        break;

                    case FlagInt.VORTEX:     // shuriken vortex
                        if (!m_pOwner.IsAlive)
                        {
                            return;
                        }

                        if (m_pOwner is Character)
                        {
                            (m_pOwner as Character).ProcessMagicAttack(6010, 0, m_pOwner.MapX, m_pOwner.MapY);
                        }
                        break;

                    case FlagInt.TOXIC_FOG:     // toxic fog
                        if (!m_pOwner.IsAlive || m_pOwner.Life <= 1)
                        {
                            return;
                        }

                        var power = (m_nData > 30000 ? ((m_nData - 30000) / 100f) : m_nData);
                        nLoseLife = (int)Calculations.CutOverflow((int)(m_pOwner.Life * power), m_pOwner.Life - 1);

                        if (m_pOwner.Detoxication > 0)
                        {
                            uint detox = m_pOwner.Detoxication;
                            if (m_pOwner.Detoxication > 100)
                            {
                                detox = 100;
                            }
                            nLoseLife = (int)
                                        Calculations.MulDiv(nLoseLife, Math.Min(100 - detox, 100), 100);
                        }

                        m_pOwner.BeAttack(1, m_pOwner, nLoseLife, false);

                        var msg = new MsgMagicEffect
                        {
                            Identity      = m_pOwner.Identity,
                            SkillIdentity = 10010
                        };
                        msg.AppendTarget(m_pOwner.Identity, (uint)nLoseLife, true, 0, 0);
                        m_pOwner.Map.SendToRange(msg, m_pOwner.MapX, m_pOwner.MapY);
                        break;
                    }
                    m_nTimes--;
                }
            }
            catch
            {
                ServerKernel.Log.SaveLog("StatusOnce::OnTimer() error!", false, LogType.EXCEPTION);
            }
        }