class Element

An element object that represents an element of Infinite Craft.

Element(
    name:               str  | None = None,
    emoji:              str  | None = None,
    is_first_discovery: bool | None = None
)

Arguments & Attributes

name (str | None, optional): Name of the element

emoji (str | None, optional): Emoji of the element.

is_first_discovery (bool | None, optional): Whether the current element was a first discovery or not.

Special Functions

__str__(): Returns the Emoji (if it exists) and Name of the element combined.

For example:

>>> str(Element(name="Fire", emoji="๐Ÿ”ฅ", is_first_discovery=False))
'๐Ÿ”ฅ Fire'
>>> str(Element(name="Water", emoji=None, is_first_discovery=True))
'Water'

__repr__(): Returns a string representing how the class was made.

For example:

>>> repr(Element(name="Fire", emoji="๐Ÿ”ฅ", is_first_discovery=False))
"Element(name='Fire', emoji='๐Ÿ”ฅ', is_first_discovery=False)"
>>> repr(Element(name="Water", emoji=None, is_first_discovery=True))
"Element(name='Water', emoji=None, is_first_discovery=True)"

__eq__(): Checks if the element name is equal to another element's name.

For example:

>>> fire1 = Element(name="Fire", emoji="๐Ÿ”ฅ", is_first_discovery=False)
>>> fire2 = Element(name="Fire", emoji="โค๏ธโ€๐Ÿ”ฅ", is_first_discovery=False)
>>> water = Element(name="Water", emoji="๐Ÿ’ง", is_first_discovery=True)
>>> fire1 == fire2
True
>>> fire1 == water 
False

__bool__(): If all attributes are None, False gets returned otherwise True gets returned.

For example:

>>> bool(Element(name="Fire", emoji="๐Ÿ”ฅ", is_first_discovery=False))
True
>>> bool(Element(name="Water", emoji=None, is_first_discovery=True))
True
>>> bool(Element(name=None, emoji=None, is_first_discovery=None))
False

You can make your own Element class by subclassing this one.

NOTE: The emoji is NOT fetched upon the creation of this class. You can fetch it by using .get_discovery().

Last updated