mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-01 08:46:40 -05:00
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.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user