Exemplo n.º 1
0
        /// <summary>
        /// Sets the <see cref="PKM.Met_Location"/> (and other met details) based on a legality check's suggestions.
        /// </summary>
        /// <param name="pk"></param>
        public static void SetSuggestedMetLocation(this PKM pk)
        {
            var encounter = EncounterSuggestion.GetSuggestedMetInfo(pk);

            if (encounter == null || (pk.Format >= 3 && encounter.Location < 0))
            {
                return;
            }

            int level    = encounter.LevelMin;
            int location = encounter.Location;
            int minlvl   = EncounterSuggestion.GetLowestLevel(pk, encounter.Species);

            if (minlvl == 0)
            {
                minlvl = level;
            }

            if (pk.CurrentLevel >= minlvl && pk.Met_Level == level && pk.Met_Location == location)
            {
                return;
            }
            if (minlvl < level)
            {
                level = minlvl;
            }
            pk.Met_Location = location;
            pk.Met_Level    = level;
        }
Exemplo n.º 2
0
        public static void SetMetValid(PKM pkm)
        {
            var encounter = EncounterSuggestion.GetSuggestedMetInfo(pkm);

            if (encounter == null || pkm.Format >= 3 && encounter.Location < 0)
            {
                return;
            }

            int level    = encounter.LevelMin;
            int location = encounter.Location;
            int minlvl   = EncounterSuggestion.GetLowestLevel(pkm, encounter.LevelMin);

            if (minlvl == 0)
            {
                minlvl = level;
            }
            if (pkm.CurrentLevel >= minlvl && pkm.Met_Level == level && pkm.Met_Location == location)
            {
                return;
            }
            if (minlvl < level)
            {
                minlvl = level;
            }

            if (pkm.Format >= 3)
            {
                pkm.Met_Location = location;
                pkm.Met_Level    = encounter.GetSuggestedMetLevel(pkm);
                // 相遇地点狩猎区
                int pkmLocation = pkm.Met_Location;
                if (pkmLocation == 52 || pkmLocation == 57 || pkmLocation == 136 || pkmLocation == 202)
                {
                    pkm.Ball = 5;
                }
                if (pkm.Ball == 5 && pkmLocation != 52 && pkmLocation != 57 && pkmLocation != 136 && pkmLocation != 202)
                {
                    pkm.Ball = 1;
                }

                if (pkm.Gen6 && pkm.WasEgg)
                {
                    pkm.SetHatchMemory6();
                }
            }

            if (pkm.CurrentLevel < minlvl)
            {
                pkm.CurrentLevel = minlvl;
            }
        }
Exemplo n.º 3
0
    public static ModifyResult SetSuggestedMetData(BatchInfo info)
    {
        var pk        = info.Entity;
        var encounter = EncounterSuggestion.GetSuggestedMetInfo(pk);

        if (encounter == null)
        {
            return(ModifyResult.Error);
        }

        int level        = encounter.LevelMin;
        int location     = encounter.Location;
        int minimumLevel = EncounterSuggestion.GetLowestLevel(pk, encounter.LevelMin);

        pk.Met_Level    = level;
        pk.Met_Location = location;
        pk.CurrentLevel = Math.Max(minimumLevel, level);

        return(ModifyResult.Modified);
    }