コード例 #1
0
        public EggInfoSource(PKM pkm, EncounterEgg e)
        {
            // Eggs with special moves cannot inherit levelup moves as the current moves are predefined.
            AllowInherited = e.Species != 489 && e.Species != 490;

            // Level up moves can only be inherited if ditto is not the mother.
            bool AllowLevelUp = Legal.GetCanInheritMoves(e.Species);

            Base = Legal.GetBaseEggMoves(pkm, e.Species, e.Form, e.Version, e.Level);

            Egg     = MoveEgg.GetEggMoves(pkm, e.Species, e.Form, e.Version);
            LevelUp = AllowLevelUp
                ? Legal.GetBaseEggMoves(pkm, e.Species, e.Form, e.Version, 100).Except(Base).ToList()
                : (IReadOnlyList <int>)Array.Empty <int>();
            Tutor = e.Version == GameVersion.C
                ? MoveTutor.GetTutorMoves(pkm, e.Species, 0, false, 2).ToList()
                : (IReadOnlyList <int>)Array.Empty <int>();

            // Only TM/HM moves from the source game of the egg, not any other games from the same generation
            TMHM = MoveTechnicalMachine.GetTMHM(pkm, pkm.Species, pkm.AltForm, e.Generation, e.Version).ToList();

            // Non-Base moves that can magically appear in the regular movepool
            bool volt = (e.Generation > 3 || e.Version == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);

            if (volt)
            {
                Egg = Egg.ToList(); // array->list
                Egg.Add(344);       // Volt Tackle
            }
        }
コード例 #2
0
ファイル: EggInfoSource.cs プロジェクト: optizard/PKHeX
        public EggInfoSource(PKM pkm, IEnumerable <int> specialMoves, EncounterEgg e)
        {
            // Eggs with special moves cannot inherit levelup moves as the current moves are predefined.
            Special = specialMoves.Where(m => m != 0).ToList();
            bool notSpecial = Special.Count == 0;

            AllowInherited = notSpecial && !pkm.WasGiftEgg && pkm.Species != 489 && pkm.Species != 490;

            // Level up moves can only be inherited if ditto is not the mother.
            var  ratio        = pkm.PersonalInfo.Gender; // Genderless/Male Only (except a few) cannot inherit.
            bool AllowLevelUp = ratio > 0 && ratio < 255 || Legal.MixedGenderBreeding.Contains(e.Species);

            Base = Legal.GetBaseEggMoves(pkm, e.Species, e.Game, e.LevelMin).ToList();

            Egg     = Legal.GetEggMoves(pkm, e.Species, pkm.AltForm).ToList();
            LevelUp = AllowLevelUp
                ? Legal.GetBaseEggMoves(pkm, e.Species, e.Game, 100).Where(x => !Base.Contains(x)).ToList()
                : new List <int>();
            Tutor = e.Game == GameVersion.C
                ? Legal.GetTutorMoves(pkm, pkm.Species, pkm.AltForm, false, 2).ToList()
                : new List <int>();

            // Only TM/HM moves from the source game of the egg, not any other games from the same generation
            TMHM = Legal.GetTMHM(pkm, pkm.Species, pkm.AltForm, pkm.GenNumber, e.Game, false).ToList();

            // Non-Base moves that can magically appear in the regular movepool
            bool volt = notSpecial && (pkm.GenNumber > 3 || e.Game == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);

            if (volt)
            {
                Egg.Add(344); // Volt Tackle
            }
        }
