示例#1
0
        /// <summary>
        /// 对决
        /// </summary>
        private void fighting()
        {
            _battleStatus = CMsgHeader.STATUS_ATTACK;

            while (_curAtter.alive && _curDefer.alive)
            {
                fightDiff = Math.Abs(_curAtter.curAtt - _curDefer.curAtt);
                int att = Math.Min(_curAtter.curAtt, _curDefer.curAtt);

                _curAtter.sufferNormalAttack(att, _curDefer);
                _curDefer.sufferNormalAttack(att, _curAtter);
            }
        }
示例#2
0
        // --------- 反弹伤害 ---------
        private float returnDamage(BT_Monster Pet, BT_Monster enemy, float damage)
        {
            short           bufDebuffType = CMsgHeader.BUFF_DEBUFF_REBOUND;
            BT_BuffOrDebuff reboundBuff   = Pet.getBuffOrDebuff(bufDebuffType);

            if (reboundBuff != null && --reboundBuff.round >= 0 && enemy.alive)
            {
                //
                float rebound = damage * reboundBuff.rate * Consts.oneHundred;
                damage -= rebound;
                if (damage < 0)
                {
                    damage = 0;
                }
                // 反弹部分伤害到敌人...
                enemy.sufferNormalAttack(MathHelper.MidpointRounding(rebound), Pet, true);
            }

            return(damage);
        }
示例#3
0
        //返回实现伤害值
        public int sufferAttack(BT_Hurt damage, BT_Monster enemy)
        {
            int finalDamage = MathHelper.MidpointRounding(damage.damageVal);

            //技能来的攻击
            if ((damage.hurtType == BT_Hurt_Type.HURT_SKILL || damage.hurtType == BT_Hurt_Type.HURT_ANGRY_SKILL) && canSufferSkillDamage() == false)
            {
                finalDamage = 0;
            }

            #region 各种buff or defbuff处理...

            //伤害全部防御技能
            short           bufDebuffType = CMsgHeader.BUFF_DEBUFF_GOLDDEFENSE;
            BT_BuffOrDebuff goldShieldBuf = getBuffOrDebuff(bufDebuffType);
            if (goldShieldBuf != null && --goldShieldBuf.round >= 0)
            {
                finalDamage = 0;

                CMsgSkillBuffDebuffEffect msg = new CMsgSkillBuffDebuffEffect(this, goldShieldBuf);
                _war.addMsgToRecorder(msg);

                _buffArr[bufDebuffType] = goldShieldBuf;
            }

            //伤害加深
            bufDebuffType = CMsgHeader.BUFF_DEBUFF_HURTUP;
            BT_BuffOrDebuff hurtUpDebuff = getBuffOrDebuff(bufDebuffType, false);
            if (hurtUpDebuff != null && --hurtUpDebuff.round >= 0)
            {
                int rDamage = MathHelper.MidpointRounding(damage.damageVal * (1 + hurtUpDebuff.rate * Consts.oneHundred));

                CMsgSkillBuffDebuffEffect msg = new CMsgSkillBuffDebuffEffect(this, hurtUpDebuff);
                msg.arg1 = MathHelper.MidpointRounding(damage.damageVal);
                msg.arg2 = rDamage;
                _war.addMsgToRecorder(msg);
                _debuffArr[bufDebuffType] = hurtUpDebuff;

                finalDamage = rDamage;
            }

            //反弹部分伤害到敌人...
            bufDebuffType = CMsgHeader.BUFF_DEBUFF_REBOUND;
            BT_BuffOrDebuff reboundBuff = getBuffOrDebuff(bufDebuffType);
            if (reboundBuff != null && --reboundBuff.round >= 0 && enemy.alive)
            {
                float rebound = damage.damageVal * reboundBuff.rate * Consts.oneHundred;
                damage.damageVal -= rebound;

                enemy.sufferNormalAttack(MathHelper.MidpointRounding(rebound), this, true);
                _buffArr[bufDebuffType] = reboundBuff;

                finalDamage = MathHelper.MidpointRounding(damage.damageVal);
            }

            //护盾技能...
            bufDebuffType = CMsgHeader.BUFF_DEBUFF_DEFENSE;
            BT_BuffOrDebuff shieldBuff = getBuffOrDebuff(bufDebuffType);
            if (shieldBuff != null && shieldBuff.suckDmg > 0)
            {
                int beforeShield = shieldBuff.suckDmg;
                if (beforeShield > damage.damageVal)
                {
                    shieldBuff.suckDmg -= MathHelper.MidpointRounding(damage.damageVal);
                    finalDamage         = 0;
                }
                else
                {
                    damage.damageVal  -= beforeShield;
                    shieldBuff.suckDmg = 0;
                    finalDamage        = MathHelper.MidpointRounding(damage.damageVal);
                }

                CMsgSkillBuffDebuffEffect msg = new CMsgSkillBuffDebuffEffect(this, shieldBuff);
                msg.arg1 = beforeShield;
                msg.arg2 = shieldBuff.suckDmg;
                _war.addMsgToRecorder(msg);

                _buffArr[bufDebuffType] = shieldBuff;
            }

            #endregion

            setCurAtt(_curAtt - finalDamage);

            return(finalDamage);
        }