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:
Kurt
2023-04-22 17:58:36 -07:00
parent 998b8f1ce0
commit f2ffd2ad1f

View File

@@ -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>