Пример #1
0
        public static EggSource2[] Validate(int species, GameVersion version, int[] moves, out bool valid)
        {
            var count = Array.IndexOf(moves, 0);

            if (count == 0)
            {
                valid = false; // empty moveset
                return(Array.Empty <EggSource2>());
            }
            if (count == -1)
            {
                count = moves.Length;
            }

            var learn    = GameData.GetLearnsets(version);
            var table    = GameData.GetPersonal(version);
            var learnset = learn[species];
            var pi       = table[species];
            var egg      = (version == GameVersion.C ? Legal.EggMovesC : Legal.EggMovesGS)[species].Moves;

            var value = new BreedInfo <EggSource2>(count, learnset, moves, level);

            {
                bool inherit = Breeding.GetCanInheritMoves(species);
                MarkMovesForOrigin(value, egg, count, inherit, pi, version);
                valid = RecurseMovesForOrigin(value, count - 1);
            }

            if (!valid)
            {
                CleanResult(value.Actual, value.Possible);
            }
            return(value.Actual);
        }
        private static Learnset GetDeoxysLearn3(int form, GameVersion ver = Any)
        {
            if (ver == Any)
            {
                switch (form)
                {
                case 0: return(LevelUpRS[386]);   // Normal

                case 1: return(LevelUpFR[386]);   // Attack

                case 2: return(LevelUpLG[386]);   // Defense

                case 3: return(LevelUpE[386]);    // Speed

                default: return(null);
                }
            }

            var gen = ver.GetGeneration();

            if (gen != 3)
            {
                return(GetDeoxysLearn3(form));
            }
            return(GameData.GetLearnsets(ver)[386]);
        }
        private static int[] GetEncounterMoves2(int species, int level, GameVersion version)
        {
            var learn = GameData.GetLearnsets(version);
            var table = GameData.GetPersonal(version);
            var index = table.GetFormeIndex(species, 0);
            var lvl0  = learn[species].GetEncounterMoves(1);
            int start = Math.Max(0, Array.FindIndex(lvl0, z => z == 0));

            return(learn[index].GetEncounterMoves(level, lvl0, start));
        }
        public static int[] GetEncounterMoves(int species, int form, int level, GameVersion version)
        {
            if (RBY.Contains(version))
            {
                return(GetEncounterMoves1(species, level, version));
            }
            if (GSC.Contains(version))
            {
                return(GetEncounterMoves2(species, level, version));
            }
            var learn = GameData.GetLearnsets(version);
            var table = GameData.GetPersonal(version);
            var index = table.GetFormeIndex(species, form);

            return(learn[index].GetEncounterMoves(level));
        }
Пример #5
0
        public static EggSource6[] Validate(int generation, int species, int form, GameVersion version, ReadOnlySpan <int> moves, out bool valid)
        {
            var count = moves.IndexOf(0);

            if (count == 0)
            {
                valid = false; // empty moveset
                return(Array.Empty <EggSource6>());
            }
            if (count == -1)
            {
                count = moves.Length;
            }

            var learn    = GameData.GetLearnsets(version);
            var table    = GameData.GetPersonal(version);
            var index    = table.GetFormIndex(species, form);
            var learnset = learn[index];
            var egg      = MoveEgg.GetEggMoves(generation, species, form, version);

            var         actual   = new EggSource6[count];
            Span <byte> possible = stackalloc byte[count];
            var         value    = new BreedInfo <EggSource6>(actual, possible, learnset, moves, level);

            if (species is (int)Species.Pichu && moves[count - 1] is (int)Move.VoltTackle)
            {
                actual[--count] = VoltTackle;
            }

            if (count == 0)
            {
                valid = VerifyBaseMoves(value);
            }
            else
            {
                bool inherit = Breeding.GetCanInheritMoves(species);
                MarkMovesForOrigin(value, egg, count, inherit);
                valid = RecurseMovesForOrigin(value, count - 1);
            }

            if (!valid)
            {
                CleanResult(actual, possible);
            }
            return(value.Actual);
        }
