Example #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();
        }