public _Pokemon(PokemonTranslator pokemonTranslator, PokemonAvailability._Pokemon _availability, Traits traits, _Stats._MaxStats maxStats) : base(pokemonTranslator.Id, pokemonTranslator.Name, pokemonTranslator.Form) { family = pokemonTranslator.CandyType; buddy_km = (int)pokemonTranslator.PokemonSettings.km_buddy_distance; gender_ratio = pokemonTranslator.GenderRatio; rarity = pokemonTranslator.Rarity; shiny = _availability.shiny; ditto = traits.CanBeDitto(pokemonTranslator); var egg = traits.GetEgg(pokemonTranslator); availability = (egg != null && string.Equals(_availability.availability, PokeConstants.Availability.HatchOnly)) ? string.Format(PokeConstants.Availability.HatchOnlyFormat, egg.type) : _availability.availability; Type = new PokeTypes(pokemonTranslator.Type1, pokemonTranslator.Type2); if (pokemonTranslator.EvolvesFromId > 0) { EvolvesFrom = new EvolvesFrom(pokemonTranslator); } Stats = new _Stats( new _Stats.IVScore(pokemonTranslator.PokemonSettings.stats.base_attack, pokemonTranslator.PokemonSettings.stats.base_defense, pokemonTranslator.PokemonSettings.stats.base_stamina), new _Stats.Variation(pokemonTranslator.PokemonSettings.pokedex_height_m, pokemonTranslator.PokemonSettings.pokedex_height_m), new _Stats.Variation(pokemonTranslator.PokemonSettings.pokedex_weight_kg, pokemonTranslator.PokemonSettings.pokedex_weight_kg), new _Stats._Rates(Math.Min(pokemonTranslator.PokemonSettings.encounter.base_capture_rate, 1.0f), pokemonTranslator.PokemonSettings.encounter.base_flee_rate, pokemonTranslator.PokemonSettings.encounter.attack_probability, pokemonTranslator.PokemonSettings.encounter.dodge_probability), maxStats); }
public async Task LoadData() { IsLoading = true; var types = await Api.GetAllPokeTypes(); PokeTypes.Clear(); foreach (var type in types) { PokeTypes.Add(type); } IsLoading = false; }
bool AreElectionsCorrect() { IEnumerable <string> elections = PokeTypes.Where(x => x.Elected).Select(x => x.NaturalID); if (elections.Count() != correctPokeTypes.Count()) { return(false); } foreach (string election in elections) { if (!IsElectionCorrect(election)) { return(false); } } return(true); }