示例#1
0
 public Pokémon(SerializationInfo info, StreamingContext ctxt)
 {
     NationalNumber      = (string)info.GetValue("NationalNumber", typeof(string));
     Name                = (string)info.GetValue("Name", typeof(string));
     Height              = (int)info.GetValue("Height", typeof(int));
     Weight              = (int)info.GetValue("Weight", typeof(int));
     JohtoNumber         = (string)info.GetValue("JohtoNumber", typeof(string));
     SinnohNumber        = (string)info.GetValue("SinnohNumber", typeof(string));
     HoennNumber         = (string)info.GetValue("HoennNumber", typeof(string));
     UnovaNumber         = (string)info.GetValue("UnovaNumber", typeof(string));
     KalosCentralNumber  = (string)info.GetValue("KalosCentralNumber", typeof(string));
     KalosCoastalNumber  = (string)info.GetValue("KalosCoastalNumber", typeof(string));
     KalosMountainNumber = (string)info.GetValue("KalosMountainNumber", typeof(string));
     BaseHP              = (int)info.GetValue("BaseHP", typeof(int));
     BaseAtt             = (int)info.GetValue("BaseAtt", typeof(int));
     BaseDef             = (int)info.GetValue("BaseDef", typeof(int));
     BaseSpAtt           = (int)info.GetValue("BaseSpAtt", typeof(int));
     BaseSpDef           = (int)info.GetValue("BaseSpDef", typeof(int));
     BaseSpeed           = (int)info.GetValue("BaseSpeed", typeof(int));
     MainType            = (PokeType)info.GetValue("MainType", typeof(PokeType));
     SecondType          = (PokeType)info.GetValue("SecondType", typeof(PokeType));
     MainEggGroup        = (EggGroup)info.GetValue("MainEggGroup", typeof(EggGroup));
     SecondEggGroup      = (EggGroup)info.GetValue("SecondEggGroup", typeof(EggGroup));
     Forme               = (string)info.GetValue("Forme", typeof(string));
     Caught              = (bool)info.GetValue("Caught", typeof(bool));
     Gen               = (int)info.GetValue("Gen", typeof(int));
     EvoInstanceID     = (int)info.GetValue("EvoInstanceID", typeof(int));
     Updated           = (DateTime)info.GetValue("Updated", typeof(DateTime));
     EvolutionInstance = (EvolutionInstance)info.GetValue("EvolutionInstance", typeof(EvolutionInstance));
 }
示例#2
0
        public string GetPreEvo(EvolutionInstance ei)
        {
            EvolutionTree     et;
            EvolutionInstance evoEi = null;
            string            x     = null;

            foreach (EvolutionTree etx in EvoTrees)
            {
                if (etx.TreeID == ei.TreeID)
                {
                    et = etx;

                    try
                    {
                        int i = 0;
                        foreach (EvolutionInstance y in et.Evolutions)
                        {
                            if (ei.Place - 1 > 0 && ei.Place - 1 == y.Place)
                            {
                                i = et.Evolutions.IndexOf(y);
                                break;
                            }
                        }

                        evoEi = et.Evolutions[i];
                    }
                    catch { }

                    break;
                }
            }

            switch (ei.Place)
            {
            case 1:
                x = ei.Method.Method;
                break;

            case 2:
            case 3:
                foreach (Pokémon p in Pokedex)
                {
                    if ((p.EvolutionInstance.TreeID == evoEi.TreeID) && (p.EvolutionInstance.Place == evoEi.Place))
                    {
                        x = p.Name;
                        break;
                    }
                }
                break;
            }

            return(x);
        }
示例#3
0
        public static bool CheckIfAdded(EvolutionTree et, EvolutionInstance ei)
        {
            bool x = false;

            foreach (EvolutionInstance y in et.Evolutions)
            {
                if (ei.Place == y.Place &&
                    ei.Move == y.Move &&
                    ei.Item == y.Item &&
                    ei.Condition == y.Condition)
                {
                    x = true;
                    break;
                }
            }

            return(x);
        }
