private void Type2_combo_SelectedIndexChanged(object sender, EventArgs e) { if (Type2_Combo.SelectedIndex == 0) Pokemon1[1] = new PokemonType(); else { if (((Type2_Combo.SelectedIndex - 1) == Type1_Combo.SelectedIndex) && Type1_Combo.SelectedIndex != -1) { MessageBox.Show("Same type selected as type1, now that's abit silly no?", "Same typing"); Type2_Combo.SelectedIndex = -1; } else { Pokemon1[1] = SetPokemonType(Type2_Combo.SelectedIndex - 1); } } Pokemon1Weak = CalculateWeaknessForPokemon(Pokemon1); UpdateWeaknessGridView(); }
private void Type1_Combo_SelectedIndexChanged(object sender, EventArgs e) { Pokemon1[0] = SetPokemonType(Type1_Combo.SelectedIndex); Pokemon1[1] = new PokemonType(); Pokemon1Weak = CalculateWeaknessForPokemon(Pokemon1); UpdateWeaknessGridView(); }
private void P6Type1_Combo_RightToLeftChanged(object sender, EventArgs e) { Pokemon6[0] = SetPokemonType(P6Type1_Combo.SelectedIndex); Pokemon6[1] = new PokemonType(); Pokemon6Weak = CalculateWeaknessForPokemon(Pokemon6); UpdateWeaknessGridView(); }
private PokemonType SetPokemonType(int SelectedIndex) { PokemonType result = new PokemonType(); switch (SelectedIndex) { case (int)PokeTypeSelection.Normal: { result = Normal; } break; case (int)PokeTypeSelection.Fire: { result = Fire; } break; case (int)PokeTypeSelection.Water: { result = Water; } break; case (int)PokeTypeSelection.Electric: { result = Electric; } break; case (int)PokeTypeSelection.Grass: { result = Grass; } break; case (int)PokeTypeSelection.Ice: { result = Ice; } break; case (int)PokeTypeSelection.Fighting: { result = Fighting; } break; case (int)PokeTypeSelection.Poison: { result = Poison; } break; case (int)PokeTypeSelection.Ground: { result = Ground; } break; case (int)PokeTypeSelection.Flying: { result = Flying; } break; case (int)PokeTypeSelection.Psychic: { result = Psychic; } break; case (int)PokeTypeSelection.Bug: { result = Bug; } break; case (int)PokeTypeSelection.Rock: { result = Rock; } break; case (int)PokeTypeSelection.Ghost: { result = Ghost; } break; case (int)PokeTypeSelection.Dragon: { result = Dragon; } break; case (int)PokeTypeSelection.Dark: { result = Dark; } break; case (int)PokeTypeSelection.Steel: { result = Steel; } break; case (int)PokeTypeSelection.Fairy: { result = Fairy; } break; }// end of switch case return result; }
/// <summary> /// Updates the DisplayString /// </summary> private string[] CalculateWeaknessForPokemon(PokemonType[] Pokemon) { string[] DisplayString = new string[18]; { int Weakness; Weakness = Pokemon[0].Normal * Pokemon[1].Normal; DisplayString[0] = Weakness.ToString(); Weakness = Pokemon[0].Fire * Pokemon[1].Fire; DisplayString[1] = Weakness.ToString(); Weakness = Pokemon[0].Water * Pokemon[1].Water; DisplayString[2] = Weakness.ToString(); Weakness = Pokemon[0].Electric * Pokemon[1].Electric; DisplayString[3] = Weakness.ToString(); Weakness = Pokemon[0].Grass * Pokemon[1].Grass; DisplayString[4] = Weakness.ToString(); Weakness = Pokemon[0].Ice * Pokemon[1].Ice; DisplayString[5] = Weakness.ToString(); Weakness = Pokemon[0].Fighting * Pokemon[1].Fighting; DisplayString[6] = Weakness.ToString(); Weakness = Pokemon[0].Poison * Pokemon[1].Poison; DisplayString[7] = Weakness.ToString(); Weakness = Pokemon[0].Ground * Pokemon[1].Ground; DisplayString[8] = Weakness.ToString(); Weakness = Pokemon[0].Flying * Pokemon[1].Flying; DisplayString[9] = Weakness.ToString(); Weakness = Pokemon[0].Psychic * Pokemon[1].Psychic; DisplayString[10] = Weakness.ToString(); Weakness = Pokemon[0].Bug * Pokemon[1].Bug; DisplayString[11] = Weakness.ToString(); Weakness = Pokemon[0].Rock * Pokemon[1].Rock; DisplayString[12] = Weakness.ToString(); Weakness = Pokemon[0].Ghost * Pokemon[1].Ghost; DisplayString[13] = Weakness.ToString(); Weakness = Pokemon[0].Dragon * Pokemon[1].Dragon; DisplayString[14] = Weakness.ToString(); Weakness = Pokemon[0].Dark * Pokemon[1].Dark; DisplayString[15] = Weakness.ToString(); Weakness = Pokemon[0].Steel * Pokemon[1].Steel; DisplayString[16] = Weakness.ToString(); Weakness = Pokemon[0].Fairy * Pokemon[1].Fairy; DisplayString[17] = Weakness.ToString(); } return DisplayString; }