From f2ffd2ad1f2a90a6046a69f143def563008508ea Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 22 Apr 2023 17:58:36 -0700 Subject: [PATCH] Allow pointer property references for filters =Stat_ATK=*Stat_DEF .Species=0 ^ will delete a pkm if the defense stat is equal to the attack stat. the `*`* allows you to use the value from that property, rather than a value from the instruction already worked for property-modify (aka copy property value), this just allows you to compare-filter with properties. --- PKHeX.Core/Editing/Bulk/BatchEditing.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PKHeX.Core/Editing/Bulk/BatchEditing.cs b/PKHeX.Core/Editing/Bulk/BatchEditing.cs index 0d19567a9..0edee815f 100644 --- a/PKHeX.Core/Editing/Bulk/BatchEditing.cs +++ b/PKHeX.Core/Editing/Bulk/BatchEditing.cs @@ -431,7 +431,14 @@ private static bool IsPropertyFiltered(StringInstruction cmd, PKM pk, IReadOnlyD return false; if (!pi.CanRead) return false; - return cmd.Comparer.IsCompareOperator(pi.CompareTo(pk, cmd.PropertyValue)); + + string val = cmd.PropertyValue; + if (cmd.PropertyValue.StartsWith(CONST_POINTER) && props.TryGetValue(val[1..], out var opi)) + { + var result = opi.GetValue(pk) ?? throw new NullReferenceException(); + return cmd.Comparer.IsCompareOperator(pi.CompareTo(pk, result)); + } + return cmd.Comparer.IsCompareOperator(pi.CompareTo(pk, val)); } ///