Example #1
0
        private static void MarkSlotDetails(PKM pkm, EncounterSlot6AO slot, EvoCriteria evo)
        {
            if (slot.LevelMin > evo.MinLevel)
            {
                slot.WhiteFlute = true;
            }
            if (slot.LevelMax + 1 <= evo.MinLevel && evo.MinLevel <= slot.LevelMax + FluteBoostMax)
            {
                slot.BlackFlute = true;
            }

            if (!slot.CanDexNav)
            {
                return;
            }

            if (slot.LevelMax != evo.MinLevel)
            {
                slot.DexNav = true;
            }
            if (pkm.RelearnMove1 != 0 || pkm.AbilityNumber == 4)
            {
                slot.DexNav = true;
            }
        }
Example #2
0
        public List <EvoCriteria> GetExplicitLineage(PKM pkm, int maxLevel, bool skipChecks, int maxSpeciesTree, int maxSpeciesOrigin, int minLevel)
        {
            int lvl   = maxLevel;
            var first = new EvoCriteria {
                Species = pkm.Species, Level = lvl, Form = pkm.AltForm
            };
            var dl = new List <EvoCriteria>(3)
            {
                first
            };

            for (int i = Chain.Count - 1; i >= 0; i--) // reverse evolution!
            {
                bool oneValid = false;
                foreach (var evo in Chain[i])
                {
                    if (!evo.Valid(pkm, lvl, skipChecks))
                    {
                        continue;
                    }

                    if (evo.RequiresLevelUp && minLevel >= lvl)
                    {
                        break; // impossible evolution
                    }
                    oneValid = true;
                    UpdateMinValues(dl, evo);
                    int species = evo.Species;

                    if (evo.RequiresLevelUp)
                    {
                        lvl--;
                    }
                    dl.Add(evo.GetEvoCriteria(species, lvl));
                    break;
                }
                if (!oneValid)
                {
                    break;
                }
            }

            // Remove future gen pre-evolutions; no Munchlax from a Gen3 Snorlax, no Pichu from a Gen1-only Raichu, etc
            var last = dl[dl.Count - 1];

            if (last.Species > maxSpeciesOrigin && dl.Any(d => d.Species <= maxSpeciesOrigin))
            {
                dl.RemoveAt(dl.Count - 1);
            }

            // Last species is the wild/hatched species, the minimum level is 1 because it has not evolved from previous species
            last               = dl[dl.Count - 1];
            last.MinLevel      = 1;
            last.RequiresLvlUp = false;
            return(dl);
        }
Example #3
0
        private static EvoCriteria[][] GetAllEmpty(int count)
        {
            var result = new EvoCriteria[count][];

            for (int i = 0; i < result.Length; i++)
            {
                result[i] = NONE; // default no-evolutions
            }
            return(result);
        }
Example #4
0
        private static EvoCriteria[][] GetChainBase(int maxgen)
        {
            var GensEvoChains = new EvoCriteria[maxgen + 1][];

            for (int i = 0; i <= maxgen; i++)
            {
                GensEvoChains[i] = NONE; // default no-evolutions
            }
            return(GensEvoChains);
        }
Example #5
0
File: Core.cs Project: LLNet/PKHeX
 private static int GetEvoMoveMinLevel1(PKM pkm, int Generation, int minLvLG1, EvoCriteria evo)
 {
     // Return moves from minLvLG1 if species if the species encounters
     // For evolutions return moves using evolution min level as min level
     if (Generation != 1)
     {
         return(1);
     }
     if (evo.MinLevel > 1)
     {
         return(Math.Min(pkm.CurrentLevel, evo.MinLevel));
     }
     return(minLvLG1);
 }
Example #6
0
File: Core.cs Project: LLNet/PKHeX
        private static IEnumerable <int> GetEvoMoves(PKM pkm, GameVersion Version, IReadOnlyList <EvoCriteria> vs, int Generation, int minLvLG1, int minLvLG2, bool LVL, bool Tutor, bool Machine, bool MoveReminder, bool RemoveTransferHM, bool moveTutor, int i, EvoCriteria evo)
        {
            int minlvlevo1 = GetEvoMoveMinLevel1(pkm, Generation, minLvLG1, evo);
            int minlvlevo2 = GetEvoMoveMinLevel2(pkm, Generation, minLvLG2, evo);
            var maxLevel   = evo.Level;

            if (i != 0 && vs[i - 1].RequiresLvlUp) // evolution
            {
                ++maxLevel;                        // allow lvlmoves from the level it evolved to the next species
            }
            return(GetMoves(pkm, evo.Species, minlvlevo1, minlvlevo2, maxLevel, pkm.AltForm, Tutor, Version, LVL, moveTutor, Machine, MoveReminder, RemoveTransferHM, Generation));
        }
