/// <summary> /// Gets the Tradeback status depending on the <see cref="PK1.Catch_Rate"/> /// </summary> /// <param name="pkm">Pokémon to guess the tradeback status from.</param> private static TradebackType GetTradebackStatusRBY(PK1 pkm) { if (!ParseSettings.AllowGen1Tradeback) { return(TradebackType.Gen1_NotTradeback); } // Detect tradeback status by comparing the catch rate(Gen1)/held item(Gen2) to the species in the pkm's evolution chain. var catch_rate = pkm.Catch_Rate; if (catch_rate == 0) { return(TradebackType.WasTradeback); } var table = EvolutionTree.GetEvolutionTree(1); var lineage = table.GetValidPreEvolutions(pkm, maxLevel: pkm.CurrentLevel); var gen1 = lineage.Select(evolution => evolution.Species); bool matchAny = GetCatchRateMatchesPreEvolution(pkm, catch_rate, gen1); if (!matchAny) { return(TradebackType.WasTradeback); } if (HeldItems_GSC.Contains((ushort)catch_rate)) { return(TradebackType.Any); } return(TradebackType.Gen1_NotTradeback); }
internal static bool IsCatchRateHeldItem(int rate) => ParseSettings.AllowGen1Tradeback && HeldItems_GSC.Contains((ushort)rate);