Files
PkmnLib.NET/PkmnLib.Static/TypeIdentifier.cs
Deukhoofd be5100df8a
All checks were successful
Build / Build (push) Successful in 39s
Implement stat drop handling for AI, Fixes for Conversion2
2026-05-23 12:57:15 +02:00

42 lines
1.2 KiB
C#

using PkmnLib.Static.Libraries;
using PkmnLib.Static.Utils;
namespace PkmnLib.Static;
/// <summary>
/// A number that identifies a type. To be used with <see cref="TypeLibrary"/>
/// </summary>
public readonly struct TypeIdentifier : IEquatable<TypeIdentifier>
{
/// <summary>
/// The name of the type identifier.
/// </summary>
public StringKey Name { get; }
/// <summary>
/// The underlying value of the type identifier.
/// </summary>
public byte Value { get; }
/// <inheritdoc cref="TypeIdentifier"/>
public TypeIdentifier(byte value, StringKey name)
{
Value = value;
Name = name;
}
/// <inheritdoc />
public override int GetHashCode() => Value.GetHashCode();
/// <inheritdoc />
public bool Equals(TypeIdentifier other) => Value == other.Value;
/// <inheritdoc />
public override bool Equals(object? obj) => obj is TypeIdentifier other && Equals(other);
public static bool operator ==(TypeIdentifier left, TypeIdentifier right) => left.Equals(right);
public static bool operator !=(TypeIdentifier left, TypeIdentifier right) => !left.Equals(right);
/// <inheritdoc />
public override string ToString() => Name.ToString();
}