Example #7
0
File: Core.cs Project: LLNet/PKHeX
 internal static bool IsTradeEvolved(EvoCriteria z) => EvolutionMethod.TradeMethods.Contains(z.Method);
Example #8
0
File: Core.cs Project: LLNet/PKHeX
 private static int GetEvoMoveMinLevel2(PKM pkm, int Generation, int minLvLG2, EvoCriteria evo)
 {
     if (Generation != 2 || ParseSettings.AllowGen2MoveReminder(pkm))
     {
         return(1);
     }
     if (evo.MinLevel > 1)
     {
         return(Math.Min(pkm.CurrentLevel, evo.MinLevel));
     }
     return(minLvLG2);
 }
Example #9
0
 private static int GetEvoMoveMinLevel2(PKM pkm, int generation, int minLvLG2, EvoCriteria evo)
 {
     if (generation != 2 || ParseSettings.AllowGen2MoveReminder(pkm))
     {
         return(1);
     }
     // For evolutions, return the lower of the two; current level should legally be >=
     if (evo.MinLevel > 1)
     {
         return(Math.Min(pkm.CurrentLevel, evo.MinLevel));
     }
     return(minLvLG2);
 }
Example #10
0
 /// <summary>
 /// Returns the minimum level the move can be learned at based on the species encounter level.
 /// </summary>
 private static int GetEvoMoveMinLevel1(PKM pkm, int generation, int minLvLG1, EvoCriteria evo)
 {
     if (generation != 1)
     {
         return(1);
     }
     // For evolutions, return the lower of the two; current level should legally be >=
     if (evo.MinLevel > 1)
     {
         return(Math.Min(pkm.CurrentLevel, evo.MinLevel));
     }
     return(minLvLG1);
 }
Example #11
0
        public List <EvoCriteria> GetExplicitLineage(PKM pkm, int maxLevel, bool skipChecks, int maxSpeciesTree, int maxSpeciesOrigin, int minLevel)
        {
            int lvl   = maxLevel;
            var first = new EvoCriteria {
                Species = pkm.Species, Level = lvl, Form = pkm.AltForm
            };
            var dl = new List <EvoCriteria> {
                first
            };

            for (int i = Chain.Count - 1; i >= 0; i--) // reverse evolution!
            {
                bool oneValid = false;
                foreach (var evo in Chain[i].StageEntryMethods)
                {
                    if (!evo.Valid(pkm, lvl, skipChecks))
                    {
                        continue;
                    }

                    if (evo.RequiresLevelUp && minLevel >= lvl)
                    {
                        break; // impossible evolution
                    }
                    oneValid = true;
                    UpdateMinValues(dl, evo);
                    int species = evo.Species;

                    // Gen7 Personal Formes -- unmap the forme personal entry ID to the actual species ID since species are consecutive
                    if (evo.Species > maxSpeciesTree)
                    {
                        species = pkm.Species - Chain.Count + i;
                    }

                    if (evo.RequiresLevelUp)
                    {
                        lvl--;
                    }
                    dl.Add(evo.GetEvoCriteria(species, lvl));
                    break;
                }
                if (!oneValid)
                {
                    break;
                }
            }

            // Remove future gen preevolutions, no munchlax in a gen3 snorlax, no pichu in a gen1 vc raichu, etc
            var last = dl[dl.Count - 1];

            if (last.Species > maxSpeciesOrigin && dl.Any(d => d.Species <= maxSpeciesOrigin))
            {
                dl.RemoveAt(dl.Count - 1);
            }

            // Last species is the wild/hatched species, the minimum is 1 because it has not evolved from previous species
            last               = dl[dl.Count - 1];
            last.MinLevel      = 1;
            last.RequiresLvlUp = false;
            return(dl);
        }