Esempio n. 1
0
    private static void ParseMovesWasEggPreRelearn(PKM pk, CheckMoveResult[] parse, IReadOnlyList <int> currentMoves, LegalInfo info, EncounterEgg e)
    {
        // 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           = pk.PersonalInfo;
        var AllowLevelUp = !pi.Genderless && !(pi.OnlyMale && Breeding.MixedGenderBreeding.Contains(e.Species));
        int BaseLevel    = AllowLevelUp ? 100 : e.LevelMin;
        var LevelUp      = MoveList.GetBaseEggMoves(pk, e.Species, e.Form, e.Version, BaseLevel);

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

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

        if (info.Generation < 3 && pk.Format >= 7 && pk.VC1)
        {
            Egg = Array.FindAll(Egg, m => m <= Legal.MaxMoveID_1);
        }

        var specialMoves = e.CanHaveVoltTackle ? 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,
        };

        ParseMoves(pk, source, info, parse);
    }
Esempio n. 2
0
    internal static IEnumerable <int> GetValidRelearn(PKM pk, int species, int form, bool inheritlvlmoves, GameVersion version = Any)
    {
        int generation = pk.Generation;

        if (generation < 6)
        {
            return(Array.Empty <int>());
        }

        var r = new List <int>();

        r.AddRange(MoveEgg.GetRelearnLVLMoves(pk, species, form, 1, version));

        if (pk.Format == 6 && pk.Species != (int)Species.Meowstic)
        {
            form = 0;
        }

        r.AddRange(MoveEgg.GetEggMoves(pk.PersonalInfo, species, form, version, Math.Max(2, generation)));
        if (inheritlvlmoves)
        {
            r.AddRange(MoveEgg.GetRelearnLVLMoves(pk, species, form, 100, version));
        }
        return(r.Distinct());
    }
    private static IEnumerable <int> GetMovesForGeneration(PKM pk, EvoCriteria[] chain, int generation)
    {
        IEnumerable <int> moves = MoveList.GetValidMoves(pk, chain, generation);

        if (generation <= 2)
        {
            moves = moves.Concat(MoveList.GetValidMoves(pk, chain, generation, MoveSourceType.LevelUp));
        }
        if (pk.Format >= 8)
        {
            // Shared Egg Moves via daycare
            // Any egg move can be obtained
            moves = moves.Concat(MoveEgg.GetSharedEggMoves(pk, generation));

            // TR moves -- default logic checks the TR flags, so we need to add all possible ones here.
            if (!(pk.BDSP || pk.LA))
            {
                moves = moves.Concat(MoveTechnicalMachine.GetAllPossibleRecords(pk.Species, pk.Form));
            }
        }
        if (pk.Species == (int)Species.Shedinja)
        {
            // Leveling up Nincada in Gen3/4 levels up, evolves to Ninjask, applies moves for Ninjask, then spawns Shedinja with the current moveset.
            // Future games spawn the Shedinja before doing Ninjask moves, so this is a special case.
            // Can't get more than the evolved-at level move; >=2 special moves will get caught by the legality checker later.
            return(generation switch
            {
                3 => moves.Concat(Legal.LevelUpE [(int)Species.Ninjask].GetMoves(100, 20)),
                4 => moves.Concat(Legal.LevelUpPt[(int)Species.Ninjask].GetMoves(100, 20)),
                _ => moves,
            });
Esempio n. 4
0
    public static void CanLearnEggMoveBDSP(Species species, Move move)
    {
        MoveEgg.GetEggMoves(8, (int)species, 0, GameVersion.BD).Contains((int)move).Should().BeFalse();

        var pb8 = new PB8 {
            Species = (int)species
        };
        var encs = EncounterMovesetGenerator.GenerateEncounters(pb8, new[] { (int)move }, GameVersion.BD);

        encs.Any().Should().BeFalse("Unavailable until HOME update supports BD/SP.");
    }
Esempio n. 5
0
        protected override void SetFormatSpecificData(PKM pk)
        {
            var pk6 = (PK6)pk;

            if (CanDexNav)
            {
                var baseSpec = EvoBase.GetBaseSpecies(pk);
                var eggMoves = MoveEgg.GetEggMoves(pk, baseSpec.Species, baseSpec.Form, Version);
                if (eggMoves.Length > 0)
                {
                    pk6.RelearnMove1 = eggMoves[Util.Rand.Next(eggMoves.Length)];
                }
            }
            pk6.SetRandomMemory6();
        }
Esempio n. 6
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);
    }