コード例 #3
0
ファイル: EggInfoSource.cs プロジェクト: callummoffat/PKHeX
        public EggInfoSource(PKM pkm, IEnumerable <int> specialMoves, EncounterEgg e)
        {
            // Eggs with special moves cannot inherit levelup moves as the current moves are predefined.
            Special = specialMoves.Where(m => m != 0).ToList();
            bool notSpecial = Special.Count == 0;

            AllowInherited = notSpecial && !pkm.WasGiftEgg && pkm.Species != 489 && pkm.Species != 490;

            // Level up moves can only be inherited if ditto is not the mother.
            bool AllowLevelUp = Legal.GetCanInheritMoves(pkm, e);

            Base = Legal.GetBaseEggMoves(pkm, e.Species, e.Version, e.Level);

            Egg     = Legal.GetEggMoves(pkm, e.Species, pkm.AltForm, e.Version);
            LevelUp = AllowLevelUp
                ? Legal.GetBaseEggMoves(pkm, e.Species, e.Version, 100).Except(Base).ToList()
                : new List <int>();
            Tutor = e.Version == GameVersion.C
                ? MoveTutor.GetTutorMoves(pkm, pkm.Species, pkm.AltForm, false, 2).ToList()
                : new List <int>();

            // Only TM/HM moves from the source game of the egg, not any other games from the same generation
            TMHM = MoveTechnicalMachine.GetTMHM(pkm, pkm.Species, pkm.AltForm, pkm.GenNumber, e.Version).ToList();

            // Non-Base moves that can magically appear in the regular movepool
            bool volt = notSpecial && (pkm.GenNumber > 3 || e.Version == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);

            if (volt)
            {
                Egg.Add(344); // Volt Tackle
            }
        }
