public ModData(Mod _mod, string _name, string _description, int _level) { mod = _mod.Clone(); name = _name; description = _description; level = _level; }
private void btnCalc_Click(object sender, EventArgs e) { if (cbbWeapon.SelectedIndex == -1) { return; } Data.Simdata result = new Data.Simdata(0, 0), temp = new Data.Simdata(); bool timeExceed = false; string resultText = ""; Enemy enemy = ((Enemy)cbbEnemyType.SelectedValue).Scale((int)nudEnemyLevel.Value); double fullHitpoint = enemy.health + enemy.shield; Mod mod = SumMod(); for (int i = 0; i < Data.cycles; i++) { temp = ((Weapon)cbbWeapon.SelectedValue).SimKill(enemy.Clone(), mod.Clone(), cbHeadshot.Checked); if (temp.time >= Data.timeLimit) { timeExceed = true; break; } result.time += temp.time; result.shots += temp.shots; } result.time /= Data.cycles; result.shots /= Data.cycles; resultText += "耗时 " + (timeExceed ? "180秒以上" : (result.time.ToString("N2") + "s")) + "\n"; resultText += "耗弹 " + (timeExceed ? "耗时过长" : result.shots.ToString("N2")) + "\n"; resultText += "实际DPS " + (timeExceed ? "N/A" : (fullHitpoint / result.time).ToString("N2")) + "\n"; lblResult.Text = resultText; }
public ModData Clone() { return(new ModData(mod.Clone(), (string)name.Clone(), (string)description.Clone(), level)); }