Exemplo n.º 1
0
        private void FlyAxeAttack(TBaseObject Target)
        {
            TAbility WAbil;
            int      nDamage;

            // 重击几率,目标等级不高于自己,才使用重击
            if (((HUtil32.Random(M2Share.g_Config.nFairyDuntRate) == 0) && (Target.m_Abil.Level <= m_Abil.Level)) ||
                (nHitCount >= HUtil32._MIN((3 + M2Share.g_Config.nFairyDuntRateBelow),
                                           (m_btSlaveExpLevel + M2Share.g_Config.nFairyDuntRateBelow))))
            {
                // 月灵重击次数,达到次数时按等级出重击
                m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, Target.m_nCurrX, Target.m_nCurrY);
                WAbil         = m_WAbil;// 重击倍数
                nDamage       = (int)HUtil32._MAX(0, (int)HUtil32.Round((double)((HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1))
                                                                                 + HUtil32.LoWord(WAbil.DC)) * M2Share.g_Config.nFairyAttackRate / 100));
                if (nDamage > 0)
                {
                    nDamage = Target.GetHitStruckDamage(this, nDamage);
                }
                if (nDamage > 0)
                {
                    Target.StruckDamage(nDamage);
                }
                Target.SetLastHiter(this);
                Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP, Target.m_WAbil.MaxHP, Parse(this), "",
                                    (uint)HUtil32._MAX(Math.Abs(m_nCurrX - Target.m_nCurrX), Math.Abs(m_nCurrY - Target.m_nCurrY)) * 50 + 600);
                SendRefMsg(Grobal2.RM_FAIRYATTACKRATE, 1, m_nCurrX, m_nCurrY, Parse(Target), "");
                m_dwActionTick = HUtil32.GetTickCount();
                nHitCount      = 0;// 攻击计数
            }
            else
            {
                m_btDirection = M2Share.GetNextDirection(m_nCurrX, m_nCurrY, Target.m_nCurrX, Target.m_nCurrY);
                WAbil         = m_WAbil;
                nDamage       = HUtil32._MAX(0, HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1)
                                             + HUtil32.LoWord(WAbil.DC));
                if (nDamage > 0)
                {
                    nDamage = Target.GetHitStruckDamage(this, nDamage);
                }
                if (nDamage > 0)
                {
                    Target.StruckDamage(nDamage);
                }
                Target.SetLastHiter(this);
                Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP,
                                    Target.m_WAbil.MaxHP, Parse(this), "", (uint)HUtil32._MAX(Math.Abs(m_nCurrX - Target.m_nCurrX), Math.Abs(m_nCurrY - Target.m_nCurrY)) * 50 + 600);
                SendRefMsg(Grobal2.RM_LIGHTING, 1, m_nCurrX, m_nCurrY, Parse(Target), "");
                m_dwActionTick = HUtil32.GetTickCount();
                nHitCount++;// 攻击计数
            }
        }
Exemplo n.º 2
0
        private void FlyAxeAttack(TBaseObject Target)
        {
            TAbility WAbil;
            int      nDamage;

            if (this.m_PEnvir.CanFly(this.m_nCurrX, this.m_nCurrY, Target.m_nCurrX, Target.m_nCurrY))
            {
                this.m_btDirection = M2Share.GetNextDirection(this.m_nCurrX, this.m_nCurrY, Target.m_nCurrX, Target.m_nCurrY);
                WAbil   = this.m_WAbil;
                nDamage = (HUtil32.Random(((short)HUtil32.HiWord(WAbil.DC) - HUtil32.LoWord(WAbil.DC)) + 1) + HUtil32.LoWord(WAbil.DC));
                if (nDamage > 0)
                {
                    nDamage = Target.GetHitStruckDamage(this, nDamage);
                }
                if (nDamage > 0)
                {
                    Target.StruckDamage(nDamage);
                    Target.SendDelayMsg(Grobal2.RM_STRUCK, Grobal2.RM_10101, nDamage, Target.m_WAbil.HP, Target.m_WAbil.MaxHP, 0, "", (uint)HUtil32._MAX(Math.Abs(this.m_nCurrX - Target.m_nCurrX), Math.Abs(this.m_nCurrY - Target.m_nCurrY)) * 50 + 600);
                }
                this.SendRefMsg(Grobal2.RM_FLYAXE, this.m_btDirection, this.m_nCurrX, this.m_nCurrY, 0, "");
            }
        }