Пример #1
0
        private static void ParseShedinjaEvolveMoves(PKM pkm, IList <CheckMoveResult> res, int[] moves)
        {
            List <int>[] ShedinjaEvoMoves        = Legal.GetShedinjaEvolveMoves(pkm);
            var          ShedinjaEvoMovesLearned = new List <int>();

            for (int gen = Math.Min(pkm.Format, 4); gen >= 3; gen--)
            {
                bool native = gen == pkm.Format;
                for (int m = 0; m < 4; m++)
                {
                    if (res[m]?.Valid ?? false)
                    {
                        continue;
                    }

                    if (!ShedinjaEvoMoves[gen].Contains(moves[m]))
                    {
                        continue;
                    }

                    res[m] = new CheckMoveResult(MoveSource.ShedinjaEvo, gen, Severity.Valid, native ? V355 : string.Format(V356, gen), CheckIdentifier.Move);
                    ShedinjaEvoMovesLearned.Add(m);
                }
            }

            if (ShedinjaEvoMovesLearned.Count <= 1)
            {
                return;
            }

            foreach (int m in ShedinjaEvoMovesLearned)
            {
                res[m] = new CheckMoveResult(res[m], Severity.Invalid, V357, CheckIdentifier.Move);
            }
        }
Пример #2
0
        private static void ParseShedinjaEvolveMoves(PKM pkm, IList <CheckMoveResult> res, int[] moves)
        {
            var ShedinjaEvoMovesLearned = new List <int>();

            for (int gen = Math.Min(pkm.Format, 4); gen >= 3; gen--)
            {
                var  ninjaskMoves = Legal.GetShedinjaEvolveMoves(pkm, generation: gen);
                bool native       = gen == pkm.Format;
                for (int m = 0; m < 4; m++)
                {
                    if (IsCheckValid(res[m])) // already validated
                    {
                        continue;
                    }

                    if (!ninjaskMoves.Contains(moves[m]))
                    {
                        continue;
                    }

                    res[m] = new CheckMoveResult(MoveSource.ShedinjaEvo, gen, Severity.Valid, native ? V355 : string.Format(V356, gen), CheckIdentifier.Move);
                    ShedinjaEvoMovesLearned.Add(m);
                }
            }

            if (ShedinjaEvoMovesLearned.Count == 0)
            {
                return;
            }
            if (ShedinjaEvoMovesLearned.Count > 1)
            {
                // Can't have more than one Ninjask exclusive move on Shedinja
                foreach (int m in ShedinjaEvoMovesLearned)
                {
                    res[m] = new CheckMoveResult(res[m], Severity.Invalid, V357, CheckIdentifier.Move);
                }
                return;
            }

            // Double check that the Ninjask move level isn't less than any Nincada move level
            int move   = ShedinjaEvoMovesLearned[0];
            int g      = res[move].Generation;
            int levelJ = Legal.GetShedinjaMoveLevel(291, moves[move], g);

            for (int m = 0; m < 4; m++)
            {
                if (m != move)
                {
                    continue;
                }
                if (res[m].Source != MoveSource.LevelUp)
                {
                    continue;
                }
                int levelS = Legal.GetShedinjaMoveLevel(292, moves[m], res[m].Generation);
                if (levelS > 0)
                {
                    continue;
                }

                int levelN = Legal.GetShedinjaMoveLevel(290, moves[m], res[m].Generation);
                if (levelN > levelJ)
                {
                    res[m] = new CheckMoveResult(res[m], Severity.Invalid, string.Format(V366, SpeciesStrings[290], SpeciesStrings[291]), CheckIdentifier.Move);
                }
            }
        }
Пример #3
0
        private static void ParseShedinjaEvolveMoves(PKM pkm, IList <CheckMoveResult> res, int[] moves, IReadOnlyList <IReadOnlyList <EvoCriteria> > evos)
        {
            var ShedinjaEvoMovesLearned = new List <int>();
            var format = pkm.Format;

            for (int gen = Math.Min(format, 4); gen >= 3; gen--)
            {
                if (evos[gen].Count != 2)
                {
                    continue; // Was not evolved in this generation
                }
                if (gen == 4 && pkm.Ball != 4)
                {
                    continue; // Was definitively evolved in Gen3
                }
                var  maxLevel     = pkm.CurrentLevel;
                var  ninjaskMoves = Legal.GetShedinjaEvolveMoves(pkm, gen, maxLevel);
                bool native       = gen == format;
                for (int m = 0; m < 4; m++)
                {
                    if (IsCheckValid(res[m])) // already validated
                    {
                        continue;
                    }

                    if (!ninjaskMoves.Contains(moves[m]))
                    {
                        continue;
                    }

                    var msg = native ? LMoveNincadaEvo : string.Format(LMoveNincadaEvoF_0, gen);
                    res[m] = new CheckMoveResult(ShedinjaEvo, gen, Valid, msg, Move);
                    ShedinjaEvoMovesLearned.Add(m);
                }
            }

            if (ShedinjaEvoMovesLearned.Count == 0)
            {
                return;
            }
            if (ShedinjaEvoMovesLearned.Count > 1)
            {
                // Can't have more than one Ninjask exclusive move on Shedinja
                foreach (int m in ShedinjaEvoMovesLearned)
                {
                    res[m] = new CheckMoveResult(res[m], Invalid, LMoveNincada, Move);
                }
                return;
            }

            // Double check that the Ninjask move level isn't less than any Nincada move level
            int move   = ShedinjaEvoMovesLearned[0];
            int g      = res[move].Generation;
            int levelJ = Legal.GetShedinjaMoveLevel((int)Species.Ninjask, moves[move], g);

            for (int m = 0; m < 4; m++)
            {
                if (m != move)
                {
                    continue;
                }
                if (res[m].Source != LevelUp)
                {
                    continue;
                }
                int levelS = Legal.GetShedinjaMoveLevel((int)Species.Shedinja, moves[m], res[m].Generation);
                if (levelS > 0)
                {
                    continue;
                }

                int levelN = Legal.GetShedinjaMoveLevel((int)Species.Nincada, moves[m], res[m].Generation);
                if (levelN > levelJ)
                {
                    res[m] = new CheckMoveResult(res[m], Invalid, string.Format(LMoveEvoFHigher, SpeciesStrings[(int)Species.Nincada], SpeciesStrings[(int)Species.Ninjask]), Move);
                }
            }
        }