其他分享
首页 > 其他分享> > 计算公式

计算公式

作者:互联网

 CalcResult calcResult = new CalcResult();
        for (int i = 0; i < comboCount; i++)
        {
            decimal critChance = 1-CalcRandom(calcMode);
            critRate = (decimal)Mathf.Clamp((float)critRate, 0, 1);
            var critMultiplierLocal = critChance < critRate ? critMultiplier : 1;

            var randomRange = CalcRandom(calcMode) * baseRandomRange;
            decimal baseValueLocal = baseValue + randomRange;

            var singleAttack = (baseValueLocal + baseAdd + baseValueLocal * baseExtraRatio) * baseIndieMupltier * critMultiplierLocal;
            calcResult.attack += singleAttack;
            calcResult.damage += (singleAttack - armor) * damageAbsorb;
        }
        //这里damage如果是负值直接取0
        calcResult.damage = calcResult.damage <= 0 ? 0 : calcResult.damage;

标签:singleAttack,critRate,damage,calcResult,baseValueLocal,var,计算公式
来源: https://blog.csdn.net/qq_33574890/article/details/104802031