コード例 #1
0
        /// <summary>
        /// 处理技能效果
        /// </summary>
        /// <param name="targetProcess"></param>
        /// <param name="abilityEffectStatus"></param>
        private void ProcessAbilityEffect(TargetProcess targetProcess, AbilityEffectStatus[] abilityEffectStatus)
        {
            foreach (AbilityEffectStatus effect in abilityEffectStatus)
            {
                //立即生效技能

                //没有配置技能效果,处理普通功击
                if (effect.IsSilentStatus)
                {
                    AddDeamgeStatus(effect);
                }
                else if (effect.IsInjuredStatus)
                {
                    //计算持续伤害值
                    if (effect.BoutNum > 0)
                    {
                        if (General.TempAbility.RatioIncreaseNum > 0)
                        {
                            effect.DamageNum = (int)Math.Floor(TagetGeneral.DamageNum * General.TempAbility.RatioIncreaseNum);
                        }
                        else
                        {
                            new BaseLog().SaveLog(new Exception("技能ID:" + General.TempAbility.AbilityID + "续伤害值系数为0"));
                        }
                    }
                    AddDeamgeStatus(effect);
                }
                else if (effect.AbilityType == AbilityType.Hunluan)
                {
                    AddDeamgeStatus(effect);
                }
                else if (effect.AbilityType == AbilityType.ShengMing)
                {
                    effect.BoutNum = 1;//固定一会合
                    AddDeamgeStatus(effect);
                    //加血类不扣防御方,
                    var lifeNum = GetAbilityDamageNum(null);
                    if (effect.IsIncrease)
                    {
                        TagetGeneral.LifeNum += lifeNum;
                    }
                    else
                    {
                        TagetGeneral.LifeNum -= lifeNum;
                    }
                    TagetGeneral.LifeNum = MathUtils.Subtraction(TagetGeneral.LifeNum, 0, 0);
                    TagetGeneral.LifeNum = MathUtils.Addition(TagetGeneral.LifeNum, 0, TagetGeneral.LifeMaxNum);

                    targetProcess.LiveNum   = TagetGeneral.LifeNum;
                    targetProcess.DamageNum = effect.IsIncrease ? -lifeNum : lifeNum;//负数客户端是加血
                }
                else if (effect.AbilityType == AbilityType.Qishi)
                {
                    effect.BoutNum = 1;//固定一会合
                    AddDeamgeStatus(effect);
                    //固定值
                    var momentum = effect.BaseNum.ToShort();
                    if (effect.IsIncrease)
                    {
                        TagetGeneral.Momentum += momentum;
                    }
                    else
                    {
                        TagetGeneral.Momentum -= momentum;
                    }
                    TagetGeneral.Momentum  = MathUtils.Subtraction(TagetGeneral.Momentum, (short)0, (short)0);
                    TagetGeneral.Momentum  = MathUtils.Addition(TagetGeneral.Momentum, (short)0, CombatGeneral.MomentumOut);
                    targetProcess.Momentum = TagetGeneral.Momentum;
                    effect.DamageNum       = momentum;
                }
                else if (effect.AbilityType == AbilityType.Jueduifangyu)
                {
                    //固定伤害
                    AddDeamgeStatus(effect);
                }
                else if (effect.IsZengyi)
                {
                    //增加属性效果
                    if (effect.IsIncrease)
                    {
                        ProcessLog.DamageStatusList.Add(effect.Copy());
                        if (effect.BoutNum > 0)
                        {
                            effect.BoutNum = MathUtils.Subtraction(effect.BoutNum, 1, 0);
                        }
                        General.AddDamageStatus(effect);
                    }
                    else
                    {
                        AddDeamgeStatus(effect);
                    }
                }
            }
        }