public static bool IsMoveRequiredToEvolve(int species, int format, int gen) { if (!SpeciesEvolutionWithMove.Contains(species)) { return(false); } if (format <= 3) { return(false); } if (BabyEvolutionWithMove.Contains(species)) { return(gen > 3); } return(true); }
internal static bool IsEvolutionValidWithMove(PKM pkm, LegalInfo info) { // Exclude species that do not evolve leveling with a move // Exclude gen 1-3 formats // Exclude Mr Mime and Snorlax for gen 1-3 games if (!SpeciesEvolutionWithMove.Contains(pkm.Species) || pkm.Format <= 3 || (BabyEvolutionWithMove.Contains(pkm.Species) && pkm.GenNumber <= 3)) { return(true); } var index = Array.FindIndex(SpeciesEvolutionWithMove, p => p == pkm.Species); var levels = MinLevelEvolutionWithMove[index]; var moves = MoveEvolutionWithMove[index]; var allowegg = EggMoveEvolutionWithMove[index][pkm.GenNumber]; // Get the minimum level in any generation when the pokemon could learn the evolve move var LearnLevel = 101; for (int g = pkm.GenNumber; g <= pkm.Format; g++) { if (pkm.InhabitedGeneration(g) && levels[g] > 0) { LearnLevel = Math.Min(LearnLevel, levels[g]); } } // Check also if the current encounter include the evolve move as an special move // That means the pokemon have the move from the encounter level if (info.EncounterMatch is IMoveset s && s.Moves?.Any(m => moves.Contains(m)) == true) { LearnLevel = Math.Min(LearnLevel, info.EncounterMatch.LevelMin); } // If the encounter is a player hatched egg check if the move could be an egg move or inherited level up move if (info.EncounterMatch.EggEncounter && !pkm.WasGiftEgg && !pkm.WasEventEgg && allowegg) { if (IsMoveInherited(pkm, info, moves)) { LearnLevel = Math.Min(LearnLevel, pkm.GenNumber < 4 ? 6 : 2); } } // If has original met location the minimum evolution level is one level after met level // Gen 3 pokemon in gen 4 games: minimum level is one level after transfer to generation 4 // VC pokemon: minimum level is one level after transfer to generation 7 // Sylveon: always one level after met level, for gen 4 and 5 eevees in gen 6 games minimum for evolution is one level after transfer to generation 5 if (pkm.HasOriginalMetLocation || (pkm.Format == 4 && pkm.Gen3) || pkm.VC || pkm.Species == 700) { LearnLevel = Math.Max(pkm.Met_Level + 1, LearnLevel); } // Current level must be at least one the minimum learn level // the level-up event that triggers the learning of the move also triggers evolution with no further level-up required return(pkm.CurrentLevel >= LearnLevel); }