Module spells

Information about spells.

Functions

cast (spell[, x=0[, y=0[, if=false]]]) Cast a spell at a target.
describe (spell) Describe a spell.
dir (name) Is this spell castable in a direction?
dir_or_target (name) Does this spell take a direction or target?
fail (name) The failure rate of the spell as a number in [0,100].
fail_severity (name) The miscast severity of the spell as a number in [0,5].
god_hates (name) Does our god hate this spell?
god_likes (name) Does our god like this spell?
letter (name) What letter is this spell assigned to?
level (name) The level of the named spell.
mana_cost (name) The MP cost of the spell.
max_power (name) The maximum spellpower (in bars).
max_range (name) The maximum range of the spell.
memorised (spellname) Is this spell memorised?
min_range (name) The minimum range of the spell.
path (spell, x, y[, source_x=0[, source_y=0[, aimed_at_spot=true]]]) If this spell is aimed at (x,y), what path will it actually take?
power (name) The current spellpower (in bars).
power_perc (name) The current spellpower (as an integer percentage 0-100).
range (name) The current range of the spell.
targ_obj (name) Can this spell target objects?
target (name) Is this spell targetable?


Functions

cast (spell[, x=0[, y=0[, if=false]]])
Cast a spell at a target. If the target is not provided, enters interactive targeting.

Parameters:

  • spell string name
  • x number coordinate (default 0)
  • y number coordinate (default 0)
  • if boolean true, aim at the target; if false, shoot past it (default false)

Returns:

    boolean whether an action took place
describe (spell)
Describe a spell. Provide the complete text description of a spell as displayed in the game UI

Parameters:

  • spell string name

Returns:

    string description
dir (name)
Is this spell castable in a direction?

Parameters:

  • name string

Returns:

    boolean
dir_or_target (name)
Does this spell take a direction or target?

Parameters:

  • name string

Returns:

    boolean
fail (name)
The failure rate of the spell as a number in [0,100].

Parameters:

  • name string

Returns:

    int
fail_severity (name)
The miscast severity of the spell as a number in [0,5]. 0: light grey, no chance of damaging miscast 1: white, <= 10% max HP damage 2: yellow, <= 30% max HP damage 3: light red, <= 50% max HP damage 4: red, <= 70% max HP damage 5: magenta, > 70% max HP damage (potentially lethal)

Parameters:

  • name string

Returns:

    int
god_hates (name)
Does our god hate this spell? Casting this will result in pennance or excommunication.

Parameters:

  • name string

Returns:

    boolean
god_likes (name)
Does our god like this spell?

Parameters:

  • name string

Returns:

    boolean
letter (name)
What letter is this spell assigned to?

Parameters:

  • name string

Returns:

    string or nil the spell letter or nil if not memorised
level (name)
The level of the named spell.

Parameters:

  • name string

Returns:

    int
mana_cost (name)
The MP cost of the spell.

Parameters:

  • name string

Returns:

    int
max_power (name)
The maximum spellpower (in bars).

Parameters:

  • name string

Returns:

    int
max_range (name)
The maximum range of the spell.

Parameters:

  • name string

Returns:

    int
memorised (spellname)
Is this spell memorised?

Parameters:

  • spellname string

Returns:

    boolean
min_range (name)
The minimum range of the spell.

Parameters:

  • name string

Returns:

    int
path (spell, x, y[, source_x=0[, source_y=0[, aimed_at_spot=true]]])
If this spell is aimed at (x,y), what path will it actually take?

Parameters:

  • spell string the name of the spell
  • x int coordinate to aim at, in player coordinates
  • y int coordinate to aim at, in player coordinates
  • source_x int coordinate of spell source, in player coordinates (default 0)
  • source_y int coordinate of spell source, in player coordinates (default 0)
  • aimed_at_spot boolean if true, aim at the target; if false, shoot past it. (default true)

Returns:

    table or nil a table of {x,y} of the path the spell will take, in player coordinates. Nil is returned if the spell does not follow a path (eg. smite-targeted spells) or if the spell has zero range.
power (name)
The current spellpower (in bars).

Parameters:

  • name string

Returns:

    int
power_perc (name)
The current spellpower (as an integer percentage 0-100).

Parameters:

  • name string

Returns:

    int
range (name)
The current range of the spell.

Parameters:

  • name string

Returns:

    int
targ_obj (name)
Can this spell target objects?

Parameters:

  • name string

Returns:

    boolean
target (name)
Is this spell targetable?

Parameters:

  • name string

Returns:

    boolean
generated by LDoc 1.5.0 Last updated 2025-12-14 12:38:40