diff options
-rw-r--r-- | doc/spell-language | 4 | ||||
-rw-r--r-- | src/map/magic-expr.c | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/doc/spell-language b/doc/spell-language index 5b0e5bb..d5f99d8 100644 --- a/doc/spell-language +++ b/doc/spell-language @@ -550,6 +550,10 @@ The following functions are available: otherwise NE, SE, NW, SW will also be used. The two locations must be on the same map. + + is_dead : entity -> bool + Determines whether the specified entity is no longer alive. + + Operations: ----------- This section documents the operations API. diff --git a/src/map/magic-expr.c b/src/map/magic-expr.c index 0c5b9ce..7840941 100644 --- a/src/map/magic-expr.c +++ b/src/map/magic-expr.c @@ -723,6 +723,14 @@ fun_is_married(env_t *env, int args_nr, val_t *result, val_t *args) } static int +fun_is_dead(env_t *env, int args_nr, val_t *result, val_t *args) +{ + RESULTINT = (ETY(0) == BL_PC + && pc_isdead(ARGPC(0))); + return 0; +} + +static int fun_partner(env_t *env, int args_nr, val_t *result, val_t *args) { if (ETY(0) == BL_PC @@ -1164,6 +1172,7 @@ static fun_t functions[] = { { "map_level", "l", 'i', fun_map_level }, { "map_nr", "l", 'i', fun_map_nr }, { "dir_towards", "lli", 'd', fun_dir_towards }, + { "is_dead", "e", 'i', fun_is_dead }, { NULL, NULL, '.', NULL } }; |