summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_moninf.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-05-25 14:47:27 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-05-26 11:54:10 +0200
commita4c3f310e25900d4a570aa64e5bf000f1b85f005 (patch)
tree2b9128f132b32a91f63f6878c701b621082cf543 /crawl-ref/source/l_moninf.cc
parentc7052421cd6263ee4568cb00af121c4995a6ace4 (diff)
downloadcrawl-ref-a4c3f310e25900d4a570aa64e5bf000f1b85f005.tar.gz
crawl-ref-a4c3f310e25900d4a570aa64e5bf000f1b85f005.zip
A clua function moninf:can_be_constricted()
Diffstat (limited to 'crawl-ref/source/l_moninf.cc')
-rw-r--r--crawl-ref/source/l_moninf.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/crawl-ref/source/l_moninf.cc b/crawl-ref/source/l_moninf.cc
index 6051f14822..6e41d9f5cf 100644
--- a/crawl-ref/source/l_moninf.cc
+++ b/crawl-ref/source/l_moninf.cc
@@ -13,6 +13,7 @@
#include "libutil.h"
#include "mon-info.h"
#include "player.h"
+#include "transform.h"
#define MONINF_METATABLE "monster.info"
@@ -164,6 +165,28 @@ LUAFN(moninf_get_is_constricting_you)
return (1);
}
+LUAFN(moninf_get_can_be_constricted)
+{
+ MONINF(ls, 1, mi);
+ if (!mi->constrictor_name.empty()
+ || !form_keeps_mutations()
+ || (you.species != SP_NAGA
+ || you.experience_level <= 12
+ || you.is_constricting())
+ && (you.species != SP_OCTOPODE || !you.has_usable_tentacle()))
+ {
+ lua_pushboolean(ls, false);
+ }
+ else
+ {
+ monster dummy;
+ dummy.type = mi->type;
+ dummy.base_monster = mi->base_type;
+ lua_pushboolean(ls, dummy.res_constrict() < 3);
+ }
+ return (1);
+}
+
LUAFN(moninf_get_is_unique)
{
MONINF(ls, 1, mi);
@@ -219,6 +242,7 @@ static const struct luaL_reg moninf_lib[] =
MIREG(is_constricted),
MIREG(is_constricting),
MIREG(is_constricting_you),
+ MIREG(can_be_constricted),
MIREG(is_unique),
MIREG(damage_level),
MIREG(damage_desc),