Example #1
0
        public async Task LoadMyPokemons(ISession session)
        {
            MyPokemons.Clear();
            var pokemons = await session.Inventory.GetPokemons().ConfigureAwait(false);

            foreach (var pokemon in pokemons.Where(w => w.Cp >= session.LogicSettings.GymConfig.MinCpToUseInAttack))
            {
                MyPokemonStat mps = new MyPokemonStat(session, pokemon);
                MyPokemons.Add(mps);
            }
        }
Example #2
0
        public void AddToTeam(ISession session, PokemonData pokemon)
        {
            if (!MyPokemons.Any(a => a.Data.Id == pokemon.Id))
            {
                MyPokemons.Add(new MyPokemonStat(session, pokemon));
            }

            if (!MyTeam.Any(a => a.Attacker.Id == pokemon.Id))
            {
                MyTeam.Add(new GymPokemon()
                {
                    Attacker = pokemon, HpState = pokemon.StaminaMax
                });
            }
        }
Example #3
0
        public void Dispose()
        {
            if (MyTeam != null)
            {
                MyTeam.Clear();
            }

            if (MyPokemons != null)
            {
                MyPokemons.Clear();
            }

            if (OtherDefenders != null)
            {
                OtherDefenders.Clear();
            }
        }
Example #4
0
        public void AddPokemon(ISession session, PokemonData pokemon, bool isMine = true)
        {
            if (isMine && MyPokemons.Any(a => a.Data.Id == pokemon.Id))
            {
                return;
            }

            if (!isMine && OtherDefenders.Any(a => a.Data.Id == pokemon.Id))
            {
                return;
            }

            if (isMine)
            {
                MyPokemons.Add(new MyPokemonStat(session, pokemon));
            }
            else
            {
                OtherDefenders.Add(new AnyPokemonStat(session, pokemon));
            }
        }