Exemple #1
0
        public PokemonData(DataRow row)
        {
            this.id           = (ushort)(long)row["ID"];
            this.dexID        = (ushort)(long)row["DexID"];
            this.name         = row["Name"] as string;
            this.pokedexEntry = row["PokedexEntry"] as string ?? "";

            this.type1 = GetPokemonTypeFromString(row["Type1"] as string);
            this.type2 = (row["Type2"] as string == null ? this.type1 : GetPokemonTypeFromString(row["Type2"] as string));

            this.ability1ID = PokemonDatabase.GetAbilityIDFromString(row["Ability1"] as string);
            this.ability2ID = (row["Ability2"] as string == null ? (byte)0 : PokemonDatabase.GetAbilityIDFromString(row["Ability2"] as string));
            //this.ability2ID		= (row["Ability2"] as string == null ? this.ability1ID : PokemonDatabase.GetAbilityIDFromString(row["Ability2"] as string));

            this.eggGroup1 = GetEggGroupFromString(row["EggGroup1"] as string);
            this.eggGroup2 = GetEggGroupFromString(row["EggGroup2"] as string);

            this.experienceGroup = GetExperienceGroupFromString(row["ExperienceGroup"] as string);

            this.hp          = (byte)(long)row["HP"];
            this.attack      = (byte)(long)row["Attack"];
            this.defense     = (byte)(long)row["Defense"];
            this.spAttack    = (byte)(long)row["SpAttack"];
            this.spDefense   = (byte)(long)row["SpDefense"];
            this.speed       = (byte)(long)row["Speed"];
            this.genderRatio = (byte)(long)row["GenderRatio"];

            this.forms      = null;
            this.evolutions = null;

            this.learnableMoves = new List <LearnableMove>();

            this.familyDexID = this.dexID;
        }
Exemple #2
0
        public Species(Pokedex pokedex, int national_dex, int family_id, LocalizedString name,
                       GrowthRates growth_rate, byte gender_ratio, EggGroups egg_group_1,
                       EggGroups egg_group_2, int egg_steps, bool gender_variations)
        {
            m_pokedex        = pokedex;
            NationalDex      = national_dex;
            FamilyID         = family_id;
            Name             = name;
            GrowthRate       = growth_rate;
            GenderRatio      = gender_ratio;
            EggGroup1        = egg_group_1;
            EggGroup2        = egg_group_2;
            EggSteps         = egg_steps;
            GenderVariations = gender_variations;

            //if (pokedex != null && pokedex.Eager)
            {
                // Retrieve foreign information like Family and Formes.
                // Otherwise, this information will be lazily evaluated
                // from the Pokedex instance.
                // If pokedex is null, this information is unavailable.

                // todo: database ownership/lazy stuff can go in a base class.
            }
        }
Exemple #3
0
        public static bool pbIsDitto(Pokemon pokemon)
        {
            //dexdata=pbOpenDexData();
            //pbDexDataOffset(dexdata,pokemon.Species,31);
            EggGroups compat10 = Game.PokemonData[pokemon.Species].EggGroup[0]; //dexdata.fgetb();
            EggGroups compat11 = Game.PokemonData[pokemon.Species].EggGroup[1]; //dexdata.fgetb();

            //dexdata.close();
            return(compat10 == EggGroups.DITTO ||
                   compat11 == EggGroups.DITTO);
        }
Exemple #4
0
 public static int pbDayCareGetCompat()
 {
     if (pbDayCareDeposited() == 2)
     {
         Pokemon pokemon1 = Game.GameData.Global.daycare[0]; //[0];
         Pokemon pokemon2 = Game.GameData.Global.daycare[1]; //[0];
         if ((pokemon1.isShadow))
         {
             return(0);         //? rescue false
         }
         if ((pokemon2.isShadow))
         {
             return(0);         //? rescue false
         }
         //dexdata=pbOpenDexData();
         //pbDexDataOffset(dexdata,pokemon1.Species,31);
         EggGroups compat10 = Game.PokemonData[pokemon1.Species].EggGroup[0]; //dexdata.fgetb();
         EggGroups compat11 = Game.PokemonData[pokemon1.Species].EggGroup[1]; //dexdata.fgetb();
         //pbDexDataOffset(dexdata,pokemon2.Species,31);
         EggGroups compat20 = Game.PokemonData[pokemon1.Species].EggGroup[0]; //dexdata.fgetb();
         EggGroups compat21 = Game.PokemonData[pokemon1.Species].EggGroup[1]; //dexdata.fgetb();
         //dexdata.close();
         if (compat10 != EggGroups.UNDISCOVERED &&
             compat11 != EggGroups.UNDISCOVERED &&
             compat20 != EggGroups.UNDISCOVERED &&
             compat21 != EggGroups.UNDISCOVERED)
         {
             if (compat10 == compat20 || compat11 == compat20 ||
                 compat10 == compat21 || compat11 == compat21 ||
                 compat10 == EggGroups.DITTO ||
                 compat11 == EggGroups.DITTO ||
                 compat20 == EggGroups.DITTO ||
                 compat21 == EggGroups.DITTO)
             {
                 if (pbDayCareCompatibleGender(pokemon1, pokemon2))
                 {
                     int ret = 1;
                     if (pokemon1.Species == pokemon2.Species)
                     {
                         ret += 1;
                     }
                     if (pokemon1.TrainerId != pokemon2.TrainerId)
                     {
                         ret += 1;
                     }
                     return(ret);
                 }
             }
         }
     }
     return(0);
 }
