namespace PKHeX.Core;
///
/// Lumped image type.
///
public enum HeldItemLumpImage
{
///
/// Held Item sprite is a specific held item.
///
NotLump = 0,
///
/// Held Item sprite should show the Technical Machine (TM) icon.
///
TechnicalMachine,
///
/// Held Item sprite should show the Technical Record (TR) icon.
///
TechnicalRecord,
}
///
/// Logic to check if a held item should show a lumped image sprite.
///
public static class HeldItemLumpUtil
{
///
/// Checks if the is a lumped sprite.
///
/// Evaluated type
/// True if the is a lumped sprite.
public static bool IsLump(this HeldItemLumpImage image) => image != HeldItemLumpImage.NotLump;
///
/// Checks if the should show a lumped sprite.
///
/// Held Item index
/// Generation context
/// Evaluation result.
public static HeldItemLumpImage GetIsLump(int item, EntityContext context) => context.Generation() switch
{
<= 4 when item is (>= 0328 and <= 0419) => HeldItemLumpImage.TechnicalMachine, // Gen2/3/4 TM
8 when item is (>= 0328 and <= 0427) => HeldItemLumpImage.TechnicalMachine, // BD/SP TMs
8 when item is (>= 1130 and <= 1229) => HeldItemLumpImage.TechnicalRecord, // Gen8 TR
9 when item is (>= 0328 and <= 0419) // TM01-TM92
or (>= 0618 and <= 0620) // TM093-TM095
or (>= 0690 and <= 0693) // TM096-TM099
or (>= 2160 and <= 2289) /* TM100-TM229 */ => HeldItemLumpImage.TechnicalMachine,
_ => HeldItemLumpImage.NotLump,
};
}