Class InternalCooldownContext

java.lang.Object
io.github.xrickastley.sevenelements.element.InternalCooldownContext

public final class InternalCooldownContext extends Object
An InternalCooldownContext is a class used for holding the various InternalCooldown components together in a single class. It also contains utility functions for getting the InternalCooldown instance from an InternalCooldownContext instance.

Definitions

ICD is the commonly used shorthand term for Internal Cooldown, a system that handles how frequent elements (of the same type) are applied by the same attack.

The origin is the LivingEntity the elemental attack comes from. Each LivingEntity has their own seperate Internal Cooldown, ensuring that same tag and type(s) that come from different entities are handled respectively, allowing the Internal Cooldown of entity "A" to not conflict with that of entity "B".

The tag, referred to as the InternalCooldownTag in this codebase, is internally a String that identifes the attack. This tag can be shared or differ across different elemental attacks, and is one of the factors that dictate Whether two elemental attacks (with the same Element) share ICD.

The type, referred to as the InternalCooldownType in this codebase, is an instance of InternalCooldownType that controls the "Reset Interval" and the "Gauge Sequence" for an attack. Much like the tag, this type can be shared or differ across different elemental attacks, and is also one of the factors that dictate Whether two elemental attacks (with the same Element) share ICD.

Sharing ICD

For ICD to be "shared", the two elemental attacks in question must:
  • Be applied from the same origin
  • Have the same tag
  • Have the same type
If all three conditions above are fulfilled, the two elemental attacks in question will share ICD.

"Removing" ICD

Internal Cooldown is only taken into account when an origin exists. If no origin exists, the element is regarded to have been applied by other means, such as the environment.

The Internal Cooldown may still be taken into account without an origin by using InternalCooldownContext#forced. All forced Internal Cooldowns without an origin are grouped under this holder.