Exemple #5
0
        public BaseStats(ushort i, string n, byte h, byte atk, byte def, byte satk, byte sdef, byte spd, Types t, byte ctch, byte exp, ushort ev, GenderRatio gender, GrowthRate growth, EggGroups eg, Ability[] ab, LearnableMove[] ls, PokedexEntry pe, IEvolution[] evo = null)
        {
            id   = i;
            name = n;

            baseHP             = h;
            baseAttack         = atk;
            baseDefense        = def;
            baseSpeed          = sdef;
            baseSpecialAttack  = satk;
            baseSpecialDefense = spd;
            types       = t;
            catchRate   = ctch;
            expYield    = exp;
            evYield     = ev;
            genderRatio = gender;

            /* 0	Arceus, Buneary, Darkrai, Deoxys, Deoxys (Attack), Deoxys (Defense), Deoxys (Speed), Dialga, Genosekuto, Giratina (Altered), Giratina (Origin), Groudon, Ho-oh, Kyogre, Kyuremu, Lugia, Mewtwo, Palkia, Rayquaza, Regigigas, Reshiram, Zekrom
             * 35	Absol, Aggron, Aron, Articuno, Axew, Bagon, Banette, Baruchai, Barujiina, Beldum, Birijion, Cacnea, Cacturne, Carvanha, Chatot, Dragonair, Dragonite, Dratini, Dusclops, Dusknoir, Duskull, Entei, Fraxure, Gallade, Gardevoir, Glaceon, Haxorus, Honchkrow, Houndoom, Houndour, Jiheddo, Kerudio, Kirikizan, Kirlia, Kobaruon, Komatana, Lairon, Larvitar, Leafeon, Metagross, Metang, Misdreavus, Mismagius, Moltres, Monozu, Murkrow, Pupitar, Raikou, Ralts, Regice, Regirock, Registeel, Sableye, Salamence, Sazandora, Sharpedo, Shelgon, Shuppet, Sneasel, Suicune, Terakion, Tyranitar, Umbreon, Weavile, Zapdos, Zuruggu
             * 70	All other Pokemon
             * 90	Borutorosu, Latias, Latios, Randorosu, Torunerosu
             * 100	Ambipom, Celebi, Cresselia, Croagunk, Heatran, Jirachi, Luxio, Meroetta, Meroetta, Mew, Pachirisu, Shaymin, Shaymin (Sky), Victini
             * 140	Azelf, Blissey, Chansey, Clefable, Clefairy, Cleffa, Happiny, Lopunny, Mesprit, Uxie
             */
            if (i == 150)
            {
                baseHappiness = 0;
            }
            else if (i >= 144 && i <= 149)
            {
                baseHappiness = 35;
            }
            else if (i == 151)
            {
                baseHappiness = 100;
            }
            else
            {
                baseHappiness = 70;
            }
            growthRate = growth;
            eggGroups  = eg;
            abilities  = ab;
            learnset   = ls;
            entry      = pe;
            evolutions = evo;
        }
