private void buttonCheck_Click(object sender, EventArgs e) { uint hp = 0; uint atk = 0; uint def = 0; uint spa = 0; uint spd = 0; uint spe = 0; uint level = 1; var pokemon = (Pokemon) comboBoxPokemon.SelectedValue; var nature = (Nature) comboBoxNature.SelectedValue; if (maskedTextBoxHP.Text != "") hp = uint.Parse(maskedTextBoxHP.Text); if (maskedTextBoxAtk.Text != "") atk = uint.Parse(maskedTextBoxAtk.Text); if (maskedTextBoxDef.Text != "") def = uint.Parse(maskedTextBoxDef.Text); if (maskedTextBoxSpA.Text != "") spa = uint.Parse(maskedTextBoxSpA.Text); if (maskedTextBoxSpD.Text != "") spd = uint.Parse(maskedTextBoxSpD.Text); if (maskedTextBoxSpe.Text != "") spe = uint.Parse(maskedTextBoxSpe.Text); if (maskedTextBoxLevel.Text != "") level = uint.Parse(maskedTextBoxLevel.Text); var stats = new[] {hp, atk, def, spa, spd, spe}; Characteristic characteristic = null; if (comboBoxCharacteristic.SelectedItem.ToString() != "NONE") { characteristic = (Characteristic) comboBoxCharacteristic.SelectedItem; } var ivCheck = new IVCheck(pokemon, level, nature, characteristic, stats); minstats = new uint[6]; maxstats = new uint[6]; for (int statCount = 0; statCount < 6; statCount++) { if (ivCheck.Possibilities[statCount].Count == 0) { buttonOk.Enabled = false; break; } minstats[statCount] = ivCheck.Possibilities[statCount][0]; maxstats[statCount] = ivCheck.Possibilities[statCount][ivCheck.Possibilities[statCount].Count - 1]; buttonOk.Enabled = true; } // Get the results back and display them to the user textBoxResults.Text = ivCheck.ToString(); }
private void buttonCheck_Click(object sender, EventArgs e) { uint hp = 0; uint atk = 0; uint def = 0; uint spa = 0; uint spd = 0; uint spe = 0; uint level = 1; var pokemon = (Pokemon) comboBoxPokemon.SelectedValue; var nature = (Nature) comboBoxNature.SelectedValue; if (maskedTextBoxHP.Text != "") hp = uint.Parse(maskedTextBoxHP.Text); if (maskedTextBoxAtk.Text != "") atk = uint.Parse(maskedTextBoxAtk.Text); if (maskedTextBoxDef.Text != "") def = uint.Parse(maskedTextBoxDef.Text); if (maskedTextBoxSpA.Text != "") spa = uint.Parse(maskedTextBoxSpA.Text); if (maskedTextBoxSpD.Text != "") spd = uint.Parse(maskedTextBoxSpD.Text); if (maskedTextBoxSpe.Text != "") spe = uint.Parse(maskedTextBoxSpe.Text); if (maskedTextBoxLevel.Text != "") level = uint.Parse(maskedTextBoxLevel.Text); var stats = new[] {hp, atk, def, spa, spd, spe}; Characteristic characteristic = null; if (comboBoxCharacteristic.SelectedItem.ToString() != "NONE") { characteristic = (Characteristic) comboBoxCharacteristic.SelectedItem; } var ivCheck = new IVCheck(pokemon, level, nature, characteristic, stats); // Get the results back and display them to the user textBoxResults.Text = ivCheck.ToString(); }