/// <summary> /// Postavlja level pokemona /// </summary> /// <param name="level">level na koji treba postavit range 1-100</param> private void SetLevel(byte level) { Experience xp; PokemonConstants.Experiences.TryGetValue(level, out xp); PokemonStructure pokemon = GetPokemonType; if (pokemon.XPGroup == 0) { this.Experience = xp.Erratic; } else if (pokemon.XPGroup == 1) { this.Experience = xp.Fast; } else if (pokemon.XPGroup == 2) { this.Experience = xp.MediumFast; } else if (pokemon.XPGroup == 3) { this.Experience = xp.MediumSlow; } else if (pokemon.XPGroup == 4) { this.Experience = xp.Slow; } else if (pokemon.XPGroup == 5) { this.Experience = xp.Fluctuating; } }
/// <summary> /// Dohvaca Level od Pokemona /// </summary> /// <returns>vraca level</returns> private byte GetLevel() { List <Experience> xp = new List <Experience>(); PokemonStructure pokemon = GetPokemonType; foreach (KeyValuePair <byte, Experience> kvp in PokemonConstants.Experiences) { xp.Add(kvp.Value); } //Trazimo level for (int i = 0; i < xp.Count; i++) { if (pokemon.XPGroup == 0) { if (this.Experience >= xp[i].Erratic && this.Experience < xp[i + 1].Erratic) { return((byte)(i + 1)); } } else if (pokemon.XPGroup == 1) { if (this.Experience >= xp[i].Fast && this.Experience < xp[i + 1].Fast) { return((byte)(i + 1)); } } else if (pokemon.XPGroup == 2) { if (this.Experience >= xp[i].MediumFast && this.Experience < xp[i + 1].MediumFast) { return((byte)(i + 1)); } } else if (pokemon.XPGroup == 3) { if (this.Experience >= xp[i].MediumSlow && this.Experience < xp[i + 1].MediumSlow) { return((byte)(i + 1)); } } else if (pokemon.XPGroup == 4) { if (this.Experience >= xp[i].Slow && this.Experience < xp[i + 1].Slow) { return((byte)(i + 1)); } } else if (pokemon.XPGroup == 5) { if (this.Experience >= xp[i].Fluctuating && this.Experience < xp[i + 1].Fluctuating) { return((byte)(i + 1)); } } } return(0); }