Exemple #6
0
        public MonsterStaticData(short id)
        {
            var pokemon        = DataFetcher.GetApiObject <Pokemon>(id).Result;
            var pokemonSpecies = DataFetcher.GetApiObject <PokemonSpecies>(id).Result;


            ID   = id;
            Name = pokemonSpecies.Names.Single(GetLocalizedName).Name;

            Types     = new Types(pokemon.Types.Select(type => Cached <MonsterTypeStaticData> .Get((byte)type.Type.ID)).ToArray <ITypeStaticData>());
            Abilities = new Abilities(pokemon.Abilities.Select(ability => new Ability((short)ability.Ability.ID, ability.IsHidden)).ToArray <BaseAbility>());
            EggGroups = new EggGroups(pokemonSpecies.EggGroups.Select(eggGroup => Cached <EggGroupStaticData> .Get((byte)eggGroup.ID)).ToArray <IEggGroupStaticData>());
            HeldItems = pokemon.HeldItems.Select(heldItem => Cached <ItemStaticData> .Get(heldItem.Item.ID)).ToList <IItemStaticData>();

            Height = pokemon.Height;
            Weight = pokemon.Mass;

            BaseStats = new Stats(
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.HP).BaseValue,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.Attack).BaseValue,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.Defense).BaseValue,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.SpecialAttack).BaseValue,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.SpecialDefense).BaseValue,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.Speed).BaseValue);
            BaseHappiness = (byte)pokemonSpecies.BaseHappiness;

            CatchRate = (byte)pokemonSpecies.CaptureRate;

            MaleRatio = 1.0f - pokemonSpecies.FemaleToMaleRate ?? -1.0f;

            HatchCycles = (byte)pokemonSpecies.HatchCounter;

            IsBaby = pokemonSpecies.IsBaby;

            HasGenderDifferences = pokemonSpecies.HasGenderDifferences;

            ExperienceType = (ExperienceType)pokemonSpecies.GrowthRate.ID;

            RewardExperience = (short)pokemon.BaseExperience;
            RewardStats      = new Stats(
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.HP).Effort,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.Attack).Effort,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.Defense).Effort,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.SpecialAttack).Effort,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.SpecialDefense).Effort,
                (short)pokemon.Stats.Single(stat => stat.Stat.ID == (int)StatType.Speed).Effort);
        }
        public Species(Pokedex pokedex, int national_dex, int family_id, LocalizedString name,
                       GrowthRates growth_rate, byte gender_ratio, EggGroups egg_group_1,
                       EggGroups egg_group_2, int egg_steps, bool gender_variations)
            : base(pokedex)
        {
            m_family_pair = Family.CreatePair(m_pokedex);
            m_lazy_pairs.Add(m_family_pair);

            NationalDex       = national_dex;
            m_family_pair.Key = family_id;
            Name             = name;
            GrowthRate       = growth_rate;
            GenderRatio      = gender_ratio;
            EggGroup1        = egg_group_1;
            EggGroup2        = egg_group_2;
            EggSteps         = egg_steps;
            GenderVariations = gender_variations;
        }
 public static string GetEggGroupName(EggGroups group)
 {
     switch (group) {
     case EggGroups.Water1: return "Water 1";
     case EggGroups.Water2: return "Water 2";
     case EggGroups.Water3: return "Water 3";
     case EggGroups.Humanoid: return "Human-Like";
     case EggGroups.DittoOnly: return "Ditto Only";
     default: return group.ToString();
     }
 }
        public BaseStats(ushort i, string n, byte h, byte atk, byte def, byte satk, byte sdef, byte spd, Types t, byte ctch, byte exp, ushort ev, GenderRatio gender, GrowthRate growth, EggGroups eg, Ability[] ab, LearnableMove[] ls, PokedexEntry pe, IEvolution[] evo = null)
        {
            id = i;
            name = n;

            baseHP = h;
            baseAttack = atk;
            baseDefense = def;
            baseSpeed = sdef;
            baseSpecialAttack = satk;
            baseSpecialDefense = spd;
            types = t;
            catchRate = ctch;
            expYield = exp;
            evYield = ev;
            genderRatio = gender;
            /* 0	Arceus, Buneary, Darkrai, Deoxys, Deoxys (Attack), Deoxys (Defense), Deoxys (Speed), Dialga, Genosekuto, Giratina (Altered), Giratina (Origin), Groudon, Ho-oh, Kyogre, Kyuremu, Lugia, Mewtwo, Palkia, Rayquaza, Regigigas, Reshiram, Zekrom
             * 35	Absol, Aggron, Aron, Articuno, Axew, Bagon, Banette, Baruchai, Barujiina, Beldum, Birijion, Cacnea, Cacturne, Carvanha, Chatot, Dragonair, Dragonite, Dratini, Dusclops, Dusknoir, Duskull, Entei, Fraxure, Gallade, Gardevoir, Glaceon, Haxorus, Honchkrow, Houndoom, Houndour, Jiheddo, Kerudio, Kirikizan, Kirlia, Kobaruon, Komatana, Lairon, Larvitar, Leafeon, Metagross, Metang, Misdreavus, Mismagius, Moltres, Monozu, Murkrow, Pupitar, Raikou, Ralts, Regice, Regirock, Registeel, Sableye, Salamence, Sazandora, Sharpedo, Shelgon, Shuppet, Sneasel, Suicune, Terakion, Tyranitar, Umbreon, Weavile, Zapdos, Zuruggu
             * 70	All other Pokemon
             * 90	Borutorosu, Latias, Latios, Randorosu, Torunerosu
             * 100	Ambipom, Celebi, Cresselia, Croagunk, Heatran, Jirachi, Luxio, Meroetta, Meroetta, Mew, Pachirisu, Shaymin, Shaymin (Sky), Victini
             * 140	Azelf, Blissey, Chansey, Clefable, Clefairy, Cleffa, Happiny, Lopunny, Mesprit, Uxie
             */
            if (i == 150) baseHappiness = 0;
            else if (i >= 144 && i <= 149) baseHappiness = 35;
            else if (i == 151) baseHappiness = 100;
            else baseHappiness = 70;
            growthRate = growth;
            eggGroups = eg;
            abilities = ab;
            learnset = ls;
            entry = pe;
            evolutions = evo;
        }
        public void AltFormsImport()
        {
            string file_path = alt_form_input.GetComponentsInChildren <Text>()[1].text;
            string full_path = Path.Combine(import_path, file_path);

            imported_forms = new List <Form>();

            try
            {
                StreamReader input_stream = new StreamReader(full_path);
                Form         current_form = null;

                while (!input_stream.EndOfStream)
                {
                    string line = input_stream.ReadLine();

                    // Line is a comment
                    if (line[0] == '#')
                    {
                    }
                    // Line is start of a new species, including base species and form id
                    else if (line[0] == '[')
                    {
                        if (current_form != null)
                        {
                            imported_forms.Add(current_form);
                        }

                        current_form = ScriptableObject.CreateInstance <Form>();
                        string[] values = line.TrimStart('[').TrimEnd(']').Split(',');
                        current_form.base_species = (Species)Enum.Parse(typeof(Species), values[0], true);
                        current_form.form_id      = uint.Parse(values[1]);

                        current_form.name = current_form.base_species.ToString() + "_" + values[1];
                    }
                    // Line contains data field
                    else
                    {
                        string[] parts = line.Split('=');
                        string   key   = parts[0].TrimEnd(' ');
                        string   value = parts[1].TrimStart(' ');

                        // Part is form name
                        if (key == "FormName")
                        {
                            current_form.form_name = value;
                        }
                        // Part is type1
                        else if (key == "Type1")
                        {
                            current_form.types    = new Pokemon.Types[2];
                            current_form.types[0] = (Pokemon.Types)Enum.Parse(typeof(Pokemon.Types), value, true);
                        }
                        // Part is type2
                        else if (key == "Type2")
                        {
                            current_form.types[1] = (Pokemon.Types)Enum.Parse(typeof(Pokemon.Types), value, true);
                        }
                        // Part is base stats
                        else if (key == "BaseStats")
                        {
                            string[]  values     = value.Split(',');
                            StatArray base_stats = new StatArray();
                            base_stats.HP     = uint.Parse(values[0]);
                            base_stats.ATK    = uint.Parse(values[1]);
                            base_stats.DEF    = uint.Parse(values[2]);
                            base_stats.SPD    = uint.Parse(values[3]);
                            base_stats.SP_ATK = uint.Parse(values[4]);
                            base_stats.SP_DEF = uint.Parse(values[5]);

                            current_form.base_stats = base_stats;
                        }
                        // Part is base exp
                        else if (key == "BaseEXP")
                        {
                            current_form.base_exp = uint.Parse(value);
                        }
                        // Part is effort values
                        else if (key == "EffortPoints")
                        {
                            string[]  values        = value.Split(',');
                            StatArray effort_values = new StatArray();
                            effort_values.HP     = uint.Parse(values[0]);
                            effort_values.ATK    = uint.Parse(values[1]);
                            effort_values.DEF    = uint.Parse(values[2]);
                            effort_values.SPD    = uint.Parse(values[3]);
                            effort_values.SP_ATK = uint.Parse(values[4]);
                            effort_values.SP_DEF = uint.Parse(values[5]);

                            current_form.effort_values = effort_values;
                        }
                        // Part is rareness
                        else if (key == "Rareness")
                        {
                            current_form.rareness = uint.Parse(value);
                        }
                        // Part is happiness
                        else if (key == "Happiness")
                        {
                            current_form.happiness = uint.Parse(value);
                        }
                        // Part is moves
                        else if (key == "Moves")
                        {
                            string[]      values         = value.Split(',');
                            int           num_moves      = values.Length / 2;
                            LevelUpMove[] level_up_moves = new LevelUpMove[num_moves];
                            for (int i = 0; i < num_moves * 2; i += 2)
                            {
                                LevelUpMove next_move = new LevelUpMove();
                                next_move.level       = uint.Parse(values[i]);
                                next_move.move        = (Moves)Enum.Parse(typeof(Moves), values[i + 1], true);
                                level_up_moves[i / 2] = next_move;
                            }

                            current_form.moves = level_up_moves;
                        }
                        // Part is egg group
                        else if (key == "Compatibility")
                        {
                            string[]    values     = value.Split(',');
                            int         num_groups = values.Length;
                            EggGroups[] egg_groups = new EggGroups[num_groups];
                            for (int i = 0; i < num_groups; i++)
                            {
                                egg_groups[i] = (EggGroups)Enum.Parse(typeof(EggGroups), values[i], true);
                            }

                            current_form.egg_groups = egg_groups;
                        }
                        // Part is steps to hatch
                        else if (key == "StepsToHatch")
                        {
                            current_form.steps_to_hatch = uint.Parse(value);
                        }
                        // Part is height
                        else if (key == "Height")
                        {
                            current_form.height = float.Parse(value);
                        }
                        // Part is weight
                        else if (key == "Weight")
                        {
                            current_form.weight = float.Parse(value);
                        }
                        // Part is color
                        else if (key == "Color")
                        {
                            current_form.color = (Colors)Enum.Parse(typeof(Colors), value, true);
                        }
                        // Part is shape
                        else if (key == "Shape")
                        {
                            current_form.shape = (Shapes)(int.Parse(value) - 1);
                        }
                        // Part is kind
                        else if (key == "Kind")
                        {
                            current_form.kind = value;
                        }
                        // Part is pokedex entry
                        else if (key == "Pokedex")
                        {
                            current_form.pokedex_entry = value;
                        }
                        // Part is abilities
                        else if (key == "Abilities")
                        {
                            string[]    values        = value.Split(',');
                            int         num_abilities = values.Length;
                            Abilities[] abilities     = new Abilities[num_abilities];
                            for (int i = 0; i < num_abilities; i++)
                            {
                                abilities[i] = (Abilities)Enum.Parse(typeof(Abilities), values[i], true);
                            }

                            current_form.abilities = abilities;
                        }
                        // Part is hidden abilities
                        else if (key == "HiddenAbility")
                        {
                            string[]    values        = value.Split(',');
                            int         num_abilities = values.Length;
                            Abilities[] abilities     = new Abilities[num_abilities];
                            for (int i = 0; i < num_abilities; i++)
                            {
                                abilities[i] = (Abilities)Enum.Parse(typeof(Abilities), values[i], true);
                            }

                            current_form.hidden_ability = abilities;
                        }
                        // Part is egg moves
                        else if (key == "EggMoves")
                        {
                            string[] values    = value.Split(',');
                            int      num_moves = values.Length;
                            Moves[]  moves     = new Moves[num_moves];
                            for (int i = 0; i < num_moves; i++)
                            {
                                moves[i] = (Moves)Enum.Parse(typeof(Moves), values[i], true);
                            }

                            current_form.egg_moves = moves;
                        }
                        // Part is habitat
                        else if (key == "Habitat")
                        {
                            current_form.habitat = (Habitats)Enum.Parse(typeof(Habitats), value, true);
                        }
                        // Part is wild item (3 varieties)
                        else if (key == "WildItemCommon")
                        {
                            current_form.wild_item_common = (Items.Items)Enum.Parse(typeof(Items.Items), value, true);
                        }
                        else if (key == "WildItemUncommon")
                        {
                            current_form.wild_item_uncommon = (Items.Items)Enum.Parse(typeof(Items.Items), value, true);
                        }
                        else if (key == "WildItemRare")
                        {
                            current_form.wild_item_rare = (Items.Items)Enum.Parse(typeof(Items.Items), value, true);
                        }
                        // Part is an in battle sprite offset
                        else if (key == "BattlerPlayerX")
                        {
                            current_form.battler_player_x = int.Parse(value);
                        }
                        else if (key == "BattlerPlayerY")
                        {
                            current_form.battler_player_y = int.Parse(value);
                        }
                        else if (key == "BattlerEnemyX")
                        {
                            current_form.battler_enemy_x = int.Parse(value);
                        }
                        else if (key == "BattlerEnemyY")
                        {
                            current_form.battler_enemy_y = int.Parse(value);
                        }
                        else if (key == "BattlerAltitude")
                        {
                            current_form.battler_altitude = int.Parse(value);
                        }
                        else if (key == "BattlerShadowX")
                        {
                            current_form.battler_shadow_x = int.Parse(value);
                        }
                        else if (key == "BattlerShadowSize")
                        {
                            current_form.battler_shadow_size = int.Parse(value);
                        }
                        // Part is evolutions
                        else if (key == "Evolutions")
                        {
                            string[]    values     = value.Split(',');
                            int         num_evos   = values.Length / 3;
                            Evolution[] evolutions = new Evolution[num_evos];
                            for (int i = 0; i < num_evos * 3; i += 3)
                            {
                                Evolution next_evo = new Evolution();
                                next_evo.evolution        = (Species)Enum.Parse(typeof(Species), values[i], true);
                                next_evo.evolution_method = (EvolutionMethods)Enum.Parse(typeof(EvolutionMethods), values[i + 1], true);
                                next_evo.parameter        = values[i + 2];
                                evolutions[i / 3]         = next_evo;
                            }

                            current_form.evolutions = evolutions;
                        }
                        // Part is mega stone
                        else if (key == "MegaStone")
                        {
                            current_form.mega_stone = (Items.Items)Enum.Parse(typeof(Items.Items), value, true);
                        }
                        // Part is mega move
                        else if (key == "MegaMove")
                        {
                            current_form.mega_move = (Moves)Enum.Parse(typeof(Moves), value, true);
                        }
                        // Part is mega message
                        else if (key == "MegaMessage")
                        {
                            current_form.mega_message = value;
                        }
                        // Part is unmega form id
                        else if (key == "UnmegaForm")
                        {
                            current_form.unmega_form_id = uint.Parse(value);
                        }
                        // Part is pokedex form id
                        else if (key == "PokedexForm")
                        {
                            current_form.pokedex_form_id = uint.Parse(value);
                        }
                    }
                }

                if (current_form != null)
                {
                    imported_forms.Add(current_form);
                }
                input_stream.Close();
            }
            catch (Exception e)
            {
                Debug.Log(e);
                return;
            }

            string forms_path = Settings.ALT_FORMS_FILE_PATH;

            for (int i = 0; i < imported_forms.Count; i++)
            {
                Form new_form = imported_forms[i];

                AssetDatabase.CreateAsset(new_form, Path.Combine(forms_path, new_form.name) + ".asset");
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                EditorUtility.FocusProjectWindow();
                Selection.activeObject = new_form;
            }
        }
