def HasItem(item: ItemTyping, condition, negate=False): try: item_type = item.item_enum except AttributeError: raise ValueError( "Can only use auto-detecting HasItem() on declared item types (Weapon, Armor, Ring, Good)." ) return instr.IfPlayerItemStateNoBox(condition, item_type, item, not negate)
def HasGood(good: Good, condition, negate=False): return instr.IfPlayerItemStateNoBox(condition, ItemType.Good, good, not negate)
def HasRing(ring: Ring, condition, negate=False): return instr.IfPlayerItemStateNoBox(condition, ItemType.Ring, ring, not negate)
def HasArmor(armor: Armor, condition, negate=False): return instr.IfPlayerItemStateNoBox(condition, ItemType.Armor, armor, not negate)
def HasWeapon(weapon: Weapon, condition, negate=False): return instr.IfPlayerItemStateNoBox(condition, ItemType.Weapon, weapon, not negate)