public void Init(BuffData buffdata, string spec)
        {
            Console.WriteLine(PlayerData.Agility);

            FuriousHowl = PlayerData.FuriousHowl;
            double agi = PlayerData.Agility + 127.0;

            if (spec == "MM")
            {
                buffdata.Crit            += 8.0;
                CriticalStrikeMultiplier += 0.3;
                DamageMult      += 0.8 + buffdata.DamagePerc;
                AttackPower     += 100;
                MultiShotDamage += 0.15;
                ImpHawk          = true;
                agi             += (buffdata.Agility + buffdata.AllStats);
                agi             *= (1.0 + ((buffdata.AgilityPerc / 100.0) + (buffdata.AllStatsPerc / 100.0)));
            }
            else if (spec == "SURV")
            {
                buffdata.Crit            += 11.0;
                CriticalStrikeMultiplier += 0.3;
                DamageMult += 0.3 + buffdata.DamagePerc;
                agi        += (buffdata.Agility + buffdata.AllStats);
                agi        *= (1.0 + ((buffdata.AgilityPerc / 100.0) + 0.15 + (buffdata.AllStatsPerc / 100.0)));
            }
            HitChance        = PlayerData.Hit;
            HitChance       += ((PlayerData.WeaponSkill - 300.0) / 4.0) * 0.8;
            CriticalChance  += 0.4 * (PlayerData.WeaponSkill - 300);
            CriticalChance  += (agi / 53.0);
            CriticalChance  += (PlayerData.AddedCrit / 100.0) + buffdata.Crit;
            AttackPower     += agi * 2.0 + PlayerData.AttackPower + buffdata.AttackPower;
            TotalDPS         = (AttackPower / 14.0) + PlayerData.WeaponDPS + PlayerData.Arrows;
            results.PaneAP   = AttackPower;
            results.PaneAgi  = agi;
            results.PaneDPS  = TotalDPS;
            results.PaneCrit = CriticalChance;
        }
