Exemplo n.º 1
0
    public static IEnumerable <PKM> GetCompatible(this SaveFile sav, IEnumerable <PKM> pks)
    {
        var savtype = sav.PKMType;

        foreach (var temp in pks)
        {
            var pk = EntityConverter.ConvertToType(temp, savtype, out var c);
            if (pk == null)
            {
                Debug.WriteLine(c.GetDisplayString(temp, savtype));
                continue;
            }

            if (sav is ILangDeviantSave il && EntityConverter.IsIncompatibleGB(temp, il.Japanese, pk.Japanese))
            {
                var str = EntityConverterResult.IncompatibleLanguageGB.GetIncompatibleGBMessage(pk, il.Japanese);
                Debug.WriteLine(str);
                continue;
            }

            var compat = sav.EvaluateCompatibility(pk);
            if (compat.Count > 0)
            {
                continue;
            }

            yield return(pk);
        }
    }