Module monster
Monster information.
Functions
get_monster_at (x, y) | Get information about a monster at a cell. |
Class monster.info
monster.info:ac () | The monster's AC value, in "pips" (number of +'s shown on its description). |
monster.info:attitude () | The monster's current attitude. |
monster.info:avg_local_depth () | Get the monster's average depth of (random) generation in the current branch Returns -1 if the monster is not generated in this branch. |
monster.info:avg_local_prob () | Get the monster's probability of randomly generating on the current floor This can be used to estimate difficulty, but keep in mind that it is highly dependent on the branch's generation table. |
monster.info:base_type () | Monster base type as in monster_type.h. |
monster.info:can_be_constricted () | Can this monster be constricted? |
monster.info:can_go_frenzy () | Can the monster currently be frenzied? |
monster.info:colour () | Monster glyph colour. |
monster.info:damage_desc () | Get a string describing how injured this monster is. |
monster.info:damage_level () | How hurt is this monster? |
monster.info:defeat_wl (spell[, true]) | Your probability of defeating the monster's WL with a given spell or zap. |
monster.info:desc ([set]) | A description of this monster. |
monster.info:ev () | The monster's EV value, in "pips" (number of +'s shown on its description). |
monster.info:has_ranged_attack () | Does this monster have a ranged attack we know about? |
monster.info:holiness ([holiness]) | Get the monster's holiness. |
monster.info:is (flagname) | Test a monster flag. |
monster.info:is_caught () | Is the monster caught in something? |
monster.info:is_constricted () | Is the monster constricted? |
monster.info:is_constricting () | Is the monster constricting something? |
monster.info:is_constricting_you () | Is the monster constricting you in particular? |
monster.info:is_firewood () | Is this monster firewood. |
monster.info:is_safe () | Is this monster safe by default? |
monster.info:is_stationary () | Can this monster move? |
monster.info:is_unique () | Is this monster a unique? |
monster.info:max_hp () | The monster's max HP given in its description. |
monster.info:mname () | Simple monster name. |
monster.info:name () | The monster's full name. |
monster.info:number () | Monster number field. |
monster.info:pos () | The x,y coordinates of the monster in player centered coordinates. |
monster.info:reach_range () | How far can the monster reach with their melee weapon? |
monster.info:res_cold () | Does the monster resist cold? |
monster.info:res_corr () | Does the monster resist corrosion? |
monster.info:res_draining () | Does the monster resist negative energy? |
monster.info:res_fire () | Does the monster resist fire? |
monster.info:res_shock () | Does the monster resist electricity? |
monster.info:speed_description () | A string describing monster speed. |
monster.info:spells () | Get the monster's possible spells. |
monster.info:stabbability () | What quality of stab can you get on this monster? |
monster.info:status ([statusname]) | What statuses is this monster under? |
monster.info:threat () | The monster's threat level. |
monster.info:type () | Monster type enum value as in monster_type.h. |
monster.info:wl () | The monster's WL level, in "pips" (number of +'s shown on its description). |
monster.info:x_pos () | The monster's x coordinate in player centered coordinates. |
monster.info:y_pos () | The monster's y coordinate in player centered coordinates. |
Functions
- get_monster_at (x, y)
-
Get information about a monster at a cell.
Returns a monster.info object of a monster at the specified coordinates.
Uses player coordinates
Parameters:
- x int
- y int
Returns:
-
monster.info or nil
Class monster.info
- monster.info:ac ()
-
The monster's AC value, in "pips" (number of +'s shown on its description).
Returns a value ranging from 0 to 5 (highest).
Returns:
-
int
AC level
- monster.info:attitude ()
-
The monster's current attitude. A numerical value representing the monster's attitude. Possible values:
- 0 hostile
- 1 neutral
- 2 strict neutral (neutral but won't attack the player)
- 3 good neutral (neutral but won't attack friendlies)
- 4 friendly (created friendly, not enslavement)
Returns:
-
int
- monster.info:avg_local_depth ()
-
Get the monster's average depth of (random) generation in the current branch
Returns -1 if the monster is not generated in this branch. Does not handle
fish or zombies.
Returns:
- monster.info:avg_local_prob ()
-
Get the monster's probability of randomly generating on the current floor
This can be used to estimate difficulty, but keep in mind that it is highly
dependent on the branch's generation table.
Returns -1 if the monster is not generated in this branch. Does not handle
fish or zombies.
Returns:
- monster.info:base_type ()
-
Monster base type as in monster_type.h.
Returns:
-
int
- monster.info:can_be_constricted ()
-
Can this monster be constricted?
Returns:
-
boolean
- monster.info:can_go_frenzy ()
-
Can the monster currently be frenzied?
Is it possible to affect the monster with the discord spell or a datura
dart?
Returns:
-
boolean
- monster.info:colour ()
-
Monster glyph colour.
Return is a crawl colour number.
Returns:
-
int
- monster.info:damage_desc ()
-
Get a string describing how injured this monster is.
Returns:
-
string
- monster.info:damage_level ()
-
How hurt is this monster?
Numeric representation of the level of damage sustained by the monster.
Return value ranges from 0 (full HP) to 6 (dead).
Returns:
-
boolean
- monster.info:defeat_wl (spell[, true])
-
Your probability of defeating the monster's WL with a given spell or zap. Returns a value ranging from 0 (no chance) to 100 (guaranteed success).
Returns nil if WL does not apply or the spell can't be cast.
Parameters:
- spell string name
- true
boolean
if this spell is evoked rather than cast;
(optional)defaults to false
Returns:
-
int, string or nil
percent chance of success (0-100);
returns "infinite will" if monster is immune; returns nil if WL does not apply.
- monster.info:desc ([set])
-
A description of this monster.
Parameters:
- set
boolean
true to get the description information body
(optional)displayed when examining the monster; if false (default) returns a short description.
Returns:
-
string
- set
boolean
- monster.info:ev ()
-
The monster's EV value, in "pips" (number of +'s shown on its description).
Returns a value ranging from 0 to 5 (highest).
Returns:
-
int
evasion level
- monster.info:has_ranged_attack ()
-
Does this monster have a ranged attack we know about?
This refers to ranged weapons. Ranged spells and abilities are not included
in this check.
Returns:
-
boolean
- monster.info:holiness ([holiness])
-
Get the monster's holiness.
If passed a holiness, returns a boolean test of whether the monster has the
given holiness. Otherwise returns a string describing the monster's
holiness.
Possible holinesses: "holy", "natural", "undead", "demonic", "nonliving", "plant", "evil". Evil is a pseudo-holiness given to natural, nonliving, or plant monsters that are hated by the good gods for the spells they cast or gods they worship.
Parameters:
- holiness string (optional)
Returns:
-
string or boolean
- monster.info:is (flagname)
-
Test a monster flag.
Check if a monster has a flag set. See
mi-flag.h
for a list of flags.Parameters:
- flagname string
Returns:
-
boolean
- monster.info:is_caught ()
-
Is the monster caught in something?
Tests for nets or webs.
Returns:
-
boolean
- monster.info:is_constricted ()
-
Is the monster constricted?
Returns:
-
boolean
- monster.info:is_constricting ()
-
Is the monster constricting something?
Returns:
-
boolean
- monster.info:is_constricting_you ()
-
Is the monster constricting you in particular?
Returns:
-
boolean
- monster.info:is_firewood ()
-
Is this monster firewood.
Plants and fungi. Immobile things that give no exp.
Returns:
-
boolean
- monster.info:is_safe ()
-
Is this monster safe by default?
Check if this monster is thought of as safe by crawl internally. Does not
check Hooks.ch_mon_is_safe, so this can be used there without causing an
infinite loop.
Returns:
-
boolean
- monster.info:is_stationary ()
-
Can this monster move?
Returns:
-
boolean
- monster.info:is_unique ()
-
Is this monster a unique?
Returns:
-
boolean
- monster.info:max_hp ()
-
The monster's max HP given in its description.
Returns:
-
string
describing the max HP (usually "about X").
- monster.info:mname ()
-
Simple monster name.
Returns the name of the monster.
Returns:
-
string
See also:
- monster.info:name ()
-
The monster's full name.
Includes any vault defined names, the uniques name, name changes induced by
polymorph, &c.
Returns:
-
string
See also:
- monster.info:number ()
-
Monster number field.
Contains hydra heads or slime size. Meaningless for all others.
Returns:
-
int
- monster.info:pos ()
-
The x,y coordinates of the monster in player centered coordinates.
Returns:
- int
- int
- monster.info:reach_range ()
-
How far can the monster reach with their melee weapon?
Returns:
-
int
- monster.info:res_cold ()
-
Does the monster resist cold?
Returns a value ranging from -1 (vulnerable) to 3 (immune).
Returns:
-
int
resistance level
- monster.info:res_corr ()
-
Does the monster resist corrosion?
Returns a value ranging from -1 (vulnerable) to 3 (immune).
Returns:
-
int
resistance level
- monster.info:res_draining ()
-
Does the monster resist negative energy?
Returns a value ranging from -1 (vulnerable) to 3 (immune).
Returns:
-
int
resistance level
- monster.info:res_fire ()
-
Does the monster resist fire?
Returns a value ranging from -1 (vulnerable) to 3 (immune).
Returns:
-
int
resistance level
- monster.info:res_shock ()
-
Does the monster resist electricity?
Returns a value ranging from -1 (vulnerable) to 3 (immune).
Returns:
-
int
resistance level
- monster.info:speed_description ()
-
A string describing monster speed.
Possible values are: "very slow", "slow", "normal", "fast", "very fast", and
"extremely fast".
Returns:
-
string
- monster.info:spells ()
-
Get the monster's possible spells.
Returns a list of the monster's possible spellbooks. Each spellbook is given
as a list of spell names.
Returns:
-
array
- monster.info:stabbability ()
-
What quality of stab can you get on this monster? The return value is a number representing the percentage of a top-tier stab you can currently get by attacking the monster. Possible values are:
- 1.0 Sleep, petrified, and paralysis stabs.
- 0.25 Net, web, petrifying, confusion, fear, invisibility, and distraction stabs
- 0.0 No stab bonus.
Returns:
- monster.info:status ([statusname])
-
What statuses is this monster under?
If passed a string parameter, returns a boolean indicating if the monster
has that status. Otherwise returns a comma separated string with all the
statuses the monster has.
Parameters:
- statusname string (optional)
Returns:
-
string or boolean
- monster.info:threat ()
-
The monster's threat level. A numeric representation of the the threat level in the monster list.
- 0 dark grey threat (trivial)
- 1 light grey threat (easy)
- 2 yellow threat (dangerous)
- 3 red threat (extremely dangerous)
Returns:
-
int
- monster.info:type ()
-
Monster type enum value as in monster_type.h.
Returns:
-
int
- monster.info:wl ()
-
The monster's WL level, in "pips" (number of +'s shown on its description).
Returns a value ranging from 0 to 125 (immune).
Returns:
-
int
WL level
- monster.info:x_pos ()
-
The monster's x coordinate in player centered coordinates.
Returns:
-
int
- monster.info:y_pos ()
-
The monster's y coordinate in player centered coordinates.
Returns:
-
int