Esempio n. 1
0
        private static int GetGrowthRateID(ushort species)
        {
            int growthrateid;

            int.TryParse(GetPokemonDataTable.Select(string.Format("{0} = {1}", PokemonDataTableColumns.species_id,
                                                                  species))[0].ItemArray[(int)PokemonDataTableColumns.growth_rate_id].ToString(), out growthrateid);
            return(growthrateid);
        }
Esempio n. 2
0
        internal static ushort[] CalcStats(
            ushort species, byte formid, byte nature, int level,
            uint HP_IV, uint ATK_IV, uint DEF_IV, uint SPE_IV, uint SPA_IV, uint SPD_IV,
            byte HP_EV, byte ATK_EV, byte DEF_EV, byte SPE_EV, byte SPA_EV, byte SPD_EV
            )
        {
            var     stats   = new ushort[6];
            var     results = GetPokemonDataTable.Select(string.Format("species_id = {0} and form_id = {1}", species, formid));
            DataRow PokemonDataRow;

            if (results.Length > 0)
            {
                PokemonDataRow = results[0];
            }
            else
            {
                return(stats);
            }

            int HP_B, ATK_B, DEF_B, SPA_B, SPD_B, SPE_B;

            int.TryParse(PokemonDataRow["hp"].ToString(), out HP_B);
            int.TryParse(PokemonDataRow["attack"].ToString(), out ATK_B);
            int.TryParse(PokemonDataRow["defense"].ToString(), out DEF_B);
            int.TryParse(PokemonDataRow["sp_attack"].ToString(), out SPA_B);
            int.TryParse(PokemonDataRow["sp_defense"].ToString(), out SPD_B);
            int.TryParse(PokemonDataRow["speed"].ToString(), out SPE_B);

            stats[0] = (HP_B == 1) ? (ushort)1 : (ushort)((((HP_IV + (2 * HP_B) + (HP_EV / 4) + 100) * level) / 100) + 10);
            stats[1] = (ushort)((((ATK_IV + (2 * ATK_B) + (ATK_EV / 4)) * level) / 100) + 5);
            stats[2] = (ushort)((((DEF_IV + (2 * DEF_B) + (DEF_EV / 4)) * level) / 100) + 5);
            stats[3] = (ushort)((((SPE_IV + (2 * SPE_B) + (SPE_EV / 4)) * level) / 100) + 5);
            stats[4] = (ushort)((((SPA_IV + (2 * SPA_B) + (SPA_EV / 4)) * level) / 100) + 5);
            stats[5] = (ushort)((((SPD_IV + (2 * SPD_B) + (SPD_EV / 4)) * level) / 100) + 5);

            var incr = nature / 5 + 1;
            var decr = nature % 5 + 1;

            if (incr == decr)
            {
                return(stats);              // if neutral return stats without mod
            }
            stats[incr] *= 11; stats[incr] /= 10;
            stats[decr] *= 9; stats[decr] /= 10;

            return(stats);
        }
Esempio n. 3
0
        public static Types GetPokemonType(ushort Species, byte FormID, TypeSlots TypeSlot)
        {
            if (Species == (ushort)PKMDS_CS.Species.Unown)
            {
                return(Types.Psychic);
            }
            if (Species == (ushort)PKMDS_CS.Species.Arceus)
            {
                switch (FormID)
                {
                case 0:
                    return(Types.Normal);

                case 1:
                    return(Types.Fighting);

                case 2:
                    return(Types.Flying);

                case 3:
                    return(Types.Poison);

                case 4:
                    return(Types.Ground);

                case 5:
                    return(Types.Rock);

                case 6:
                    return(Types.Bug);

                case 7:
                    return(Types.Ghost);

                case 8:
                    return(Types.Steel);

                case 9:
                    return(Types.Fire);

                case 10:
                    return(Types.Water);

                case 11:
                    return(Types.Grass);

                case 12:
                    return(Types.Electric);

                case 13:
                    return(Types.Psychic);

                case 14:
                    return(Types.Ice);

                case 15:
                    return(Types.Dragon);

                case 16:
                    return(Types.Dark);

                case 17:
                    return(Types.Fairy);
                }
            }
            int typeint;

            try
            {
                var slot = PokemonDataTableColumns.type_1_id;
                if (TypeSlot == TypeSlots.Slot2)
                {
                    slot = PokemonDataTableColumns.type_2_id;
                }
                if (Species == (ushort)PKMDS_CS.Species.Tornadus || Species == (ushort)PKMDS_CS.Species.Thundurus || Species == (ushort)PKMDS_CS.Species.Landorus)
                {
                    if (FormID != 0)
                    {
                        FormID--;
                    }
                }
                var row = GetPokemonDataTable.Select(string.Format("{0} = {1} and {2} = {3}", PokemonDataTableColumns.species_id,
                                                                   Species, PokemonDataTableColumns.form_id, FormID));
                if (!(int.TryParse(row[0].ItemArray[(int)slot].ToString(), out typeint)))
                {
                }
            }
            catch (Exception)
            {
                return(GetPokemonType(Species, 0, TypeSlot));
            }
            return((Types)typeint);
        }