using System;
namespace PKHeX.Core
{
///
public sealed class ComplexSet : IComplexSet
{
public readonly string PropertyName;
public readonly Func IsValueCompatible = _ => true;
private readonly Action Action;
public ComplexSet(string propertyName, Action modify)
{
PropertyName = propertyName;
Action = modify;
}
public ComplexSet(string propertyName, Func criteria, Action modify) : this(propertyName, modify) => IsValueCompatible = criteria;
public bool IsMatch(string name, string value) => name == PropertyName && IsValueCompatible(value);
public void Modify(PKM pk, StringInstruction instr) => Action(pk, instr);
}
}