Fandom

Wikihack

Source:NetHack 3.4.0/monst.h

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Below is the full text to monst.h from the source code of NetHack 3.4.0. To link to a particular line, write [[NetHack 3.4.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.4	1999/01/04	*/
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, 3, or 4 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.  --KAA
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.   	short movement;		/* movement points (derived from permonst definition and added effects */
44.   	uchar m_lev;		/* adjusted difficulty level of monster */
45.   	aligntyp malign;	/* alignment of this monster, relative to the
46.   				   player (positive = good to kill) */
47.   	xchar mx, my;
48.   	xchar mux, muy;		/* where the monster thinks you are */
49.   #define MTSZ	4
50.   	coord mtrack[MTSZ];	/* monster track */
51.   	int mhp, mhpmax;
52.   	unsigned mappearance;	/* for undetected mimics and the wiz */
53.   	uchar	 m_ap_type;	/* what mappearance is describing: */
54.   #define M_AP_NOTHING	0	/* mappearance is unused -- monster appears
55.   				   as itself */
56.   #define M_AP_FURNITURE	1	/* stairs, a door, an altar, etc. */
57.   #define M_AP_OBJECT	2	/* an object */
58.   #define M_AP_MONSTER	3	/* a monster */
59.   
60.   	schar mtame;		/* level of tameness, implies peaceful */
61.   	unsigned short mintrinsics;	/* low 8 correspond to mresists */
62.   	int mspec_used;		/* monster's special ability attack timeout */
63.   
64.   	Bitfield(female,1);	/* is female */
65.   	Bitfield(minvis,1);	/* currently invisible */
66.   	Bitfield(invis_blkd,1); /* invisibility blocked */
67.   	Bitfield(perminvis,1);	/* intrinsic minvis value */
68.   	Bitfield(cham,3);	/* shape-changer */
69.   /* note: lychanthropes are handled elsewhere */
70.   #define CHAM_ORDINARY		0	/* not a shapechanger */
71.   #define CHAM_CHAMELEON		1	/* animal */
72.   #define CHAM_DOPPELGANGER	2	/* demi-human */
73.   #define CHAM_SANDESTIN		3	/* demon */
74.   #define CHAM_MAX_INDX		CHAM_SANDESTIN
75.   	Bitfield(mundetected,1);	/* not seen in present hiding place */
76.   				/* implies one of M1_CONCEAL or M1_HIDE,
77.   				 * but not mimic (that is, snake, spider,
78.   				 * trapper, piercer, eel)
79.   				 */
80.   
81.   	Bitfield(mcan,1);	/* has been cancelled */
82.   	Bitfield(mburied,1);	/* has been buried */
83.   	Bitfield(mspeed,2);	/* current speed */
84.   	Bitfield(permspeed,2);	/* intrinsic mspeed value */
85.   	Bitfield(mrevived,1);	/* has been revived from the dead */
86.   	Bitfield(mavenge,1);	/* did something to deserve retaliation */
87.   
88.   	Bitfield(mflee,1);	/* fleeing */
89.   	Bitfield(mfleetim,7);	/* timeout for mflee */
90.   
91.   	Bitfield(mcansee,1);	/* cansee 1, temp.blinded 0, blind 0 */
92.   	Bitfield(mblinded,7);	/* cansee 0, temp.blinded n, blind 0 */
93.   
94.   	Bitfield(mcanmove,1);	/* paralysis, similar to mblinded */
95.   	Bitfield(mfrozen,7);
96.   
97.   	Bitfield(msleeping,1);	/* asleep until woken */
98.   	Bitfield(mstun,1);	/* stunned (off balance) */
99.   	Bitfield(mconf,1);	/* confused */
100.  	Bitfield(mpeaceful,1);	/* does not attack unprovoked */
101.  	Bitfield(mtrapped,1);	/* trapped in a pit or bear trap */
102.  	Bitfield(mleashed,1);	/* monster is on a leash */
103.  	Bitfield(isshk,1);	/* is shopkeeper */
104.  	Bitfield(isminion,1);	/* is a minion */
105.  
106.  	Bitfield(isgd,1);	/* is guard */
107.  	Bitfield(ispriest,1);	/* is a priest */
108.  	Bitfield(iswiz,1);	/* is the Wizard of Yendor */
109.  	Bitfield(wormno,5);	/* at most 31 worms on any level */
110.  #define MAX_NUM_WORMS	32	/* should be 2^(wormno bitfield size) */
111.  
112.  	long mstrategy;		/* for monsters with mflag3: current strategy */
113.  #define STRAT_ARRIVE	0x40000000L	/* just arrived on current level */
114.  #define STRAT_WAITFORU	0x20000000L
115.  #define STRAT_CLOSE	0x10000000L
116.  #define STRAT_WAITMASK	0x30000000L
117.  #define STRAT_HEAL	0x08000000L
118.  #define STRAT_GROUND	0x04000000L
119.  #define STRAT_MONSTR	0x02000000L
120.  #define STRAT_PLAYER	0x01000000L
121.  #define STRAT_NONE	0x00000000L
122.  #define STRAT_STRATMASK 0x0f000000L
123.  #define STRAT_XMASK	0x00ff0000L
124.  #define STRAT_YMASK	0x0000ff00L
125.  #define STRAT_GOAL	0x000000ffL
126.  #define STRAT_GOALX(s)	((xchar)((s & STRAT_XMASK) >> 16))
127.  #define STRAT_GOALY(s)	((xchar)((s & STRAT_YMASK) >> 8))
128.  
129.  	long mtrapseen;		/* bitmap of traps we've been trapped in */
130.  	long mlstmv;		/* for catching up with lost time */
131.  #ifndef GOLDOBJ
132.  	long mgold;
133.  #endif
134.  	struct obj *minvent;
135.  
136.  	struct obj *mw;
137.  	long misc_worn_check;
138.  	xchar weapon_check;
139.  
140.  	uchar mnamelth;		/* length of name (following mxlth) */
141.  	short mxlth;		/* length of following data */
142.  	/* in order to prevent alignment problems mextra should
143.  	   be (or follow) a long int */
144.  	int meating;		/* monster is eating timeout */
145.  	long mextra[1]; /* monster dependent info */
146.  };
147.  
148.  /*
149.   * Note that mextra[] may correspond to any of a number of structures, which
150.   * are indicated by some of the other fields.
151.   *	isgd	 ->	struct egd
152.   *	ispriest ->	struct epri
153.   *	isshk	 ->	struct eshk
154.   *	isminion ->	struct emin
155.   *			(struct epri for roaming priests and angels, which is
156.   *			 compatible with emin for polymorph purposes)
157.   *	mtame	 ->	struct edog
158.   *			(struct epri for guardian angels, which do not eat
159.   *			 or do other doggy things)
160.   * Since at most one structure can be indicated in this manner, it is not
161.   * possible to tame any creatures using the other structures (the only
162.   * exception being the guardian angels which are tame on creation).
163.   */
164.  
165.  #define newmonst(xl) (struct monst *)alloc((unsigned)(xl) + sizeof(struct monst))
166.  #define dealloc_monst(mon) free((genericptr_t)(mon))
167.  
168.  /* these are in mspeed */
169.  #define MSLOW 1		/* slow monster */
170.  #define MFAST 2		/* speeded monster */
171.  
172.  #define NAME(mtmp)	(((char *)(mtmp)->mextra) + (mtmp)->mxlth)
173.  
174.  #define MON_WEP(mon)	((mon)->mw)
175.  #define MON_NOWEP(mon)	((mon)->mw = (struct obj *)0)
176.  
177.  #define DEADMONSTER(mon)	((mon)->mhp < 1)
178.  
179.  #endif /* MONST_H */

Also on Fandom

Random Wiki