Beispiel #1
0
 public ValidEncounterMoves(PKM pkm, LegalInfo info)
 {
     MinimumLevelGen1 = pkm.GenNumber <= 2 ? info.EncounterMatch.LevelMin + 1 : 0;
     MinimumLevelGen2 = Legal.AllowGen2MoveReminder(pkm) ? 1 : info.EncounterMatch.LevelMin + 1;
     EncounterSpecies = info.EncounterMatch.Species;
     EvolutionChains  = info.EvoChainsAllGens;
     LevelUpMoves     = Legal.GetValidMovesAllGens(pkm, EvolutionChains, minLvLG1: MinimumLevelGen1, minLvLG2: MinimumLevelGen2, Tutor: false, Machine: false, RemoveTransferHM: false);
     TMHMMoves        = Legal.GetValidMovesAllGens(pkm, EvolutionChains, LVL: false, Tutor: false, MoveReminder: false, RemoveTransferHM: false);
     TutorMoves       = Legal.GetValidMovesAllGens(pkm, EvolutionChains, LVL: false, Machine: false, MoveReminder: false, RemoveTransferHM: false);
 }
Beispiel #2
0
        private static CheckMoveResult[] ParseMovesForEncounters(PKM pkm, LegalInfo info, GameVersion game, int[] Moves)
        {
            if (pkm.Species == 235)                              // special handling for Smeargle
            {
                return(ParseMovesForSmeargle(pkm, Moves, info)); // Smeargle can have any moves except a few
            }
            // Iterate over encounters
            bool pre3DS = info.Generation < 6;

            // gather valid moves for encounter species
            info.EncounterMoves = new ValidEncounterMoves(pkm, info);

            if (info.Generation <= 3)
            {
                pkm.WasEgg = info.EncounterMatch.EggEncounter;
            }

            var EncounterMatchGen   = info.EncounterMatch as IGeneration;
            var defaultG1LevelMoves = info.EncounterMoves.LevelUpMoves[1];
            var defaultG2LevelMoves = pkm.InhabitedGeneration(2) ? info.EncounterMoves.LevelUpMoves[2] : null;
            var defaultTradeback    = pkm.TradebackStatus;

            if (EncounterMatchGen != null)
            {
                // Generation 1 can have different minimum level in different encounter of the same species; update valid level moves
                UptateGen1LevelUpMoves(pkm, info.EncounterMoves, info.EncounterMoves.MinimumLevelGen1, EncounterMatchGen.Generation, info);

                // The same for Generation 2; if move reminder from Stadium 2 is not allowed
                if (!Legal.AllowGen2MoveReminder(pkm) && pkm.InhabitedGeneration(2))
                {
                    UptateGen2LevelUpMoves(pkm, info.EncounterMoves, info.EncounterMoves.MinimumLevelGen2, EncounterMatchGen.Generation, info);
                }
            }

            var res = pre3DS
                ? ParseMovesPre3DS(pkm, Moves, info)
                : ParseMoves3DS(pkm, Moves, info);

            if (res.All(x => x.Valid))
            {
                return(res);
            }

            if (EncounterMatchGen?.Generation == 1 || EncounterMatchGen?.Generation == 2) // not valid, restore generation 1 and 2 moves
            {
                info.EncounterMoves.LevelUpMoves[1] = defaultG1LevelMoves;
                if (pkm.InhabitedGeneration(2))
                {
                    info.EncounterMoves.LevelUpMoves[2] = defaultG2LevelMoves;
                }
            }
            pkm.TradebackStatus = defaultTradeback;
            return(res);
        }
Beispiel #3
0
        private static CheckMoveResult[] ParseMovesPre3DS(PKM pkm, int[] Moves, LegalInfo info)
        {
            if (pkm.IsEgg && info.EncounterMatch is EncounterEgg egg)
            {
                int[] SpecialMoves = GetSpecialMoves(info.EncounterMatch);
                return(ParseMovesIsEggPreRelearn(pkm, Moves, SpecialMoves, egg));
            }
            if (info.EncounterMatch is EncounterEgg e)
            {
                return(ParseMovesWasEggPreRelearn(pkm, Moves, info, e));
            }
            if (info.Generation <= 2 && info.EncounterMatch is IGeneration g && (g.Generation == 1 || (g.Generation == 2 && !Legal.AllowGen2MoveReminder(pkm)))) // fixed encounter moves without relearning
            {
                return(ParseMovesGenGB(pkm, Moves, info));
            }

            return(ParseMovesSpecialMoveset(pkm, Moves, info));
        }
Beispiel #4
0
        private static CheckMoveResult[] ParseMovesPre3DS(PKM pkm, int[] Moves, LegalInfo info)
        {
            if (pkm.IsEgg && info.EncounterMatch is EncounterEgg egg)
            {
                int[] SpecialMoves = GetSpecialMoves(info.EncounterMatch);
                return(ParseMovesIsEggPreRelearn(pkm, Moves, SpecialMoves, egg));
            }
            var NoMoveReminder = (info.EncounterMatch as IGeneration)?.Generation == 1 || (info.EncounterMatch as IGeneration)?.Generation == 2 && !Legal.AllowGen2MoveReminder(pkm);

            if (info.Generation <= 2 && NoMoveReminder)
            {
                return(ParseMovesGenGB(pkm, Moves, info));
            }
            if (info.EncounterMatch is EncounterEgg e)
            {
                return(ParseMovesWasEggPreRelearn(pkm, Moves, info, e));
            }

            return(ParseMovesSpecialMoveset(pkm, Moves, info));
        }