/// <summary> /// Set a valid Pokeball based on a legality check's suggestions. /// </summary> /// <param name="pk">Pokémon to modify</param> /// <param name="matching">Set matching ball</param> public static void SetSuggestedBall(this PKM pk, bool matching = true) { if (matching) { if (!pk.IsShiny) { pk.SetMatchingBall(); } else { Aesthetics.ApplyShinyBall(pk); } } var la = new LegalityAnalysis(pk); var report = la.Report(); if (!report.Contains(LegalityCheckStrings.LBallEncMismatch)) { return; } if (pk.GenNumber == 5 && pk.Met_Location == 75) { pk.Ball = (int)Ball.Dream; } else { pk.Ball = 4; } }
/// <summary> /// Set a valid Pokeball based on a legality check's suggestions. /// </summary> /// <param name="pk">Pokémon to modify</param> /// <param name="matching">Set matching ball</param> /// <param name="force"></param> /// <param name="ball"></param> public static void SetSuggestedBall(this PKM pk, bool matching = true, bool force = false, Ball ball = Ball.None) { if (ball != Ball.None) { var orig = pk.Ball; pk.Ball = (int)ball; if (!force && !pk.ValidBall()) { pk.Ball = orig; } } else if (matching) { if (!pk.IsShiny) { pk.SetMatchingBall(); } else { Aesthetics.ApplyShinyBall(pk); } } var la = new LegalityAnalysis(pk); var report = la.Report(); if (!report.Contains(LegalityCheckStrings.LBallEncMismatch) || force) { return; } if (pk.Generation == 5 && pk.Met_Location == 75) { pk.Ball = (int)Ball.Dream; } else { pk.Ball = 4; } }