Exemplo n.º 1
0
        public static string GetFormattedShowdownText(PKM pkm)
        {
            var newShowdown = new List <string>();
            var showdown    = new ShowdownSet(pkm).Text;

            foreach (var line in showdown.Split('\n'))
            {
                newShowdown.Add(line);
            }

            if (pkm.IsEgg)
            {
                newShowdown.Add("\nPokémon is an egg");
            }
            if (pkm.Ball > (int)Ball.None)
            {
                newShowdown.Insert(newShowdown.FindIndex(z => z.Contains("Nature")), $"Ball: {(Ball)pkm.Ball} Ball");
            }
            if (pkm.IsShiny)
            {
                var index = newShowdown.FindIndex(x => x.Contains("Shiny: Yes"));
                if (pkm.ShinyXor == 0 || pkm.FatefulEncounter)
                {
                    newShowdown[index] = "Shiny: Square\r";
                }
                else
                {
                    newShowdown[index] = "Shiny: Star\r";
                }
            }

            newShowdown.InsertRange(1, new string[] { $"OT: {pkm.OT_Name}", $"TID: {pkm.DisplayTID}", $"SID: {pkm.DisplaySID}", $"OTGender: {(Gender)pkm.OT_Gender}", $"Language: {(LanguageID)pkm.Language}" });
            return(Format.Code(string.Join("\n", newShowdown).TrimEnd()));
        }
Exemplo n.º 2
0
 public void SimulatorGetParse()
 {
     foreach (var setstr in Sets)
     {
         var set   = new ShowdownSet(setstr).Text;
         var lines = set.Split('\n').Select(z => z.Trim());
         Assert.IsTrue(lines.All(z => setstr.Contains(z)), setstr);
     }
 }