コード例 #1
0
        private IReadOnlyList <EvolutionMethod[]> GetEntries(IReadOnlyList <byte[]> data)
        {
            switch (Game)
            {
            case GameVersion.Gen1:
            case GameVersion.Gen2: return(EvolutionSet1.GetArray(data[0], MaxSpeciesTree));

            case GameVersion.Gen3: return(EvolutionSet3.GetArray(data[0]));

            case GameVersion.Gen4: return(EvolutionSet4.GetArray(data[0]));

            case GameVersion.Gen5: return(EvolutionSet5.GetArray(data[0]));

            case GameVersion.Gen6: return(EvolutionSet6.GetArray(data));

            case GameVersion.Gen7: return(EvolutionSet7.GetArray(data));

            default: throw new Exception();
            }
        }
コード例 #2
0
ファイル: EvolutionTree.cs プロジェクト: kang1806/PKHeX
        private IReadOnlyList <EvolutionSet> GetEntries(IReadOnlyList <byte[]> data)
        {
            switch (Game)
            {
            case GameVersion.Gen1: return(EvolutionSet1.GetArray(data[0], MaxSpeciesTree));

            case GameVersion.Gen2: return(EvolutionSet2.GetArray(data[0], MaxSpeciesTree));

            case GameVersion.Gen3: return(EvolutionSet3.GetArray(data[0]));

            case GameVersion.Gen4: return(EvolutionSet4.GetArray(data[0]));

            case GameVersion.Gen5: return(EvolutionSet5.GetArray(data[0]));

            case GameVersion.Gen6: return(new List <EvolutionSet>(data.Select(d => new EvolutionSet6(d))));

            case GameVersion.Gen7: return(new List <EvolutionSet>(data.Select(d => new EvolutionSet7(d))));

            default: throw new Exception();
            }
        }
コード例 #3
0
        public EvolutionTree(byte[][] data, GameVersion game, PersonalTable personal, int maxSpeciesTree)
        {
            Game           = game;
            Personal       = personal;
            MaxSpeciesTree = maxSpeciesTree;
            switch (game)
            {
            case GameVersion.RBY:
                Entries = EvolutionSet1.GetArray(data[0], maxSpeciesTree);
                break;

            case GameVersion.GSC:
                Entries = EvolutionSet2.GetArray(data[0], maxSpeciesTree);
                break;

            case GameVersion.RS:
                Entries = EvolutionSet3.GetArray(data[0]);
                break;

            case GameVersion.DP:
                Entries = EvolutionSet4.GetArray(data[0]);
                break;

            case GameVersion.BW:
                Entries = EvolutionSet5.GetArray(data[0]);
                break;

            case GameVersion.ORAS:
                Entries.AddRange(data.Select(d => new EvolutionSet6(d)));
                break;

            case GameVersion.SM:
                Entries.AddRange(data.Select(d => new EvolutionSet7(d)));
                break;
            }

            // Create Lineages
            Lineage = new EvolutionLineage[Entries.Count];
            for (int i = 0; i < Entries.Count; i++)
            {
                Lineage[i] = new EvolutionLineage();
            }
            if (Game == GameVersion.ORAS)
            {
                Array.Resize(ref Lineage, MaxSpeciesTree + 1);
            }

            // Populate Lineages
            for (int i = 1; i < Lineage.Length; i++)
            {
                // Iterate over all possible evolutions
                var s = Entries[i];
                foreach (EvolutionMethod evo in s.PossibleEvolutions)
                {
                    int index = GetIndex(evo);
                    if (index < 0)
                    {
                        continue;
                    }

                    var sourceEvo = evo.Copy(i);

                    Lineage[index].Insert(sourceEvo);
                    // If current entries has a pre-evolution, propagate to evolution as well
                    if (Lineage[i].Chain.Count > 0)
                    {
                        Lineage[index].Insert(Lineage[i].Chain[0]);
                    }

                    if (index >= i)
                    {
                        continue;
                    }
                    // If destination species evolves into something (ie a 'baby' Pokemon like Cleffa)
                    // Add it to the corresponding parent chains
                    foreach (EvolutionMethod mid in Entries[index].PossibleEvolutions)
                    {
                        int newIndex = GetIndex(mid);
                        if (newIndex < 0)
                        {
                            continue;
                        }

                        Lineage[newIndex].Insert(sourceEvo);
                    }
                }
            }
            FixEvoTreeManually();
        }