private static void UpdateGen2LevelUpMoves(PKM pkm, ValidEncounterMoves EncounterMoves, int defaultLvlG2, int generation, LegalInfo info) { if (generation >= 3) { return; } var lvlG2 = info.EncounterMatch?.LevelMin + 1 ?? 6; if (lvlG2 == defaultLvlG2) { return; } EncounterMoves.LevelUpMoves[2] = Legal.GetValidMoves(pkm, info.EvoChainsAllGens[2], generation: 2, minLvLG2: defaultLvlG2, LVL: true, Tutor: false, Machine: false, MoveReminder: false).ToList(); }
private static void UptateGen1LevelUpMoves(PKM pkm, ValidEncounterMoves EncounterMoves, int defaultLvlG1, int generation, LegalInfo info) { switch (generation) { case 1: case 2: var lvlG1 = info.EncounterMatch?.LevelMin + 1 ?? 6; if (lvlG1 != defaultLvlG1) { EncounterMoves.LevelUpMoves[1] = Legal.GetValidMoves(pkm, info.EvoChainsAllGens[1], generation: 1, minLvLG1: lvlG1, LVL: true, Tutor: false, Machine: false, MoveReminder: false).ToList(); } break; } }
/// <summary> /// Gets possible encounters that allow all moves requested to be learned. /// </summary> /// <param name="pk">Rough Pokémon data which contains the requested species, gender, and form.</param> /// <param name="moves">Moves that the resulting <see cref="IEncounterable"/> must be able to learn.</param> /// <param name="version">Specific version to iterate for.</param> /// <returns>A consumable <see cref="IEncounterable"/> list of possible encounters.</returns> public static IEnumerable <IEncounterable> GenerateVersionEncounters(PKM pk, IEnumerable <int> moves, GameVersion version) { pk.Version = (int)version; var et = EvolutionTree.GetEvolutionTree(PKX.Generation); var dl = et.GetValidPreEvolutions(pk, maxLevel: 100, skipChecks: true); var gens = VerifyCurrentMoves.GetGenMovesCheckOrder(pk); var canlearn = gens.SelectMany(z => Legal.GetValidMoves(pk, dl, z)); var needs = moves.Except(canlearn).ToArray(); foreach (var enc in GetPossible(pk, needs, version)) { yield return(enc); } }
/// <summary> /// Gets four moves which can be learned depending on the input arguments. /// </summary> /// <param name="tm">Allow TM moves</param> /// <param name="tutor">Allow Tutor moves</param> /// <param name="reminder">Allow Move Reminder</param> public int[] GetSuggestedMoves(bool tm, bool tutor, bool reminder) { if (!Parsed) { return(new int[4]); } if (pkm.IsEgg && pkm.Format <= 5) // pre relearn { return(Legal.GetBaseEggMoves(pkm, pkm.Species, (GameVersion)pkm.Version, pkm.CurrentLevel)); } if (!(tm || tutor || reminder) && (Info.Generation <= 2 || pkm.Species == EncounterOriginal.Species)) { var lvl = Info.Generation <= 2 && pkm.Format >= 7 ? pkm.Met_Level : pkm.CurrentLevel; var ver = Info.Generation <= 2 && EncounterOriginal is IVersion v ? v.Version : (GameVersion)pkm.Version; return(MoveLevelUp.GetEncounterMoves(pkm, lvl, ver)); } var evos = Info.EvoChainsAllGens; return(Legal.GetValidMoves(pkm, evos, Tutor: tutor, Machine: tm, MoveReminder: reminder).Skip(1).ToArray()); // skip move 0 }