Skip to content

Enums

A table containing all enums used in the game.

The value of an enum is its own type. string or number cannot be used in place of an enum. Use the values contained in any of the tables for any function that takes an enum as a parameter. You can also use the enums from any function or property that returns one.

The enums table can be accessed as follows:

game.enums
-- pass an enum as a parameter
unit:get_stat(game.enums.Stat.attack, game.enums.Adjective.physical)
-- get an enum from a property and compare it to another
is_skeleton = unit.family == game.enums.Family.skeleton

Access all the values of the Adjective enum. Can be accessed as follows:

game.enums.Adjective

Access all the values of the Allegiance enum. Can be accessed as follows:

game.enums.Allegiance

Access all the values of the CorpseFilter enum. Can be accessed as follows:

game.enums.CorpseFilter

Access all the values of the Family enum. Can be accessed as follows:

game.enums.Family

Access all the values of the HealthFilter enum. Can be accessed as follows:

game.enums.HealthFilter

Access all the values of the Stat enum. Can be accessed as follows:

game.enums.Stat

Access all the values of the TargetPriority enum. Can be accessed as follows:

game.enums.TargetPriority

Access all the values of the Team enum. Can be accessed as follows:

game.enums.Team

An adjective describes a type of damage.

Units may deal specific types of damage, such as physical or poison. Units may also be resistant or particularly vulnerable to certain adjectives.

  • physical
  • poison

A value of the Adjective enum can be accessed as follows:

game.enums.Adjective.physical

An allegiance describes a relationship between two units. Units may be opponent or ally to each other: player's units are ally to each other, but opponent to the enemy's units.

Use the any allegiance when you want to ignore the allegiance of a unit, for example if an attack can hit both opponents and allies.

  • any
  • opponent
  • ally

A value of the Allegiance enum can be accessed as follows:

game.enums.Allegiance.any

Filters based on whether a unit is a corpse (i.e. dead) or not.

Use the any corpse value when you want to ignore whether a unit is a corpse or not, for example if an ability can target both corpses and living units.

  • any
  • no
  • yes

A value of the CorpseFilter enum can be accessed as follows:

game.enums.CorpseFilter.any

The family of a unit.

Families can be used, for example, to implement abilities that only affect units of the same family.

  • skeleton

A value of the Family enum can be accessed as follows:

game.enums.Family.skeleton

Filter based on the health of a unit.

  • any

    Ignores the health of the unit when filtering.

  • full

    Matches only units in full health.

  • damaged

    Matches only units with less than full health.

A value of the HealthFilter enum can be accessed as follows:

game.enums.HealthFilter.any

An attribute of a unit.

Used when retreiving or buffing stats.

  • attack

    The damage a unit deals.

A value of the Stat enum can be accessed as follows:

game.enums.Stat.attack

A targetting priority, used when selecting a target for an ability.

  • closest

A value of the TargetPriority enum can be accessed as follows:

game.enums.TargetPriority.closest

A side of the battle. Units can be on either team.

Used when spawning units, and units use it to decide who to target. Targetting is usually determined by the Allegiance: units belonging to the same team are ally, and units belonging to different teams are opponent.

  • player

    The units belonging to the player.

  • enemy

    The enemy units.

A value of the Team enum can be accessed as follows:

game.enums.Team.player

opponent: Team

The opponent team to this.

If this is the player team, then enemy is returned. If this is the enemy team, then player is returned.