Exemple #11
0
 public static void Initialize(string CacheFolder = "")
 {
     if (Connector.isInitialized)
     {
         throw new Exception("PokeAPI is initialized and can only be initialized once"); //May seems a bit over kill but this is nessecery for corrent usage.
     }
     #region "Structure"
     Connector.Berries                  = new Berries();
     Connector.BerryFirmnesses          = new BerryFirmnesses();
     Connector.BerryFlavors             = new BerryFlavors();
     Connector.ContestNames             = new ContestNames();
     Connector.ContestEffects           = new ContestEffects();
     Connector.SuperContestEffects      = new SuperContestEffects();
     Connector.EncounterMethods         = new EncounterMethods();
     Connector.EncounterConditions      = new EncounterConditions();
     Connector.EncounterConditionValues = new EncounterConditionValues();
     Connector.EvolutionChains          = new EvolutionChains();
     Connector.EvolutionTrigger         = new EvolutionTrigger();
     Connector.Generations              = new Generations();
     Connector.Pokedexes                = new Pokedexes();
     Connector.Versions                 = new Versions();
     Connector.VersionGroups            = new VersionGroups();
     Connector.Items             = new Items();
     Connector.ItemAttributes    = new ItemAttributes();
     Connector.ItemCategories    = new ItemCategories();
     Connector.ItemFlingEffects  = new ItemFlingEffects();
     Connector.ItemPockets       = new ItemPockets();
     Connector.Locations         = new Locations();
     Connector.LocationAreas     = new LocationAreas();
     Connector.PalParkAreas      = new PalParkAreas();
     Connector.Regions           = new Regions();
     Connector.Machines          = new Machines();
     Connector.Moves             = new Moves();
     Connector.MoveAilments      = new MoveAilments();
     Connector.MoveBattleStyles  = new MoveBattleStyles();
     Connector.MoveCategories    = new MoveCategories();
     Connector.MoveDamageClasses = new MoveDamageClasses();
     Connector.MoveLearnMethods  = new MoveLearnMethods();
     Connector.MoveTargets       = new MoveTargets();
     Connector.Abilities         = new Abilities();
     Connector.Characteristics   = new Characteristics();
     Connector.EggGroups         = new EggGroups();
     Connector.Genders           = new Genders();
     Connector.GrowthRates       = new GrowthRates();
     Connector.Natures           = new Natures();
     Connector.PokeathlonStats   = new PokeathlonStats();
     Connector.Pokemons          = new Pokemons();
     Connector.PokemonColors     = new PokemonColors();
     Connector.PokemonForms      = new PokemonForms();
     Connector.PokemonHabitats   = new PokemonHabitats();
     Connector.PokemonShapes     = new PokemonShapes();
     Connector.PokemonSpecies    = new PokemonSpecies();
     Connector.Stats             = new Stats();
     Connector.Types             = new Types();
     Connector.Languages         = new Languages();
     #endregion
     if (CacheFolder == "")
     {
         Connector.CacheFolder = AppDomain.CurrentDomain.BaseDirectory + "pokeAPI//";
     }
     else
     {
         if (!System.IO.Directory.Exists(CacheFolder))
         {
             throw new Exception("Directory : " + CacheFolder + " was not found");
         }
         Connector.CacheFolder = CacheFolder;
     }
     Cacher.Initialize();
     Connector.isInitialized = true;
 }
