private PKM clickMetLocationModPKSM(PKM p) { LegalityAnalysis Legality = new LegalityAnalysis(p); var encounter = Legality.GetSuggestedMetInfo(); if (encounter == null || (p.Format >= 3 && encounter.Location < 0)) { return(p); } int level = encounter.Level; int location = encounter.Location; int minlvl = Legal.GetLowestLevel(p, encounter.Species); if (minlvl == 0) { minlvl = level; } if (p.CurrentLevel >= minlvl && p.Met_Level == level && p.Met_Location == location) { return(p); } if (minlvl < level) { minlvl = level; } p.Met_Location = location; p.Met_Level = level; return(p); }
/// <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 la = new LegalityAnalysis(pk); var encounter = la.GetSuggestedMetInfo(); if (encounter == null || (pk.Format >= 3 && encounter.Location < 0)) { return; } int level = encounter.Level; int location = encounter.Location; int minlvl = Legal.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; }
/// <summary> /// Sets the <see cref="PKM.RelearnMoves"/> based on a legality check's suggestions. /// </summary> /// <param name="pk"></param> public static void SetSuggestedRelearnMoves(this PKM pk) { if (pk.Format < 6) { return; } pk.ClearRelearnMoves(); var la = new LegalityAnalysis(pk); var m = la.GetSuggestedRelearn(); if (m.All(z => z == 0)) { if (!pk.WasEgg && !pk.WasEvent && !pk.WasEventEgg && !pk.WasLink) { if (pk.Version != (int)GameVersion.CXD) { var encounter = la.GetSuggestedMetInfo(); if (encounter != null) { m = encounter.Relearn; } } } } if (pk.RelearnMoves.SequenceEqual(m)) { return; } if (m.Count > 3) { pk.SetRelearnMoves(m); } }
private PKM SetSuggestedRelearnMoves_PKSM(PKM Set) { Set.RelearnMove1 = 0; Set.RelearnMove2 = 0; Set.RelearnMove3 = 0; Set.RelearnMove4 = 0; LegalityAnalysis Legality = new LegalityAnalysis(Set); if (Set.Format < 6) { return(Set); } int[] m = Legality.GetSuggestedRelearn(); if (m.All(z => z == 0)) { if (!Set.WasEgg && !Set.WasEvent && !Set.WasEventEgg && !Set.WasLink) { var encounter = Legality.GetSuggestedMetInfo(); if (encounter != null) { m = encounter.Relearn; } } } if (Set.RelearnMoves.SequenceEqual(m)) { return(Set); } Set.RelearnMove1 = m[0]; Set.RelearnMove2 = m[1]; Set.RelearnMove3 = m[2]; Set.RelearnMove4 = m[3]; return(Set); }