Exemple #2
0
        private void SimulateClick(object sender, EventArgs e)
        {
            BuffData   buffdata   = new BuffData();
            Simulation simulation = new Simulation();

            simulation.UseCDs = checkBox3.Checked;

            for (int i = 0; i < worldbuffsBox.Items.Count; i++)
            {
                if (worldbuffsBox.GetSelected(i))
                {
                    buffdata.Agility      += WorldBuffs[i].Agility;
                    buffdata.AllStats     += WorldBuffs[i].AllStats;
                    buffdata.AgilityPerc  += WorldBuffs[i].AgilityPerc;
                    buffdata.AllStatsPerc += WorldBuffs[i].AllStatsPerc;
                    buffdata.Crit         += WorldBuffs[i].Crit;
                    buffdata.DamagePerc   += WorldBuffs[i].DamagePerc;
                    buffdata.AttackPower  += WorldBuffs[i].AttackPower;
                }
            }

            for (int i = 0; i < consumesBox.Items.Count; i++)
            {
                if (consumesBox.GetSelected(i))
                {
                    buffdata.Agility      += Consumables[i].Agility;
                    buffdata.AllStats     += Consumables[i].AllStats;
                    buffdata.AgilityPerc  += Consumables[i].AgilityPerc;
                    buffdata.AllStatsPerc += Consumables[i].AllStatsPerc;
                    buffdata.Crit         += Consumables[i].Crit;
                    buffdata.DamagePerc   += Consumables[i].DamagePerc;
                    buffdata.AttackPower  += Consumables[i].AttackPower;
                }
            }
            for (int i = 0; i < buffsBox.Items.Count; i++)
            {
                if (buffsBox.GetSelected(i))
                {
                    buffdata.Agility      += Buffs[i].Agility;
                    buffdata.AllStats     += Buffs[i].AllStats;
                    buffdata.AgilityPerc  += Buffs[i].AgilityPerc;
                    buffdata.AllStatsPerc += Buffs[i].AllStatsPerc;
                    buffdata.Crit         += Buffs[i].Crit;
                    buffdata.DamagePerc   += Buffs[i].DamagePerc;
                    buffdata.AttackPower  += Buffs[i].AttackPower;
                }
            }

            PlayerData pdata = new PlayerData();

            pdata.IsTroll         = checkBox1.Checked;
            pdata.AddedCrit       = (double)critBox.Value;
            pdata.Agility         = (double)agilityBox.Value;
            pdata.AttackPower     = (double)apBox.Value;
            pdata.Hit             = (double)hitBox.Value;
            pdata.WeaponSkill     = (double)weaponskillBox.Value;
            pdata.WeaponSpeed     = (double)weaponspeedBox.Value;
            pdata.WeaponDPS       = (double)dpsBox.Value;
            pdata.FuriousHowl     = checkBox2.Checked;
            simulation.PlayerData = pdata;

            switch (quiverBox.SelectedIndex)
            {
            case 0:
                pdata.Quiver = 13;
                break;

            case 1:
                pdata.Quiver = 14;
                break;

            case 2:
                pdata.Quiver = 15;
                break;
            }

            switch (arrowBox.SelectedIndex)
            {
            case 0:
                pdata.Arrows = 13;
                break;

            case 1:
                pdata.Arrows = 17.5;
                break;

            case 2:
                pdata.Arrows = 20;
                break;

            case 3:
                pdata.Arrows = 20.5;
                break;
            }

            if (radioButton2.Checked)
            {
                simulation.Init(buffdata, "MM");
            }
            else
            {
                simulation.Init(buffdata, "SURV");
            }

            var worker = new BackgroundWorker {
                WorkerReportsProgress = true, WorkerSupportsCancellation = true
            };
            var progressForm = new Progress((int)numsimsBox.Value);

            worker.DoWork += (_sender, _e) =>
            {
                Action action = () =>
                {
                    simButton.Enabled = false;
                    progressForm.ShowDialog(this);
                };
                BeginInvoke(action);
                _e.Result = simulation.Simulate((int)bosshpBox.Value, (int)numsimsBox.Value, worker);
            };

            worker.RunWorkerCompleted += (_sender, _e) =>
            {
                progressForm.Hide();
                simButton.Enabled = true;
                SimulationResults results = (SimulationResults)_e.Result;

                resultsBox.AppendText("------------------------------------------------------\n");
                resultsBox.AppendText(numsimsBox.Value.ToString() + " Simulations completed with " +
                                      bosshpBox.Value.ToString() + " Mob health\n");
                resultsBox.AppendText("\n");
                resultsBox.AppendText("Character Pane Agility: " + results.PaneAgi + "\n");
                resultsBox.AppendText("Character Pane AP: " + results.PaneAP + "\n");
                resultsBox.AppendText("Character Pane Crit: " + Math.Round(results.PaneCrit, 2) + "%\n");
                resultsBox.AppendText("Character Pane DPS: " + Math.Round(results.PaneDPS, 2) + "\n");
                resultsBox.AppendText("\n");
                resultsBox.AppendText("Number of Actions: " + results.NumActions + "\n");
                resultsBox.AppendText("Number of Misses: " + results.NumMisses + "\n");
                double hitChance = (1.0 - ((double)results.NumMisses / (double)results.NumActions));
                resultsBox.AppendText("Effective Hit Chance: " + Math.Round(hitChance * 100.0, 2) + "%\n");
                resultsBox.AppendText("Number of Critical strikes: " + results.NumCrits + "\n");
                resultsBox.AppendText("Effective Critical Strike Chance: " +
                                      Math.Round(results.CritPercentage * 100.0, 2) + "%\n");
                resultsBox.AppendText("Total Damage: " + Math.Round(results.TotalDamage) + "\n");
                resultsBox.AppendText("Time Taken: " + results.TimeTaken + "\n");
                resultsBox.AppendText("DPS: " + Math.Round(results.DPS, 2) + "\n");
                resultsBox.AppendText("------------------------------------------------------\n");
            };

            worker.ProgressChanged += (_sender, _e) =>
            {
                progressForm.SetProgress(_e.ProgressPercentage);
                progressForm.SetCurrentSimulations(simulation.CurrentSimulation);
            };

            worker.RunWorkerAsync();
        }