Пример #1
0
        public static EncounterStatic GetSuggestedMetInfo(PKM pkm)
        {
            if (pkm == null)
            {
                return(null);
            }

            int loc = GetSuggestedTransferLocation(pkm);

            if (pkm.WasEgg)
            {
                return(GetSuggestedEncounterEgg(pkm, loc));
            }

            var w = EncounterGenerator.GetCaptureLocation(pkm);

            if (w != null)
            {
                return(GetSuggestedEncounterWild(w, loc));
            }

            var s = EncounterGenerator.GetStaticLocation(pkm);

            if (s != null)
            {
                return(GetSuggestedEncounterStatic(s, loc));
            }

            return(null);
        }
Пример #2
0
        public EncounterStatic GetSuggestedMetInfo()
        {
            if (pkm == null)
            {
                return(null);
            }

            int loc = GetSuggestedTransferLocation(pkm);

            if (pkm.WasEgg)
            {
                int lvl = 1; // gen5+
                if (!pkm.IsNative)
                {
                    lvl = pkm.CurrentLevel; // be generous with transfer conditions
                }
                else if (pkm.Format < 5)    // and native
                {
                    lvl = 0;
                }
                return(new EncounterStatic
                {
                    Species = Legal.GetBaseSpecies(pkm),
                    Location = loc != -1 ? loc : GetSuggestedEggMetLocation(pkm),
                    Level = lvl,
                });
            }

            var area = EncounterGenerator.GetCaptureLocation(pkm);

            if (area != null)
            {
                var slots = area.Slots.OrderBy(s => s.LevelMin);
                return(new EncounterStatic
                {
                    Species = slots.First().Species,
                    Location = loc != -1 ? loc : area.Location,
                    Level = slots.First().LevelMin,
                });
            }

            var encounter = EncounterGenerator.GetStaticLocation(pkm);

            if (loc != -1 && encounter != null)
            {
                encounter.Location = loc;
            }
            return(encounter);
        }