Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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
                });
            }
        }
Ejemplo n.º 3
0
        public void Dispose()
        {
            if (MyTeam != null)
            {
                MyTeam.Clear();
            }

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

            if (OtherDefenders != null)
            {
                OtherDefenders.Clear();
            }
        }
Ejemplo n.º 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));
            }
        }