コード例 #1
0
 public void UsePotion()
 {
     if (this.Potions > 0)
     {
         int index = 1;
         int choice;
         Console.WriteLine("Use potion to: ");
         foreach (var item in this.Pokemons)
         {
             Console.WriteLine($"{index}. {item.name.english}");
         }
         choice = Convert.ToInt32(Console.ReadLine());
         if (this.Pokemons[choice - 1].HP + 25 < PokemonFactory.CreateSpecificPokemon(this.Pokemons[choice - 1].name.english).HP)
         {
             this.Pokemons[choice - 1].HP += 25;
         }
         else
         {
             this.Pokemons[choice - 1].HP = PokemonFactory.CreateSpecificPokemon(this.Pokemons[choice - 1].name.english).HP;
         }
         this.Potions--;
     }
     else
     {
         Console.WriteLine("You have not any potion!\n");
     }
 }
コード例 #2
0
        public static void Rehabilitation(Trainer trainer)
        {
            List <Pokemon> trainerPokemons = new List <Pokemon>();

            trainerPokemons = trainer.Pokemons;
            int index = 1;

            Console.WriteLine("Your pokemons are healed!");
            foreach (var item in trainerPokemons)
            {
                item.HP = PokemonFactory.CreateSpecificPokemon(item.name.english).HP;
                Console.WriteLine($"{index}. {item.name.english} - {item.HP} HP");
                index++;
            }

            Menu.MainActions(trainer);
        }