示例#4
0
        public void GetEvo(EvolutionInstance ei, TextBlock lbevo, ComboBox cbevo, Image imgevo)
        {
            EvolutionTree            et;
            List <EvolutionInstance> evoEi = new List <EvolutionInstance>();

            foreach (EvolutionTree etx in EvoTrees)
            {
                if (etx.TreeID == ei.TreeID)
                {
                    et = etx;

                    try
                    {
                        foreach (EvolutionInstance y in et.Evolutions)
                        {
                            if (ei.Place == y.Place)
                            {
                                foreach (EvolutionInstance x in et.Evolutions)
                                {
                                    if (x.Place == ei.Place + 1)
                                    {
                                        evoEi.Add(x);
                                    }
                                }
                            }
                        }
                    }
                    catch { }

                    break;
                }
            }

            if (evoEi.Count() > 1)
            {
                foreach (EvolutionInstance eix in evoEi)
                {
                    switch (ei.Place)
                    {
                    case 1:
                    case 2:
                        foreach (Pokémon p in Pokedex)
                        {
                            if (p.EvoInstanceID == eix.ID)
                            {
                                /*ComboBoxItem cbi = new ComboBoxItem();
                                 * Image cbii = new Image*/
                                cbevo.Items.Add(p.Name);
                            }
                        }
                        break;
                    }
                }

                lbevo.Visibility = System.Windows.Visibility.Collapsed;
                cbevo.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                string x = null;

                if (evoEi.Count > 0)
                {
                    switch (ei.Place)
                    {
                    case 1:
                    case 2:
                        foreach (Pokémon p in Pokedex)
                        {
                            if ((p.EvolutionInstance.TreeID == evoEi[0].TreeID) && (p.EvolutionInstance.Place == evoEi[0].Place))
                            {
                                x             = p.Name;
                                imgevo.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "/minisprites/" + Convert.ToInt32(p.NationalNumber) + ".png"));
                                break;
                            }
                        }
                        break;
                    }
                }

                if (x == null)
                {
                    x             = "Final evolution";
                    imgevo.Source = null;
                }

                lbevo.Text       = x;
                lbevo.Visibility = System.Windows.Visibility.Visible;
                cbevo.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
示例#5
0
        public static List <EvolutionTree> ReadEvoTrees()
        {
            List <int> test = new List <int>();

            List <EvolutionTree> returnable = new List <EvolutionTree>();

            _doc.Load(URL + "evotrees.xml");
            XmlElement root = _doc.DocumentElement;
            XmlElement current;

            for (int x = 0; x < root.GetElementsByTagName("Instance").Count; x++)
            {
                current = (XmlElement)root.ChildNodes[x];

                int       id          = Convert.ToInt32(current.GetElementsByTagName("ID")[0].InnerText);
                int       treenumber  = Convert.ToInt32(current.GetElementsByTagName("TreeNumber")[0].InnerText);
                int       placeintree = Convert.ToInt32(current.GetElementsByTagName("PlaceInTree")[0].InnerText);
                EvoMethod evomethod   = Database.GetEvoMethod(Convert.ToInt32(current.GetElementsByTagName("EvoWay")[0].InnerText));
                string    condition   = current.GetElementsByTagName("Condition")[0].InnerText;
                int       level       = Convert.ToInt32(current.GetElementsByTagName("Level")[0].InnerText);

                EvolutionTree     et = new EvolutionTree(id, treenumber);
                EvolutionInstance ei = null;

                if (returnable.Count > 0)
                {
                    foreach (EvolutionTree temp in returnable)
                    {
                        if (et.TreeID == temp.TreeID)
                        {
                            et = temp;
                            break;
                        }
                    }
                }

                switch (evomethod.Method)
                {
                case "Level":
                case "Level At Time":
                case "Level At Location":
                case "Level With Friendship":
                case "Level With Unique Condition":
                case "Trade":
                case "Trade for Specific Pokemon":
                    ei = new EvolutionInstance(id,
                                               et.TreeID,
                                               placeintree,
                                               evomethod,
                                               level,
                                               condition);
                    break;

                case "Level With Item":
                case "Trade With Item":
                case "Use Stone":
                    ei = new EvolutionInstance(id,
                                               et.TreeID,
                                               placeintree,
                                               evomethod,
                                               level,
                                               condition,
                                               Database.GetItem(Convert.ToInt32(current.GetElementsByTagName("Item")[0].InnerText)));
                    break;

                case "Level With Move":
                    ei = new EvolutionInstance(id,
                                               et.TreeID,
                                               placeintree,
                                               evomethod,
                                               level,
                                               condition,
                                               Database.GetMove(Convert.ToInt32(current.GetElementsByTagName("Move")[0].InnerText)));
                    break;

                case "Egg":
                    ei = new EvolutionInstance(id,
                                               et.TreeID,
                                               placeintree,
                                               evomethod);
                    break;
                }

                if (!Database.CheckIfAdded(et, ei))
                {
                    et.Evolutions.Add(ei);
                }
                if (!returnable.Contains(et))
                {
                    returnable.Add(et);
                }

                foreach (Pokémon p in Database.Pokedex)
                {
                    if (p.EvoInstanceID == id)
                    {
                        p.AddEvolutionInstance(ei);
                    }
                }
            }

            return(returnable);
        }
示例#6
0
 public void AddEvolutionInstance(EvolutionInstance t)
 {
     EvolutionInstance = t;
 }