Source:NetHack 3.3.0/you.h

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

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

1.   /*	SCCS Id: @(#)you.h	3.3	1999/11/01	*/ 2.   /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3.    /* NetHack may be freely redistributed. See license for details. */ 4.     5.    #ifndef YOU_H 6.   #define YOU_H 7.    8.    #include "attrib.h"  9.    #include "monst.h"  10. #ifndef PROP_H 11.  #include "prop.h"		/* (needed here for util/makedefs.c) */ 12.  #endif 13.  #include "skills.h"  14. 15.  /*** Substructures ***/ 16.   17.   struct RoleName { 18.  	const char	*m;	/* name when character is male */ 19.  	const char	*f;	/* when female; null if same as male */ 20.  };  21.    22.   struct RoleAdvance { 23.  	/* "fix" is the fixed amount, "rnd" is the random amount */ 24.  	xchar infix, inrnd;	/* at character initialization */ 25.  	xchar lofix, lornd;	/* gained per level <  urole.xlev */ 26.  	xchar hifix, hirnd;	/* gained per level >= urole.xlev */ 27.  };  28.    29.   struct u_have { 30.  	Bitfield(amulet,1);	/* carrying Amulet	*/ 31.  	Bitfield(bell,1);	/* carrying Bell	*/ 32.  	Bitfield(book,1);	/* carrying Book	*/ 33.  	Bitfield(menorah,1);	/* carrying Candelabrum */ 34.  	Bitfield(questart,1);	/* carrying the Quest Artifact */ 35.  	Bitfield(unused,3); 36.  };  37.    38.   struct u_event { 39.  	Bitfield(minor_oracle,1);	/* received at least 1 cheap oracle */ 40.  	Bitfield(major_oracle,1);	/*  "  expensive oracle */  41.   	Bitfield(qcalled,1);		/* called by Quest leader to do task */  42.   	Bitfield(qexpelled,1);		/* expelled from the Quest dungeon */  43.   	Bitfield(qcompleted,1);		/* successfully completed Quest task */  44.   	Bitfield(uheard_tune,2);	/* 1=know about, 2=heard passtune */  45.   	Bitfield(uopened_dbridge,1);	/* opened the drawbridge */  46.    47.   	Bitfield(invoked,1);		/* invoked Gate to the Sanctum level */  48.   	Bitfield(gehennom_entered,1);	/* entered Gehennom via Valley */  49.   #ifdef ELBERETH  50.   	Bitfield(uhand_of_elbereth,2);	/* became Hand of Elbereth */  51.   #endif  52.   	Bitfield(udemigod,1);		/* killed the wiz */  53.   	Bitfield(ascended,1);		/* has offered the Amulet */  54.   };  55.    56.   /* KMH, conduct --  57.    * These are voluntary challenges.  Each field denotes the number of  58. * times a challenge has been violated. 59.   */  60.   struct u_conduct {		/* number of times... */ 61.   	long	meat;		/* eaten corpse, tin, egg, tripe, body part */ 62.  	long	flesh;		/* ... or anything "fleshy" */ 63.  	long	food;		/* ... or any comestible */ 64.  	long	gnostic;	/* used prayer, priest, or altar */ 65.  	long	weaphit;	/* hit a monster with a weapon */ 66.  	long	killer;		/* killed a monster yourself */ 67.  	long	literate;	/* read something (other than BotD) */ 68.  	long	polypiles;	/* polymorphed an object */ 69.  	long	polyselfs;	/* transformed yourself */ 70.  	long	wishes;		/* used a wish */ 71.  	long	wisharti;	/* wished for an artifact */ 72.  				/* genocides already listed at end of game */ 73.  };  74.    75.   /*** Unified structure containing role information ***/ 76.  struct Role { 77.  	/*** Strings that name various things ***/ 78.  	struct RoleName name;	/* the role's name (from u_init.c) */ 79.  	struct RoleName rank[9]; /* names for experience levels (from botl.c) */ 80.  	const char *lgod, *ngod, *cgod; /* god names (from pray.c) */ 81.  	const char *filecode;	/* abbreviation for use in file names */ 82.  	const char *homebase;	/* quest leader's location (from questpgr.c) */ 83.  	const char *intermed;	/* quest intermediate goal (from questpgr.c) */ 84.   85.   	/*** Indices of important monsters and objects ***/ 86.  	short malenum,		/* index (PM_) as a male (botl.c) */ 87.  	      femalenum,	/* ...or as a female (NON_PM == same) */ 88.  	      petnum,		/* PM_ of preferred pet (NON_PM == random) */ 89.  	      ldrnum,		/* PM_ of quest leader (questpgr.c) */ 90.  	      guardnum,		/* PM_ of quest guardians (questpgr.c) */ 91.  	      neminum,		/* PM_ of quest nemesis (questpgr.c) */ 92.  	      enemy1num,	/* specific quest enemies (NON_PM == random) */ 93.  	      enemy2num; 94.  	char  enemy1sym,	/* quest enemies by class (S_) */ 95.  	      enemy2sym; 96.  	short questarti;	/* index (ART_) of quest artifact (questpgr.c) */ 97.   98.   	/*** Bitmasks ***/ 99.  	short allow;		/* bit mask of allowed variations */ 100. #define ROLE_RACEMASK	0x0ff8		/* allowable races */ 101. #define ROLE_GENDMASK	0xf000		/* allowable genders */ 102. #define ROLE_MALE	0x1000 103. #define ROLE_FEMALE	0x2000 104. #define ROLE_NEUTER	0x4000 105. #define ROLE_ALIGNMASK	AM_MASK		/* allowable alignments */ 106. #define ROLE_LAWFUL	AM_LAWFUL 107. #define ROLE_NEUTRAL	AM_NEUTRAL 108. #define ROLE_CHAOTIC	AM_CHAOTIC 109.  110.  	/*** Attributes (from attrib.c and exper.c) ***/ 111. 	xchar attrbase[A_MAX];	/* lowest initial attributes */ 112. 	xchar attrdist[A_MAX];	/* distribution of initial attributes */ 113. 	struct RoleAdvance hpadv; /* hit point advancement */ 114. 	struct RoleAdvance enadv; /* energy advancement */ 115. 	xchar xlev;		/* cutoff experience level */ 116. 	xchar initrecord;	/* initial alignment record */ 117.  118.  	/*** Spell statistics (from spell.c) ***/ 119. 	int spelbase;		/* base spellcasting penalty */ 120. 	int spelheal;		/* penalty (-bonus) for healing spells */ 121. 	int spelshld;		/* penalty for wearing any shield */ 122. 	int spelarmr;		/* penalty for wearing metal armour */ 123. 	int spelstat;		/* which stat (A_) is used */ 124. 	int spelspec;		/* spell (SPE_) the class excels at */ 125. 	int spelsbon;		/* penalty (-bonus) for that spell */ 126.  127.  	/*** Properties in variable-length arrays ***/ 128. 	/* intrinsics (see attrib.c) */ 129. 	/* initial inventory (see u_init.c) */ 130. 	/* skills (see u_init.c) */ 131.  132.  	/*** Don't forget to add... ***/ 133.  	/* quest leader, guardians, nemesis (monst.c) */ 134. 	/* quest artifact (artilist.h) */ 135. 	/* quest dungeon definition (dat/Xyz.dat) */ 136. 	/* quest text (dat/quest.txt) */ 137. 	/* dictionary entries (dat/data.bas) */ 138. };  139.   140.  extern const struct Role roles[];	/* table of available roles */ 141. extern struct Role urole; 142. #define Role_if(X)	(urole.malenum == (X)) 143. #define Role_switch	(urole.malenum) 144.  145.   146.  /*** Unified structure specifying race information ***/ 147.  148.  struct Race { 149. 	/*** Strings that name various things ***/ 150. 	const char *noun;	/* noun ("human", "elf") */ 151. 	const char *adj;	/* adjective ("human", "elven") */ 152. 	const char *coll;	/* collective ("humanity", "elvenkind") */ 153. 	const char *filecode;	/* code for filenames */ 154. 	struct RoleName individual; /* individual as a noun ("man", "elf") */ 155.  156.  	/*** Indices of important monsters and objects ***/ 157. 	short malenum,		/* PM_ as a male monster */ 158. 	      femalenum,	/* ...or as a female (NON_PM == same) */ 159. 	      mummynum,		/* PM_ as a mummy */ 160. 	      zombienum;	/* PM_ as a zombie */ 161.  162.  	/*** Bitmasks ***/ 163. 	short allow;		/* bit mask of allowed variations */ 164. 	short selfmask,		/* your own race's bit mask */ 165. 	      lovemask,		/* bit mask of always peaceful */ 166. 	      hatemask;		/* bit mask of always hostile */ 167.  168.  	/*** Attributes ***/ 169. 	xchar attrmin[A_MAX];	/* minimum allowable attribute */ 170. 	xchar attrmax[A_MAX];	/* maximum allowable attribute */ 171. 	struct RoleAdvance hpadv; /* hit point advancement */ 172. 	struct RoleAdvance enadv; /* energy advancement */ 173. #if 0	/* DEFERRED */ 174. 	int   nv_range;		/* night vision range */ 175. 	int   xray_range;	/* X-ray vision range */ 176. #endif 177.  178.  	/*** Properties in variable-length arrays ***/ 179. 	/* intrinsics (see attrib.c) */ 180.  181.  	/*** Don't forget to add... ***/ 182.  	/* quest leader, guardians, nemesis (monst.c) */ 183. 	/* quest dungeon definition (dat/Xyz.dat) */ 184. 	/* quest text (dat/quest.txt) */ 185. 	/* dictionary entries (dat/data.bas) */ 186. };  187.   188.  extern const struct Race races[];	/* Table of available races */ 189. extern struct Race urace; 190. #define Race_if(X)	(urace.malenum == (X)) 191. #define Race_switch	(urace.malenum) 192.  193.   194.  /*** Unified structure specifying gender information ***/ 195. struct Gender { 196. 	const char *adj;	/* male/female/neuter */ 197. 	const char *he;		/* he/she/it */ 198. 	const char *him;	/* him/her/it */ 199. 	const char *his;	/* his/her/its */ 200. 	const char *filecode;	/* file code */ 201. 	short allow;		/* equivalent ROLE_ mask */ 202. };  203.  #define ROLE_GENDERS	2	/* number of permitted player genders */ 204. 				/* increment to 3 if you allow neuter roles */ 205.  206.  extern const struct Gender genders[];	/* table of available genders */ 207.  208.   209.  /*** Unified structure specifying alignment information ***/ 210. struct Align { 211. 	const char *noun;	/* law/balance/chaos */ 212. 	const char *adj;	/* lawful/neutral/chaotic */ 213. 	const char *filecode;	/* file code */ 214. 	short allow;		/* equivalent ROLE_ mask */ 215. 	aligntyp value;		/* equivalent A_ value */ 216. };  217.  #define ROLE_ALIGNS	3	/* number of permitted player alignments */ 218.  219.  extern const struct Align aligns[];	/* table of available alignments */ 220.  221.   222.  /*** Information about the player ***/ 223. struct you { 224. 	xchar ux, uy; 225. 	schar dx, dy, dz;	/* direction of move (or zap or ... ) */ 226. 	schar di;		/* direction of FF */ 227. 	xchar ux0, uy0;		/* initial position FF */ 228. 	d_level uz, uz0;	/* your level on this and the previous turn */ 229. 	d_level utolev;		/* level monster teleported you to, or uz */ 230. 	uchar utotype;		/* bitmask of goto_level flags for utolev */ 231. 	boolean umoved;		/* changed map location (post-move) */ 232. 	int last_str_turn;	/* 0: none, 1: half turn, 2: full turn */ 233. 				/* +: turn right, -: turn left */ 234. 	int ulevel;		/* 1 to MAXULEV */ 235. 	int ulevelmax; 236. 	unsigned utrap;		/* trap timeout */ 237. 	unsigned utraptype;	/* defined if utrap nonzero */ 238. #define TT_BEARTRAP	0 239. #define TT_PIT		1 240. #define TT_WEB		2 241. #define TT_LAVA		3 242. #define TT_INFLOOR	4 243. 	char	urooms[5];	/* rooms (roomno + 3) occupied now */ 244. 	char	urooms0[5];	/* ditto, for previous position */ 245. 	char	uentered[5];	/* rooms (roomno + 3) entered this turn */ 246. 	char	ushops[5];	/* shop rooms (roomno + 3) occupied now */ 247. 	char	ushops0[5];	/* ditto, for previous position */ 248. 	char	ushops_entered[5]; /* ditto, shops entered this turn */ 249. 	char	ushops_left[5]; /* ditto, shops exited this turn */ 250.  251.  	int	 uhunger;	/* refd only in eat.c and shk.c */ 252. 	unsigned uhs;		/* hunger state - see eat.c */ 253.  254.  	struct prop uprops[LAST_PROP+1]; 255.  256.  	unsigned umconf; 257. 	char usick_cause[PL_PSIZ+20]; /* sizeof "unicorn horn named "+1 */ 258. 	Bitfield(usick_type,2); 259. #define SICK_VOMITABLE 0x01 260. #define SICK_NONVOMITABLE 0x02 261. #define SICK_ALL 0x03 262.  263.  /* For messages referring to hands, eyes, feet, etc... when polymorphed */ 264. #define ARM 0 265. #define EYE 1 266. #define FACE 2 267. #define FINGER 3 268. #define FINGERTIP 4 269. #define FOOT 5 270. #define HAND 6 271. #define HANDED 7 272. #define HEAD 8 273. #define LEG 9 274. #define LIGHT_HEADED 10 275. #define NECK 11 276. #define SPINE 12 277. #define TOE 13 278. #define HAIR 14 279.  280.  	/* These ranges can never be more than MAX_RANGE (vision.h). */ 281.  	int nv_range;		/* current night vision range */ 282. 	int xray_range;		/* current xray vision range */ 283.  284.  	/*  285.  	 * These variables are valid globally only when punished and blind. 286. 	 */  287.  #define BC_BALL  0x01	/* bit mask for ball  in 'bc_felt' below */ 288. #define BC_CHAIN 0x02	/* bit mask for chain in 'bc_felt' below */ 289. 	int bglyph;	/* glyph under the ball */ 290. 	int cglyph;	/* glyph under the chain */ 291. 	int bc_order;	/* ball & chain order [see bc_order in ball.c] */ 292. 	int bc_felt;	/* mask for ball/chain being felt */ 293.  294.  	int umonster;			/* hero's "real" monster num */ 295. 	int umonnum;			/* current monster number */ 296.  297.  	int mh, mhmax, mtimedone;	/* for polymorph-self */ 298. 	struct attribs	macurr,		/* for monster attribs */ 299. 			mamax;		/* for monster attribs */ 300. 	int ulycn;			/* lycanthrope type */ 301.  302.  	unsigned ucreamed; 303. 	unsigned uswldtim;		/* time you have been swallowed */ 304.  305.  	Bitfield(uswallow,1);		/* true if swallowed */ 306. 	Bitfield(uinwater,1);		/* if you're currently in water (only  307.  					   underwater possible currently) */ 308. 	Bitfield(uundetected,1);	/* if you're a hiding monster/piercer */ 309. 	Bitfield(mfemale,1);		/* saved human value of flags.female */ 310. 	Bitfield(uinvulnerable,1);	/* you're invulnerable (praying) */ 311. 	Bitfield(uburied,1);		/* you're buried */ 312. 	/* 2 free bits! */ 313.   314.  	unsigned udg_cnt;		/* how long you have been demigod */ 315. 	struct u_event	uevent;		/* certain events have happened */ 316. 	struct u_have	uhave;		/* you're carrying special objects */ 317. 	struct u_conduct uconduct;	/* KMH, conduct */ 318. 	struct attribs	acurr,		/* your current attributes (eg. str)*/ 319. 			aexe,		/* for gain/loss via "exercise" */ 320. 			abon,		/* your bonus attributes (eg. str) */ 321. 			amax,		/* your max attributes (eg. str) */ 322. 			atemp,		/* used for temporary loss/gain */ 323. 			atime;		/* used for loss/gain countdown */ 324. 	align	ualign;			/* character alignment */ 325. #define CONVERT		2 326. 	aligntyp ualignbase[CONVERT];	/* for ualign conversion record */ 327. 	schar uluck, moreluck;		/* luck and luck bonus */ 328. #define Luck	(u.uluck + u.moreluck) 329. #define LUCKADD		3	/* added value when carrying luck stone */ 330. #define LUCKMAX		10	/* on moonlit nights 11 */ 331. #define LUCKMIN		(-10) 332. 	schar	uhitinc; 333. 	schar	udaminc; 334. 	schar	uac; 335. 	uchar	uspellprot;		/* protection by SPE_PROTECTION */ 336. 	uchar	usptime;		/* #moves until uspellprot-- */ 337. 	uchar	uspmtime;		/* #moves between uspellprot-- */ 338. 	int	uhp,uhpmax; 339. 	int	uen, uenmax;		/* magical energy - M. Stephenson */ 340. 	int ugangr;			/* if the gods are angry at you */ 341. 	int ugifts;			/* number of artifacts bestowed */ 342. 	int ublessed, ublesscnt;	/* blessing/duration from #pray */ 343. 	long	ugold, ugold0; 344. 	long	uexp, urexp; 345. 	long	ucleansed;	/* to record moves when player was cleansed */ 346. 	long	usleep;		/* sleeping; monstermove you last started */ 347. 	int uinvault; 348. 	struct monst *ustuck; 349. #ifdef STEED 350. 	struct monst *usteed; 351. 	long ugallop; 352. 	int urideturns; 353. #endif 354. 	int	umortality;		/* how many times you died */ 355. 	int ugrave_arise; /* you die and become something aside from a ghost */ 356. 	time_t	ubirthday;		/* real world time when game began */ 357.  358.  	int	weapon_slots;		/* unused skill slots */ 359. 	int	skills_advanced;		/* # of advances made so far */ 360. 	xchar	skill_record[P_SKILL_LIMIT];	/* skill advancements */ 361. 	struct skills weapon_skills[P_NUM_SKILLS]; 362. 	boolean twoweap;		/* KMH -- Using two-weapon combat */ 363.  364.  };	/* end of `struct you' */ 365.  366.  #define Upolyd (u.umonnum != u.umonster) 367.  368.  #endif	/* YOU_H */