ONB Lua DocsClient v2.1.4 Generated 2026-05-27

ActionOrder: table

    N/A

    AddEntityStatus: table

    When adding an Entity to the Field, it's useful to know if that operation failed1 or succeeded.

    Some mechanics may prevent new entities from being added that same frame and they will be added in the next frame instead. AddEntityStatus.Queued is returned when this happens.
    -- Example: This enemy gets angrier every time an attack fails!
    if field:add_entity(fireball, x, y) == AddEntityStatus.Failed then
        self:aggresive_maneuvers()
    end
    1. Sometimes entities reserve a tile for themselves and don't share.

    Animation: table

      new (anim)

      anim can be either a filepath or another Animation object.

      If given a filepath, creates a new Animation by retrieving the animation file at the given path, and loading it. If given another Animation, creates a new Animation object and copies from the given object. Returns the new Animation object.

      load (self , path)

      Replaces all current animation data with new data created from the file at path. Often called when setting up a new Entity, which does not have any animation data yet.

      set_state (self , state)

      Sets the Animation's current state to the keyframe group with the same name as state, as specified in the animation file. This resets everything associated with the previous state. This includes setting progressed time to 0, setting the current Playback mode to Playback.Once, wiping all animation callbacks, and calling the callback set with on_interrupt, before removing that callback as well.
      br/> Often followed by calls to other functions that modify aspects of the state, such as set_playback and on_frame. When finished configuring the new state like this, it's often recommended to call refresh to ensure the new state draws this frame. If the refresh call is inside an Animation callback, make sure to call it after set_state, or else there may be a stack overflow.

      The Animation is set to state even when the animation file does not define that state. This can result in nothing being drawn. In almost every case, you will know whether or not the Animation has the state you are changing to, but in the rare case you don't know, consider checking has_state.

      get_state (self)

      Returns the String name of the current Animation state, which may be the state last set by a call to set_state, but it may also have been changed internally.

      Typically empty (if the Animation is in no state yet) or equal to the name of a state found in the Animation's animation file. Sometimes, the returned state may have such a name, but with an "@" and many numbers at the end. These are special states that the engine creates to override the keyframe timings and order in the animation file. For Player's, these are created for the "PLAYER_HIT" and "PLAYER_MOVE" states, for the engine to call when the Player flinches or moves. For other cases, these are temporary states created by CardAction.override_animation_frames.

      has_state (self , state_name)

      Returns true if the Animation has a state with the name state_name. Most often used to check if a user of a CardAction has the state that the action wants to use. Scripts can fall back to a different state if the user is missing the desired state.

      set_playback (self , mode)

      Sets a the Playback mode as the new Playback for the Animation. The state will play with Playback.Once if unset, and changing state will reset the Playback back to Once.

      Using Playback.Reverse will reorder on_frame callbacks so that they happen in an intuitive order: a frame 1 callback will happen first, followed by a frame 2 callback. They do not reverse so that frame 1 happens last. Setting Reverse while the Animation state is in progress will also not change the order these callbacks happen, but the state will proceed in reverse starting from when it was set. This can cause the state to progress past the beginning and loop back to the final keyframe.

      Using Playback.Loop will cause the state to start over from the beginning once it has completed. This does not cause on_frame callbacks to run a second time, but the on_complete callback will run each time the state loops. As an unintended bug, the on_complete will run a second time on the next update immediately after it runs.

      Playback.Bounce functions identically to Playback.Once.

      set_playback_speed (self , speed)

      Sets a speed to multiply elapsed time by when progressing the current animmation state. This speed is 1.0 if unset. If speed is 2.0, the state will progress by 2/60 seconds every 1/60 seconds. A speed of 0.0 will halt the animation entirely.

      get_playback_speed (self)

      Returns the speed last set by a call to set_playback_speed. If no other speed has been set, returns 1.0. Indicates the multiplier to use when progressing the animation state. For example, a return value of 2.0 means the animation is playing at 2x speed (every 1/60 second, the state progresses as if 2/60 seconds passed).

      update (self , delta , node)

      Progresses the current Animation state by delta seconds for the given node. The delta will be mulitiplied by the current playback speed, as set by set_playback_speed (1.0 by default).

      It's recommended that delta be a multiple of 1/60.

      refresh (self , node)

      Forces an update on the Animation that progresses it by 0 seconds. Normally, calling set_state does not immediately apply the new state for drawnig. This happens instead when the Animation updates. set_state may often be called after the Animation already updated (like when a new Entity is spawned, or when state is changed as part of an Animation callback). In times like these, a call to refresh ensures the Animation is visually correct in time for drawing.

      In short, it's safe to always call this whenever you finish confguring a new animation state (i.e. after setting state, callbacks, playback). This ensures the state is drawn correctly, and avoids graphical issues such as drawing the entire Texture for a single frame.

      copy_from (self , anim)

      Copies the Animation anim and replaces all parts of this object with that one. This includes current frame progress, animation state, and all states and keyframes from anim, as well as any callbacks associated with anim's current state.

      If a Player's Animation is being copied to, keep in mind that Players have specially bound versions of the "PLAYER_HIT" and "PLAYER_MOVE" states, which may not be in anim. If the Player loses these like this, they will have no hit or move animation until a form change activates. Similarly, keep in mind that CardActions also use specially bound versions of their animation state, which may be lost if another Animation is copied.

      point (self , name)

      Returns a vec2 with the values X and Y of the point with the given label name. The values returned are based on the current keyframe, and so may give different results at different times in the state.

      Does not directly indicate if no point with a label of name exists. Instead, if the point doesn't exist, the vec2 will have 0 as the valye for its x and y.

      on_frame (self , keyframe , callback)

      Registers the given function callback to be called when the Animation's current state reaches the given keyframe. Calls to set_state will clear all callbacks set this way.

      Calling this again with the same keyframe as already registered will not replace the previous callback. Instead, the second callback will be called on the next update, as long as the keyframe hasn't finished. For example, if the current state's second keyframe lasts 4 update ticks, and you set 5 callbacks through this function, 4 of them will be called, each one update apart.

      Do not call refresh inside one of these callbacks unless set_state is called first, or else there will be a stack overflow (because refresh is a disguised update with 0 passed time, this keyframe has "just started" again and will run this callback again, which calls refresh, etc. set_state clears the callback and resets progressed time so this doesn't happen.)

      on_complete (self , callback)

      Registers the given function callback to be called when the Animation's current state finishes its final keyframe. Calls to set_state will clear the callback that was set this way. Calling this again will replace the previous callback with the new one.

      If the Playback mode is Playback.Loop, the callback will be called again on the next update, as the state restarts from the beginning.

      Do not call refresh inside the callback unless set_state is called first, or else there will be a stack overflow (because refresh is a disguised update with 0 passed time, the Animation has "just completed" again and will run this callback again, which calls refresh, etc. set_state clears the callback and resets progressed time so this doesn't happen.)

      on_interrupt (self , callback)

      Registers the given function callback to be called when the Animation's current state changes before finishing. Calls to set_state will clear the callback that was set this way after calling it. Calling this again will replace the previous callback with the new one.

      Because this callback is only called if the state changes while unfinished, calls to set_state that are inside the on_complete callback will never trigger this.

      .animpath

      .ref_animpath

    AudioPriority: table

    The utility function Engine.play_audio takes AudioPriority as its second parameter.

      .Lowest

      Play the sound on a free channel, but other Lowest priority sounds can't play at the same time.

      .Low

      Play the sound on a free channel.

      .High

      Forces the sound to play, but other High priority sounds can't play at the same time.

      .Highest

      Forces the sound to play, cancelling another sound if it must.

    AudioType: table

      N/A

      Battle: table

        N/A

        BlockPackage: table

        Blocks: table

        Blocks are modifiers1 for the Player character types only.
        They have a required shape, color, and trait.

        This enum set is used to specify which color the block will be. The other properties are handled by the Block package object API.

        1. Usually Blocks upgrade a playable character, but they can be used to nerf them too!

        CardAction: table

          new (character , state)

          Creates a new CardAction with character as the reference point for the actor, and state as the name of the Animation state to put the actor in when the action begins.

          Creating the CardAction is not the same as performing it. It must be queued first, and then it may be executed on a later game frame. This is usually done through returning this object from a callback that the engine called expecting a CardAction, such as a card mod's card_create_action or a Player's charged_attack_func.

          Queuing this CardAction under a different Character than character, for example through Character.card_action_event, is undefined behavior.

        CardClass: table

        A card has a visual representation in the client and in later ONB engines can determine if there's a duplication limit.

          .Standard

          This card is common.

          .Mega

          This card is more powerful than common cards.

          .Giga

          This card is extremely powerful and rare.

          .Dark

          This card has an evil aura...

        CardPackage: table

        CardProps: table

        Color: table

        A color has red, green, blue, and alpha color components.
        Color components have a limited range of [0-255].

          new (r , g , b , a)

        ColorMode: table

        This enum set specifies how a sprite can blend with additional Color data.

        DefenseFrameStateJudge: table

          For any defense rule to notify the combat system when some attack was blocked correctly, the DefenseFrameStateJudge or Judge is passed into the DefenseRule.can_block_func(judge, attacker, victim) function.
          From there it can signal if the attack was blocked1, impacted2, or pierced3.

          1. Prevented entirely.
          2. Collision occured.
          3. By-passes other defenses.

          DefenseOrder: table

          Any attacks to a Character must succeed checks from defense rules applied to that Character. But not all defense rules run at the same time. The time when a defense rule is ran is called its order.

          There are two defense rule orders:
          1. Always - Check if this attack succeeds before2 impact detection.
          2. CollisionOnly - Check if this attack succeeds1 after impact detection.

          1. An attack can impact a Character and deal no damage.
          2. Likewise an attack can never physically make contact and still deal damage.

          DefensePriority: table

          This enum set encodes a defense rule's process priority from soonest (Barrier) to latest (Last).
          If two defense rules have the same priority, then the newest rule is kept and the oldest is removed.

          DefenseRule: table

            Defense rules determine if and how a Character takes hits.

            Some hits can be completely overwritten or blocked by defense rules. And some defense rules may trigger side effects.

            By default Player characters do not have any defense rules. However, it is common for enemies to have VirusBody at minimum.

            Direction: table

            Whenever an Entity moves or is forced to move by one tile, it must provide a Direction. There are 9 direction values in total. Utility functions are provided that makes coding direction logic easier.

              .None

              .Up

              .Down

              .Left

              .Right

              .UpLeft

              .UpRight

              .DownLeft

              .DownRight

              flip_x (self)

              Flips a direction across the vertical axis.
              e.g. Left becomes Right and UpLeft becomes UpRight.

              flip_y (self)

              Flips a direction across the horizontal axis.
              e.g. Up becomes Down and UpLeft becomes DownLeft.

              reverse (self)

              Flips a direction across both axes.
              e.g. UpRight becomes DownLeft.

              unit_vector (self)

              Sometimes it's convenient to map a Direction to an engine Vector object.
              This will return a unit vector for the corresponding direction value.
              e.g. If dir=Direction.DownLeft then dir:unit_vector()={-1, 1}.

              join (a , b)

              Given two direction values a and b, returns their combined equivalent enum value.

              For example if a=Up and b=Right then join(a,b)=UpRight.

              Directions can cancel-out. If a=Left and b=Right then join(a,b)=None.

              Combining the same direction doesn't do anything. If a=Down and b=Down then join(a,b)=Down.

            Drag (dir , count)

            DrawBits: table

            DrawBits are a 2.5 concept. In older versions of the ONB client, such as 2.0 and 2.1, entities were limited to draw when their tile was drawn and in the order of their z-index. That is to say their layer value. In 2.5, the client's new renderer allows sprites to retarget themselves. This opens up possibilities for an entity to have their child nodes drawn out-of-order. Entities on one tile could sit behind or infront of another entity on a different tile regardless of the order they were drawn.

              .Background

              Draws a sprite on the Background layer.

              .Floor

              Draws a sprite on the Floor layer.

              .Object

              Draws a sprite on the Object layer.

              .Attack

              Draws a sprite on the Attack layer.

              .Effect

              Draws a sprite on the Effect layer.

              .Misc

              Draws a sprite on the Misc layer.

            Element: table

            Entities and HitProps have elements.
            They determine what Entities take bonus damage from, what HitProps deal bonus damage to, and what special interactions on a Tile the HitProps might have.

            Engine: table

              Animation: table

              Most graphics on the screen animate. Animation objects have several ways to modify their playback behavior in real-time. CardAction objects rely on custom animations to make cool things happen on-screen.

                new (path)

                Constructs a new Animation object with the path to the animation document. Subsequently calls Animation:load() to parse the document.

              load_texture (path)

              This engine-provided utility function loads a texture (image) located at path and returns a handle in lua to pass around for your Entity sprites.

              load_audio (path)

              This engine-provided utility loads the audio file located at path and returns a handle in lua.

              To play the audio, pass the handle into Engine.play_audio(...).

              load_shader (path)

              This engine-provided utility loads the shader file located at path and returns a handle in lua.

              play_audio (audio , priority)

              After loading the audio with Engine.load_audio(path), play the audio by passing it into the first argument and providing an audio priority. Audio priorities help the engine to decide when to play or when to skip playing a sound depending on its importance and remaining available audio channels.

              define_character (uuid , path)

              This is one of the most important to use in your Mob mod's package_init(package) function bnody.
              It tells the engine that a new Character mod is available under name given by uuid.
              In other words, this Mob exports an additional mod which the engine can find and load next at path.

              requires_character (uuid)

              If a mod requires a Character mod in order to work correctly (or at all), then this function should be present in your mod's package_init(package) body. This function tells the engine that mod given by the name uuid is a dependency.

            Entity: table

              get_id (self)

              Returns the unique number identifier for this Entity. No two Entities have the same ID, and the ID is unchanged for its lifetime.

              IDs are set as the Entity is constructed. An Entity created sooner than another Entity will have a smaller ID, but note that this does not necessarily denote spawn order because Entities can be created and then spawned out of order.

              get_name (self)

              Returns the String this Entity has for a name.

              set_name (self , name)

              Sets a new name for the Entity. Enemy Character names appear in battle, during the first card select. For other Entities, this goes unused, but is still readable by get_name, and so can be acted on by scripted mods.

              get_element (self)

              Returns the Entity's current Element.

              set_element (self , element)

              Sets a new Element for the Entity. Entities have a default of Element.None

              ⚠️ In v2.1, Player mods often call this in the player_init to set the initial Element, but in v2.5, this should be done with PlayerPackage.set_element so that it appears in the Player select screen.

              get_tile (self [, dir [, count]])

              Returns a Tile relative to the Entity, count away in dir Direction. If no Tile exists at that distance in that direction, returns nil instead, for example if moving count to the dir would reach beyond the bounds of the Field.

              dir and count are optional. If called without either, returns the current Tile, as in get_current_tile. Otherwise, both args must be present.
              count will be forced positive, as in cast to an unsigned number. If a negative number is passed in, it will likely become a very large positive number. If wanting to get a Tile "behind" the Entity, instead of using its facing Direction as the dir with a negative count, use the opposite Direction with a positive count.

              get_current_tile (self)

              Returns the Entity's Tile. Returns nil if the Entity has not been spawned.

              share_tile (self , share)

              Sets whether or not the Entity is allowed to share Tiles with other Entities, based on share. Often checked as part of movement processing to determine if an occupied destination Tile can be moved to.

              get_field (self)

              Returns the Entity's Field. This Field is invalid if the Entity has not been spawned. An invalid Field will have any function on it fail, giving a data deleted message.

              set_facing (self , dir)

              Sets a new Direction for the Entity to "face". This affects whether or not their Sprite will be drawn flipped to face one direction or the other. Only Direction.Left and Direction.Right are acceptable values.

              If unset, an Entity will adopt their spawn Tile's facing, which is Direction.Right for Tiles that are on the left side of the Field (with X <= 3), and Direction.Left for Tiles that are on the right side of the Field (with X >= 4). This is usually undesired, so call this function accordingly when creating an Entity.

              Because perspective flips for players based on Team, keep in mind that "player 2" will visually be looking to the right on their screen, but their facing is Direction.Left. Because of this, it's most common and recommended to call set_facing with a Direction relative to the related Entity. For example, when creating a Spell during an attack performed by an Entity, almost all use cases would call set_facing for that Spell while passing in the return value of get_facing, as in
              function create_attack(user)
                local spell = Battle.Spell.new(user:get_team())
                spell:set_texture(tex)
                spell:set_facing(user:get_facing())
              end

              get_facing (self)

              Returns the Direction that the Entity is "facing". Often used by scripted mods to determine a direction to move in, or to set_facing on another related Entity.

              get_facing_away (self)

              Returns the Direction that is the reverse of the Entity's "facing".

              get_move_direction (self)

              Utility function that returns the Direction set by set_move_direction. Direction.None by default.

              Unused internally, so its usage is entirely determined by scripted content. May be used to learn that this Entity is currently moving in a particular direction.

              set_move_direction (self , dir)

              Utility function that sets a Direction to be read by get_move_direction.

              Unused internally, so its usage is entirely determined by scripted content. May be used to tell other mods that this Entity is currently moving in a particular direction.

              set_elevation (self , elevation)

              Sets a height in pixels to draw the Entity. Differs from offsets in several ways:
              1. Positive elevation goes up, and negative goes down
              2. The Entity's sprite moves, but its shadow stays on the ground
              Useful when scripting the appearance of moving upwards, like during a jump, because the shadow is left on the ground.

              get_elevation (self)

              Returns the value set by Entity.set_elevation. 0.0 by default. A positive number indicates that the Entity is drawn above the ground by that many pixels.

              set_offset (self , x , y)

              Offsets the Entity by x half pixels horizontally and y half pixels vertically, relative to the screen position of its Tile.
              Because every 1 unit is a half pixel, multiply your desired offset by 2. The reason for half pixels is because the game's screen is actually upscaled by x2.
              Positive x moves to the right, and positive y moves down. The offset is stored and replaced by a subsequent call, so Entity:set_offset(0, 0) will reset the offset.

              Perspective flipping causes a Team.Blue player to see positive x visually move left instead of right, as everything is flipped. Because of this, it's common in most use cases to make x positive or negative based on a related Direction.
              For example, consider an Artifact that should be spawned on an Entity's Tile, offset to appear visually behind them. The offset can be flipped to always point behind them.
              function create_attack(user)
                local spell = Battle.Spell.new(user:get_team())
                spell:set_texture(tex)
                local facing = user:get_facing()
                spell:set_facing(facing)
                -- 10 pixels backwards
                local x_off = -10
                -- Flip if facing Left, so that x_off is still "backwards" relative to facing
                if facing == Direction.Left then 
                  x_off = x_off * -1
                end
              
                spell:set_offset(x_off, 0)
              end


              If trying to visually move vertically, consider if set_elevation would be better.

              get_offset (self)

              Returns the Entity's current offset as a vec2, as set by Entity.set_offset. Often used when tracking the Entity's previous offset to restore after a temporary offset change, or to add to the the offset of a graphical effect that is meant to be near the Entity's visual position.

              Not to be confused with get_tile_offset, which returns the visual offset away from the current Tile, and is a separate value.

              get_tile_offset (self)

              Returns the Entity's current offset from its Tile as a vec2. The tile offset is not set by any Lua function. Instead, it represents movement, and is set as a MoveEvent progresses.

              Often used alongside get_offset to add to the the offset of a graphical effect that is meant to be near the Entity's visual position. Not to be confused with get_offset, which returns the sprite offset away from the parent origin, and is a separate value.

              sprite (self)

              Returns the Entity's Sprite Node. Note that while `Node` has some functions with similar names and utility to the Entity, they sometimes act differently.

              hide (self)

              Tells the Entity to stop drawing. It will become invisible. Calliing this again while already hidden will do nothing.

              reveal (self)

              Tells the Entity to draw. It will become visible if it was hidden (see hide. Calling this again while already visible will do nothing.

              Note that this is a different name from Node.show, despite having similar functionality.

              never_flip (self , toggle)

              Toggles whether or not to allow the Entity's sprite to be drawn flipped. If toggle is false, disallows flipping based on facing and perspective flip.

              set_shadow (self , shadow_type)

              Sets the Shadow for the Entity. Hidden unless show_shadow reveals it.

              shadow_type can be a Shadow or a Texture. Because there is no associated animation file for a Texture input, the center of the image is used as the origin.

              Shadows draw beneath other Entities, and appear on the "floor". If the Entity is offset, the Shadow mimics the offset. If the Entity is elevated, the Shadow stays on the ground.

              show_shadow (self , visible)

              Reveals or hides the Shadow set by set_shadow.

              set_palette (self , palette)

              Sets a Texture to use to color the pixels in the Entity's sprites. If calling this for the first time because a "default" palette is being set for a Player, it's recommended to also call store_base_palette.

              A palette is a 256x1 image where each pixel is a color that will be used to color in corresponding pixels in the Entity's Texture. To use the palette properly, the image used for the Entity's Texture should be greyscaled. RGB 0,0,0 in the Entity's Texture will be colored using the color of the pixel at (0,0) (transparency is recommended here). RGB 1,1,1 will use the color of the pixel at (1,0), and so on.

              get_current_palette (self)

              Returns the Texture set by set_palette. This will be nil if no palette has been set.

              store_base_palette (self , palette)

              Stores a Texture to be retrieved later through get_base_palette. Useful in letting other scripted content know that, if they change this Entity's palette, this one should be restored when its effect is reverted.

              get_base_palette (self)

              Returns the Texture set by store_base_palette. This will be nil if no palette has been stored.

              set_height (self , value)

              Sets a value for the Entity's height. This does not necessarily need to match the height of its visible sprite, and often should be taller than that.

              Used by the engine for sizing and positioning various effects, including the visual effects for the Freeze status. It's also used in calculating the fallback position of the visual effects for the Confusion and Blind statuses, if there is no "HEAD" animation point to use in calculation instead.

              For Players, this is used to position selected cards.

              get_height (self)

              Returns the value set by Entity.set_height. By default, 0.0.

              register_component (self , component)

              Registers a Component for the Entity. If the Entity is currently in the middle of updating, the Component is instead queued to be added when its update is finished.

              create_node (self)

              Creates a new Node, adds it to the Entity, and returns it. This Node is anchored at the origin in the Entity's animation state.

              set_texture (self , tex)

              Sets the Texture to be used when drawing this Entity.

              get_texture (self)

              Returns the Texture currently used by the Entity to draw.

              get_sprite (self)

              q ⚠️ v2.5 only
              Returns the Entity's Sprite Node. Note that while `Node` has some functions with similar names and utility to the Entity, they sometimes act differently.

              set_animation (self , path)

              Sets the path for the animation file used for the Player's battle sprites. Associated with the Texture set by set_texture

              ⚠️ Removed in v2.5. Instead, use Animation.load, as in player:get_animation():load(path)

              get_animation (self)

              Returns the Animation object used by this Entity.

              set_counter_frame_range (self , keyframe_start , keyframe_end)

              Sets Animation keyframes that will toggle on and off counterability.

              Does nothing if keyframe_start is greater than keyframe_end, or if either value is less than 1. If both are the same value, 1 is added to keyframe_end.

              This is essentially a shortcut function for
              local anim = char:get_animation()
              -- Assume keyframe_start and keyframe_end are defined as numbers
              anim:on_frame(keyframe_start, function()
                  char:toggle_counter(true)
              end)
              
              anim:on_frame(keyframe_end, function()
                  char:toggle_counter(false)
              end)
              
              
              Because this is tied to the current Animation state, anything that invalidates frame callbacks, such as a call to Animation.set_state, will also prevent these toggles from running if they have yet to run.

              highlight_tile (self , mode)

              Causes the Entity's Tile to highlight with the Highlight mode. This highlight is checked during Spell updates, so it's common that the Tile will not react on the frame an an Entity calls this, or the frame an Entity is spawned

              Unlike Tile.highlight, which is for a single, targeted Tile and lasts for a single frame, this always highlights the Entity's current Tile until called with Highlight.None (or the Entity is removed from the Field).

              get_context (self)

              Returns the Entity's Context object, which includes information such as its ID. Its fields are unreadable from Lua, and is mostly used as part of constructing HitProps, which will set the Hitprops.aggressor to the ID in the Context.

              If the Entity has not yet executed a CardAction, the Context will not have an aggressor set. This is unusual to worry about, however, as hitboxes are almost always created during a CardAction.

              copy_hit_props (self)

              Returns the Entity's HitProps object, as set by set_hit_props. Often used when inspecting an attacker's HitProps inside a DefenseRule.can_block_func in order to react to the damage, flags, element, or aggressor for the attack.

              Because this is a copy, modifications to the return value will not affect the HitProps on the Entity. Use set_hit_props afterwards with the modified copy to do this.

              set_hit_props (self , props)

              Sets the Entity's HitProps. Often used when creating Spells or Obstacles that will attempt attacks as part of their scripted logic.

              Less commonly, this is also used during a DefenseRule.can_block_func in order to modify the HitProps of an incoming attack. If doing this, keep in mind that HitProps are treated somewhat differently during defense checks. Their HitProps are temporarily modified to include the Hit.Cancel flag, and the attacker's original HitProps will be restored afterwards.

              set_color (self , color)

              Sets the Color to draw the Entity wit this frame. Influenced by the set ColorMode.

              Unlike other nodes, an Entity's coloring will only last a single frame, resetting at the start of its update.

              get_color (self)

              Returns the Color that the Entity will be drawn with this frame.

              set_health (self , health)

              Sets the Entity's health. Cannot be set to a negative number, and cannot exceed the Entity's max health. If max health is 0, max health will be set to health.

              If an Entity has a nonzero max health, and their health is 0 at the start of their update, they call delete automatically.

              For Obstacles only, passing a health value of 0 causes delete to be called immediately.

              get_health (self)

              Returns the Entity's current health as a number.

              get_max_health (self)

              Returns the Entity's current max health as a number.

              Note that there is no set_max_health. Max health is instead set through the Entity's first call to set_health.

              set_float_shoe (self , enabled)

              Enables or disables the float shoe ability. When enabled, the Entity avoids certain negative TileState effects:
              • Does not cause Cracked Tiles to become Broken when stepping off them
              • Will not be forced to move by Ice Tiles
              • Does not trigger damage from Lava Tiles
              • Does not take damage from Poison Tiles
              • Will not be forced to move by any of the Direction* Tiles
              • Will not be afflicted by Root when stepping on Sea Tiles
              • Will not be afflicted by Root when stepping on Sand Tiles

              set_air_shoe (self , enabled)

              Enables or disables the air shoe ability. When enabled, the Entity is allowed to move onto Broken Tiles. For non-Players, the Entity's can_move_to_func takes priority.

              add_defense_rule (self , rule)

              Adds a DefenseRule to the Entity. If the rule's priority matches an existing added DefenseRule, the previous one is removed before the new one is added.

              ⚠️ In v2.5, replacing another DefenseRule will trigger its DefenseRule.on_replace_func.

              remove_defense_rule (self , rule)

              Removes the DefenseRule rule from the Entity. If rule has already been removed or otherwise is not on the Entity, does nothing.

              ignore_common_aggressor (self , toggle)

              Toggles whether or not the Entity should ignore attacks whose HitProps.aggressor matches the Entity's own HitProps.aggressor. This could be useful, for example, in the scenario that one Entity creates two Obstacles that are able to attack each other, such as if they are opposing Teams or Team.Other, but they should avoid attacking each other regardless. If they both ignore Entities with the same aggressor, they will not attack each other.

              register_status_callback (self , flag , callback)

              Tells the Entity to call callback whenever the Hit flag flag is processed. These flags are processed at the start of the Entity's update, so hits that occur during time freeze will not activate any callbacks until after time resumes.

              flag must be a single Hit flag, not a combination of them. If it is a combination of flags, it will never be run. Hit.None will similarly never be processed.

              Attempting to add a second callback for a flag will result in the previous callback being replaced by the new one. Because of this, it's recommended to only use this function on Entities created by your own mods, so that calling this doesn't compromise any functionality.

              set_hurt_sfx (self , audio [, priority])

              Sets the SFX to play when the Entity is damaged1 by an attack with the Hit.Impact flag. The SFX set by a call to this function will not be used unless enabled in a call to use_default_hurt_sfx.

              audio can be a loaded audio file, an AudioType, or nil. If nil is passed in, no sound will play when taking damage.
              priority is the AudioPriority for the SFX to play at. If not provided, defaults to the AudioPriority last set by this function, or, if this has not been called before, defaults to AudioPriority.Low.

              Typically called by the Player mod itself in its player_init, rather than other scripted mods. Attacks or other things that want to alter the SFX temporarily should consider using DefenseFrameStateJudge.set_hit_sfx instead.

              1. "Taking damage" means an attack passed all DefenseRules without being blocked, and dealt more than 0 damage

              get_hurt_sfx (self)

              Returns the SFX that the Entity is currently using to play when it takes damage. This takes use_default_hurt_sfx into account, and returns the default SFX instead of any custom SFX set by set_hurt_sfx if the default is being used.

              Can return nil if that is the current set SFX. This is normal, and all functions which use an SFX object can safely accept nil.

              use_default_hurt_sfx (self , enabled)

              Whether or not the default hurt SFX or the custom hurt SFX set by set_hurt_sfx should play when this Entity takes damage.

              teleport (self , dest [, order [, on_begin]])

              Creates and queues a preconfigured MoveEvent for a "teleport" movement. The event will have the following properties: In short, the movement will complete instantly when starting, unless the Entity moving is a Player.

              If provided, order is the ActionOrder the event will be queued with (Voluntary by default), and on_begin is a function to be called if the movement starts, when it starts. Because queuing the movement is no guarantee that it will happen, the on_begin can be a good way to react to it happening.

              Returns true if the Entity is able to reach dest at the time this is called. This is not a guarantee that it will still be reachable when movement tries to begin, nor a guarantee that the movement will succeed, or even start. Internally, the return value is based on a call to can_move_to_func. If false is returned, the movement is not added to the queue.

              slide (self , dest , slide_time [, endlag [, order [, on_begin]]])

              Creates and queues a preconfigured MoveEvent for a "slide" movement. The event will have the following properties: In short, the movement will visually slide to the destination, without any starting delay.

              If provided, order is the ActionOrder the event will be queued with (Voluntary by default), and on_begin is a function to be called if the movement starts, when it starts. Because queuing the movement is no guarantee that it will happen, the on_begin can be a good way to react to it happening.

              Returns true if the Entity is able to reach dest at the time this is called. This is not a guarantee that it will still be reachable when movement tries to begin, nor a guarantee that the movement will succeed, or even start. Internally, the return value is based on a call to can_move_to_func. If false is returned, the movement is not added to the queue.

              jump (self , dest , dest_height , jump_time [, endlag [, order [, on_begin]]])

              Creates and queues a preconfigured MoveEvent for a "jump" movement. The event will have the following properties: In short, the movement will visually jump to the destination, without any starting delay. The Entity will be elevated to a height of float_height by the time the movement is half over, at which point it begins descending in a smooth parabola.

              If provided, order is the ActionOrder the event will be queued with (Voluntary by default), and on_begin is a function to be called if the movement starts, when it starts. Because queuing the movement is no guarantee that it will happen, the on_begin can be a good way to react to it happening.

              Returns true if the Entity is able to reach dest at the time this is called. This is not a guarantee that it will still be reachable when movement tries to begin, nor a guarantee that the movement will succeed, or even start. Internally, the return value is based on a call to can_move_to_func. If false is returned, the movement is not added to the queue.

              raw_move_event (self , event , order)

              Attempts to queue a movement using a fully configured MoveEvent..

              Unlike the functions that create configured events, this function requires order, which is the ActionOrder the event will be queued with.

              Returns true if the Entity is able to reach the evebt's destination at the time this is called. This is not a guarantee that it will still be reachable when movement tries to begin, nor a guarantee that the movement will succeed, or even start. Internally, the return value is based on a call to can_move_to_func. If false is returned, the movement is not added to the queue.

              is_moving (self)

              Returns true if the Entity is currently being moved by a MoveAction. Based on a combination of is_jumping, is_sliding and is_teleporting.

              is_jumping (self)

              Returns true when all of the following are true:
              1. The Entity is currently processing a MoveAction
              2. The current MoveAction has a nonzero height
              3. The current MoveAction has a nonzero deltaframes

              is_sliding (self)

              Returns true when all of the following are true:
              1. The Entity is currently processing a MoveAction
              2. The current MoveAction has height of 0
              3. The current MoveAction has a nonzero deltaframes

              is_teleporting (self)

              Returns true when all of the following are true:
              1. The Entity is currently processing a MoveAction
              2. The current MoveAction has height of 0
              3. The current MoveAction has deltaframes of 0
              In other words, a MoveEvent that finishes its movement instantly is a teleport. Because the deltaframes is 0, is_teleporting often returns false, as the move finishes almost instantly. Most likely to return true if the movement also has delayframes or endlag.

              is_passthrough (self)

              Returns true if the Entity is currently intangible, otherwise false. Currently unused in v2.1, so the return value will never be useful. In some cases where you would want to check intangibility, consider checking is_flashing.

              is_deleted (self)

              Checks whether or not the Entity is maked deleted, and returns the answer. A deleted Entity can be one of two things:
              1. An Entity that has been marked for removal by a call to delete
              2. An Entity that has had its memory freed, likely because it was cleaned up after having been marked for removal
              In both cases, the Entity should be considered unfit to act on. In the second case, attempting to call functions on the deleted Entity will result in an error saying data deleted.

              Check this or will_erase_eof when working with an Entity across multiple frames. For example, if you collect an Entity through Field.find_characters and keep a reference to it, and your code still makes use of its reference next frame, the Entity may have been deleted by then. Check this to make sure no errors happen.

              will_erase_eof (self)

              Checks whether or not the Entity is marked as erased, and returns the answer. An erased Entity can be one of two things:
              1. An Entity that has been marked for erasure by a call to erase
              2. An Entity that has had its memory freed, likely because it was cleaned up after having been marked for removal
              In both cases, the Entity should be considered unfit to act on. In the second case, attempting to call functions on the erased Entity will result in an error saying data deleted.

              Check this or is_deleted when working with an Entity across multiple frames. For example, if you collect an Entity through Field.find_characters and keep a reference to it, and your code still makes use of its reference next frame, the Entity may have been erased by then. Check this to make sure no errors happen.

              is_team (self , team)

              Checks if the Entity is considered a teammate to team. Returns true if one of the following is true:
              1. The Entity is Team.Other
              2. team is Team.Other
              3. The Entity is the same Team as team
              In summary, true if Team.Other is involved or the Entity is the same Team as the input, else returns false.

              It's common that Team checks want to target exactly a single Team to denote real allies, or they target exactly not the Entity's Team. If this is the case, use get_team and compare to one Team instead.

              set_team (self , team)

              Sets the Entity's Team to team. There is often no need to call this, as most Entity types must be provided a Team during construction.

              Most use cases would pass in either Team.other or the returned value from of a call to get_team. This ensures the Team is set relative to some other Entity, which is important when considering that the user of an effect could be on any Team.

              Players default to the same Team as the Tile they spawn on. This is the same for Characters spawned by a Mob.

              If the local Player changes Team, the perspective may flip to accommodate.

              get_team (self)

              Returns the Entity's current Team. The return value is often used to check for enemies or allies, to use as input to set_team, or to construct Entity types that require a Team during construction.

              erase (self)

              Marks the Entity as erased, which prepares it to be removed. It will be removed after its Tile updates. See will_erase_eof.

              If an Entity is removed in this way, its delete_func will not run. Because of this, it's common to only call this for Entities which do not have any delete_func set. Often when affecting Entities not created by the mod which calls this, you don't know if they have a delete_func set. It's recommended to instead call delete in this scenario, so that the other mod may handle anything it needs to.

              delete (self)

              Marks the Entity as deleted, which prepares it to be removed. It will be removed after its Tile updates. See is_deleted.

              If it has not already run, the Entity's delete_func will be called immediately. Because this could let Entities clean up more smoothly, it's recommended to call this when working with Entities that you don't know have a delete_func set or not.

              Unlike erase, the Entity will still be drawn on the frame this is called. If you need the benefits of delete but want the visibility of erase, simply call hide afterwards, which will prevent the Entity from drawing this frame.

              toggle_hitbox (self , toggle)

              Enables or disables the Entity's ability to be hit.

              Toggling false will cause the Entity to skip all attack checks. Attacks made against the Entity will not check any DefenseRules, will not make collision, and will not deal damage. Toggling false multiple times will do nothing.

              Toggling true while the hitbox is disabled will re-enable all of the above behavior, or do nothing if it was not already disabled.

              Recommended to be used alongside hide, to mimic the Entity being "off the field" and unable to be targeted or attacked. Tile.remove_entity_by_id can also accomplish this, but with the caveat that the Entity's update_func will not run, which can be more difficult to work with. There are cases where you want an Entity to be targetable but take no damage and/or have no collision. These cases can instead be solved using DefenseRules.

              ⚠️ In v2.5, toggling false will also prevent the Entity from being returned by any search for Entities, for example by Field.find_nearest_characters or Tile.find_obstacles.

              is_counterable (self)

              Whether or not the Entity is currently able to be countered. If the Entity is counterable, they will be countered if hit by an attack with all of the following properties: An attack that meets the above criteria and causes a counter will add the Hit.Counter flag to be processed, which will add a 150f Hit.Stun and remove Hit.Flash from the flags to be applied.

              If the HitProps.aggressor of an attack that counters was a Player, that Player will enter the FullSynchro Emotion. A local Player in the FullSynchro Emotion will see a counterable Entity flash blue.

              toggle_counter (self , toggle)

              Toggle Whether or not the Entity is currently able to be countered. If the Entity is counterable, they will be countered if hit by an attack with all of the following properties: An attack that meets the above criteria and causes a counter will add the Hit.Counter flag to be processed, which will add a 150f Hit.Stun and remove Hit.Flash from the flags to be applied.

              If the HitProps.aggressor of an attack that counters was a Player, that Player will enter the FullSynchro Emotion. A local Player in the FullSynchro Emotion will see a counterable Entity flash blue.

              is_bubbled (self)

              Whether or not the Entity is currently afflicted by the Bubble status. See Hit.Bubble.

              is_dragged (self)

              Whether or not the Entity is currently afflicted by the Drag status. See Hit.Drag.

              is_blind (self)

              Whether or not the Entity is currently afflicted by the Blind status. See Hit.Blind.

              is_confused (self)

              Whether or not the Entity is currently afflicted by the Confuse status. See Hit.Confuse.

              is_stunned (self)

              Whether or not the Entity is currently afflicted by the Stun status. See Hit.Stun.

              is_frozen (self)

              Whether or not the Entity is currently afflicted by the Freeze status. See Hit.Freeze.

              is_rooted (self)

              Whether or not the Entity is currently afflicted by the Root status. See Hit.Root.

              shake_camera (self , power , duration)

              Requests that the camera shake with the given power and duration. The shake starts with power and gradually weakens over the duration.

              Does nothing if the camera is in the middle of another shake.

              .update_func

              Function to run when the Entity updates, which is generally one time per frame. Used as a place for logic which must do something every frame. Note that this also runs once when the Entity first spawns, because it didn't get to run earlier in the frame, as it was not spawned yet.

              Does not run if the Entity is stunned, frozen, or bubbled. If it's necessary that your logic run even in these circumstances, consider registering a Component with Lifetimes.Local instead. This also does not run if the Entity is time frozen, because the Entity does not update at all if time frozen.

              When the set function is called, it will receive two parameters, which are the Entity that is updating, and an extra value known as "delta time", or dt. The Entity parameter will match the type of the Entity; for example, it will be a ScriptedPlayer if the Entity is a ScriptedPlayer. dt will always be equal to a float representation of 1/60. There is no use in including or reading this value, as tracking time through an incremented integer will always be more precise and easier to handle.

              ⚠️ In v2.5, the dt parameter will be removed, which is another reason to not use it.

              .can_move_to_func

              Function to run when checking if the Entity is allowed to move to a given Tile. The engine will call this during movement to check that a destination can be moved to, and will pass in the Tile to be tested as a parameter. Most notably used in teleport, teleport, and teleport to determine the return value, and if the movement should proceed.

              If the function returns false, that means the given Tile should not be moved to. If this is unset, the default value for all move checks will be false. It's common to want certain Entities, such as Spells, to ignore all movement restrictions, which can be done by setting this to a function that always returns true.

              .on_spawn_func

              Function to run when the Entity is spawned for the first time. Often used as initial setup for certain variables that require a Tile or Field on the Entity, which are unset before spawning.

              When the set function is called, it will receive two parameters, which are the Entity that spawned, and the Tile Tile it spawned on. This Entity parameter will match the type of the Entity; for example, it will be a ScriptedPlayer if the Entity is a ScriptedPlayer.

              .delete_func

              Function to run when the Entity is deleted. Specifically, it will be called immediately when delete is called. This is often used for effects that go with deletion, such as spawning explosions. It's also used to do cleanup, such as removing related Entities or signaling progress in an attack, but it's safer to use other functions for important logic that should never be skipped. erase will remove the Entity without causing this function to be called. Use other callbacks, like Field.callback_on_delete or Field.notify_on_delete for logic that absolutely must happen.

              When the set function is called, it will receive one parameter, which is the Entity that is deleting. This parameter will match the type of the Entity; for example, it will be a ScriptedSpell if the Entity is a ScriptedSpell.
              Note: This is not present on scripted player objects!

              .battle_end_func

              Function to run when the battle sends the signal that it has ended. Typically used to clean up things that should no longer be around while the battle results appear or the screen fade out, or to block scripted logic that would create new attacks during that time.

              When the set function is called, it will receive one parameter, which is the Entity that received the signal. This parameter will match the type of the Entity; for example, it will be a ScriptedPlayer if the Entity is a ScriptedPlayer.

              .battle_start_func

              Function to run when the battle sends the signal that battle has begun. The signal is sent when the Card Select battle state finishes. The set function will also run immediately when the Entity spawns if it was spawned after battle started.

              Typically used to set up data that will be used by the Entity during battle.

              When the set function is called, it will receive one parameter, which is the Entity that received the signal. This parameter will match the type of the Entity; for example, it will be a ScriptedPlayer if the Entity is a ScriptedPlayer.

              .collision_func

              Function to run when an attack made by the Entity makes collision with another Entity. This is a step signifying that something was hit, but it's still unsure if damage will be done. See attack_func for that. Often used to spawn graphic effects that signify the hit, and to delete the Entity so that it stops attacking now that it has hit. It's common to read the given DefenseFrameStateJudge to see if graphics are suggested to spawn or not. See DefenseFrameStateJudge.hint_spawn_gfx

              When the set function is called, it will receive three parameters, which are the Entity this callback belongs to, the Entity that was collided with, and the DefenseFrameStateJudge overseeing the attack. The first parameter will match the type of this Entity; for example, it will be a ScriptedSpell if the Entity is a ScriptedSpell.

              .attack_func

              Function to run when an attack made by the Entity deals damage to another Entity. This is a step signifying that the attack passed all defense checks on the target without being blocked, which means that the actual damage taken may have been 0, but it did hit. Commonly used to apply effects that shouldn't happen when an attack only makes collision and is blocked (e.g. blocked by a barrier or shield), such as applying an HP bug.

              It's uncommon to do things like deleting the attacker here or creating graphic effects for the hit. These are usually done in the collision_func instead.

              When the set function is called, it will receive three parameters, which are the Entity this callback belongs to, the Entity that was collided with, and the DefenseFrameStateJudge overseeing the attack. The first parameter will match the type of this Entity; for example, it will be a ScriptedSpell if the Entity is a ScriptedSpell.

            Hit: table

            This enum set represents all status effects that an attack is capable of inflicting.
            Statuses and certain reactions to them are only applied when the attack passes all DefenseRules checks without being blocked or filtered.

            HitProps: table

            Input: table

              N/A

              Lifetimes: table

              Components in ONB are allowed to update at different times in a single frame. A component can only have one lifetime type which tells the engine when to process it.
              1. Local - Updates a component only when the entity it belongs to updates.
              2. Battle - Updates a component every frame during the combat state1.
              3. UI - Updates a component every frame the UI draws2.
              1. The battle scene is composed of different states. Combat is when enemies move and attack on the field.
              2. UI draws every frame, so this means that the component will update every frame, even during chip select.

              MobPackage: table

                get_field (self)

                Returns the Field that is used by this Mob.

                set_name (self , name)

                Sets the name for this Mob, to be displayed in the Mob Select screen.

                set_description (self , desc)

                Sets a description to be displayed in the Mob Select screen for this Mob. desc should fit within a single textbox.

                set_speed (self , speed)

                Sets a "speed" value to be displayed in the Mob Select screen for this Mob. Purely aesthetic and has no effect on the Characters spawned by the Mob.

                set_attack (self , attack)

                Sets an "attack" value to be displayed in the Mob Select screen for this Mob. Purely aesthetic and has no effect on the Characters spawned by the Mob.

                set_health (self , health)

                Sets a "health" value to be displayed in the Mob Select screen for this Mob. Purely aesthetic and has no effect on the Characters spawned by the Mob.

                set_preview_texture_path (self , path)

                Sets the image path for the image to be displayed in the Mob Select screen for this Mob. Recommended size is a strict 86px width by 54px height.

                enable_freedom_mission (self , enabled)

                enable_boss_battle (self , enabled)

                create_spawner (self , id , rank)

                spawn_player (self , player_num , x , y)

                set_background (self , texPath , animPath , scrollX , scrollY)

                stream_music (self , path , loopStart , loopEnd)

                no_results (self)

              MoveEvent: table

                N/A

                Playback: table

                Player: table

                  get_id (self)

                  Returns the unique number identifier for this Entity. No two Entities have the same ID, and the ID is unchanged for its lifetime.

                  IDs are set as the Entity is constructed. An Entity created sooner than another Entity will have a smaller ID, but note that this does not necessarily denote spawn order because Entities can be created and then spawned out of order.

                  get_name (self)

                  Returns the String this Entity has for a name.

                  set_name (self , name)

                  Sets a new name for the Entity. Enemy Character names appear in battle, during the first card select. For other Entities, this goes unused, but is still readable by get_name, and so can be acted on by scripted mods.

                  get_element (self)

                  Returns the Entity's current Element.

                  set_element (self , element)

                  Sets a new Element for the Entity. Entities have a default of Element.None

                  ⚠️ In v2.1, Player mods often call this in the player_init to set the initial Element, but in v2.5, this should be done with PlayerPackage.set_element so that it appears in the Player select screen.

                  get_tile (self [, dir [, count]])

                  Returns a Tile relative to the Entity, count away in dir Direction. If no Tile exists at that distance in that direction, returns nil instead, for example if moving count to the dir would reach beyond the bounds of the Field.

                  dir and count are optional. If called without either, returns the current Tile, as in get_current_tile. Otherwise, both args must be present.
                  count will be forced positive, as in cast to an unsigned number. If a negative number is passed in, it will likely become a very large positive number. If wanting to get a Tile "behind" the Entity, instead of using its facing Direction as the dir with a negative count, use the opposite Direction with a positive count.

                  get_current_tile (self)

                  Returns the Entity's Tile. Returns nil if the Entity has not been spawned.

                  share_tile (self , share)

                  Sets whether or not the Entity is allowed to share Tiles with other Entities, based on share. Often checked as part of movement processing to determine if an occupied destination Tile can be moved to.

                  get_field (self)

                  Returns the Entity's Field. This Field is invalid if the Entity has not been spawned. An invalid Field will have any function on it fail, giving a data deleted message.

                  set_facing (self , dir)

                  Sets a new Direction for the Entity to "face". This affects whether or not their Sprite will be drawn flipped to face one direction or the other. Only Direction.Left and Direction.Right are acceptable values.

                  If unset, an Entity will adopt their spawn Tile's facing, which is Direction.Right for Tiles that are on the left side of the Field (with X <= 3), and Direction.Left for Tiles that are on the right side of the Field (with X >= 4). This is usually undesired, so call this function accordingly when creating an Entity.

                  Because perspective flips for players based on Team, keep in mind that "player 2" will visually be looking to the right on their screen, but their facing is Direction.Left. Because of this, it's most common and recommended to call set_facing with a Direction relative to the related Entity. For example, when creating a Spell during an attack performed by an Entity, almost all use cases would call set_facing for that Spell while passing in the return value of get_facing, as in
                  function create_attack(user)
                    local spell = Battle.Spell.new(user:get_team())
                    spell:set_texture(tex)
                    spell:set_facing(user:get_facing())
                  end

                  get_facing (self)

                  Returns the Direction that the Entity is "facing". Often used by scripted mods to determine a direction to move in, or to set_facing on another related Entity.

                  get_facing_away (self)

                  Returns the Direction that is the reverse of the Entity's "facing".

                  get_move_direction (self)

                  Utility function that returns the Direction set by set_move_direction. Direction.None by default.

                  Unused internally, so its usage is entirely determined by scripted content. May be used to learn that this Entity is currently moving in a particular direction.

                  set_move_direction (self , dir)

                  Utility function that sets a Direction to be read by get_move_direction.

                  Unused internally, so its usage is entirely determined by scripted content. May be used to tell other mods that this Entity is currently moving in a particular direction.

                  set_elevation (self , elevation)

                  Sets a height in pixels to draw the Entity. Differs from offsets in several ways:
                  1. Positive elevation goes up, and negative goes down
                  2. The Entity's sprite moves, but its shadow stays on the ground
                  Useful when scripting the appearance of moving upwards, like during a jump, because the shadow is left on the ground.

                  get_elevation (self)

                  Returns the value set by Entity.set_elevation. 0.0 by default. A positive number indicates that the Entity is drawn above the ground by that many pixels.

                  set_offset (self , x , y)

                  Offsets the Entity by x half pixels horizontally and y half pixels vertically, relative to the screen position of its Tile.
                  Because every 1 unit is a half pixel, multiply your desired offset by 2. The reason for half pixels is because the game's screen is actually upscaled by x2.
                  Positive x moves to the right, and positive y moves down. The offset is stored and replaced by a subsequent call, so Entity:set_offset(0, 0) will reset the offset.

                  Perspective flipping causes a Team.Blue player to see positive x visually move left instead of right, as everything is flipped. Because of this, it's common in most use cases to make x positive or negative based on a related Direction.
                  For example, consider an Artifact that should be spawned on an Entity's Tile, offset to appear visually behind them. The offset can be flipped to always point behind them.
                  function create_attack(user)
                    local spell = Battle.Spell.new(user:get_team())
                    spell:set_texture(tex)
                    local facing = user:get_facing()
                    spell:set_facing(facing)
                    -- 10 pixels backwards
                    local x_off = -10
                    -- Flip if facing Left, so that x_off is still "backwards" relative to facing
                    if facing == Direction.Left then 
                      x_off = x_off * -1
                    end
                  
                    spell:set_offset(x_off, 0)
                  end


                  If trying to visually move vertically, consider if set_elevation would be better.

                  get_offset (self)

                  Returns the Entity's current offset as a vec2, as set by Entity.set_offset. Often used when tracking the Entity's previous offset to restore after a temporary offset change, or to add to the the offset of a graphical effect that is meant to be near the Entity's visual position.

                  Not to be confused with get_tile_offset, which returns the visual offset away from the current Tile, and is a separate value.

                  get_tile_offset (self)

                  Returns the Entity's current offset from its Tile as a vec2. The tile offset is not set by any Lua function. Instead, it represents movement, and is set as a MoveEvent progresses.

                  Often used alongside get_offset to add to the the offset of a graphical effect that is meant to be near the Entity's visual position. Not to be confused with get_offset, which returns the sprite offset away from the parent origin, and is a separate value.

                  sprite (self)

                  Returns the Entity's Sprite Node. Note that while `Node` has some functions with similar names and utility to the Entity, they sometimes act differently.

                  hide (self)

                  Tells the Entity to stop drawing. It will become invisible. Calliing this again while already hidden will do nothing.

                  reveal (self)

                  Tells the Entity to draw. It will become visible if it was hidden (see hide. Calling this again while already visible will do nothing.

                  Note that this is a different name from Node.show, despite having similar functionality.

                  never_flip (self , toggle)

                  Toggles whether or not to allow the Entity's sprite to be drawn flipped. If toggle is false, disallows flipping based on facing and perspective flip.

                  set_shadow (self , shadow_type)

                  Sets the Shadow for the Entity. Hidden unless show_shadow reveals it.

                  shadow_type can be a Shadow or a Texture. Because there is no associated animation file for a Texture input, the center of the image is used as the origin.

                  Shadows draw beneath other Entities, and appear on the "floor". If the Entity is offset, the Shadow mimics the offset. If the Entity is elevated, the Shadow stays on the ground.

                  show_shadow (self , visible)

                  Reveals or hides the Shadow set by set_shadow.

                  set_palette (self , palette)

                  Sets a Texture to use to color the pixels in the Entity's sprites. If calling this for the first time because a "default" palette is being set for a Player, it's recommended to also call store_base_palette.

                  A palette is a 256x1 image where each pixel is a color that will be used to color in corresponding pixels in the Entity's Texture. To use the palette properly, the image used for the Entity's Texture should be greyscaled. RGB 0,0,0 in the Entity's Texture will be colored using the color of the pixel at (0,0) (transparency is recommended here). RGB 1,1,1 will use the color of the pixel at (1,0), and so on.

                  get_current_palette (self)

                  Returns the Texture set by set_palette. This will be nil if no palette has been set.

                  store_base_palette (self , palette)

                  get_base_palette (self)

                  set_height (self , value)

                  Sets a value for the Entity's height. This does not necessarily need to match the height of its visible sprite, and often should be taller than that.

                  Used by the engine for sizing and positioning various effects, including the visual effects for the Freeze status. It's also used in calculating the fallback position of the visual effects for the Confusion and Blind statuses, if there is no "HEAD" animation point to use in calculation instead.

                  For Players, this is used to position selected cards.

                  get_height (self)

                  Returns the value set by Entity.set_height. By default, 0.0.

                  register_component (self , component)

                  Registers a Component for the Entity. If the Entity is currently in the middle of updating, the Component is instead queued to be added when its update is finished.

                  create_node (self)

                  Creates a new Node, adds it to the Entity, and returns it. This Node is anchored at the origin in the Entity's animation state.

                  set_texture (self , tex)

                  Sets the Texture to be used when drawing this Entity.

                  get_texture (self)

                  Returns the Texture currently used by the Entity to draw.

                  get_sprite (self)

                  q ⚠️ v2.5 only
                  Returns the Entity's Sprite Node. Note that while `Node` has some functions with similar names and utility to the Entity, they sometimes act differently.

                  set_animation (self , path)

                  Sets the path for the animation file used for the Player's battle sprites. Associated with the Texture set by set_texture

                  ⚠️ Removed in v2.5. Instead, use Animation.load, as in player:get_animation():load(path)

                  get_animation (self)

                  Returns the Animation object used by this Entity.

                  set_counter_frame_range (self , keyframe_start , keyframe_end)

                  Sets Animation keyframes that will toggle on and off counterability.

                  Does nothing if keyframe_start is greater than keyframe_end, or if either value is less than 1. If both are the same value, 1 is added to keyframe_end.

                  This is essentially a shortcut function for
                  local anim = char:get_animation()
                  -- Assume keyframe_start and keyframe_end are defined as numbers
                  anim:on_frame(keyframe_start, function()
                      char:toggle_counter(true)
                  end)
                  
                  anim:on_frame(keyframe_end, function()
                      char:toggle_counter(false)
                  end)
                  
                  
                  Because this is tied to the current Animation state, anything that invalidates frame callbacks, such as a call to Animation.set_state, will also prevent these toggles from running if they have yet to run.

                  highlight_tile (self , mode)

                  Causes the Entity's Tile to highlight with the Highlight mode. This highlight is checked during Spell updates, so it's common that the Tile will not react on the frame an an Entity calls this, or the frame an Entity is spawned

                  Unlike Tile.highlight, which is for a single, targeted Tile and lasts for a single frame, this always highlights the Entity's current Tile until called with Highlight.None (or the Entity is removed from the Field).

                  get_context (self)

                  Returns the Entity's Context object, which includes information such as its ID. Its fields are unreadable from Lua, and is mostly used as part of constructing HitProps, which will set the Hitprops.aggressor to the ID in the Context.

                  If the Entity has not yet executed a CardAction, the Context will not have an aggressor set. This is unusual to worry about, however, as hitboxes are almost always created during a CardAction.

                  copy_hit_props (self)

                  Returns the Entity's HitProps object, as set by set_hit_props. Often used when inspecting an attacker's HitProps inside a DefenseRule.can_block_func in order to react to the damage, flags, element, or aggressor for the attack.

                  Because this is a copy, modifications to the return value will not affect the HitProps on the Entity. Use set_hit_props afterwards with the modified copy to do this.

                  set_hit_props (self , props)

                  Sets the Entity's HitProps. Often used when creating Spells or Obstacles that will attempt attacks as part of their scripted logic.

                  Less commonly, this is also used during a DefenseRule.can_block_func in order to modify the HitProps of an incoming attack. If doing this, keep in mind that HitProps are treated somewhat differently during defense checks. Their HitProps are temporarily modified to include the Hit.Cancel flag, and the attacker's original HitProps will be restored afterwards.

                  set_color (self , color)

                  Sets the Color to draw the Entity wit this frame. Influenced by the set ColorMode.

                  Unlike other nodes, an Entity's coloring will only last a single frame, resetting at the start of its update.

                  get_color (self)

                  Returns the Color that the Entity will be drawn with this frame.

                  set_health (self , health)

                  Sets the Entity's health. Cannot be set to a negative number, and cannot exceed the Entity's max health. If max health is 0, max health will be set to health.

                  If an Entity has a nonzero max health, and their health is 0 at the start of their update, they call delete automatically.

                  For Obstacles only, passing a health value of 0 causes delete to be called immediately.

                  get_health (self)

                  Returns the Entity's current health as a number.

                  get_max_health (self)

                  Returns the Entity's current max health as a number.

                  Note that there is no set_max_health. Max health is instead set through the Entity's first call to set_health.

                  set_float_shoe (self , enabled)

                  Enables or disables the float shoe ability. When enabled, the Entity avoids certain negative TileState effects:
                  • Does not cause Cracked Tiles to become Broken when stepping off them
                  • Will not be forced to move by Ice Tiles
                  • Does not trigger damage from Lava Tiles
                  • Does not take damage from Poison Tiles
                  • Will not be forced to move by any of the Direction* Tiles
                  • Will not be afflicted by Root when stepping on Sea Tiles
                  • Will not be afflicted by Root when stepping on Sand Tiles

                  set_air_shoe (self , enabled)

                  Enables or disables the air shoe ability. When enabled, the Entity is allowed to move onto Broken Tiles. For non-Players, the Entity's can_move_to_func takes priority.

                  add_defense_rule (self , rule)

                  Adds a DefenseRule to the Entity. If the rule's priority matches an existing added DefenseRule, the previous one is removed before the new one is added.

                  ⚠️ In v2.5, replacing another DefenseRule will trigger its DefenseRule.on_replace_func.

                  remove_defense_rule (self , rule)

                  Removes the DefenseRule rule from the Entity. If rule has already been removed or otherwise is not on the Entity, does nothing.

                  ignore_common_aggressor (self , toggle)

                  Toggles whether or not the Entity should ignore attacks whose HitProps.aggressor matches the Entity's own HitProps.aggressor. This could be useful, for example, in the scenario that one Entity creates two Obstacles that are able to attack each other, such as if they are opposing Teams or Team.Other, but they should avoid attacking each other regardless. If they both ignore Entities with the same aggressor, they will not attack each other.

                  register_status_callback (self , flag , callback)

                  Tells the Entity to call callback whenever the Hit flag flag is processed. These flags are processed at the start of the Entity's update, so hits that occur during time freeze will not activate any callbacks until after time resumes.

                  flag must be a single Hit flag, not a combination of them. If it is a combination of flags, it will never be run. Hit.None will similarly never be processed.

                  Attempting to add a second callback for a flag will result in the previous callback being replaced by the new one. Because of this, it's recommended to only use this function on Entities created by your own mods, so that calling this doesn't compromise any functionality.

                  set_hurt_sfx (self , audio [, priority])

                  Sets the SFX to play when the Entity is damaged1 by an attack with the Hit.Impact flag. The SFX set by a call to this function will not be used unless enabled in a call to use_default_hurt_sfx.

                  audio can be a loaded audio file, an AudioType, or nil. If nil is passed in, no sound will play when taking damage.
                  priority is the AudioPriority for the SFX to play at. If not provided, defaults to the AudioPriority last set by this function, or, if this has not been called before, defaults to AudioPriority.Low.

                  Typically called by the Player mod itself in its player_init, rather than other scripted mods. Attacks or other things that want to alter the SFX temporarily should consider using DefenseFrameStateJudge.set_hit_sfx instead.

                  1. "Taking damage" means an attack passed all DefenseRules without being blocked, and dealt more than 0 damage

                  get_hurt_sfx (self)

                  Returns the SFX that the Entity is currently using to play when it takes damage. This takes use_default_hurt_sfx into account, and returns the default SFX instead of any custom SFX set by set_hurt_sfx if the default is being used.

                  Can return nil if that is the current set SFX. This is normal, and all functions which use an SFX object can safely accept nil.

                  use_default_hurt_sfx (self , enabled)

                  Whether or not the default hurt SFX or the custom hurt SFX set by set_hurt_sfx should play when this Entity takes damage.

                  teleport (self , dest [, order [, on_begin]])

                  Creates and queues a preconfigured MoveEvent for a "teleport" movement. The event will have the following properties: In short, the movement will complete instantly when starting, unless the Entity moving is a Player.

                  If provided, order is the ActionOrder the event will be queued with (Voluntary by default), and on_begin is a function to be called if the movement starts, when it starts. Because queuing the movement is no guarantee that it will happen, the on_begin can be a good way to react to it happening.

                  Returns true if the Entity is able to reach dest at the time this is called. This is not a guarantee that it will still be reachable when movement tries to begin, nor a guarantee that the movement will succeed, or even start. Internally, the return value is based on a call to can_move_to_func. If false is returned, the movement is not added to the queue.

                  slide (self , dest , slide_time [, endlag [, order [, on_begin]]])

                  Creates and queues a preconfigured MoveEvent for a "slide" movement. The event will have the following properties: In short, the movement will visually slide to the destination, without any starting delay.

                  If provided, order is the ActionOrder the event will be queued with (Voluntary by default), and on_begin is a function to be called if the movement starts, when it starts. Because queuing the movement is no guarantee that it will happen, the on_begin can be a good way to react to it happening.

                  Returns true if the Entity is able to reach dest at the time this is called. This is not a guarantee that it will still be reachable when movement tries to begin, nor a guarantee that the movement will succeed, or even start. Internally, the return value is based on a call to can_move_to_func. If false is returned, the movement is not added to the queue.

                  jump (self , dest , dest_height , jump_time [, endlag [, order [, on_begin]]])

                  Creates and queues a preconfigured MoveEvent for a "jump" movement. The event will have the following properties: In short, the movement will visually jump to the destination, without any starting delay. The Entity will be elevated to a height of float_height by the time the movement is half over, at which point it begins descending in a smooth parabola.

                  If provided, order is the ActionOrder the event will be queued with (Voluntary by default), and on_begin is a function to be called if the movement starts, when it starts. Because queuing the movement is no guarantee that it will happen, the on_begin can be a good way to react to it happening.

                  Returns true if the Entity is able to reach dest at the time this is called. This is not a guarantee that it will still be reachable when movement tries to begin, nor a guarantee that the movement will succeed, or even start. Internally, the return value is based on a call to can_move_to_func. If false is returned, the movement is not added to the queue.

                  raw_move_event (self , event , order)

                  Attempts to queue a movement using a fully configured MoveEvent..

                  Unlike the functions that create configured events, this function requires order, which is the ActionOrder the event will be queued with.

                  Returns true if the Entity is able to reach the evebt's destination at the time this is called. This is not a guarantee that it will still be reachable when movement tries to begin, nor a guarantee that the movement will succeed, or even start. Internally, the return value is based on a call to can_move_to_func. If false is returned, the movement is not added to the queue.

                  is_moving (self)

                  Returns true if the Entity is currently being moved by a MoveAction. Based on a combination of is_jumping, is_sliding and is_teleporting.

                  is_jumping (self)

                  Returns true when all of the following are true:
                  1. The Entity is currently processing a MoveAction
                  2. The current MoveAction has a nonzero height
                  3. The current MoveAction has a nonzero deltaframes

                  is_sliding (self)

                  Returns true when all of the following are true:
                  1. The Entity is currently processing a MoveAction
                  2. The current MoveAction has height of 0
                  3. The current MoveAction has a nonzero deltaframes

                  is_teleporting (self)

                  Returns true when all of the following are true:
                  1. The Entity is currently processing a MoveAction
                  2. The current MoveAction has height of 0
                  3. The current MoveAction has deltaframes of 0
                  In other words, a MoveEvent that finishes its movement instantly is a teleport. Because the deltaframes is 0, is_teleporting often returns false, as the move finishes almost instantly. Most likely to return true if the movement also has delayframes or endlag.

                  is_passthrough (self)

                  Returns true if the Entity is currently intangible, otherwise false. Currently unused in v2.1, so the return value will never be useful. In some cases where you would want to check intangibility, consider checking is_flashing.

                  is_deleted (self)

                  Checks whether or not the Entity is maked deleted, and returns the answer. A deleted Entity can be one of two things:
                  1. An Entity that has been marked for removal by a call to delete
                  2. An Entity that has had its memory freed, likely because it was cleaned up after having been marked for removal
                  In both cases, the Entity should be considered unfit to act on. In the second case, attempting to call functions on the deleted Entity will result in an error saying data deleted.

                  Check this or will_erase_eof when working with an Entity across multiple frames. For example, if you collect an Entity through Field.find_characters and keep a reference to it, and your code still makes use of its reference next frame, the Entity may have been deleted by then. Check this to make sure no errors happen.

                  will_erase_eof (self)

                  Checks whether or not the Entity is marked as erased, and returns the answer. An erased Entity can be one of two things:
                  1. An Entity that has been marked for erasure by a call to erase
                  2. An Entity that has had its memory freed, likely because it was cleaned up after having been marked for removal
                  In both cases, the Entity should be considered unfit to act on. In the second case, attempting to call functions on the erased Entity will result in an error saying data deleted.

                  Check this or is_deleted when working with an Entity across multiple frames. For example, if you collect an Entity through Field.find_characters and keep a reference to it, and your code still makes use of its reference next frame, the Entity may have been erased by then. Check this to make sure no errors happen.

                  is_team (self , team)

                  Checks if the Entity is considered a teammate to team. Returns true if one of the following is true:
                  1. The Entity is Team.Other
                  2. team is Team.Other
                  3. The Entity is the same Team as team
                  In summary, true if Team.Other is involved or the Entity is the same Team as the input, else returns false.

                  It's common that Team checks want to target exactly a single Team to denote real allies, or they target exactly not the Entity's Team. If this is the case, use get_team and compare to one Team instead.

                  set_team (self , team)

                  Sets the Entity's Team to team. There is often no need to call this, as most Entity types must be provided a Team during construction.

                  Most use cases would pass in either Team.other or the returned value from of a call to get_team. This ensures the Team is set relative to some other Entity, which is important when considering that the user of an effect could be on any Team.

                  Players default to the same Team as the Tile they spawn on. This is the same for Characters spawned by a Mob.

                  If the local Player changes Team, the perspective may flip to accommodate.

                  get_team (self)

                  Returns the Entity's current Team. The return value is often used to check for enemies or allies, to use as input to set_team, or to construct Entity types that require a Team during construction.

                  erase (self)

                  Marks the Entity as erased, which prepares it to be removed. It will be removed after its Tile updates. See will_erase_eof.

                  If an Entity is removed in this way, its delete_func will not run. Because of this, it's common to only call this for Entities which do not have any delete_func set. Often when affecting Entities not created by the mod which calls this, you don't know if they have a delete_func set. It's recommended to instead call delete in this scenario, so that the other mod may handle anything it needs to.

                  delete (self)

                  Marks the Entity as deleted, which prepares it to be removed. It will be removed after its Tile updates. See is_deleted.

                  If it has not already run, the Entity's delete_func will be called immediately. Because this could let Entities clean up more smoothly, it's recommended to call this when working with Entities that you don't know have a delete_func set or not.

                  Unlike erase, the Entity will still be drawn on the frame this is called. If you need the benefits of delete but want the visibility of erase, simply call hide afterwards, which will prevent the Entity from drawing this frame.

                  toggle_hitbox (self , toggle)

                  Enables or disables the Entity's ability to be hit.

                  Toggling false will cause the Entity to skip all attack checks. Attacks made against the Entity will not check any DefenseRules, will not make collision, and will not deal damage. Toggling false multiple times will do nothing.

                  Toggling true while the hitbox is disabled will re-enable all of the above behavior, or do nothing if it was not already disabled.

                  Recommended to be used alongside hide, to mimic the Entity being "off the field" and unable to be targeted or attacked. Tile.remove_entity_by_id can also accomplish this, but with the caveat that the Entity's update_func will not run, which can be more difficult to work with. There are cases where you want an Entity to be targetable but take no damage and/or have no collision. These cases can instead be solved using DefenseRules.

                  ⚠️ In v2.5, toggling false will also prevent the Entity from being returned by any search for Entities, for example by Field.find_nearest_characters or Tile.find_obstacles.

                  is_counterable (self)

                  Whether or not the Entity is currently able to be countered. If the Entity is counterable, they will be countered if hit by an attack with all of the following properties: An attack that meets the above criteria and causes a counter will add the Hit.Counter flag to be processed, which will add a 150f Hit.Stun and remove Hit.Flash from the flags to be applied.

                  If the HitProps.aggressor of an attack that counters was a Player, that Player will enter the FullSynchro Emotion. A local Player in the FullSynchro Emotion will see a counterable Entity flash blue.

                  toggle_counter (self , toggle)

                  Toggle Whether or not the Entity is currently able to be countered. If the Entity is counterable, they will be countered if hit by an attack with all of the following properties: An attack that meets the above criteria and causes a counter will add the Hit.Counter flag to be processed, which will add a 150f Hit.Stun and remove Hit.Flash from the flags to be applied.

                  If the HitProps.aggressor of an attack that counters was a Player, that Player will enter the FullSynchro Emotion. A local Player in the FullSynchro Emotion will see a counterable Entity flash blue.

                  is_bubbled (self)

                  Whether or not the Entity is currently afflicted by the Bubble status. See Hit.Bubble.

                  is_dragged (self)

                  Whether or not the Entity is currently afflicted by the Drag status. See Hit.Drag.

                  is_blind (self)

                  Whether or not the Entity is currently afflicted by the Blind status. See Hit.Blind.

                  is_confused (self)

                  Whether or not the Entity is currently afflicted by the Confuse status. See Hit.Confuse.

                  is_stunned (self)

                  Whether or not the Entity is currently afflicted by the Stun status. See Hit.Stun.

                  is_frozen (self)

                  Whether or not the Entity is currently afflicted by the Freeze status. See Hit.Freeze.

                  is_rooted (self)

                  Whether or not the Entity is currently afflicted by the Root status. See Hit.Root.

                  shake_camera (self , power , duration)

                  Requests that the camera shake with the given power and duration. The shake starts with power and gradually weakens over the duration.

                  Does nothing if the camera is in the middle of another shake.

                  .update_func

                  Function to run when the Entity updates, which is generally one time per frame. Used as a place for logic which must do something every frame. Note that this also runs once when the Entity first spawns, because it didn't get to run earlier in the frame, as it was not spawned yet.

                  Does not run if the Entity is stunned, frozen, or bubbled. If it's necessary that your logic run even in these circumstances, consider registering a Component with Lifetimes.Local instead. This also does not run if the Entity is time frozen, because the Entity does not update at all if time frozen.

                  When the set function is called, it will receive two parameters, which are the Entity that is updating, and an extra value known as "delta time", or dt. The Entity parameter will match the type of the Entity; for example, it will be a ScriptedPlayer if the Entity is a ScriptedPlayer. dt will always be equal to a float representation of 1/60. There is no use in including or reading this value, as tracking time through an incremented integer will always be more precise and easier to handle.

                  ⚠️ In v2.5, the dt parameter will be removed, which is another reason to not use it.

                  .can_move_to_func

                  Function to run when checking if the Entity is allowed to move to a given Tile. The engine will call this during movement to check that a destination can be moved to, and will pass in the Tile to be tested as a parameter. Most notably used in teleport, teleport, and teleport to determine the return value, and if the movement should proceed.

                  If the function returns false, that means the given Tile should not be moved to. If this is unset, the default value for all move checks will be false. It's common to want certain Entities, such as Spells, to ignore all movement restrictions, which can be done by setting this to a function that always returns true.

                  .on_spawn_func

                  Function to run when the Entity is spawned for the first time. Often used as initial setup for certain variables that require a Tile or Field on the Entity, which are unset before spawning.

                  When the set function is called, it will receive two parameters, which are the Entity that spawned, and the Tile Tile it spawned on. This Entity parameter will match the type of the Entity; for example, it will be a ScriptedPlayer if the Entity is a ScriptedPlayer.

                  .delete_func

                  Function to run when the Entity is deleted. Specifically, it will be called immediately when delete is called. This is often used for effects that go with deletion, such as spawning explosions. It's also used to do cleanup, such as removing related Entities or signaling progress in an attack, but it's safer to use other functions for important logic that should never be skipped. erase will remove the Entity without causing this function to be called. Use other callbacks, like Field.callback_on_delete or Field.notify_on_delete for logic that absolutely must happen.

                  When the set function is called, it will receive one parameter, which is the Entity that is deleting. This parameter will match the type of the Entity; for example, it will be a ScriptedSpell if the Entity is a ScriptedSpell.
                  Note: This is not present on scripted player objects!

                  .battle_end_func

                  Function to run when the battle sends the signal that it has ended. Typically used to clean up things that should no longer be around while the battle results appear or the screen fade out, or to block scripted logic that would create new attacks during that time.

                  When the set function is called, it will receive one parameter, which is the Entity that received the signal. This parameter will match the type of the Entity; for example, it will be a ScriptedPlayer if the Entity is a ScriptedPlayer.

                  .battle_start_func

                  Function to run when the battle sends the signal that battle has begun. The signal is sent when the Card Select battle state finishes. The set function will also run immediately when the Entity spawns if it was spawned after battle started.

                  Typically used to set up data that will be used by the Entity during battle.

                  When the set function is called, it will receive one parameter, which is the Entity that received the signal. This parameter will match the type of the Entity; for example, it will be a ScriptedPlayer if the Entity is a ScriptedPlayer.

                  .collision_func

                  Function to run when an attack made by the Entity makes collision with another Entity. This is a step signifying that something was hit, but it's still unsure if damage will be done. See attack_func for that. Often used to spawn graphic effects that signify the hit, and to delete the Entity so that it stops attacking now that it has hit. It's common to read the given DefenseFrameStateJudge to see if graphics are suggested to spawn or not. See DefenseFrameStateJudge.hint_spawn_gfx

                  When the set function is called, it will receive three parameters, which are the Entity this callback belongs to, the Entity that was collided with, and the DefenseFrameStateJudge overseeing the attack. The first parameter will match the type of this Entity; for example, it will be a ScriptedSpell if the Entity is a ScriptedSpell.

                  .attack_func

                  Function to run when an attack made by the Entity deals damage to another Entity. This is a step signifying that the attack passed all defense checks on the target without being blocked, which means that the actual damage taken may have been 0, but it did hit. Commonly used to apply effects that shouldn't happen when an attack only makes collision and is blocked (e.g. blocked by a barrier or shield), such as applying an HP bug.

                  It's uncommon to do things like deleting the attacker here or creating graphic effects for the hit. These are usually done in the collision_func instead.

                  When the set function is called, it will receive three parameters, which are the Entity this callback belongs to, the Entity that was collided with, and the DefenseFrameStateJudge overseeing the attack. The first parameter will match the type of this Entity; for example, it will be a ScriptedSpell if the Entity is a ScriptedSpell.

                  new (team , rank)

                  Returns a newly-created ScriptedCharacter, with team and rank as its Team and Rank, respectively.

                  It's not common to create a Character in this way, as they are usually instead created and spawned by a Mob. Sometimes a Character might be spawned in the middle of combat, which is where this comes in.

                  from (self , entity)

                  Attempts to convert the given entity to a Player. If successful, returns a reference to the entity as a Player. Otherwise, returns nil. Use this when a callback or engine function gives back an Entity or Character, but you need a function that only exists on Player.

                  Expect nil when the underlying type of entity is Artifact, Spell, or Obstacle.

                  If entity is already explicitly Player, returns a ScriptedPlayer.

                  from_package (self , uuid , team , rank)

                  Finds a Character defined with uuid as its UUID, and calls its associated script. If the script is found and properly executed, returns a Character created from that script, with team and rank as its Team and Rank, respectively. If not found, an error is raised.

                  The uuid should not be the UUID of a Mob package, which creates Characters but is not the Character itself. Instead, it is the UUID passed into Engine.define_character that declared a UUID and script for a Character.

                  It's not common to create a Character in this way, as they are usually instead created and spawned by a Mob. Sometimes a Character might be spawned in the middle of combat, which is where this comes in.

                  get_target (self)

                  This function is a relic of v1.0. Does nothing as of v2.0.

                  card_action_event (self , action , order)

                  Queues the given CardAction action with the ActionOrder order. The queued CardAction will remain queued until either it is performed, or the queue is cleared, such as a result of Hit.Cancel and related statuses.

                  Does not guarantee that action will be executed. Another action may queue ahead of it, or it may be removed before executing.

                  can_attack (self)

                  Returns true if the Character is currently able to perform actions, otherwise false. If returning false, expect any CardActions added by card_action_event to be performed later than expected.

                  It's sometimes recommended to check this alongside Entity.is_moving to determine whether or not card_action_event should be called, to comply with other expectations around action queuing. For example:
                  
                  player.update_func = function(self)
                      -- If moving or can't attack, the player won't do the action immediately
                      if self:is_moving() or not self:can_attack() then 
                          return
                      end
                  
                      if self:input_has(Input.Pressed.Left_Shoulder) then 
                          self:card_action_event(make_shoulder_action(self), ActionOrder.Voluntary)
                      end
                  end
                  
                  


                  Expect false under these cases for Characters:
                  • The Character is already processing a CardAction
                  • The Character is stunned, frozen, bubbled, or dragged
                  • The Character is a Player and is flinching
                  Notice that movement is not part of this list, despite movement delaying other actions queued behind it. This is to allow for queuing during movement. If this is not desired, then follow the above code snippet and check for movement at the same time.

                  get_rank (self)

                  Returns the Rank used to create this Character.

                  set_explosion_behavior (self , num , speed , as_boss)

                  Specifies the number and speed of explosions to spawn while the Character is deleting. If as_boss is true, some extra graphic effects are added in to look more spectacular, as if this is a boss exploding. speed will be used as the playback speed, so consider 1.0 to be the default, and 2.0 to be twice as fast.

                  .on_countered

                  Function to run when the Character is countered. Note that this will run before statuses for attacks have been finalized, so calls to can_attack, Entity.is_bubbled, and so on may give different results than if they were called later, such as in the Entity.update_func.

                  When the set function is called, it will receive one parameters, which is the Character that was countered.

                  create_sync_node (self , point)

                  Creates a new SyncNode and returns it. The SyncNode will be "attached" to the point point.

                  SyncNodes automatically change animation state to match the parent's. If the current keyframe of its animation state has no point with the label point, the SyncNode will appear in the top-left of the keyframe's bounding box. Make sure points are set up appropriately. (0,0) coordinate is the paren't top-left corner of their frame.

                  remove_sync_node (self , node)

                  Removes the SyncNode node from the Entity. returns it. The SyncNode will be "attached" to the point point.

                  If node is not currently attached to the Entity, throws an error.

                  is_charging (self)

                  Returns true if the Player is currently cgaring their charged_attack_func, else false. Continues to return true while fully charged.

                  A value of true indicates that the charging graphic is currently visible. In other words, the Player has held the Shoot input for at least 10 frames in a row while being allowed to charge.

                  set_fully_charged_color (self , color)

                  set_charge_level (self , level)

                  get_charge_level (self)

                  set_attack_level (self , level)

                  get_attack_level (self)

                  mod_max_health (self , mod)

                  Modifies the Player's current max health by mod, a positive or negative number. If the Player has full health, the Player's health will also change to reflect the new max. If changing max health by mod causes the Player's max health to drop below their current health, their current health will change to the new max.

                  get_max_health_mod (self)

                  Returns the cumulative health mod through all calls to Player.mod_max_health. For example, if mod_max_health had been called with a value of 50 and then -20, returns 30.

                  set_charge_position (self , x , y)

                  slide_when_moving (self , enable , frames)

                  Enables or disables slide movement. Disabled by default. When enabled, the Player's movement inputs will do a slide instead of a teleport, which will last for frames frametime duration.

                  Unusual to use, as all playables move normally in source material.

                  get_flinch_count (self)

                  Returns the number of times the Player has been flinched. This number is incremented for each time the Player is afflicted by Flinch, Stun, Freeze, Bubble, or Drag.

                  Sometimes read by attacks that increase in damage the more times the Player has been flinched.

                  create_form (self)

                  Creates a new PlayerForm, registers it, and returns it. Only 5 forms can be created this way. If 5 forms have already been registered, throws an error instead.

                  Forms can only be registerd in the player_init, before the Player has finished being created.

                  .normal_attack_func

                  Function to run when the Player uses their normal attack. This is triggered when the Player releases the Shoot button while not fully charged. Expects a valid CardAction to be returned, which will then be queued and executed a few game frames later.

                  It's common to read the Player's attack level to use in a formula for the attack's damage.

                  When the set function is called, it will receive one parameter, which is the ScriptedPlayer that is performing the attack.

                  .charged_attack_func

                  Function to run when the Player uses their charged attack. This is triggered when the Player releases the Shoot button while fully charged. Expects a valid CardAction to be returned, which will then be queued and executed a few game frames later.

                  It's common to read the Player's attack level to use in a formula for the attack's damage.

                  When the set function is called, it will receive one parameter, which is the ScriptedPlayer that is performing the attack.

                  .special_attack_func

                  Function to run when the Player uses their Special attack. This is triggered when the Player releases the Special button. Expects a valid CardAction to be returned, which will then be queued and executed a few game frames later.

                  It's not unusual to leave this unset in a Player mod. It's somewhat common for Block mods to set this. When it is set, the special attack is typically used as a sort of utility action, like creating a shield or temporary invulnerability, with extra scripting to enforce a cooldown.

                  When the set function is called, it will receive one parameter, which is the ScriptedPlayer that is performing the attack.

                  .charge_time_func

                  Function to run when the Player decides the time it will take to charge its charged attack. Called by the engine when set, and when the Player's charge level is set.

                  When the set function is called, it will receive two parameters, which are the Player that is having its charge times updated, and the current charge level to calculate a charge time for. Expects a return value of type frametime, which is the charge time to use. The returned time does not factor in the 10f that it takes to begin charging, so a return value of frames(1) will require 11 consecutive frames of holding the Shoot button to be fully charged.

                  Remember that the level parameter will only ever be in the range of 1 to 5, inclusive, so cover all cases. Example:
                  player.charge_time_func = function(self, level)
                      if level == 1 then
                          return frames(50)
                      end
                  
                      if level == 2 then 
                          return frames(40)
                      end
                  
                      -- For every other case (level 3, 4, 5), return frames(20)
                      return frames(20)
                  end
                  
                  
                  If unset, the charge times are 90, 80, 70, 60, and 50, for levels 1 through 5. This is equivalent to the Lua function
                  player.charge_time_func = function(self, level)
                    return frames(100 - 10 * level)
                  end
                  
                  

                PlayerPackage: table

                  set_name (self , name)

                  ⚠️ v2.5 only
                  Sets a name to be displayed on the Player select screen. This is also used to set an initial name for the Player, as if Entity.set_name had been called.

                  set_ability_name (self , name)

                  ⚠️ v2.5 only
                  Sets a name to be displayed on the Player status screen. The intended use is to be a name for the charged attack used by the Player, as extra flavor. Has no effect in battles.

                  set_health (self , health)

                  ⚠️ v2.5 only
                  Sets the health to be displayed when viewing the Player mod in the Player select screen. This is used as the initial health value for the Player, as if Entity.set_health had been called. Because this is the first time health is set for the Player, health will also be the Player's initial max health.

                  health must be a positive number.

                  set_element (self , element)

                  ⚠️ v2.5 only
                  Sets the Element to be displayed when viewing the Player mod in the Player select screen. This is also used as the initial Element for the Player, as if Player.set_element had been called. If this is not called, the initial Element of the is Element.None.

                  set_attack_level (self , level)

                  ⚠️ v2.5 only
                  Sets the attack level to be displayed when viewing the Player mod in the Player select screen. This is also used as the initial attack level for the Player, as if Player.set_attack_level had been called.

                  level will be clamped to a number between 1 and 5, inclusive.

                  set_attack (self , level)

                  Sets the Integer level as text to be displayed as the lower bound of damage when viewing the Player mod in the Player select screen.

                  While the text displayed is entirely aesthetic, the value used here is also used to set the initial attack_level of the Player, as if Player.set_attack_level was called. This means that the level can be a number larger than 5 and the input number will be displayed, but the initial attack level will still be clamped to the 1-5 range.

                  ⚠️ Replaced by PlayerPackage.set_attack_level in v2.5.

                  set_charge_level (self , level)

                  ⚠️ v2.5 only
                  Sets the charge level to be displayed when viewing the Player mod in the Player select screen. This is also used as the initial charge level for the Player, as if Player.set_charge_level had been called.

                  level will be clamped to a number between 1 and 5, inclusive.

                  set_charged_attack (self , level)

                  Sets the Integer level as text to be displayed as the upper bound of damage when viewing the Player mod in the Player select screen.

                  The text is entirely aesthetic, and has no effect on the Player mod's stats.

                  ⚠️ Replaced by PlayerPackage.set_charge_level in v2.5, which does have an effect on stats.

                  set_speed_level (self , level)

                  ⚠️ v2.5 only
                  Sets the speed level to be displayed when viewing the Player mod in the Player select screen. This is also used as the initial speed level for the Player, as if Player.set_speed_level had been called.

                  level will be clamped to a number between 1 and 5, inclusive.

                  set_speed (self , level)

                  Sets the float level as text to be displayed as a speed when viewing the Player mod in the Player select screen.

                  As the Speed stat does not exist in v2.1, the text is entirely aesthetic, and has no effect on the Player mod's stats. Despite the input accepting floats, the text display truncates the decimal.

                  ⚠️ Replaced by PlayerPackage.set_speed_level in v2.5, which does have an effect on stats.

                  set_soul_points_range (self , min , max)

                  ⚠️ v2.5 only
                  Sets the range that soul points are allowed to be within, inclusive. By default, this range is 0-1000. This is also used as the initial soul points range for the Player, as if Player.set_soul_points_range had been called.

                  set_uses_sword (self , value)

                  Sets whether or not the Player uses a sword. Does nothing.

                  set_overworld_animation_path (self , path)

                  Sets the path for the animation file used for the Player's overworld sprites. Associated with the image path set by PlayerPackage.set_overworld_texture_path

                  The engine expects animation states for walking and running in each of 8 directions. These states are prefixed with WALK or RUN, and end in a direction.
                  • WALK_U - Plays while Player walks up
                  • WALK_UR - Plays while Player walks up and right
                  • WALK_R - Plays while Player walks right
                  • WALK_DR - Plays while Player walks down and right
                  • WALK_D - Plays while Player walks down
                  • WALK_DL - Plays while Player walks down and left
                  • WALK_L - Plays while Player walks left
                  • WALK_UL - Plays while Player walks up and left

                  This list is nearly duplicated for the RUN states, where it would instead be RUN_U etc.

                  set_overworld_texture_path (self , path)

                  Sets the image path for the Player's sprites on the overworld. Associated with the animation file path set by PlayerPackage.set_overworld_animation_path

                  set_mugshot_animation_path (self , path)

                  Sets the path for the animation file associated with the Player mugshot, used to display with textboxes "spoken" by this Player mod. Associated with the image path set by PlayerPackage.set_mugshot_texture_path

                  The engine expects 2 animation states in this file:
                  1. IDLE - Plays when there is no more text to process in the texbox.
                  2. TALK - Plays while text is processing in the textbox. Restarts on certain text characters.

                  set_mugshot_texture_path (self , path)

                  Sets the image path for the Player mugshot, displayed with textboxes "spoken" by this Player mod. Associated with the animation file path set by PlayerPackage.set_mugshot_animation_path

                  set_emotions_texture_path (self , path)

                  Sets the image path for emotions in battle.

                  Because there is no animation file associated with emotions, the section shown is instead based on the size of the image. For example, because there are 10 Emotions in the engine, one single Emotion will use a cutout that is 1/10th of the image height as its height, and the image's width as its width. Additionally, the order of the individual sprites matters.

                  Typically, the image would be 43x160 pixels, granting each Emotion a 43x16 sprite. The order of sprites in the image, from top to bottom, should be:
                  1. normal
                  2. full_synchro
                  3. angry
                  4. evil
                  5. anxious
                  6. tired
                  7. exhausted
                  8. pinch
                  9. focus
                  10. happy

                  Note that only the first three are used in v2.1. See Emotion for details on when and how these appear.

                  set_icon_texture (self , tex)

                  Sets the Texture tex to be used as the Player mod's icon texture. This is shown in an alternate UI mode that can be triggered by servers. When that UI mode is active, the provided Texture is displayed in the upper left corner of the screen in place of health.

                  set_preview_animation_path (self , path)

                  ⚠️ v2.5 only
                  Sets the path for the animation file associated with the Player preview. Associated with the Texture set by PlayerPackage.set_preview_texture

                  The engine expects 1 single animation states in this file:
                  • MAIN

                  Because many previews are only a single keyframe, this animation file may not be needed in every mod, but it can be used to animate, for example, blinking or fire on the Player.

                  set_preview_texture (self , tex)

                  Sets the Texture tex to be displayed in the Player select screen. Typically used as a portrait of the Player, often less than half as wide and more than half as tall as the screen. Associated with the animation file path set by PlayerPackage.set_preview_animation_path

                  ⚠️ In v2.5, the image also displays beside the main menu.

                  set_special_description (self , desc)

                  Sets desc as text to be displayed when viewing the Player mod in the Player select screen.
                  The display area is small, so the desc should be short.

                  set_emblem_texture (self , tex)

                  ⚠️ v2.5 only
                  Sets the Texture tex to be used as the Player mod's emblem texture. If not provided, a default is used instead. This is shown in the upper right corner of the Cust graphic in battle, above selected cards.

                  A size of 15x15 pixels is enforced.

                Rank: table

                ⚠️ ONB versions 2.0 and 2.1 used a different naming scheme for Rank.
                For versions 2.5+ this naming scheme is standardized along with the rest of the API.
                Use the variant that begins with a single capital letter.
                e.g. Rank.Rv or Omega.

                Shadow: table

                Entities cast shadows onto the field and are not a part of the battle sprite. This is apparent when the entity is jumping from tile-to-tile. But entities also come in different shapes and sizes. The engine provides the following built-in shadow types.
                Default shadow type is Shadow.Small.

                Team: table

                If two entities share the same Team, then they are allies1.
                If two entities do not share the same Team, then they are enemies.
                If any entity's Team is Unknown2, then they are open to attacks from everyone.

                1. Attacks from allies passthrough and do not inflict damage to other allies.
                2. Only allies and enemies are tracked by the engine to determine the win-lose condition.

                TileState: table

                Tiles are the floor in the battle field. Their visual appearance isn't just for looks. Standing on different tile states have different dangers or bonuses.

                This enum set represents each possible state a tile can change to via tile:set_state(...).

                _folderpath

                A meta-variable set by the engine runtime when including other scripts.
                Particularly _folderpath will be the path to the directory where the current lua script is. This variable allows modders to easily include other resources in the same folder as the script.

                _modpath

                A meta-variable set by the engine runtime when loading mods.
                Particularly _modpath will be the path to the directory where entry.lua is. This variable allows modders to easily include other resources in the mod file.

                field: table

                frames: table

                  N/A

                  include (path)

                  The runtime opens the lua script located at path, executes, and returns any values. This enables passing lua objects between files.
                  local f = include('fibonacci.lua')
                  print(f(7)) -- prints 13 
                  
                  

                  ipairs (table)

                  Enumerates over a lua table and returns a {index, value} pair. Used in for-loops where integer index is expected.

                  make_animation_lockout ()

                  This engine utility function returns an internal engine object value that is only needed to correctly configure a CardAction lockout.
                  -- Example: This action uses "PLAYER_IDLE" and 
                  -- prevents further actions until it has finished.
                  local action = Battle.CardAction.new(player, "PLAYER_IDLE")
                  action:set_lockout(make_animation_lockout())
                  
                  

                  make_frame_data (list)

                  The engine utility function make_frame_data({...}) creates a new animation from an existing animation's frames.
                  The input table is a list of {key, time} pairs where key is the key frame index in the source animation and time is the floating-point time of the frame in seconds.

                  math: table

                  The lua runtime math library.

                  node: table

                  pairs (table)

                  Enumerates over a lua table and returns a {key, value} pair. Used in common for-loops.

                  print (...)

                  Converts a lua object to a string and then displays to console. See tostring.

                  table: table

                  Tables are to lua what classes are to other modern programming languages.
                  They can also be used as lists.

                    insert (t , position [, value])

                    Inserts value into table t at position.

                    If only two arguments are given, then the second argument becomes value and the position is determined to be the front of the table t.
                    This is convenient to write stacks in lua.
                    local t = {}
                    table.insert(t, 1, "foo")
                    -- is the same as
                    table.insert(t, "foo")
                    

                    remove (tableData , position)

                  tostring (value)

                  Converts any lua object into a printable string.
                  Depending on the runtime implementation, calling tostring on tables and functions print their address.

                  type (obj)

                  Returns the name of the lua object's type as a string.
                  The supported types are:
                  1. function
                  2. table
                  3. nil
                  4. string
                  5. number
                  6. boolean
                  If the runtime detects a value other than the primitives listed above, then "userdata" is returned.

                  vec2: table