Exemplo n.º 1
0
        public static void FillPokemonList()
        {
            DataRowCollection pokemonDataRows = StaticSQL.GetPokemons().Rows;

            foreach (DataRow pokemonRow in pokemonDataRows)
            {
                var      values  = pokemonRow.ItemArray;
                IPokemon pokemon = PokemonFactory.CreatePokemon();

                pokemon.ID   = (int)values[0];
                pokemon.Name = (string)values[1];

                pokemon.Stats.Health         = (int)values[2];
                pokemon.Stats.Attack         = (int)values[3];
                pokemon.Stats.Defence        = (int)values[4];
                pokemon.Stats.SpecialAttack  = (int)values[5];
                pokemon.Stats.SpecialDefence = (int)values[6];
                pokemon.Stats.Speed          = (int)values[7];

                pokemon.PrimaryTypeID   = (int)values[8];
                pokemon.SecondaryTypeID = values[9] != DBNull.Value ? (int?)values[9] : null;
                pokemon.MinimalLevel    = (int)values[10];

                Pokemons.Add(pokemon.ID, pokemon);
            }
            AddAttacksToPokemons();
        }
Exemplo n.º 2
0
        public static void FillItemsList()
        {
            DataRowCollection itemDataRows = StaticSQL.GetItemList().Rows;

            foreach (DataRow itemRow in itemDataRows)
            {
                var            values = itemRow.ItemArray;
                IEquipmentItem item   = EquipmentItemFactory.CreateItem(values);
                Items.Add(item.ID, item);
            }
        }
Exemplo n.º 3
0
 private static void AddAttacksToPokemons()
 {
     foreach (IPokemon pokemon in Pokemons.Values)
     {
         var attacks = StaticSQL.GetPokemonAttacks(pokemon.ID);
         foreach (var attack in attacks)
         {
             attack.AdditionalEffects = AdditionalEffectsList.GetAdditionalEffects(attack.ID);
             pokemon.Attacks.Add(attack);
         }
     }
 }
Exemplo n.º 4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            StaticSQL.SetConnectionString("Server=DESKTOP-6CLE20J\\SQLEXPRESS;Database=Pokemon;Trusted_Connection=true;");

            AdditionalEffects.AdditionalEffectsList.FillAdditionalEffectsList();
            PokemonList.FillPokemonList();
            ItemsList.FillItemsList();



            Application.Run(new StartForm());
        }
Exemplo n.º 5
0
        public static void FillAttackList()
        {
            DataRowCollection attackDataRows = StaticSQL.GetAttacks().Rows;

            foreach (DataRow attackRow in attackDataRows)
            {
                var     values = attackRow.ItemArray;
                IAttack attack = PokemonAttacksFactory.CreateAttack();

                attack.ID                = (int)values[0];
                attack.Name              = (string)values[1];
                attack.Power             = values[2] != DBNull.Value ? (int?)values[2] : null;
                attack.Accuracy          = (int)values[3];
                attack.BoostStats        = values[4] != DBNull.Value ? (string)values[4] : "";
                attack.ElementalType     = values[5] != DBNull.Value ? (ElementalType)values[5] : 0;
                attack.IsSpecial         = (bool)values[6];
                attack.AdditionalEffects = AdditionalEffectFactory.GetAdditionalEffects(values[7] != DBNull.Value ? (string)values[7] : "");

                Attacks.Add(attack.ID, attack);
            }
        }