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); } }
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 }); } }
public void Dispose() { if (MyTeam != null) { MyTeam.Clear(); } if (MyPokemons != null) { MyPokemons.Clear(); } if (OtherDefenders != null) { OtherDefenders.Clear(); } }
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)); } }