home *** CD-ROM | disk | FTP | other *** search
- /* SCCS Id: @(#)monst.h 3.1 92/10/18 */
- /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
- /* NetHack may be freely redistributed. See license for details. */
-
- #ifndef MONST_H
- #define MONST_H
-
- #ifdef MUSE
- /* The weapon_check flag is used two ways:
- * 1) When calling mon_wield_item, is 2 or 3 depending on what is desired.
- * 2) Between calls to mon_wield_item, is 0 or 1 depending on whether or not
- * the weapon is known by the monster to be cursed (so it shouldn't bother
- * trying for another weapon).
- * I originally planned to also use 0 if the monster already had its best
- * weapon, to avoid the overhead of a call to mon_wield_item, but it turns out
- * that there are enough situations which might make a monster change its
- * weapon that this is impractical.
- */
- #define NO_WEAPON_WANTED 0
- #define NEED_WEAPON 1
- #define NEED_RANGED_WEAPON 2
- #define NEED_HTH_WEAPON 3
- #define NEED_PICK_AXE 4
- #endif
-
- #ifndef ALIGN_H
- #include "align.h"
- #endif
-
- struct monst {
- struct monst *nmon;
- struct permonst *data;
- unsigned m_id;
- short mnum; /* permanent monster index number */
- uchar m_lev; /* adjusted difficulty level of monster */
- aligntyp malign; /* alignment of this monster, relative to the
- player (positive = good to kill) */
- xchar mx, my;
- xchar mux, muy; /* where the monster thinks you are */
- #define MTSZ 4
- coord mtrack[MTSZ]; /* monster track */
- int mhp, mhpmax;
- unsigned mappearance; /* for undetected mimics and the wiz */
- uchar m_ap_type; /* what mappearance is describing: */
- #define M_AP_NOTHING 0 /* mappearance is unused -- monster appears
- as itself */
- #define M_AP_FURNITURE 1 /* stairs, a door, an altar, etc. */
- #define M_AP_OBJECT 2 /* an object */
- #define M_AP_MONSTER 3 /* a monster */
-
- schar mtame; /* level of tameness, implies peaceful */
- int mspec_used; /* monster's special ability attack timeout */
-
- Bitfield(female,1); /* is female */
- Bitfield(minvis,1); /* invisible */
- Bitfield(cham,1); /* shape-changer */
- Bitfield(mundetected,1); /* not seen in present hiding place */
- /* implies one of M1_CONCEAL or M1_HIDE,
- * but not mimic (that is, snake, spider,
- * trapper, piercer)
- */
- Bitfield(mcan,1); /* has been cancelled */
- Bitfield(mspeed,2);
- /* free bit! */
-
- Bitfield(mflee,1); /* fleeing */
- Bitfield(mfleetim,7); /* timeout for mflee */
-
- Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */
- Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */
-
- Bitfield(mcanmove,1); /* paralysis, similar to mblinded */
- Bitfield(mfrozen,7);
-
- Bitfield(msleep,1); /* sleeping */
- Bitfield(mstun,1); /* stunned (off balance) */
- Bitfield(mconf,1); /* confused */
- Bitfield(mpeaceful,1); /* does not attack unprovoked */
- Bitfield(mtrapped,1); /* trapped in a pit or bear trap */
- Bitfield(mleashed,1); /* monster is on a leash */
- Bitfield(isshk,1); /* is shopkeeper */
- Bitfield(isminion,1); /* is a minion */
-
- Bitfield(isgd,1); /* is guard */
- Bitfield(ispriest,1); /* is a priest */
- Bitfield(iswiz,1); /* is the Wizard of Yendor */
- Bitfield(wormno,5); /* at most 31 worms on any level */
- #define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */
-
- long mstrategy; /* for monsters with mflag3: current strategy */
- long mtrapseen; /* bitmap of traps we've been trapped in */
- long mlstmv; /* prevent two moves at once */
- long mgold;
- struct obj *minvent;
- #ifdef MUSE
- struct obj *mw;
- long misc_worn_check;
- xchar weapon_check;
- #endif
- uchar mnamelth; /* length of name (following mxlth) */
- short mxlth; /* length of following data */
- /* in order to prevent alignment problems mextra should
- be (or follow) a long int */
- int meating; /* monster is eating timeout */
- long mextra[1]; /* monster dependent info */
- };
-
- /*
- * Note that mextra[] may correspond to any of a number of structures, which
- * are indicated by some of the other fields.
- * isgd -> struct egd
- * ispriest -> struct epri
- * isshk -> struct eshk
- * isminion -> struct emin
- * (struct epri for roaming priests and angels, which is
- * compatible with emin for polymorph purposes)
- * mtame -> struct edog
- * (struct epri for guardian angels, which do not eat
- * or do other doggy things)
- * Since at most one structure can be indicated in this manner, it is not
- * possible to tame any creatures using the other structures (the only
- * exception being the guardian angels which are tame on creation).
- */
-
- #define newmonst(xl) (struct monst *)alloc((unsigned)(xl) + sizeof(struct monst))
- #define dealloc_monst(mon) free((genericptr_t)(mon))
-
- /* these are in mspeed */
- #define MSLOW 1 /* slow monster */
- #define MFAST 2 /* speeded monster */
-
- #define NAME(mtmp) (((char *)(mtmp)->mextra) + (mtmp)->mxlth)
-
- #define MON_WEP(mon) ((mon)->mw)
- #define MON_NOWEP(mon) ((mon)->mw = (struct obj *)0)
-
- #endif /* MONST_H */
-