Пример #1
0
        private void Calculate()
        {
            double[] f        = new double[65];
            var      ff       = 0D;
            var      phys     = 0D;
            var      elem     = 0D;
            Upheaval upheaval = new Upheaval();

            for (int i = 1; i < CountOfRows(); i++)
            {
                var a      = Tablex(i, 1).Value;                                                                                          // +-------+-------+-------+-------+-------+
                var b      = Tablex(i, 2).Value;                                                                                          // |单段倍率|伤害段数|属性加成|反应类型|伤害占比|
                var c      = Tablex(i, 3).Value;                                                                                          // +-------+-------+-------+-------+-------+
                var d      = Tablex(i, 4).Value;                                                                                          // |   a   |   b   |   c   |   d   |   e   |
                var e      = Tablex(i, 5).Value;                                                                                          // +-------+-------+-------+-------+-------+
                var ab     = Convert.ToDouble(a) * Convert.ToDouble(b);
                var React1 = (1 + (16 * EM / (2000 + EM) + ReactionBuff)) * upheaval.Upheaval_Damage(Level, false) * Convert.ToDouble(b); //剧变反应
                var React2 = 1 + (2.78 * EM / (1400 + EM) + ReactionBuff);                                                                //增幅反应
                switch (d.ToString())
                {
                case "不反应":
                    switch (c.ToString())
                    {
                    case "物理": e = Buffcheck(0) * ab; break;

                    case "风": e = Buffcheck(1) * ab; break;

                    case "冰": e = Buffcheck(2) * ab; break;

                    case "雷": e = Buffcheck(3) * ab; break;

                    case "火": e = Buffcheck(4) * ab; break;

                    case "水": e = Buffcheck(5) * ab; break;

                    case "岩": e = Buffcheck(6) * ab; break;

                    default: e = 0; break;
                    }
                    break;                                               //不反应

                case "超导": e = React1 * 0.25 * RESCalc(Res[2]); break;   //超导

                case "扩散": e = React1 * 0.30 * RESCalc(Res[1]); break;   //扩散

                case "感电": e = React1 * 0.60 * RESCalc(Res[3]); break;   //感电

                case "碎冰": e = React1 * 0.75 * RESCalc(Res[0]); break;   //碎冰

                case "超载": e = React1 * 1.00 * RESCalc(Res[4]); break;   //超载

                case "火蒸发": e = React2 * 1.5 * Buffcheck(4) * ab; break; //1.5倍增幅

                case "水蒸发": e = React2 * 2.0 * Buffcheck(5) * ab; break; //2.0倍增幅

                case "火融化": e = React2 * 2.0 * Buffcheck(4) * ab; break; //2.0倍增幅

                case "冰融化": e = React2 * 1.5 * Buffcheck(2) * ab; break; //1.5倍增幅

                default: React1 = 0; React2 = 0; break;
                }
                if (d.ToString() == "不反应" && c.ToString() == "物理")
                {
                    phys += Convert.ToDouble(e);
                }
                else
                {
                    elem += Convert.ToDouble(e);
                }
                f[i] = Convert.ToDouble(e);
            }
            for (int i = 1; i < f.Length; i++)
            {
                ff += f[i];
                if (f[i] == 0)
                {
                    break;
                }
            }
            for (int i = 1; i < CountOfRows(); i++)
            {
                Tablex(i, 5).Value = f[i] / ff;
            }
            DMG_P     = phys;
            DMG_E     = elem;
            DMG       = DMG_P + DMG_E;
            TimeCount = Convert.ToDouble(Time_Input.Text);
            DPS       = DMG / TimeCount;
            DPS_P     = DMG_P / TimeCount;
            DPS_E     = DMG_E / TimeCount;
            DMG_Displayer();
            DPS_Displayer();
        }
Пример #2
0
        /// <summary>
        /// 计算伤害的主要公式
        /// </summary>
        public void Calculate()
        {
            try
            {
                //反应伤害相关计算
                ReactionCalculator(Reaction_Choose.SelectedIndex);
                if (Reaction_Choose.SelectedIndex >= 6 || Reaction_Choose.SelectedIndex == 0)
                {
                    //基础、增幅伤害相关计算
                    check  = false;
                    Normal = ATKLC                                  //总攻击力
                             * (1 + (ELMLV + BUFLV) / 100)          //伤害加成
                             * React                                //元素精通
                             * DEFLC                                //防御属性
                             * Resistance                           //抗性计算
                             * float.Parse(Skill.Value.Text) / 100  //技能倍率
                             * float.Parse(Other.Value.Text) / 100; //其他乘区
                    //等级压制计算,参考:https://bbs.nga.cn/read.php?tid=24358389
                    if (Level_Player.Current - Level_Enemy.Current > 70 && Level_Enemy.Current <= 10)
                    {
                        Normal *= 1.5;
                    }
                    else if (Level_Enemy.Current - Level_Player.Current > 70 && Level_Player.Current <= 10)
                    {
                        Normal *= 0.5;
                    }

                    Crit = Normal * (1 + float.Parse(Crit_Damage.Value.Text) / 100);
                    Avg  = Normal * (1 + float.Parse(Crit_Rate.Value.Text) * float.Parse(Crit_Damage.Value.Text) / 10000);

                    //暴击时的伤害修正
                    //满暴击时,普通伤害等于暴击伤害
                    if (float.Parse(Crit_Rate.Value.Text) == 100)
                    {
                        Normal = Crit;
                    }
                    //不暴击时,暴击伤害等于普通伤害
                    else if (float.Parse(Crit_Rate.Value.Text) == 0)
                    {
                        Crit = Normal;
                    }
                }
                else    //剧变反应伤害相关计算
                {
                    check  = true;
                    Normal = React * upheaval.Upheaval_Damage((int)Level_Player.Current, false) * Resistance;
                    Avg    = Normal;
                }
                //免疫相关显示
                if (Resistance_Percent.Value.Text.Contains("∞"))
                {
                    Normal     = 0;
                    Avg        = 0;
                    Crit       = 0;
                    Resistance = 0;
                }
                //伤害数值转为文本
                Normal_DMG.Text = Convert.ToString(Normal);
                Crit_DMG.Text   = check ? "N/A" : Convert.ToString(Crit);
                Avg_DMG.Text    = Convert.ToString(Avg);
            }
            catch
            {
                //_ = MessageBox.Show("111");// 调试用 调试完成后尽快将其注释掉
            }
            if (P1.SelectedIndex == 4)
            {
                if (ChartDrawing != null)
                {
                    DetailedCalculate();
                }
                else
                {
                    ChartDrawing = new Thread(DetailedCalculate);
                    ChartDrawing.Start();
                }
            }
            else if (ChartDrawing != null)
            {
                ChartDrawing.Abort();
                ComChart.Enabled = false;
            }
        }