Wikia

Wikihack

Source:NetHack 3.2.0/monst.h

2,032pages on
this wiki
Talk0

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

Warning! This is the source code from an old release. For the latest release, see Source code

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

Around Wikia's network

Random Wiki