コード例 #4
0
ファイル: EncounterVerifier.cs プロジェクト: vvcln/PKHeX
 private static CheckResult VerifyEncounter(PKM pkm, LegalInfo info)
 {
     return(info.EncounterMatch switch
     {
         EncounterEgg _ => VerifyEncounterEgg(pkm),
         EncounterTrade t => VerifyEncounterTrade(pkm, t),
         EncounterSlot w => VerifyEncounterWild(pkm, w),
         EncounterStatic s => VerifyEncounterStatic(pkm, s),
         MysteryGift g => VerifyEncounterEvent(pkm, g),
         _ => new CheckResult(Severity.Invalid, LEncInvalid, CheckIdentifier.Encounter)
     });
コード例 #5
0
        public static CheckResult[] VerifyRelearn(PKM pkm, LegalInfo info)
        {
            if (info.Generation < 6 || (pkm is IBattleVersion v && v.BattleVersion != 0))
            {
                return(VerifyRelearnNone(pkm, info));
            }

            return(info.EncounterMatch switch
            {
                IRelearn s when s.Relearn.Count > 0 => VerifyRelearnSpecifiedMoveset(pkm, info, s.Relearn),
                EncounterEgg e => VerifyRelearnEggBase(pkm, info, e),
                EncounterSlot6AO z when pkm.RelearnMove1 != 0 && z.CanDexNav => VerifyRelearnDexNav(pkm, info),
                _ => VerifyRelearnNone(pkm, info)
            });
コード例 #6
0
        public static CheckResult[] VerifyRelearn(PKM pkm, IEncounterable enc)
        {
            if (enc.Generation < 6 || (pkm is IBattleVersion v && v.BattleVersion != 0))
            {
                return(VerifyRelearnNone(pkm));
            }

            return(enc switch
            {
                IRelearn s when s.Relearn.Count > 0 => VerifyRelearnSpecifiedMoveset(pkm, s.Relearn),
                EncounterEgg e => VerifyRelearnEggBase(pkm, e),
                EncounterSlot6AO z when pkm.RelearnMove1 != 0 && z.CanDexNav => VerifyRelearnDexNav(pkm),
                _ => VerifyRelearnNone(pkm)
            });
コード例 #7
0
        private static void FlagSplitbreedMoves(CheckResult[] res, int required, EncounterEgg e, PKM pkm)
        {
            var splitSpecies = Legal.GetBaseEggSpecies(pkm, e.SplitBreed ? 0 : 1);

            for (int i = required; i < 4; i++)
            {
                if (res[i] != null)
                {
                    continue;
                }

                string message = string.Format(V379, SpeciesStrings[splitSpecies], SpeciesStrings[e.Species]);
                res[i] = new CheckResult(Severity.Invalid, message, CheckIdentifier.RelearnMove);
            }
        }
コード例 #8
0
ファイル: VerifyRelearnMoves.cs プロジェクト: tools-env/PKHeX
        public static CheckResult[] VerifyRelearn(PKM pkm, LegalInfo info)
        {
            if (info.Generation < 6)
            {
                return(VerifyRelearnNone(pkm, info));
            }

            return(info.EncounterMatch switch
            {
                MysteryGift g => VerifyRelearnSpecifiedMoveset(pkm, info, g.RelearnMoves),
                EncounterStatic s when s.Relearn.Length > 0 => VerifyRelearnSpecifiedMoveset(pkm, info, s.Relearn),
                EncounterEgg e => VerifyRelearnEggBase(pkm, info, e),
                EncounterSlot z when pkm.RelearnMove1 != 0 && z.Permissions.DexNav && EncounterSlotGenerator.IsDexNavValid(pkm) => VerifyRelearnDexNav(pkm, info),
                _ => VerifyRelearnNone(pkm, info)
            });
コード例 #9
0
        private static void FlagSplitbreedMoves(CheckResult[] res, int required, EncounterEgg e, PKM pkm)
        {
            var other = e is EncounterEggSplit x ? x.OtherSpecies : Legal.GetBaseEggSpecies(pkm, 1);

            for (int i = required; i < 4; i++)
            {
                if (res[i] != null)
                {
                    continue;
                }

                string message = string.Format(LMoveEggFIncompatible0_1, SpeciesStrings[other], SpeciesStrings[e.Species]);
                res[i] = new CheckResult(Severity.Invalid, message, CheckIdentifier.RelearnMove);
            }
        }
コード例 #10
0
        private CheckResult VerifyBall(LegalityAnalysis data)
        {
            var EncounterMatch = data.EncounterMatch;
            var Info           = data.Info;

            // Fixed ball cases -- can be only one ball ever
            switch (EncounterMatch)
            {
            case MysteryGift g:
                return(VerifyBallMysteryGift(data, g));

            case EncounterTrade t:
                return(VerifyBallEquals(data, t.Ball));

            case EncounterStatic s when s.Gift:
                return(VerifyBallEquals(data, s.Ball));

            case EncounterSlot8GO _:     // Already a strict match
                return(GetResult(true));
            }

            // Capture / Inherit cases -- can be one of many balls
            var pkm = data.pkm;

            if (pkm.Species == (int)Species.Shedinja && data.EncounterMatch.Species != (int)Species.Shedinja) // Shedinja. For gen3, copy the ball from Nincada
            {
                // Only Gen3 origin Shedinja can copy the wild ball.
                // Evolution chains will indicate if it could have existed as Shedinja in Gen3.
                // The special move verifier has a similar check!
                if (Info.Generation != 3 || Info.EvoChainsAllGens[3].Count != 2)
                {
                    return(VerifyBallEquals(data, (int)Poke)); // Pokeball Only
                }
            }

            if (pkm.Ball == (int)Heavy && Legal.AlolanCaptureNoHeavyBall.Contains(EncounterMatch.Species) && !EncounterMatch.EggEncounter && pkm.SM)
            {
                return(GetInvalid(LBallHeavy)); // Heavy Ball, can inherit if from egg (USUM fixed catch rate calc)
            }
            return(EncounterMatch switch
            {
                EncounterStatic e => VerifyBallStatic(data, e),
                EncounterSlot w => VerifyBallWild(data, w),
                EncounterEgg _ => VerifyBallEgg(data),
                EncounterInvalid _ => VerifyBallEquals(data, pkm.Ball), // ignore ball, pass whatever
                _ => VerifyBallEquals(data, (int)Poke)
            });
コード例 #11
0
ファイル: VerifyRelearnMoves.cs プロジェクト: zekroman/PKHeX
        public static CheckMoveResult[] VerifyRelearn(PKM pkm, IEncounterTemplate enc, CheckMoveResult[] result)
        {
            if (ShouldNotHaveRelearnMoves(enc, pkm))
            {
                return(VerifyRelearnNone(pkm, result));
            }

            return(enc switch
            {
                IRelearn s when s.Relearn.Count != 0 => VerifyRelearnSpecifiedMoveset(pkm, s.Relearn, result),
                EncounterEgg e => VerifyEggMoveset(e, result, pkm.RelearnMoves),
                EncounterSlot6AO {
                    CanDexNav : true
                } z when pkm.RelearnMove1 != 0 => VerifyRelearnDexNav(pkm, result, z),
                EncounterSlot8b {
                    IsUnderground : true
                } u => VerifyRelearnUnderground(pkm, result, u),
                _ => VerifyRelearnNone(pkm, result),
            });
コード例 #12
0
        private static CheckResult[] VerifyRelearnEggBase(PKM pkm, LegalInfo info, EncounterEgg e)
        {
            int[]         RelearnMoves = pkm.RelearnMoves;
            CheckResult[] res          = new CheckResult[4];
            // Level up moves cannot be inherited if Ditto is the parent
            // that means genderless species and male only species except Nidoran and Volbeat (they breed with female nidoran and illumise) could not have level up moves as an egg
            bool inheritLvlMoves = Legal.GetCanInheritMoves(e.Species);

            // Obtain level1 moves
            var baseMoves = Legal.GetBaseEggMoves(pkm, e.Species, e.Version, 1);
            int baseCt    = Math.Min(4, baseMoves.Length);

            // Obtain Inherited moves
            var inheritMoves = Legal.GetValidRelearn(pkm, e.Species, inheritLvlMoves, e.Version).ToList();
            int reqBase      = GetRequiredBaseMoves(RelearnMoves, baseMoves, baseCt, inheritMoves);

            // Check if the required amount of Base Egg Moves are present.
            FlagBaseEggMoves(res, reqBase, baseMoves, RelearnMoves);

            // Non-Base moves that can magically appear in the regular movepool
            if (Legal.LightBall.Contains(pkm.Species))
            {
                inheritMoves.Add(344); // Volt Tackle
            }
            // If any splitbreed moves are invalid, flag accordingly
            var splitMoves = e is EncounterEggSplit s
                ? Legal.GetValidRelearn(pkm, s.OtherSpecies, inheritLvlMoves, e.Version).ToList()
                : (IReadOnlyList <int>)Array.Empty <int>();

            // Inherited moves appear after the required base moves.
            // If the pkm is capable of split-species breeding and any inherited move is from the other split scenario, flag accordingly.
            bool splitInvalid = FlagInvalidInheritedMoves(res, reqBase, RelearnMoves, inheritMoves, splitMoves);

            if (splitInvalid)
            {
                FlagSplitbreedMoves(res, reqBase, e, pkm);
            }

            info.RelearnBase = baseMoves;
            return(res);
        }
コード例 #13
0
ファイル: BallVerifier.cs プロジェクト: westtb/PKHeX
        private CheckResult VerifyBall(LegalityAnalysis data)
        {
            var EncounterMatch = data.EncounterMatch;
            var Info           = data.Info;

            // Fixed ball cases -- can be only one ball ever
            switch (EncounterMatch)
            {
            case MysteryGift g:
                return(VerifyBallMysteryGift(data, g));

            case EncounterTrade t:
                return(VerifyBallEquals(data, t.Ball));

            case EncounterStatic s when s.Gift:
                return(VerifyBallEquals(data, s.Ball));
            }

            // Capture / Inherit cases -- can be one of many balls
            var pkm = data.pkm;

            if (pkm.Species == (int)Species.Shedinja && Info.Generation != 3 && data.EncounterMatch.Species != (int)Species.Shedinja) // Shedinja. For gen3, copy the ball from Nincada
            {
                return(VerifyBallEquals(data, (int)Poke));                                                                            // Pokeball Only
            }
            if (pkm.Ball == (int)Heavy && Legal.AlolanCaptureNoHeavyBall.Contains(EncounterMatch.Species) && !EncounterMatch.EggEncounter && pkm.SM)
            {
                return(GetInvalid(LBallHeavy)); // Heavy Ball, can inherit if from egg (USUM fixed catch rate calc)
            }
            return(EncounterMatch switch
            {
                EncounterStatic e => VerifyBallStatic(data, e),
                EncounterSlot w => VerifyBallWild(data, w),
                EncounterEgg _ => VerifyBallEgg(data),
                EncounterInvalid _ => VerifyBallEquals(data, pkm.Ball), // ignore ball, pass whatever
                _ => VerifyBallEquals(data, (int)Poke)
            });
コード例 #14
0
        private static CheckResult[] VerifyRelearnEggBase(PKM pkm, LegalInfo info, EncounterEgg e)
        {
            int[] RelearnMoves = pkm.RelearnMoves;
            info.RelearnBase = new int[4];
            CheckResult[] res = new CheckResult[4];
            // Level up moves could not be inherited if Ditto is parent,
            // that means genderless species and male only species except Nidoran and Volbet (they breed with female nidoran and illumise) could not have level up moves as an egg
            var inheritLvlMoves = pkm.PersonalInfo.Gender > 0 && pkm.PersonalInfo.Gender < 255 || Legal.MixedGenderBreeding.Contains(e.Species);

            // Obtain level1 moves
            List <int> baseMoves = new List <int>(Legal.GetBaseEggMoves(pkm, e.Species, e.Game, 1));
            int        baseCt    = baseMoves.Count;

            if (baseCt > 4)
            {
                baseCt = 4;
            }

            // Obtain Inherited moves
            var inheritMoves = Legal.GetValidRelearn(pkm, e.Species, inheritLvlMoves).ToList();
            var inherited    = RelearnMoves.Where(m => m != 0 && (!baseMoves.Contains(m) || inheritMoves.Contains(m))).ToList();
            int inheritCt    = inherited.Count;


            // Get required amount of base moves
            int unique  = baseMoves.Concat(inherited).Distinct().Count();
            int reqBase = inheritCt == 4 || baseCt + inheritCt > 4 ? 4 - inheritCt : baseCt;

            if (RelearnMoves.Where(m => m != 0).Count() < Math.Min(4, baseMoves.Count))
            {
                reqBase = Math.Min(4, unique);
            }

            // Check if the required amount of Base Egg Moves are present.
            for (int i = 0; i < reqBase; i++)
            {
                if (baseMoves.Contains(RelearnMoves[i]))
                {
                    res[i] = new CheckResult(Severity.Valid, V179, CheckIdentifier.RelearnMove);
                }
                else
                {
                    // mark remaining base egg moves missing
                    for (int z = i; z < reqBase; z++)
                    {
                        res[z] = new CheckResult(Severity.Invalid, V180, CheckIdentifier.RelearnMove);
                    }

                    // provide the list of suggested base moves for the last required slot
                    string em = string.Join(", ", baseMoves.Select(m => m >= MoveStrings.Length ? V190 : MoveStrings[m]));
                    res[reqBase - 1].Comment += string.Format(Environment.NewLine + V181, em);
                    break;
                }
            }

            // Non-Base moves that can magically appear in the regular movepool
            if (Legal.LightBall.Contains(pkm.Species))
            {
                inheritMoves.Add(344);
            }

            // Begin verification of moves

            // If any splitbreed moves are invalid, flag accordingly
            var splitInvalid = false;
            var splitMoves   = e.SplitBreed ? Legal.GetValidRelearn(pkm, Legal.GetBaseEggSpecies(pkm), inheritLvlMoves).ToList() : new List <int>();

            // Inherited moves appear after the required base moves.
            for (int i = reqBase; i < 4; i++)
            {
                if (RelearnMoves[i] == 0) // empty
                {
                    res[i] = new CheckResult(Severity.Valid, V167, CheckIdentifier.RelearnMove);
                }
                else if (inheritMoves.Contains(RelearnMoves[i])) // inherited
                {
                    res[i] = new CheckResult(Severity.Valid, V172, CheckIdentifier.RelearnMove);
                }
                else if (e.SplitBreed && splitMoves.Contains(RelearnMoves[i])) // inherited
                {
                    splitInvalid = true;
                }
                else // not inheritable, flag
                {
                    res[i] = new CheckResult(Severity.Invalid, V182, CheckIdentifier.RelearnMove);
                }
            }

            if (splitInvalid)
            {
                var splitSpecies = Legal.GetBaseEggSpecies(pkm);
                for (int i = reqBase; i < 4; i++)
                {
                    if (inheritMoves.Contains(RelearnMoves[i]) && !splitMoves.Contains(RelearnMoves[i]))
                    {
                        res[i] = new CheckResult(Severity.Invalid, string.Format(V379, SpeciesStrings[splitSpecies], SpeciesStrings[e.Species]), CheckIdentifier.RelearnMove);
                    }
                    if (!inheritMoves.Contains(RelearnMoves[i]) && splitMoves.Contains(RelearnMoves[i]))
                    {
                        res[i] = new CheckResult(Severity.Invalid, string.Format(V379, SpeciesStrings[e.Species], SpeciesStrings[splitSpecies]), CheckIdentifier.RelearnMove);
                    }
                }
            }

            info.RelearnBase = baseMoves.ToArray();
            return(res);
        }
コード例 #15
0
ファイル: VerifyCurrentMoves.cs プロジェクト: kang1806/PKHeX
        private static CheckMoveResult[] ParseMovesWasEggPreRelearn(PKM pkm, int[] Moves, LegalInfo info, EncounterEgg e)
        {
            var EventEggMoves = GetSpecialMoves(info.EncounterMatch);
            // Level up moves could not be inherited if Ditto is parent,
            // that means genderless species and male only species except Nidoran and Volbeat (they breed with female nidoran and illumise) could not have level up moves as an egg
            var AllowLevelUp = (pkm.PersonalInfo.Gender > 0 && pkm.PersonalInfo.Gender < 255) || Legal.MixedGenderBreeding.Contains(e.Species);
            int BaseLevel    = AllowLevelUp ? 100 : e.LevelMin;
            var LevelUp      = Legal.GetBaseEggMoves(pkm, e.Species, e.Version, BaseLevel);

            var TradebackPreevo      = pkm.Format == 2 && info.EncounterMatch.Species > 151;
            var NonTradebackLvlMoves = TradebackPreevo
                ? Legal.GetExclusivePreEvolutionMoves(pkm, info.EncounterMatch.Species, info.EvoChainsAllGens[2], 2, e.Version).Where(m => m > Legal.MaxMoveID_1).ToArray()
                : Array.Empty <int>();

            var Egg = MoveEgg.GetEggMoves(pkm, e.Species, pkm.AltForm, e.Version);

            if (info.Generation < 3 && pkm.Format >= 7 && pkm.VC1)
            {
                Egg = Egg.Where(m => m <= Legal.MaxMoveID_1).ToArray();
            }

            bool volt    = (info.Generation > 3 || e.Version == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
            var  Special = volt && EventEggMoves.Length == 0 ? new[] { 344 } : Array.Empty <int>(); // Volt Tackle for bred Pichu line

            var source = new MoveParseSource
            {
                CurrentMoves             = Moves,
                SpecialSource            = Special,
                NonTradeBackLevelUpMoves = NonTradebackLvlMoves,

                EggLevelUpSource = LevelUp,
                EggMoveSource    = Egg,
                EggEventSource   = EventEggMoves,
            };

            return(ParseMoves(pkm, source, info));
        }
コード例 #16
0
ファイル: VerifyCurrentMoves.cs プロジェクト: kang1806/PKHeX
        private static CheckMoveResult[] ParseMovesIsEggPreRelearn(PKM pkm, int[] Moves, int[] SpecialMoves, EncounterEgg e)
        {
            EggInfoSource infoset = new EggInfoSource(pkm, SpecialMoves, e);

            return(VerifyPreRelearnEggBase(pkm, Moves, infoset));
        }
コード例 #17
0
ファイル: VerifyCurrentMoves.cs プロジェクト: rv2900/PKHeX
        private static CheckMoveResult[] ParseMovesIsEggPreRelearn(PKM pkm, IReadOnlyList <int> currentMoves, EncounterEgg e)
        {
            var infoset = new EggInfoSource(pkm, e);

            return(VerifyPreRelearnEggBase(pkm, currentMoves, infoset));
        }
コード例 #18
0
        private static bool FlagInvalidInheritedMoves(CheckResult[] res, int required, EncounterEgg e, IReadOnlyList <int> RelearnMoves, IReadOnlyList <int> inheritMoves, IReadOnlyList <int> splitMoves)
        {
            bool splitInvalid = false;

            for (int i = required; i < 4; i++)
            {
                if (RelearnMoves[i] == 0) // empty
                {
                    res[i] = new CheckResult(Severity.Valid, V167, CheckIdentifier.RelearnMove);
                }
                else if (inheritMoves.Contains(RelearnMoves[i])) // inherited
                {
                    res[i] = new CheckResult(Severity.Valid, V172, CheckIdentifier.RelearnMove);
                }
                else if (e.SplitBreed && splitMoves.Contains(RelearnMoves[i])) // inherited
                {
                    splitInvalid = true;
                }
                else // not inheritable, flag
                {
                    res[i] = new CheckResult(Severity.Invalid, V182, CheckIdentifier.RelearnMove);
                }
            }

            return(splitInvalid);
        }
コード例 #19
0
        private static CheckMoveResult[] ParseMovesWasEggPreRelearn(PKM pkm, int[] Moves, LegalInfo info, EncounterEgg e)
        {
            var EventEggMoves = GetSpecialMoves(info.EncounterMatch);
            // Level up moves could not be inherited if Ditto is parent,
            // that means genderless species and male only species except Nidoran and Volbet (they breed with female nidoran and illumise) could not have level up moves as an egg
            var inheritLvlMoves      = pkm.PersonalInfo.Gender > 0 && pkm.PersonalInfo.Gender < 255 || Legal.MixedGenderBreeding.Contains(e.Species);
            int BaseLvlMoves         = inheritLvlMoves ? 100 : pkm.GenNumber <= 3 ? 5 : 1;
            var LvlupEggMoves        = Legal.GetBaseEggMoves(pkm, e.Species, e.Game, BaseLvlMoves);
            var TradebackPreevo      = pkm.Format == 2 && info.EncounterMatch.Species > 151;
            var NonTradebackLvlMoves = new int[0];

            if (TradebackPreevo)
            {
                NonTradebackLvlMoves = Legal.GetExclusivePreEvolutionMoves(pkm, info.EncounterMatch.Species, info.EvoChainsAllGens[2], 2, e.Game).Where(m => m > Legal.MaxMoveID_1).ToArray();
            }
            var EggMoves = Legal.GetEggMoves(pkm, e.Species, pkm.AltForm);

            bool volt         = (pkm.GenNumber > 3 || e.Game == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
            var  SpecialMoves = volt && EventEggMoves.Length == 0 ? new[] { 344 } : new int[0]; // Volt Tackle for bred Pichu line

            return(ParseMoves(pkm, Moves, SpecialMoves, LvlupEggMoves, EggMoves, NonTradebackLvlMoves, EventEggMoves, new int[0], info));
        }
コード例 #20
0
        private static CheckMoveResult[] ParseMovesIsEggPreRelearn(PKM pkm, int[] Moves, int[] SpecialMoves, bool allowinherited, EncounterEgg e)
        {
            CheckMoveResult[] res = new CheckMoveResult[4];

            var baseEggMoves = Legal.GetBaseEggMoves(pkm, e.Species, e.Game, pkm.GenNumber < 4 ? 5 : 1)?.ToList() ?? new List <int>();
            // Level up moves cannot be inherited if Ditto is parent, thus genderless/single gender species cannot have level up moves as an egg
            bool AllowLvlMoves     = pkm.PersonalInfo.Gender > 0 && pkm.PersonalInfo.Gender < 255 || Legal.MixedGenderBreeding.Contains(e.Species);
            var  InheritedLvlMoves = !AllowLvlMoves? new List <int>() : Legal.GetBaseEggMoves(pkm, e.Species, e.Game, 100)?.ToList() ?? new List <int>();

            InheritedLvlMoves.RemoveAll(x => baseEggMoves.Contains(x));

            var infoset = new MoveInfoSet
            {
                EggMoves       = Legal.GetEggMoves(pkm, e.Species, pkm.AltForm)?.ToList() ?? new List <int>(),
                TutorMoves     = e.Game == GameVersion.C ? Legal.GetTutorMoves(pkm, pkm.Species, pkm.AltForm, false, 2)?.ToList() : new List <int>(),
                TMHMMoves      = Legal.GetTMHM(pkm, pkm.Species, pkm.AltForm, pkm.GenNumber, e.Game, false)?.ToList(),
                LvlMoves       = InheritedLvlMoves,
                BaseMoves      = baseEggMoves,
                SpecialMoves   = SpecialMoves.Where(m => m != 0).ToList(),
                AllowInherited = allowinherited
            };

            // Only TM Hm moves from the source game of the egg, not any other games from the same generation

            if (pkm.Format > 2 || SpecialMoves.Any())
            {
                // For gen 2 is not possible to difference normal eggs from event eggs
                // If there is no special moves assume normal egg
                res = VerifyPreRelearnEggBase(pkm, Moves, infoset, e.Game);
            }
            else if (pkm.Format == 2)
            {
                infoset.SpecialMoves.Clear();
                infoset.AllowInherited = true;
                res = VerifyPreRelearnEggBase(pkm, Moves, infoset, e.Game);
            }

            return(res);
        }
コード例 #21
0
        private static CheckMoveResult[] ParseMovesWasEggPreRelearn(PKM pkm, IReadOnlyList <int> currentMoves, LegalInfo info, EncounterEgg e)
        {
            var  EventEggMoves = GetSpecialMoves(info.EncounterMatch);
            bool notEvent      = EventEggMoves.Count == 0;
            // Level up moves could not be inherited if Ditto is parent,
            // that means genderless species and male only species (except Nidoran-M and Volbeat; they breed with Nidoran-F and Illumise) could not have level up moves as an egg
            var pi           = pkm.PersonalInfo;
            var AllowLevelUp = notEvent && !pi.Genderless && !(pi.OnlyMale && Breeding.MixedGenderBreeding.Contains(e.Species));
            int BaseLevel    = AllowLevelUp ? 100 : e.LevelMin;
            var LevelUp      = MoveList.GetBaseEggMoves(pkm, e.Species, e.Form, e.Version, BaseLevel);

            var TradebackPreevo      = pkm.Format == 2 && info.EncounterMatch.Species > 151;
            var NonTradebackLvlMoves = TradebackPreevo
                ? MoveList.GetExclusivePreEvolutionMoves(pkm, info.EncounterMatch.Species, info.EvoChainsAllGens[2], 2, e.Version).Where(m => m > Legal.MaxMoveID_1).ToArray()
                : Array.Empty <int>();

            var Egg = MoveEgg.GetEggMoves(pkm.PersonalInfo, e.Species, e.Form, e.Version, e.Generation);

            if (info.Generation < 3 && pkm.Format >= 7 && pkm.VC1)
            {
                Egg = Egg.Where(m => m <= Legal.MaxMoveID_1).ToArray();
            }

            bool volt         = (info.Generation > 3 || e.Version == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
            var  specialMoves = volt && notEvent ? new[] { (int)Move.VoltTackle } : Array.Empty <int>(); // Volt Tackle for bred Pichu line

            var source = new MoveParseSource
            {
                CurrentMoves             = currentMoves,
                SpecialSource            = specialMoves,
                NonTradeBackLevelUpMoves = NonTradebackLvlMoves,

                EggLevelUpSource = LevelUp,
                EggMoveSource    = Egg,
                EggEventSource   = EventEggMoves,
            };

            return(ParseMoves(pkm, source, info));
        }