Пример #1
0
 public static PokemonInfo GetpPokemonUSE(string name)
 {
     if (pokemonListId.Contains(name))
     {
         PokemonInfo b = new PokemonInfo(GetPokemonBase(name));
         b.Pokemonextend();
         return(b);
     }
     return(null);
 }
Пример #2
0
        public static PokemonInfo PStoPokemon_once(string PStext)
        {
            string[] data        = Regex.Split(PStext.Trim(), "\r*\n");
            string[] NameandItem = Regex.Split(data[0].Trim(), @"\s+@\s+"); // 昵称
            string   Item        = null;
            string   Name        = NameandItem[0];
            string   move        = "";
            string   Ability     = null;
            Racial   EVSfin      = new Racial();

            EVSfin.clear();
            Racial IVsfin = new Racial();

            IVsfin.fill();
            int Level     = 50;
            int Happiness = 160;

            if (NameandItem.Length > 1)
            {
                Item = Pokemondata.GetItemName(Pokemondata.EnglishNametoItemID(NameandItem[1]));
            }
            string[] ntemp    = Regex.Split(Name, @"\s+\(");
            string   nickname = null;
            string   Nature   = "Serious";
            bool     SHINY    = false;

            if (ntemp.Length == 3)
            {
                nickname = ntemp[0];
                Name     = ntemp[1].Substring(0, ntemp[1].Length - 1);
            }
            else if (ntemp.Length == 2)
            {
                if (ntemp[1].Length <= 4)
                {
                    Name = ntemp[0];
                }
                else
                {
                    Name = ntemp[1].Substring(0, ntemp[1].Length - 1);
                }
            }
            int qq = 9;
            //Name = Name.Replace("-Gmax", "");
            PokemonInfo PB = new PokemonInfo(Pokemondata.GetPokemonBase(Pokemondata.EnglishNametopokeID(Name.Replace("-Gmax", ""))));

            if (Name.Contains("-Gmax"))
            {
                PB.Gmax = true;
            }
            for (int i = 1; i < data.Length; ++i)
            {
                string[] temp = Regex.Split(data[i].Trim(), @"\s*:\s*");
                switch (temp[0])
                {
                case "Ability":
                    Ability = Pokemondata.GetAbilityName(Pokemondata.EnglishNametoAbilityID(temp[1]));
                    break;

                case "EVs":
                    string[] EVs = Regex.Split(temp[1], @"\s*/\s*");

                    foreach (string item in EVs)
                    {
                        string[] orz = Regex.Split(item, @"\s+");
                        if (title(orz[1]) >= 0)
                        {
                            EVSfin.FromnumToSet(title(orz[1]), int.Parse(orz[0]));
                        }
                    }
                    break;

                case "IVs":
                    string[] IVs = Regex.Split(temp[1], @"\s*/\s*");

                    foreach (string item in IVs)
                    {
                        string[] orz = Regex.Split(item, @"\s+");
                        if (title(orz[1]) >= 0)
                        {
                            IVsfin.FromnumToSet(title(orz[1]), int.Parse(orz[0]));
                        }
                    }
                    break;

                case "Level":
                    Level = int.Parse(temp[1]);
                    break;

                case "Shiny":
                    if (temp[1] == "Yes")
                    {
                        SHINY = true;
                    }

                    break;

                case "Happiness":
                    Happiness = int.Parse(temp[1]);
                    break;

                default:
                    string[] gg = data[i].Split(' ');
                    if (gg[1] == "Nature")
                    {
                        Nature = gg[0];
                    }
                    else
                    {
                        string move1 = Regex.Replace(data[i].Trim(), @"\s*-\s+", "");
                        if (move1.Contains("Hidden Power"))
                        {
                            if (move1.Contains("["))
                            {
                                string wqeeq = move1.Substring(move1.IndexOf("[")
                                                               + 1, move1.Length - move1.IndexOf("[") - 2);
                                move1 = "觉醒力量-" + Pokemondata.GetTypeName
                                            (Pokemondata.GetEngTypeId(move1.Substring(move1.IndexOf("[")
                                                                                      + 1, move1.Length - move1.IndexOf("[") - 2)));
                            }
                            else
                            {
                                move1 = "觉醒力量-" + Pokemondata.GetTypeName(Pokemondata.GetEngTypeId(IVsfin.getHiddenPowerType()));
                            }
                            if (move == "")
                            {
                                move = move1;
                            }
                            else
                            {
                                move += "," + (move1);
                            }
                        }
                        else
                        {
                            if (move == "")
                            {
                                move = Pokemondata.GetMoveName(Pokemondata.EnglishNametoMoveID(move1));
                            }
                            else
                            {
                                move += "," + Pokemondata.GetMoveName(Pokemondata.EnglishNametoMoveID(move1));
                            }
                        }
                        //move1 = Regex.Replace(move1, "\\[.+?\\]", "").Trim();
                    }
                    break;
                }
            }
            string[] movelist = move.Split(',');
            PB.Pokemonextend(movelist, Item, Ability, SHINY, EVSfin, IVsfin, Level, Pokemondata.getNatureClass(Nature));
            return(PB);
        }