Source:NetHack 3.4.3/include/monst.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to include/monst.h from NetHack 3.4.3. To link to a particular line, write [[monst.h#line123]], for example.

  1. /*	SCCS Id: @(#)monst.h	3.4	1999/01/04	*/
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

  1. #ifndef MONST_H
  2. #define MONST_H
  3.  
  4. /* The weapon_check flag is used two ways:
  5. * 1) When calling mon_wield_item, is 2-6 depending on what is desired.
  6. * 2) Between calls to mon_wield_item, is 0 or 1 depending on whether or not
  7. *    the weapon is known by the monster to be cursed (so it shouldn't bother
  8. *    trying for another weapon).
  9. * I originally planned to also use 0 if the monster already had its best
  10. * weapon, to avoid the overhead of a call to mon_wield_item, but it turns out
  11. * that there are enough situations which might make a monster change its
  12. * weapon that this is impractical.  --KAA
  13. */
  14. # define NO_WEAPON_WANTED 0
  15. # define NEED_WEAPON 1
  16. # define NEED_RANGED_WEAPON 2
  17. # define NEED_HTH_WEAPON 3
  18. # define NEED_PICK_AXE 4
  19. # define NEED_AXE 5
  20. # define NEED_PICK_OR_AXE 6
  21.  
  22. /* The following flags are used for the second argument to display_minventory
  23. * in invent.c:
  24. *
  25. * MINV_NOLET  If set, don't display inventory letters on monster's inventory.
  26. * MINV_ALL    If set, display all items in monster's inventory, otherwise
  27. *	       just display wielded weapons and worn items.
  28. */
  29. #define MINV_NOLET 0x01
  30. #define MINV_ALL   0x02
  31.  
  32. #ifndef ALIGN_H
  33. #include "align.h"
  34. #endif
  35.  
  36. struct monst {
  37. 	struct monst *nmon;
  38. 	struct permonst *data;
  39. 	unsigned m_id;
  40. 	short mnum;		/* permanent monster index number */
  41. 	short movement;		/* movement points (derived from permonst definition and added effects */
  42. 	uchar m_lev;		/* adjusted difficulty level of monster */
  43. 	aligntyp malign;	/* alignment of this monster, relative to the
  44. 				   player (positive = good to kill) */
  45. 	xchar mx, my;
  46. 	xchar mux, muy;		/* where the monster thinks you are */
  47. #define MTSZ	4
  48. 	coord mtrack[MTSZ];	/* monster track */
  49. 	int mhp, mhpmax;
  50. 	unsigned mappearance;	/* for undetected mimics and the wiz */
  51. 	uchar	 m_ap_type;	/* what mappearance is describing: */
  52. #define M_AP_NOTHING	0	/* mappearance is unused -- monster appears
  53. 				   as itself */
  54. #define M_AP_FURNITURE	1	/* stairs, a door, an altar, etc. */
  55. #define M_AP_OBJECT	2	/* an object */
  56. #define M_AP_MONSTER	3	/* a monster */
  57.  
  58. 	schar mtame;		/* level of tameness, implies peaceful */
  59. 	unsigned short mintrinsics;	/* low 8 correspond to mresists */
  60. 	int mspec_used;		/* monster's special ability attack timeout */
  61.  
  62. 	Bitfield(female,1);	/* is female */
  63. 	Bitfield(minvis,1);	/* currently invisible */
  64. 	Bitfield(invis_blkd,1); /* invisibility blocked */
  65. 	Bitfield(perminvis,1);	/* intrinsic minvis value */
  66. 	Bitfield(cham,3);	/* shape-changer */
  67. /* note: lychanthropes are handled elsewhere */
  68. #define CHAM_ORDINARY		0	/* not a shapechanger */
  69. #define CHAM_CHAMELEON		1	/* animal */
  70. #define CHAM_DOPPELGANGER	2	/* demi-human */
  71. #define CHAM_SANDESTIN		3	/* demon */
  72. #define CHAM_MAX_INDX		CHAM_SANDESTIN
  73. 	Bitfield(mundetected,1);	/* not seen in present hiding place */
  74. 				/* implies one of M1_CONCEAL or M1_HIDE,
  75. 				 * but not mimic (that is, snake, spider,
  76. 				 * trapper, piercer, eel)
  77. 				 */
  78.  
  79. 	Bitfield(mcan,1);	/* has been cancelled */
  80. 	Bitfield(mburied,1);	/* has been buried */
  81. 	Bitfield(mspeed,2);	/* current speed */
  82. 	Bitfield(permspeed,2);	/* intrinsic mspeed value */
  83. 	Bitfield(mrevived,1);	/* has been revived from the dead */
  84. 	Bitfield(mavenge,1);	/* did something to deserve retaliation */
  85.  
  86. 	Bitfield(mflee,1);	/* fleeing */
  87. 	Bitfield(mfleetim,7);	/* timeout for mflee */
  88.  
  89. 	Bitfield(mcansee,1);	/* cansee 1, temp.blinded 0, blind 0 */
  90. 	Bitfield(mblinded,7);	/* cansee 0, temp.blinded n, blind 0 */
  91.  
  92. 	Bitfield(mcanmove,1);	/* paralysis, similar to mblinded */
  93. 	Bitfield(mfrozen,7);
  94.  
  95. 	Bitfield(msleeping,1);	/* asleep until woken */
  96. 	Bitfield(mstun,1);	/* stunned (off balance) */
  97. 	Bitfield(mconf,1);	/* confused */
  98. 	Bitfield(mpeaceful,1);	/* does not attack unprovoked */
  99. 	Bitfield(mtrapped,1);	/* trapped in a pit, web or bear trap */
  100. 	Bitfield(mleashed,1);	/* monster is on a leash */
  101. 	Bitfield(isshk,1);	/* is shopkeeper */
  102. 	Bitfield(isminion,1);	/* is a minion */
  103.  
  104. 	Bitfield(isgd,1);	/* is guard */
  105. 	Bitfield(ispriest,1);	/* is a priest */
  106. 	Bitfield(iswiz,1);	/* is the Wizard of Yendor */
  107. 	Bitfield(wormno,5);	/* at most 31 worms on any level */
  108. #define MAX_NUM_WORMS	32	/* should be 2^(wormno bitfield size) */
  109.  
  110. 	long mstrategy;		/* for monsters with mflag3: current strategy */
  111. #define STRAT_ARRIVE	0x40000000L	/* just arrived on current level */
  112. #define STRAT_WAITFORU	0x20000000L
  113. #define STRAT_CLOSE	0x10000000L
  114. #define STRAT_WAITMASK	0x30000000L
  115. #define STRAT_HEAL	0x08000000L
  116. #define STRAT_GROUND	0x04000000L
  117. #define STRAT_MONSTR	0x02000000L
  118. #define STRAT_PLAYER	0x01000000L
  119. #define STRAT_NONE	0x00000000L
  120. #define STRAT_STRATMASK 0x0f000000L
  121. #define STRAT_XMASK	0x00ff0000L
  122. #define STRAT_YMASK	0x0000ff00L
  123. #define STRAT_GOAL	0x000000ffL
  124. #define STRAT_GOALX(s)	((xchar)((s & STRAT_XMASK) >> 16))
  125. #define STRAT_GOALY(s)	((xchar)((s & STRAT_YMASK) >> 8))
  126.  
  127. 	long mtrapseen;		/* bitmap of traps we've been trapped in */
  128. 	long mlstmv;		/* for catching up with lost time */
  129. #ifndef GOLDOBJ
  130. 	long mgold;
  131. #endif
  132. 	struct obj *minvent;
  133.  
  134. 	struct obj *mw;
  135. 	long misc_worn_check;
  136. 	xchar weapon_check;
  137.  
  138. 	uchar mnamelth;		/* length of name (following mxlth) */
  139. 	short mxlth;		/* length of following data */
  140. 	/* in order to prevent alignment problems mextra should
  141. 	   be (or follow) a long int */
  142. 	int meating;		/* monster is eating timeout */
  143. 	long mextra[1]; /* monster dependent info */
  144. };
  145.  
  146. /*
  147. * Note that mextra[] may correspond to any of a number of structures, which
  148. * are indicated by some of the other fields.
  149. *	isgd	 ->	struct egd
  150. *	ispriest ->	struct epri
  151. *	isshk	 ->	struct eshk
  152. *	isminion ->	struct emin
  153. *			(struct epri for roaming priests and angels, which is
  154. *			 compatible with emin for polymorph purposes)
  155. *	mtame	 ->	struct edog
  156. *			(struct epri for guardian angels, which do not eat
  157. *			 or do other doggy things)
  158. * Since at most one structure can be indicated in this manner, it is not
  159. * possible to tame any creatures using the other structures (the only
  160. * exception being the guardian angels which are tame on creation).
  161. */
  162.  
  163. #define newmonst(xl) (struct monst *)alloc((unsigned)(xl) + sizeof(struct monst))
  164. #define dealloc_monst(mon) free((genericptr_t)(mon))
  165.  
  166. /* these are in mspeed */
  167. #define MSLOW 1		/* slow monster */
  168. #define MFAST 2		/* speeded monster */
  169.  
  170. #define NAME(mtmp)	(((char *)(mtmp)->mextra) + (mtmp)->mxlth)
  171.  
  172. #define MON_WEP(mon)	((mon)->mw)
  173. #define MON_NOWEP(mon)	((mon)->mw = (struct obj *)0)
  174.  
  175. #define DEADMONSTER(mon)	((mon)->mhp < 1)
  176.  
  177. #endif /* MONST_H */