throw-and-return weapons used by monsters

Resolves #1338
This commit is contained in:
nhmall
2025-03-16 15:37:49 -04:00
parent 7c43654580
commit 0bdf9830e6
8 changed files with 301 additions and 54 deletions

View File

@@ -3648,6 +3648,8 @@ extern int weapon_hit_bonus(struct obj *) NO_NNARGS;
extern int weapon_dam_bonus(struct obj *) NO_NNARGS;
extern void skill_init(const struct def_skill *) NONNULLARG1;
extern void setmnotwielded(struct monst *, struct obj *) NONNULLARG1;
extern const struct throw_and_return_weapon *autoreturn_weapon(struct obj *)
NONNULLARG1;
/* ### were.c ### */

View File

@@ -868,6 +868,12 @@ enum stoning_checks {
st_all = (st_gloves | st_corpse | st_petrifies | st_resists)
};
struct throw_and_return_weapon {
short otyp;
int range;
Bitfield(tethered, 1);
};
struct trapinfo {
struct obj *tobj;
coordxy tx, ty;

View File

@@ -6,26 +6,28 @@
#ifndef MFNDPOS_H
#define MFNDPOS_H
#define ALLOW_MDISP 0x00001000L /* can displace a monster out of its way */
#define ALLOW_TRAPS 0x00020000L /* can enter traps */
#define ALLOW_U 0x00040000L /* can attack you */
#define ALLOW_M 0x00080000L /* can attack other monsters */
#define ALLOW_TM 0x00100000L /* can attack tame monsters */
/* clang-format off */
#define ALLOW_MDISP 0x00001000L /* can displace a monster out of its way */
#define ALLOW_TRAPS 0x00020000L /* can enter traps */
#define ALLOW_U 0x00040000L /* can attack you */
#define ALLOW_M 0x00080000L /* can attack other monsters */
#define ALLOW_TM 0x00100000L /* can attack tame monsters */
#define ALLOW_ALL (ALLOW_U | ALLOW_M | ALLOW_TM | ALLOW_TRAPS)
#define NOTONL 0x00200000L /* avoids direct line to player */
#define OPENDOOR 0x00400000L /* opens closed doors */
#define UNLOCKDOOR 0x00800000L /* unlocks locked doors */
#define BUSTDOOR 0x01000000L /* breaks any doors */
#define ALLOW_ROCK 0x02000000L /* pushes rocks */
#define ALLOW_WALL 0x04000000L /* walks thru walls */
#define ALLOW_DIG 0x08000000L /* digs */
#define ALLOW_BARS 0x10000000L /* may pass thru iron bars */
#define ALLOW_SANCT 0x20000000L /* enters temples */
#define ALLOW_SSM 0x40000000L /* ignores scare monster */
#define NOTONL 0x00200000L /* avoids direct line to player */
#define OPENDOOR 0x00400000L /* opens closed doors */
#define UNLOCKDOOR 0x00800000L /* unlocks locked doors */
#define BUSTDOOR 0x01000000L /* breaks any doors */
#define ALLOW_ROCK 0x02000000L /* pushes rocks */
#define ALLOW_WALL 0x04000000L /* walks thru walls */
#define ALLOW_DIG 0x08000000L /* digs */
#define ALLOW_BARS 0x10000000L /* may pass thru iron bars */
#define ALLOW_SANCT 0x20000000L /* enters temples */
#define ALLOW_SSM 0x40000000L /* ignores scare monster */
#ifdef NHSTDC
#define NOGARLIC 0x80000000UL /* hates garlic */
#define NOGARLIC 0x80000000UL /* hates garlic */
#else
#define NOGARLIC 0x80000000L /* hates garlic */
#define NOGARLIC 0x80000000L /* hates garlic */
#endif
/* clang-format on */
#endif /* MFNDPOS_H */