Exemple #12
0
        //public string Name { get { return ToString(TextScripts.Name); } }
        //public string Description { get { return ToString(TextScripts.Description); } }
        #endregion

        #region Constructors
        public PokemonData(Pokemons Id             = Pokemons.NONE, int[] regionalDex = null,
                           Types type1             = Types.NONE, Types type2          = Types.NONE, Abilities ability1 = Abilities.NONE, Abilities ability2 = Abilities.NONE, Abilities hiddenAbility = Abilities.NONE,        //Abilities[] abilities,
                           GenderRatio?genderRatio = GenderRatio.Genderless, float?maleRatio = null, int catchRate = 1, EggGroups eggGroup1                 = EggGroups.NONE, EggGroups eggGroup2     = EggGroups.NONE, int hatchTime = 0,
                           float height            = 0f, float weight = 0f, int baseExpYield = 0, LevelingRate levelingRate = LevelingRate.MEDIUMFAST,
                           int evHP           = 0, int evATK          = 0, int evDEF = 0, int evSPA = 0, int evSPD = 0, int evSPE = 0,
                           Color pokedexColor = Color.NONE, int baseFriendship = 0,
                           int baseStatsHP    = 0, int baseStatsATK = 0, int baseStatsDEF = 0, int baseStatsSPA = 0, int baseStatsSPD = 0, int baseStatsSPE = 0,
                           Rarity rarity      = Rarity.Common, //float luminance = 0f,
                                                               //PokemonMoveset[] movesetmoves = null,
                                                               //int[] movesetLevels = null, Moves[] movesetMoves = null, int[] tmList = null,
                                                               //IPokemonEvolution[] evolution = null,
                                                               //int[] evolutionID = null, int[] evolutionLevel = null, int[] evolutionMethod = null, //string[] evolutionRequirements,
                                                               //Pokemons evolutionFROM = Pokemons.NONE, List<int> evolutionTO = null,
                           Items incense     = Items.NONE,
                           int evoChainId    = 0, byte generationId        = 0, bool isDefault = false, bool isBaby = false, bool formSwitchable = false, bool hasGenderDiff = false,
                           Habitat habitatId = Habitat.RARE, Shape shapeId = Shape.BLOB, int order = -1,
                           Forms baseForm    = Forms.NONE,                      //int forms = 0,
                           int[,] heldItem   = null)                            //: this(Id)
        {
            this.ID       = Id;
            this.BaseForm = baseForm;
            //this.RegionalPokedex = regionalDex;

            this.type1 = type1;             //!= null ? (Types)type1 : Types.NONE;
            this.type2 = type2;             //!= null ? (Types)type2 : Types.NONE;
            //this.ability = abilities;
            this.ability1 = (Abilities)ability1;
            this.ability2 = (Abilities)ability2;
            this.abilityh = (Abilities)hiddenAbility;

            this.CatchRate = catchRate;
            this.eggGroup1 = eggGroup1;
            this.eggGroup2 = eggGroup2;
            this.HatchTime = hatchTime;

            this.Height       = height;
            this.Weight       = weight;
            this.BaseExpYield = baseExpYield;
            this.GrowthRate   = (LevelingRate)levelingRate;           //== null ? (LevelingRate)levelingRate : LevelingRate.NONE;

            this.evYieldHP  = evHP;
            this.evYieldATK = evATK;
            this.evYieldDEF = evDEF;
            this.evYieldSPA = evSPA;
            this.evYieldSPD = evSPD;
            this.evYieldSPE = evSPE;

            this.BaseStatsHP    = baseStatsHP;
            this.BaseStatsATK   = baseStatsATK;
            this.BaseStatsDEF   = baseStatsDEF;
            this.BaseStatsSPA   = baseStatsSPA;
            this.BaseStatsSPD   = baseStatsSPD;
            this.BaseStatsSPE   = baseStatsSPE;
            this.BaseFriendship = baseFriendship;

            this.Rarity = rarity;
            //this.lightColor = lightColor;
            this.PokedexColor = pokedexColor | Color.NONE;

            //ToDo: wild pokemon held items not yet implemented
            this.HeldItem = heldItem;             //[item id,% chance]

            /*this.Luminance = luminance;
             * //if(movesetmoves != null)
             * this.MoveTree = new PokemonMoveTree(movesetmoves);
             * //this.MovesetLevels = movesetLevels;
             * //this.MovesetMoves = movesetMoves;
             * //this.tmList = tmList;
             *
             * this.Evolutions = evolution ?? new IPokemonEvolution[0];
             * //this.EvolutionID = evolutionID;
             * //this.evolutionMethod = evolutionMethod;
             * //this.evolutionRequirements = evolutionRequirements;*/

            this.Order          = order;
            this.ShinyChance    = 0;
            this.IsDefault      = isDefault;
            this.IsBaby         = isBaby;
            this.FormSwitchable = formSwitchable;
            this.HasGenderDiff  = hasGenderDiff;
            //this.EvolutionFROM= evolutionFROM ;
            //this.EvolutionTO  = evolutionTO   ;
            this.Incense      = incense;
            this.EvoChainId   = evoChainId;
            this.GenerationId = generationId;
            this.HabitatId    = habitatId;
            this.ShapeId      = shapeId;

            this.GenderEnum = GenderRatio.Genderless;
            if (genderRatio.HasValue)
            {
                this.GenderEnum = genderRatio.Value;
            }
            else
            {
                this.GenderEnum = maleRatio.HasValue ? getGenderRatio(maleRatio.Value) : GenderEnum;                 //genderRatio.Value;
            }
        }
        private void PopulateComboBoxes()
        {
            bool oldLoaded = loaded;

            loaded = false;

            AddComparisonComboBoxItems(comboBoxHatchCounterComparison);
            AddComparisonComboBoxItems(comboBoxStatComparison);
            AddComparisonComboBoxItems(comboBoxConditionComparison);
            AddComparisonComboBoxItems(comboBoxIVComparison);
            AddComparisonComboBoxItems(comboBoxEVComparison);
            AddComparisonComboBoxItems(comboBoxLevelComparison);
            AddComparisonComboBoxItems(comboBoxFriendshipComparison);
            AddComparisonComboBoxItems(comboBoxHiddenPowerDamageComparison);

            comboBoxSpecies.Items.Clear();
            for (ushort i = 1; i <= 386; i++)
            {
                AddComboBoxItem(comboBoxSpecies, PokemonDatabase.GetPokemonFromDexID(i).Name, (int)i);
            }

            comboBoxType.Items.Clear();
            for (PokemonTypes i = PokemonTypes.Normal; i <= PokemonTypes.Dark; i++)
            {
                AddComboBoxItem(comboBoxType, i.ToString(), (int)i);
            }

            comboBoxNature.Items.Clear();
            for (byte i = 0; i <= 24; i++)
            {
                AddComboBoxItem(comboBoxNature, PokemonDatabase.GetNatureFromID(i).Name, (int)i);
            }

            comboBoxAbility.Items.Clear();
            for (byte i = 1; i <= 76; i++)
            {
                AddComboBoxItem(comboBoxAbility, PokemonDatabase.GetAbilityFromID(i).Name, (int)i);
            }

            comboBoxHeldItem.Items.Clear();
            AddComboBoxItem(comboBoxHeldItem, "Any", 0);
            for (int i = 1; ItemDatabase.GetItemAt(i) != null; i++)
            {
                ItemData item = ItemDatabase.GetItemAt(i);
                if (!item.IsImportant && item.ID < 500)
                {
                    AddComboBoxItem(comboBoxHeldItem, item.Name, (int)item.ID);
                }
            }

            comboBoxPokeBall.Items.Clear();
            AddComboBoxItem(comboBoxPokeBall, "Poké Ball", 4);
            AddComboBoxItem(comboBoxPokeBall, "Great Ball", 3);
            AddComboBoxItem(comboBoxPokeBall, "Ultra Ball", 2);
            AddComboBoxItem(comboBoxPokeBall, "Master Ball", 1);
            AddComboBoxItem(comboBoxPokeBall, "Safari Ball", 5);
            AddComboBoxItem(comboBoxPokeBall, "Timer Ball", 10);
            AddComboBoxItem(comboBoxPokeBall, "Repeat Ball", 9);
            AddComboBoxItem(comboBoxPokeBall, "Net Ball", 6);
            AddComboBoxItem(comboBoxPokeBall, "Dive Ball", 7);
            AddComboBoxItem(comboBoxPokeBall, "Nest Ball", 8);
            AddComboBoxItem(comboBoxPokeBall, "Premier Ball", 12);
            AddComboBoxItem(comboBoxPokeBall, "Luxury Ball", 11);


            comboBoxRibbon.Items.Clear();
            for (PokemonRibbons i = PokemonRibbons.Any; i <= PokemonRibbons.World; i++)
            {
                // Add spaces to the names
                string        name    = i.ToString();
                StringBuilder newName = new StringBuilder();
                foreach (char c in name)
                {
                    if (char.IsUpper(c) && newName.Length > 0)
                    {
                        newName.Append(' ');
                    }
                    newName.Append(c);
                }
                AddComboBoxItem(comboBoxRibbon, newName.ToString(), (int)i);
            }


            comboBoxPokerus.Items.Clear();
            AddComboBoxItem(comboBoxPokerus, "None", (int)PokerusStatuses.None);
            AddComboBoxItem(comboBoxPokerus, "Infected", (int)PokerusStatuses.Infected);
            AddComboBoxItem(comboBoxPokerus, "Cured", (int)PokerusStatuses.Cured);

            ComboBox[] statComboBoxes = new ComboBox[] { comboBoxStatType, comboBoxIVType, comboBoxEVType };
            for (int i = 0; i < 3; i++)
            {
                statComboBoxes[i].Items.Clear();
                AddComboBoxItem(statComboBoxes[i], "HP", (int)StatTypes.HP);
                AddComboBoxItem(statComboBoxes[i], "Attack", (int)StatTypes.Attack);
                AddComboBoxItem(statComboBoxes[i], "Defense", (int)StatTypes.Defense);
                AddComboBoxItem(statComboBoxes[i], "Sp Attack", (int)StatTypes.SpAttack);
                AddComboBoxItem(statComboBoxes[i], "Sp Defense", (int)StatTypes.SpDefense);
                AddComboBoxItem(statComboBoxes[i], "Speed", (int)StatTypes.Speed);
                AddComboBoxItem(statComboBoxes[i], "Any", (int)StatTypes.Any);
                AddComboBoxItem(statComboBoxes[i], "All", (int)StatTypes.All);
                AddComboBoxItem(statComboBoxes[i], "Total", (int)StatTypes.Total);
            }

            comboBoxConditionType.Items.Clear();
            AddComboBoxItem(comboBoxConditionType, "Cool", (int)ConditionTypes.Cool);
            AddComboBoxItem(comboBoxConditionType, "Beauty", (int)ConditionTypes.Beauty);
            AddComboBoxItem(comboBoxConditionType, "Cute", (int)ConditionTypes.Cute);
            AddComboBoxItem(comboBoxConditionType, "Smart", (int)ConditionTypes.Smart);
            AddComboBoxItem(comboBoxConditionType, "Tough", (int)ConditionTypes.Tough);
            AddComboBoxItem(comboBoxConditionType, "Feel", (int)ConditionTypes.Feel);
            AddComboBoxItem(comboBoxConditionType, "Any", (int)ConditionTypes.Any);
            AddComboBoxItem(comboBoxConditionType, "All", (int)ConditionTypes.All);
            AddComboBoxItem(comboBoxConditionType, "Total", (int)ConditionTypes.Total);

            comboBoxGender.Items.Clear();
            AddComboBoxItem(comboBoxGender, "Male", (int)Genders.Male);
            AddComboBoxItem(comboBoxGender, "Female", (int)Genders.Female);
            AddComboBoxItem(comboBoxGender, "Genderless", (int)Genders.Genderless);

            comboBoxFamily.Items.Clear();
            for (ushort i = 1; i <= 386; i++)
            {
                PokemonData pokemonData = PokemonDatabase.GetPokemonFromDexID(i);
                if (pokemonData.FamilyDexID == i)
                {
                    AddComboBoxItem(comboBoxFamily, pokemonData.Name, (int)i);
                }
            }


            ComboBox[] moveComboBoxes = new ComboBox[] { comboBoxMove1, comboBoxMove2, comboBoxMove3, comboBoxMove4 };
            for (int i = 0; i < 4; i++)
            {
                moveComboBoxes[i].Items.Clear();
                AddComboBoxItem(moveComboBoxes[i], "None", 0);
                for (ushort j = 1; j <= 354; j++)
                {
                    AddComboBoxItem(moveComboBoxes[i], PokemonDatabase.GetMoveFromID(j).Name, (int)j);
                }
            }

            comboBoxHiddenPowerType.Items.Clear();
            for (PokemonTypes i = PokemonTypes.Fighting; i <= PokemonTypes.Dark; i++)
            {
                AddComboBoxItem(comboBoxHiddenPowerType, i.ToString(), (int)i);
            }


            comboBoxEggGroup.Items.Clear();
            for (EggGroups i = EggGroups.Field; i <= EggGroups.Ditto; i++)
            {
                AddComboBoxItem(comboBoxEggGroup, PokemonDatabase.GetEggGroupName(i), (int)i);
            }

            comboBoxEggMode.Items.Clear();
            AddComboBoxItem(comboBoxEggMode, "Include Eggs", (int)EggModes.IncludeEggs);
            AddComboBoxItem(comboBoxEggMode, "Exclude Eggs", (int)EggModes.ExcludeEggs);
            AddComboBoxItem(comboBoxEggMode, "Only Eggs", (int)EggModes.OnlyEggs);

            comboBoxShinyMode.Items.Clear();
            AddComboBoxItem(comboBoxShinyMode, "Include Shinies", (int)ShinyModes.IncludeShinies);
            AddComboBoxItem(comboBoxShinyMode, "Exclude Shinies", (int)ShinyModes.ExcludeShinies);
            AddComboBoxItem(comboBoxShinyMode, "Only Shinies", (int)ShinyModes.OnlyShinies);

            comboBoxShadowMode.Items.Clear();
            AddComboBoxItem(comboBoxShadowMode, "Include Shadow", (int)ShadowModes.IncludeShadow);
            AddComboBoxItem(comboBoxShadowMode, "Exclude Shadow", (int)ShadowModes.ExcludeShadow);
            AddComboBoxItem(comboBoxShadowMode, "Only Shadow", (int)ShadowModes.OnlyShadow);

            comboBoxSortMethod.Items.Clear();
            AddComboBoxItem(comboBoxSortMethod, "None", (int)SortMethods.None);
            AddComboBoxItem(comboBoxSortMethod, "Dex Number", (int)SortMethods.DexNumber);
            AddComboBoxItem(comboBoxSortMethod, "Alphabetical", (int)SortMethods.Alphabetical);
            AddComboBoxItem(comboBoxSortMethod, "Level", (int)SortMethods.Level);
            AddComboBoxItem(comboBoxSortMethod, "Friendship", (int)SortMethods.Friendship);
            AddComboBoxItem(comboBoxSortMethod, "Hatch Counter", (int)SortMethods.HatchCounter);
            AddComboBoxItem(comboBoxSortMethod, "Type", (int)SortMethods.Type);
            AddComboBoxItem(comboBoxSortMethod, "Hidden Power Type", (int)SortMethods.HiddenPowerType);
            AddComboBoxItem(comboBoxSortMethod, "Hidden Power Damage", (int)SortMethods.HiddenPowerDamage);
            AddComboBoxItem(comboBoxSortMethod, "Total Stats", (int)SortMethods.TotalStats);
            AddComboBoxItem(comboBoxSortMethod, "Total IVs", (int)SortMethods.TotalIVs);
            AddComboBoxItem(comboBoxSortMethod, "Total EVs", (int)SortMethods.TotalEVs);
            AddComboBoxItem(comboBoxSortMethod, "Total Conditions", (int)SortMethods.TotalCondition);
            AddComboBoxItem(comboBoxSortMethod, "Ribbon Count", (int)SortMethods.RibbonCount);
            AddComboBoxItem(comboBoxSortMethod, "HP", (int)SortMethods.HP);
            AddComboBoxItem(comboBoxSortMethod, "Attack", (int)SortMethods.Attack);
            AddComboBoxItem(comboBoxSortMethod, "Defense", (int)SortMethods.Defense);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack", (int)SortMethods.SpAttack);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense", (int)SortMethods.SpDefense);
            AddComboBoxItem(comboBoxSortMethod, "Speed", (int)SortMethods.Speed);
            AddComboBoxItem(comboBoxSortMethod, "HP IV", (int)SortMethods.HPIV);
            AddComboBoxItem(comboBoxSortMethod, "Attack IV", (int)SortMethods.AttackIV);
            AddComboBoxItem(comboBoxSortMethod, "Defense IV", (int)SortMethods.DefenseIV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack IV", (int)SortMethods.SpAttackIV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense IV", (int)SortMethods.SpDefenseIV);
            AddComboBoxItem(comboBoxSortMethod, "Speed IV", (int)SortMethods.SpeedIV);
            AddComboBoxItem(comboBoxSortMethod, "HP EV", (int)SortMethods.HPEV);
            AddComboBoxItem(comboBoxSortMethod, "Attack EV", (int)SortMethods.AttackEV);
            AddComboBoxItem(comboBoxSortMethod, "Defense EV", (int)SortMethods.DefenseEV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack EV", (int)SortMethods.SpAttackEV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense EV", (int)SortMethods.SpDefenseEV);
            AddComboBoxItem(comboBoxSortMethod, "Speed EV", (int)SortMethods.SpeedEV);
            AddComboBoxItem(comboBoxSortMethod, "Coolness", (int)SortMethods.Coolness);
            AddComboBoxItem(comboBoxSortMethod, "Beauty", (int)SortMethods.Beauty);
            AddComboBoxItem(comboBoxSortMethod, "Cuteness", (int)SortMethods.Cuteness);
            AddComboBoxItem(comboBoxSortMethod, "Smartness", (int)SortMethods.Smartness);
            AddComboBoxItem(comboBoxSortMethod, "Toughness", (int)SortMethods.Toughness);
            AddComboBoxItem(comboBoxSortMethod, "Feel", (int)SortMethods.Feel);

            comboBoxSortOrder.Items.Clear();
            AddComboBoxItem(comboBoxSortOrder, "Highest to Lowest", (int)SortOrders.HighestToLowest);
            AddComboBoxItem(comboBoxSortOrder, "Lowest to Highest", (int)SortOrders.LowestToHighest);

            comboBoxSearchMode.Items.Clear();
            AddComboBoxItem(comboBoxSearchMode, "New Search", (int)SearchModes.NewSearch);
            AddComboBoxItem(comboBoxSearchMode, "Add Results", (int)SearchModes.AddResults);
            AddComboBoxItem(comboBoxSearchMode, "Refine Results", (int)SearchModes.RefineResults);

            loaded = oldLoaded;
        }