Beispiel #1
0
 /// <summary>
 /// 检查攻击方式
 /// </summary>
 /// <returns></returns>
 public static CombatBaseAttack CheckAttack(CombatGeneral general)
 {
     //return !general.IsHunluanStatus && general.IsRelease
     //           ? (CombatBaseAttack)new CombatAbilityAttack(general)
     //           : new CombatPhysicalAttack(general);
     if (!general.IsHunluanStatus && general.IsRelease)
     {
         general.IsSelfAbility = 1;
         return((CombatBaseAttack) new CombatAbilityAttack(general));
     }
     else
     {
         var ability = AbilityDispose.TriggerAbilityList(general.AbilityInfoList);
         if (ability != null)
         {
             general.IsSelfAbility  = 2;
             general.TriggerAbility = ability;
             return((CombatBaseAttack) new CombatAbilityAttack(general));
         }
         else
         {
             return(new CombatPhysicalAttack(general));
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 计算技能伤害公式,不产生负数
        /// </summary>
        /// <param name="tagetGeneral"></param>
        /// <returns></returns>
        protected int GetAbilityDamageNum(CombatGeneral tagetGeneral)
        {
            string traceStr = string.Empty;
            int    damageNum;
            int    attackNum;
            int    defenseNum = 0;

            decimal         harmNum  = 0; //法宝属相克制伤害 --技能攻击
            AbilityProperty property = General.AbilityProperty;

            ProcessLog.AbilityProperty = property;
            attackNum = General.GetAttackNum(AbilityProperty.Ability) + General.GetAttackNum(property);
            if (tagetGeneral != null)
            {
                //法宝属相克制伤害 --技能攻击
                harmNum = TrumpAbilityAttack.TrumpZodiacHarm(General, tagetGeneral.UserID);

                defenseNum = tagetGeneral.GetDefenseNum(AbilityProperty.Ability, tagetGeneral) + tagetGeneral.GetDefenseNum(property, tagetGeneral);
            }
            General.MinDamageNum = (int)Math.Ceiling(attackNum * ConfigEnvSet.GetDouble("Combat.MinDamagePencent"));
            damageNum            = MathUtils.Subtraction(attackNum, defenseNum, General.MinDamageNum);

            decimal ratioNum = General.TempAbility.RatioNum > 0 ? General.TempAbility.RatioNum : 1;

            damageNum = (int)Math.Floor(damageNum * ratioNum); //计算伤害系数
            //气势加成=气势/{100-(气势-100)*2/3}*100%
            if (General != null)
            {
                var qishiNum = General.Momentum == 0 ? (short)100 : General.Momentum;
                traceStr += "qishiNum:" + qishiNum;
                decimal qishiPercent = (decimal)qishiNum / 100;
                traceStr += "qishiPercent:" + qishiNum;
                damageNum = (int)Math.Floor(damageNum * qishiPercent);
                traceStr += "damageNum:" + qishiNum;
                //加固定伤害
                damageNum = MathUtils.Addition(damageNum, General.FixedDamageNum, int.MaxValue);
                traceStr += "FixedDamageNum:" + qishiNum;
            }
            //技能伤害,负数是增加,
            //damageNum = General != null && General.Ability.IsIncrease ? -damageNum : damageNum;
            if (damageNum == 0)
            {
                new BaseLog().SaveLog(new Exception("释放技能:" + General.TempAbility.AbilityName + General.TempAbility.AbilityID + "伤害为0,Trace:" + traceStr));
            }
            if (damageNum < General.MinDamageNum)
            {
                damageNum = General.MinDamageNum;
            }
            //法宝属相克制伤害 --技能攻击
            if (!isharm && harmNum > 0)
            {
                damageNum = (int)(damageNum * MathUtils.Addition(1, harmNum));
                isharm    = true;
            }
            //魂技等级与自身魂技加成

            int     abilityID   = General.TempAbility != null ? General.TempAbility.AbilityID : 0;
            decimal effectValue = AbilityDispose.GetAbilityEffect(General.UserID, General.GeneralID, abilityID);

            if (effectValue > 0)
            {
                damageNum = MathUtils.ToCeilingInt(damageNum * MathUtils.Addition(1, (effectValue)));
            }
            return(damageNum);
        }