diff --git a/PKHeX.Core/Editing/Bulk/BatchEditing.cs b/PKHeX.Core/Editing/Bulk/BatchEditing.cs index 5d1cca662..b2e7a0a48 100644 --- a/PKHeX.Core/Editing/Bulk/BatchEditing.cs +++ b/PKHeX.Core/Editing/Bulk/BatchEditing.cs @@ -25,7 +25,7 @@ namespace PKHeX.Core typeof (PK2), typeof (SK2), typeof (PK1), }; - public static readonly List CustomProperties = new() { PROP_LEGAL, PROP_RIBBONS }; + public static readonly List CustomProperties = new() { PROP_LEGAL, PROP_TYPENAME, PROP_RIBBONS }; public static readonly string[][] Properties = GetPropArray(); private static readonly Dictionary[] Props = Types.Select(z => ReflectUtil.GetAllPropertyInfoPublic(z) @@ -38,6 +38,7 @@ namespace PKHeX.Core private const string CONST_BYTES = "$[]"; private const string PROP_LEGAL = "Legal"; + private const string PROP_TYPENAME = "ObjectType"; private const string PROP_RIBBONS = "Ribbons"; private const string IdentifierContains = nameof(PKM.Identifier) + "Contains"; @@ -192,6 +193,12 @@ namespace PKHeX.Core { foreach (var cmd in filters) { + if (cmd.PropertyName is PROP_TYPENAME) + { + if ((obj.GetType().Name == cmd.PropertyValue) != cmd.Evaluator) + return false; + } + if (!ReflectUtil.HasProperty(obj, cmd.PropertyName, out var pi)) return false; try @@ -434,6 +441,10 @@ namespace PKHeX.Core (pkm, cmd) => new LegalityAnalysis(pkm).Valid == cmd.Evaluator, (info, cmd) => info.Legality.Valid == cmd.Evaluator), + new ComplexFilter(PROP_TYPENAME, + (pkm, cmd) => (pkm.GetType().Name == cmd.PropertyValue) == cmd.Evaluator, + (info, cmd) => (info.Entity.GetType().Name == cmd.PropertyValue) == cmd.Evaluator), + new ComplexFilter(IdentifierContains, (pkm, cmd) => pkm.Identifier?.Contains(cmd.PropertyValue) == cmd.Evaluator, (info, cmd) => info.Entity.Identifier?.Contains(cmd.PropertyValue) == cmd.Evaluator),