Skip to main content

Living

Instance of Entity.

Living functions are accessible to all entities, but will throw if the entity is not a Player, Character, or Obstacle.

Living.from(entity)

Returns the entity passed in if the entity is considered living, otherwise returns nil.

living:max_health()

Returns the entity's max health.

living:health()

Returns the entity's current health.

living:set_health(health)

Sets the entity's max health.

living:hit(hit_props)

Queues a hit for processing, in most cases spell:attack_tile() should be used instead.

living:hitbox_enabled()

Returns true if the entity can interact with attacks.

Different from entity:hittable()

living:enable_hitbox(enabled?)

Passing false will allow attacks to pass through as if the entity didn't exist.

living:counterable()

Returns true if the entity can currently be countered.

living:set_counterable(enabled?)

Allows the entity to be countered when hit by an attack with a context created in card_init

living:intangible()

Returns true if an IntangibleRule is active.

living:set_intangible(intangible, intangible_rule?)

  • intangible: bool, if false the active rule is removed.
  • intangible_rule: IntangibleRule
    • Ignored if intangible is false.
    • A default will be used if intangible_rule is unset.

living:add_defense_rule(defense_rule)

living:remove_defense_rule(defense_rule)

living:add_aux_prop(aux_prop)

living:remove_aux_prop(aux_prop)

living:apply_status(hit_flag, duration)

  • hit_flag a single hit flag, see HitProps
  • duration number, how many battle frames the effect should last

Queues a status update. If the status is already applied, the remaining time will be updated to use the longer duration.

living:remove_status(hit_flag)

  • hit_flag a single hit flag, see HitProps

living:remaining_status_time(hit_flag)

  • hit_flag a single hit flag, see HitProps

Returns a number representing the amount of battle frames until the status wears off.

living:set_remaining_status_time(hit_flag, duration)

  • hit_flag a single hit flag, see HitProps
  • duration number, how many battle frames the effect should last.

Updates remaining time for a status already applied, or queues a new status update if isn't.

living:register_status_callback(hit_flag, function())

  • hit_flag a single hit flag, see HitProps

The callback will be called when the hit_flag is applied to the entity.

living:is_inactionable()

Returns true if status effects that entity processing are applied.

living:is_immobile()

Returns true if status effects that immobilize are applied.

living.on_countered_func = function(self)

Called when this entity has been countered.

Not to be confused with entity.on_counter_func