Beispiel #1
0
        /// <summary>
        /// Adds a Pokémon to team.
        /// </summary>
        /// <param name="pokémon">The <see cref="Pokémon"/> to add.</param>
        /// <returns>true if the Pokémon has been added.
        /// false if the Pokémon is already present in the team.</returns>
        /// <exception cref="TeamIsFullException">Throw when team contains the amount of Pokémon defined in <see cref="MAX_POKÉMON"/>.</exception>
        public bool AddPokémon(Pokémon pokémon)
        {
            if (MyPokémon.Count >= MAX_POKÉMON)
            {
                throw new TeamIsFullException($"A team cannot contain more than {MAX_POKÉMON} Pokémon.");
            }

            return(MyPokémon.Add(pokémon));
        }
Beispiel #2
0
 /// <summary>
 /// Removes Pokémon from team.
 /// </summary>
 /// <param name="pokémon">The <see cref="Pokémon"/> to remove.</param>
 /// <returns>true if the Pokémon is successfully found and removed; otherwise, false (e.g.: if the Pokémon is not present in this team).</returns>
 public bool RemovePokémon(Pokémon pokémon)
 {
     return(MyPokémon.Remove(pokémon));
 }