Пример #1
0
        void UpdateDamage()
        {
            int s = 0, r = 1, t = 2;
            var src = sAtkRadioButton.Checked ? s
                    : rAtkRadioButton.Checked ? r : t;
            var patk = (double)(src == s ? sAtkBaseUpDown.Value
                     : src == r ? rAtkBaseUpDown.Value
                                : tAtkBaseUpDown.Value);
            var satk = (double)(
                       src == s ? sAtkAblUpDown.Value + sAtkUserUpDown.Value
                     : src == r ? rAtkAblUpDown.Value + rAtkUserUpDown.Value
                                : tAtkAblUpDown.Value + tAtkUserUpDown.Value);

            var wet = wp.MapDefault(x => x.ExtendType, WeaponExtendType.Rare);
            var watk = wp.MapDefault(x => x.Stats[src], 0);
            var grind = wp.MapDefault(x => x.Grind, 1.0);
            var elem = wp.MapDefault(x => x.Element, 0);

            var totalm = 1.0;
            var partm = 1.0;
            var elemm = 1.0;
            var critm = 1.0;
            var pam = pa.MapDefault(x => x.Power, 100);

            var mydex = (double)(dexBaseUpDown.Value + dexAblUpDown.Value + dexUserUpDown.Value);
            var padex = pa.MapDefault(x => x.DexAccuracy, 100);
            var endef = en.MapDefault(x => x.Def, 315);
            var endex = en.MapDefault(x => x.Dex, 414);
            var crit = (double)(critBaseUpDown.Value + critUserUpDown.Value);

            var validskills = skillsListView.CheckedIndices.Cast<int>().Map(x => Skills[x]).Concat(potentialCheckBox.Checked ? wp.MapDefault(x => new[] { x.Potential }, new Skill[] { }) : new Skill[] { });
            var effects = GenSkillEffects(validskills);

            var atkty = src == s ? SkillTarget.S_ATK : src == r ? SkillTarget.R_ATK : SkillTarget.T_ATK;
            var dmgty = src == s ? SkillTarget.S_DMG : src == r ? SkillTarget.R_DMG : SkillTarget.T_DMG;
            var dmgcty = src == s ? SkillTarget.S_DMG_C : src == r ? SkillTarget.R_DMG_C : SkillTarget.T_DMG_C;

            Func<SkillTarget, double, Func<double, SkillEffect, double>, double> fold = (st, se, f) =>
                 effects[(int)st].FoldL(f, se);

            satk += fold(SkillTarget.ALL_ATK, 0, (i, x) => i + x.MaxValue) + fold(atkty, 0, (i, x) => i + x.MaxValue);
            crit += fold(SkillTarget.CRIT, 0, (i, x) => i + x.MaxValue);
            totalm *= fold(SkillTarget.ALL_DMG, 1.0, (i, x) => i * x.MaxValue / 100d) * fold(dmgty, 1.0, (i, x) => i * x.MaxValue / 100d);
            critm *= fold(SkillTarget.ALL_DMG_C, 1.0, (i, x) => i * x.MaxValue / 100d) * fold(dmgcty, 1.0, (i, x) => i * x.MaxValue / 100d);

            if (wbCheckBox.Checked)
                totalm *= 2.55;
            if (jaCheckBox.Checked)
                totalm *= 1.30;
            if (ubCheckBox.Checked)
                totalm *= 1.10;
            if (ssCheckBox.Checked)
                totalm *= 1.10;
            if (hsCheckBox.Checked)
                totalm *= 2.0;
            if (userMultiElemCheckBox.Checked)
            {
                if (useTechCheckBox.Checked)
                    totalm *= (double)userMultiElemUpDown.Value;
                else
                    elemm *= (double)userMultiElemUpDown.Value;
            }
            if (userMultiCheckBox.Checked)
                totalm *= (double)userMultiUpDown.Value;

            if (shiftaCheckBox.Checked)
            {
                if (shiftaAdvCheckBox.Checked)
                    patk *= 1.24625;
                else
                    patk *= 1.197;
            }
            if (shiftaCritiCheckBox.Checked)
                crit += 20;
            if (critFieldCheckBox.Checked)
                crit += 30;

            if (crit > 100)
                crit = 100;

            totalListView.Items.Clear();
            totalListView.Items.AddRange(new ListViewItem[]
            {
                new ListViewItem(new [] { "Player's ATP", patk.ToString() }),
                new ListViewItem(new [] { "Skill & Ability ATP", satk.ToString() }),
                new ListViewItem(new [] { "Weapon's ATP", watk.ToString() }),
                new ListViewItem(new [] { "Sum of ATP", (patk + satk + watk).ToString() }),
                new ListViewItem(new [] { "DEX", mydex.ToString() }),

                new ListViewItem(new [] { "Critical %", crit.ToString() }),
                new ListViewItem(new [] { "Damage Multiplier", totalm.ToString() }),
                new ListViewItem(new [] { "Critical Damage Multiplier", critm.ToString() }),
                new ListViewItem(new [] { "Elemental Multiplier", elemm.ToString() }),

                new ListViewItem(new [] { "Weapon Type", wet.ToString() }),
                new ListViewItem(new [] { "Weapon Element", elem.ToString() }),
                new ListViewItem(new [] { "Weapon Max Grind", grind.ToString() }),

                new ListViewItem(new [] { "PA Power", pam.ToString() }),
                new ListViewItem(new [] { "PA Accuracy", padex.ToString() }),
                new ListViewItem(new [] { "Enemy DEF", endef.ToString() }),
                new ListViewItem(new [] { "Enemy DEX", endex.ToString() }),

            });

            Result = Damage.CalculateAll(patk, satk, wet, watk, grind, elem, totalm, partm, elemm, pam, mydex, padex, endef, endex, crit, critm, nazoCheckBox.Checked);
            DamageCalculated(ProfileName, Result);
        }
Пример #2
0
 void ReceiveCalculatedDamage(string name, Damage d)
 {
     damages[name] = d;
     listView1.Items.Clear();
     foreach (var x in damages)
         listView1.Items.Add(new ListViewItem(new[] { x.Key, x.Value.MinDamage.ToString(), x.Value.MaxDamage.ToString(), x.Value.ExpectedDamage.ToString() }));
 }
Пример #3
0
 void Dummy(string s, Damage d)
 {
 }