Esempio n. 1
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());
    }
Esempio n. 2
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. 3
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. 4
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);
    }