Element and Reaction

Element

from dgisim import Element
class Element(value)

An enumeration.

ANEMO = 3
ANY = 10
CRYO = 6
DENDRO = 5
ELECTRO = 4
GEO = 7
HYDRO = 2
OMNI = 0
PHYSICAL = 8
PIERCING = 9
PYRO = 1
is_aurable_element() bool
Returns:

True if the element is an aurable element.

is_pure_element() bool
Returns:

True if the element is a pure element.

There are some const values for different groups of elements. These values can be directly imported from dgisim.

element.PURE_ELEMENTS: set[dgisim.element.Element] = {GEO, ANEMO, ELECTRO, HYDRO, DENDRO, CRYO, PYRO}

Elements of the seven.

element.AURA_ELEMENTS: FrozenSet[Element] = frozenset({ELECTRO, HYDRO, DENDRO, CRYO, PYRO})

Elements that are aurable (can be applied to characters).

element.AURA_ELEMENTS_ORDERED: tuple[dgisim.element.Element, ...] = (PYRO, HYDRO, ELECTRO, CRYO, DENDRO)

Elements ordered by reaction priority when they are already applied to a character.

Elemental Aura

class ElementalAura(aura: dict[dgisim.element.Element, bool] = {})

Stores the aura elements (element applications) of a character.

This class must initialized by calling .from_default() for correct aura element ordering.

add(elem: Element) ElementalAura
Returns:

a new ElementalAura with elem.

This should only be called if elem is aurable.

static aurable(elem: Element) bool
Returnx:

True if elem is an aura element.

consult_reaction(incoming_elem: Element) None | ReactionDetail
Returns:

ReactionDetail if incoming_elem triggers a reaction with the current elements.

contains(elem: Element) bool
Returns:

True if elem is applied to the character.

elem_auras() tuple[dgisim.element.Element, ...]
Returns:

a tuple of applied elements from highest priority to the lowest.

classmethod from_default() ElementalAura
Returns:

an ElementalAura object that respects aura orders. (namely, Cryo reacts prior to Dendro)

has_aura() bool
Returns:

True if any element is applied.

peek() Element | None
Returns:

the element that has the highest priority to be reacted.

remove(elem: Element) ElementalAura
Returns:

a new ElementalAura without elem.

This should only be called if elem is contained.

Reaction

from dgisim import Reaction, ReactionDetail
class Reaction(value)

An enumeration.

BLOOM = _ReactionData(reaction_elems=(frozenset({DENDRO}), frozenset({HYDRO})), damage_boost=1)
BURNING = _ReactionData(reaction_elems=(frozenset({DENDRO}), frozenset({PYRO})), damage_boost=1)
CRYSTALLIZE = _ReactionData(reaction_elems=(frozenset({CRYO, PYRO, ELECTRO, HYDRO}), frozenset({GEO})), damage_boost=1)
ELECTRO_CHARGED = _ReactionData(reaction_elems=(frozenset({HYDRO}), frozenset({ELECTRO})), damage_boost=1)
FROZEN = _ReactionData(reaction_elems=(frozenset({HYDRO}), frozenset({CRYO})), damage_boost=1)
MELT = _ReactionData(reaction_elems=(frozenset({PYRO}), frozenset({CRYO})), damage_boost=2)
OVERLOADED = _ReactionData(reaction_elems=(frozenset({PYRO}), frozenset({ELECTRO})), damage_boost=2)
QUICKEN = _ReactionData(reaction_elems=(frozenset({DENDRO}), frozenset({ELECTRO})), damage_boost=1)
SUPERCONDUCT = _ReactionData(reaction_elems=(frozenset({CRYO}), frozenset({ELECTRO})), damage_boost=1)
SWIRL = _ReactionData(reaction_elems=(frozenset({CRYO, PYRO, ELECTRO, HYDRO}), frozenset({ANEMO})), damage_boost=0)
VAPORIZE = _ReactionData(reaction_elems=(frozenset({HYDRO}), frozenset({PYRO})), damage_boost=2)
classmethod consult_reaction(first: Element, second: Element) Reaction | None
Returns:

a Reaction if the first element can react with the second element.

classmethod consult_reaction_with_aura(aura: ElementalAura, second: Element) None | ReactionDetail
Returns:

the ReactionDetail if the incoming element has a reaction with any aura elements.

damage_boost() int
Returns:

the direct damage boost of the reaction.

class ReactionDetail(reaction_type: 'Reaction', first_elem: 'Element', second_elem: 'Element')
elem_reaction(elem: Element) bool
Returns:

True if this reaction is an elem reaction.

first_elem: Element
reaction_type: Reaction
second_elem: Element