Пример #6
0
        public static EggSource34[] Validate(int species, GameVersion version, int[] moves, out bool valid)
        {
            var count = Array.IndexOf(moves, 0);

            if (count == 0)
            {
                valid = false; // empty moveset
                return(Array.Empty <EggSource34>());
            }
            if (count == -1)
            {
                count = moves.Length;
            }

            var learn    = GameData.GetLearnsets(version);
            var table    = GameData.GetPersonal(version);
            var learnset = learn[species];
            var pi       = table[species];
            var egg      = Legal.EggMovesRS[species].Moves;

            var value = new BreedInfo <EggSource34>(count, learnset, moves, level);

            if (species is (int)Species.Pichu && moves[count - 1] is (int)Move.VoltTackle && version == GameVersion.E)
            {
                value.Actual[--count] = VoltTackle;
            }

            if (count == 0)
            {
                valid = VerifyBaseMoves(value);
            }
            else
            {
                bool inherit = Breeding.GetCanInheritMoves(species);
                MarkMovesForOrigin(value, egg, count, inherit, pi);
                valid = RecurseMovesForOrigin(value, count - 1);
            }

            if (!valid)
            {
                CleanResult(value.Actual, value.Possible);
            }
            return(value.Actual);
        }
Пример #7
0
        public static EggSource34[] Validate(int species, GameVersion version, ReadOnlySpan <int> moves, out bool valid)
        {
            var count = moves.IndexOf(0);

            if (count == 0)
            {
                valid = false; // empty moveset
                return(Array.Empty <EggSource34>());
            }
            if (count == -1)
            {
                count = moves.Length;
            }

            var learn    = GameData.GetLearnsets(version);
            var table    = GameData.GetPersonal(version);
            var learnset = learn[species];
            var pi       = table[species];
            var egg      = (version is HG or SS ? Legal.EggMovesHGSS : Legal.EggMovesDPPt)[species].Moves;
Пример #8
0
        public static EggSource6[] Validate(int generation, int species, int form, GameVersion version, int[] moves, out bool valid)
        {
            var count = Array.IndexOf(moves, 0);

            if (count == 0)
            {
                valid = false; // empty moveset
                return(Array.Empty <EggSource6>());
            }
            if (count == -1)
            {
                count = moves.Length;
            }

            var learn    = GameData.GetLearnsets(version);
            var table    = GameData.GetPersonal(version);
            var index    = table.GetFormIndex(species, form);
            var learnset = learn[index];
            var egg      = MoveEgg.GetEggMoves(generation, species, form, version);

            var value = new BreedInfo <EggSource6>(count, learnset, moves, 1);

            if (moves[count - 1] is (int)Move.VoltTackle)
            {
                if (--count == 0)
                {
                    valid = false; // must have base moves; sanity check
                    return(Array.Empty <EggSource6>());
                }
                value.Actual[count] = VoltTackle;
            }

            bool inherit = Breeding.GetCanInheritMoves(species);

            MarkMovesForOrigin(value, egg, count, inherit);

            valid = RecurseMovesForOrigin(value, count - 1);
            return(value.Actual);
        }
Пример #9
0
        public static EggSource5[] Validate(int species, GameVersion version, int[] moves, out bool valid)
        {
            var count = Array.IndexOf(moves, 0);

            if (count == 0)
            {
                valid = false; // empty moveset
                return(Array.Empty <EggSource5>());
            }
            if (count == -1)
            {
                count = moves.Length;
            }

            var learn    = GameData.GetLearnsets(version);
            var table    = GameData.GetPersonal(version);
            var learnset = learn[species];
            var pi       = table[species];
            var egg      = Legal.EggMovesBW[species].Moves;

            var value = new BreedInfo <EggSource5>(count, learnset, moves, level);

            if (moves[count - 1] is (int)Move.VoltTackle)
            {
                if (--count == 0)
                {
                    valid = false; // must have base moves; sanity check
                    return(Array.Empty <EggSource5>());
                }
                value.Actual[count] = VoltTackle;
            }

            bool inherit = Breeding.GetCanInheritMoves(species);

            MarkMovesForOrigin(value, egg, count, inherit, pi);

            valid = RecurseMovesForOrigin(value, count - 1);
            return(value.Actual);
        }