Esempio n. 1
0
 public void Delete(Pokemons pokemon)
 {
     using (var conn = NewConnection)
     {
         conn.Delete(pokemon);
     }
 }
Esempio n. 2
0
        public bool UseItemInBattle(Consumable consumable, Pokemon targetPokemon)
        {
            var useditem = Inventory.First(i => consumable.Id == i.Item.Id);

            useditem.ItemUsed();
            if (consumable.GetType() == typeof(Pokeball))
            {
                return(consumable.Use(targetPokemon));
            }

            var selectedPokemon = Pokemons.First(p => targetPokemon.Id == p.Id);

            if (consumable.GetType() == typeof(Revive))
            {
                var revive = (Revive)consumable;
                selectedPokemon.Revive(revive.Percentage);
                return(true);
            }

            if (consumable.GetType() == typeof(Potion))
            {
                var potion = (Potion)consumable;
                selectedPokemon.HealByPotion(potion);
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
 public void Save(Pokemons pokemon)
 {
     using (var conn = NewConnection)
     {
         conn.Insert(pokemon);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Number of Pokémon owned
        /// </summary>
        /// <param name="region"></param>
        /// <returns></returns>
        public int pokedexOwned(Regions?region = null)
        {
            int ret = 0;

            if (region == null)
            {
                //for (int i = 0; i < Game.PokemonData.Count; i++) {
                //  if (@owned[i]) ret+=1;
                //}
                return(owned.Count);
            }
            else
            {
                //int[] regionlist=Game.pbAllRegionalSpecies(region);
                Pokemons[] regionlist = new Pokemons[0];
                foreach (Pokemons i in regionlist)
                {
                    if (@owned[i])
                    {
                        ret += 1;
                    }
                }
            }
            return(ret);
        }
Esempio n. 5
0
 /*POKERADAREXCLUSIVES=[
  *      [5,  20, :STARLY,     12, 15],
  *      [21, 10, :STANTLER,   14],
  *      [28, 20, :BUTTERFREE, 15, 18],
  *      [28, 20, :BEEDRILL,   15, 18]
  * ]*/
 /// <summary>
 /// A set of arrays each containing details of a wild encounter that can only
 /// occur via using the Poké Radar.
 /// </summary>
 /// <param name="map">Map ID on which this encounter can occur.</param>
 /// <param name="pkmn">Species.</param>
 /// <param name="chance">Probability that this encounter will occur (as a percentage).</param>
 /// <param name="min">Minimum possible level.</param>
 /// <param name="max">Maximum possible level (optional).</param>
 public PokeRadars(int map, Pokemons pkmn, int chance, byte min, byte max)
 {
     MapId           = map;
     Species         = pkmn;
     EncounterChance = chance;
     LevelMinMax     = new int[] { min, max };
 }
Esempio n. 6
0
    public override string ToString()
    {
        var result = new StringBuilder();

        result.AppendLine(Name);

        result.AppendLine("Company:");
        if (TheCompany != null)
        {
            result.AppendLine(TheCompany.ToString());
        }

        result.AppendLine("Car:");
        if (TheCar != null)
        {
            result.AppendLine(TheCar.ToString());
        }

        result.AppendLine("Pokemon:");
        Pokemons.ForEach(p => result.AppendLine(p.ToString()));

        result.AppendLine("Parents:");
        Parents.ForEach(p => result.AppendLine(p.ToString()));

        result.AppendLine("Children:");
        Children.ForEach(c => result.AppendLine(c.ToString()));

        return(result.ToString());
    }
Esempio n. 7
0
        internal void OnEvolved(PokemonEvolveEvent ev)
        {
            var exist = Get(ev.OriginalId);

            if (ev.Cancelled && exist != null)
            {
                exist.IsEvolving = false;
            }
            if (ev.Result == POGOProtos.Networking.Responses.EvolvePokemonResponse.Types.Result.Success)
            {
                Candy candy = Session.Inventory.GetCandyFamily(ev.EvolvedPokemon.PokemonId).Result;
                if (candy != null)
                {
                    var familyId = candy.FamilyId;
                    foreach (var item in Pokemons.Where(p => p.FamilyId == familyId))
                    {
                        item.RaisePropertyChanged("Candy");
                    }
                }
            }
            else
            {
                exist.IsEvolving = false;
            }
        }
Esempio n. 8
0
        internal void Update(IEnumerable <PokemonData> pokemons)
        {
            foreach (var item in pokemons)
            {
                var existing = Pokemons.FirstOrDefault(x => x.Id == item.Id);

                if (existing != null)
                {
                    existing.UpdateWith(item);
                }
                else
                {
                    Pokemons.Add(new PokemonDataViewModel(this.Session, item));
                }
            }

            // Remove missing pokemon
            List <PokemonDataViewModel> modelsToRemove = new List <PokemonDataViewModel>();

            foreach (var item in Pokemons)
            {
                var existing = pokemons.FirstOrDefault(x => x.Id == item.Id);
                if (existing == null)
                {
                    modelsToRemove.Add(item);
                }
            }

            foreach (var model in modelsToRemove)
            {
                Pokemons.Remove(model);
            }
        }
Esempio n. 9
0
 public bool hasSeen(Pokemons species)
 {
     //if (Pokemons.is_a(String) || Pokemons.is_a(Symbol)) {
     //  species=getID(PBSpecies,species);
     //}
     return(species > 0 ? @seen[species] : false);
 }
Esempio n. 10
0
 public void Update(Pokemons pokemon)
 {
     using (var conn = NewConnection)
     {
         conn.Update(pokemon);
     }
 }
Esempio n. 11
0
        public IPokemon GetFirstAlivePokemon()
        {
            IPokemon pokemon = Pokemons.First(p => p.HPCurrent > 0);

            ActivePokemon = pokemon;
            return(pokemon);
        }
Esempio n. 12
0
        public async Task Carregar()
        {
            try
            {
                using (var Dialog = UserDialogs.Instance.Loading("Carregando Pokemons", null, null, true, MaskType.Black))
                {
                    var existingList = Barrel.Current.Get <List <Pokemon> >(_key) ?? new List <Pokemon>();
                    Pokemons.Clear();


                    if (existingList.Count == 0 && !IsNotConnected)
                    {
                        await GravarPokemons();
                    }
                    else
                    {
                        foreach (var pokemon in existingList)
                        {
                            Pokemons.Add(pokemon);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Esempio n. 13
0
    public void UpdateData(string[] data)
    {
        switch (data[1])
        {
        case "company":
            Company = new Company(data[2], data[3], decimal.Parse(data[4]));
            break;

        case "pokemon":
            Pokemon pokemon = new Pokemon(data[2], data[3]);
            Pokemons.Add(pokemon);
            break;

        case "parents":
            Parent parent = new Parent(data[2], data[3]);
            Parents.Add(parent);
            break;

        case "children":
            Children children = new Children(data[2], data[3]);
            Childrens.Add(children);
            break;

        case "car":
            Car = new Car(data[2], int.Parse(data[3]));
            break;
        }
    }
Esempio n. 14
0
 public EvolutionTrigger(Pokemons species      = Pokemons.NONE, EvoTrigger evo = EvoTrigger.level_up, Items trigger = Items.NONE, int?minLevel = null, bool?gender = null, int?location = null,
                         Items held            = Items.NONE, int?time = null, Moves knownMove  = Moves.NONE, Types knownType = Types.NONE, int?happiness      = null,
                         int?beauty            = null, int?affection  = null, int?physicalStat = null, Pokemons partySpecies = Pokemons.NONE, Types partyType = Types.NONE,
                         Pokemons tradeSpecies = Pokemons.NONE, bool overworldRain = false, bool turnUpsideDown = true)
 {
     Species        = species;
     Evo            = evo;
     Trigger        = trigger;
     MinLevel       = minLevel;
     Gender         = gender;
     Location       = location;
     Held           = held;
     Time           = time;
     KnownMove      = knownMove;
     KnownType      = knownType;
     Happiness      = happiness;
     Beauty         = beauty;
     Affection      = affection;
     PhysicalStat   = physicalStat;
     PartySpecies   = partySpecies;
     PartyType      = partyType;
     TradeSpecies   = tradeSpecies;
     OverworldRain  = overworldRain;
     TurnUpsideDown = turnUpsideDown;
 }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;
            try
            {
                Pokemons.Clear();
                var pokemons = await DataStore.GetPokemonsAsync();

                foreach (var pokemon in pokemons)
                {
                    Pokemons.Add(pokemon);
                }
                Search();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 16
0
        private void LireTablePokemons()
        {
            commande.CommandText = "SELECT * FROM [pokemon]";
            OleDbDataReader reader = commande.ExecuteReader();

            while (reader.Read())
            {
                List <string> Tempo = new List <string>();

                Tempo.Add(reader.GetInt32(0).ToString());
                Tempo.Add(reader.GetString(1));
                Tempo.Add(reader.GetInt16(2).ToString());
                Tempo.Add(reader.GetInt16(3).ToString());
                Tempo.Add(reader.GetInt16(4).ToString());
                Tempo.Add(reader.GetInt16(5).ToString());
                Tempo.Add(reader.GetInt16(6).ToString());
                Tempo.Add(reader.GetInt16(7).ToString());
                Tempo.Add(reader.GetString(8));
                Tempo.Add(reader.GetString(9));
                Tempo.Add(reader.GetInt32(10).ToString());

                Pokemons.Add(Tempo);
            }
            reader.Close();
        }
Esempio n. 17
0
        private async Task CarregarPaginaHttpExtension()
        {
            try
            {
                Ocupado = true;

                _ApiService = new HttpExtensionService();

                var pokemons = await _ApiService.GetPokemonsAsync();

                Pokemons.Clear();

                foreach (var pokemon in pokemons)
                {
                    pokemon.Image = GetImageStreamFromUrl(pokemon.Sprites.FrontDefault.AbsoluteUri);
                    Pokemons.Add(pokemon);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                _ApiService = null;
                Ocupado     = false;
            }
        }
Esempio n. 18
0
 public bool hasOwned(Pokemons species)
 {
     //if (species.is_a(String) || species.is_a(Symbol)) {
     //  species=getID(PBSpecies,species);
     //}
     return(species > 0 ? @owned[species] : false);
 }
Esempio n. 19
0
        public void SetPokemonsAndStades(List <Pokemon> allPokemons, List <Stade> allStades)
        {
            int i = 0;

            while (i < 32)
            {
                Pokemon poke = allPokemons[rng.Next(0, allPokemons.Count)];
                if (!Pokemons.Contains(poke))
                {
                    Pokemons.Add(poke);
                    i++;
                }
            }

            int nbStades = rng.Next(6, 13);

            i = 0;

            while (i < nbStades)
            {
                Stade stade = allStades[rng.Next(0, allStades.Count)];
                if (!Stades.Contains(stade))
                {
                    Stades.Add(stade);
                    i++;
                }
            }
        }
        async Task GetPokemons()
        {
            if (!IsBusy)
            {
                Exception Error = null;
                try
                {
                    IsBusy = true;

                    var repository = new Repository();
                    var items      = await repository.GetPokemons();

                    Pokemons.Clear();
                    foreach (var pokemon in items)
                    {
                        Pokemons.Add(pokemon);
                    }
                }
                catch (Exception ex)
                {
                    Error = ex;
                }
                finally
                {
                    IsBusy = false;
                }

                if (Error != null)
                {
                    await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Error", Error.Message, "OK");
                }
            }
            return;
        }
        public MainPage()
        {
            InitializeComponent();

            Pokemons.Add(new Data.Pokemon { Name = "Daniel" });

            BindingContext = this;
        }
    public Trainer(string name, string pokemonName, string pokemonElement, int pokemonHealth)
    {
        this.name     = name;
        this.Pokemons = new List <Pokemon>();
        Pokemon pokemon = new Pokemon(pokemonName, pokemonElement, pokemonHealth);

        Pokemons.Add(pokemon);
    }
Esempio n. 23
0
 internal void OnTransfer(TransferPokemonEvent e)
 {
     Remove(e.Id);
     foreach (var item in Pokemons.Where(p => p.FamilyId == e.FamilyId))
     {
         item.RaisePropertyChanged("Candy");
     }
 }
Esempio n. 24
0
        internal void Remove(ulong id)
        {
            var pkm = Pokemons.FirstOrDefault(x => x.Id == id);

            if (pkm != null)
            {
                Pokemons.Remove(pkm);
            }
        }
Esempio n. 25
0
    public Trainer(string trainer, string pokName, string pokElement, int pokHealt, int numberOFBadges = 0)
    {
        this.Name     = trainer;
        this.Pokemons = new List <Pokemon>();
        Pokemon p = new Pokemon(pokName, pokElement, pokHealt);

        Pokemons.Add(p);
        this.NumberOfBadges = numberOFBadges;
    }
Esempio n. 26
0
        ObservableCollection <Pokemon> GetSelectedPokemons()
        {
            var selected = Pokemons
                           .Where(p => p.IsSelected)
                           .Select(p => p.Item)
                           .ToList();

            return(new ObservableCollection <Pokemon>(selected));
        }
Esempio n. 27
0
        public void Powerup(ulong pokemonId)
        {
            var pkm = Pokemons.FirstOrDefault(x => x.Id == pokemonId);

            if (pkm != null)
            {
                pkm.IsUpgrading = true;
            }
        }
Esempio n. 28
0
        public List <Pokemon> SearchName(string needle)
        {
            //TODO: This is case-sensitive, this might not be what is needed.
            return(Pokemons.FindAll(s => s.Name.Contains(needle)));
            //return Pokemons.FindAll(s => s.Name.ToLower().Contains(needle.ToLower()));

            //This could be improved using both prefix and suffix search
            //We have already discussed this :-)
        }
Esempio n. 29
0
        internal void Evolve(ulong pokemonId)
        {
            var pkm = Pokemons.FirstOrDefault(x => x.Id == pokemonId);

            if (pkm != null)
            {
                pkm.IsEvolving = true;
            }
        }
Esempio n. 30
0
        public void Transfer(ulong pokemonId)
        {
            var pkm = Pokemons.FirstOrDefault(x => x.Id == pokemonId && Session.Inventory.CanTransferPokemon(x.PokemonData));

            if (pkm != null)
            {
                pkm.IsTransfering = true;
            }
        }
Esempio n. 31
0
 // Initialisation
 void Awake()
 {
     // If no instance, initialize one
     if (main == null) {
         DontDestroyOnLoad(gameObject);
         main = this;
         this.destinatedSpawn = "DEFAULT";
         this.collectedItems = ";";
         this.defeatedTrainers = ";";
         this.inventory = gameObject.AddComponent<Inventory> ();
         this.pokemons = gameObject.AddComponent<Pokemons> ();
         this.battle_opponent = new Pokemon ();
         this.battle_friendly = new Pokemon ();
     } else if (main != this) {
         Destroy(gameObject);
     }
 }
Esempio n. 32
0
 /* Constructor of Pokemon class
  * Parameters:
  *  type - type of pokemon
  */
 public Pokemon(Pokemons pokeName)
 {
     PokeName = pokeName;
 }