using static PKHeX.Core.LegalityCheckStrings;
namespace PKHeX.Core;
///
/// Verifies the .
///
public sealed class GroundTileVerifier : Verifier
{
protected override CheckIdentifier Identifier => CheckIdentifier.Encounter;
public override void Verify(LegalityAnalysis data)
{
if (data.Entity is not IGroundTile e)
return;
var enc = data.EncounterMatch;
bool valid = IsGroundTileValid(enc, e);
var result = !valid ? GetInvalid(LEncTypeMismatch) : GetValid(LEncTypeMatch);
data.AddLine(result);
}
///
/// Indicates if the is valid for the .
///
/// Encounter Template
/// Entity with a stored value.
/// True if stored ground tile value is permitted.
public static bool IsGroundTileValid(IEncounterTemplate enc, IGroundTile e)
{
var type = enc is IGroundTypeTile t ? t.GroundTile : GroundTileAllowed.None;
return type.Contains(e.GroundTile);
}
}