1 /* NetHack 3.6 you.h $NHDT-Date: 1432512782 2015/05/25 00:13:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.29 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
11 #include "prop.h" /* (needed here for util/makedefs.c) */
15 /*** Substructures ***/
18 const char *m; /* name when character is male */
19 const char *f; /* when female; null if same as male */
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 */
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 */
39 Bitfield(minor_oracle, 1); /* received at least 1 cheap oracle */
40 Bitfield(major_oracle, 1); /* " expensive oracle */
41 Bitfield(read_tribute, 1); /* read a passage from a novel */
42 Bitfield(qcalled, 1); /* called by Quest leader to do task */
43 Bitfield(qexpelled, 1); /* expelled from the Quest dungeon */
44 Bitfield(qcompleted, 1); /* successfully completed Quest task */
45 Bitfield(uheard_tune, 2); /* 1=know about, 2=heard passtune */
47 Bitfield(uopened_dbridge, 1); /* opened the drawbridge */
48 Bitfield(invoked, 1); /* invoked Gate to the Sanctum level */
49 Bitfield(gehennom_entered, 1); /* entered Gehennom via Valley */
50 Bitfield(uhand_of_elbereth, 2); /* became Hand of Elbereth */
51 Bitfield(udemigod, 1); /* killed the wiz */
52 Bitfield(uvibrated, 1); /* stepped on "vibrating square" */
53 Bitfield(ascended, 1); /* has offered the Amulet */
57 Bitfield(amulet, 1); /* touched Amulet */
58 Bitfield(bell, 1); /* touched Bell */
59 Bitfield(book, 1); /* touched Book */
60 Bitfield(menorah, 1); /* touched Candelabrum */
61 Bitfield(enter_gehennom,
62 1); /* entered Gehennom (or Valley) by any means */
63 Bitfield(ascended, 1); /* not quite the same as u.uevent.ascended */
64 Bitfield(mines_luckstone, 1); /* got a luckstone at end of mines */
65 Bitfield(finish_sokoban, 1); /* obtained the sokoban prize */
67 Bitfield(killed_medusa, 1);
73 realtime; /* actual playing time up until the last restore, seconds */
74 time_t restored; /* time the game was started or restored */
77 long realtime; /* accumulated playing time in seconds */
78 time_t start_timing; /* time game was started or restored or 'realtime'
79 was last updated (savegamestate for checkpoint) */
80 time_t finish_time; /* end of 'realtime' interval: time of save or
81 end of game; used for topten/logfile/xlogfile */
86 * These are voluntary challenges. Each field denotes the number of
87 * times a challenge has been violated.
89 struct u_conduct { /* number of times... */
90 long unvegetarian; /* eaten any animal */
91 long unvegan; /* ... or any animal byproduct */
92 long food; /* ... or any comestible */
93 long gnostic; /* used prayer, priest, or altar */
94 long weaphit; /* hit a monster with a weapon */
95 long killer; /* killed a monster yourself */
96 long literate; /* read something (other than BotD) */
97 long polypiles; /* polymorphed an object */
98 long polyselfs; /* transformed yourself */
99 long wishes; /* used a wish */
100 long wisharti; /* wished for an artifact */
101 /* genocides already listed at end of game */
105 boolean blind; /* permanently blind */
106 boolean nudist; /* has not worn any armor, ever */
107 long numbones; /* # of bones files loaded */
110 /*** Unified structure containing role information ***/
112 /*** Strings that name various things ***/
113 struct RoleName name; /* the role's name (from u_init.c) */
114 struct RoleName rank[9]; /* names for experience levels (from botl.c) */
115 const char *lgod, *ngod, *cgod; /* god names (from pray.c) */
116 const char *filecode; /* abbreviation for use in file names */
117 const char *homebase; /* quest leader's location (from questpgr.c) */
118 const char *intermed; /* quest intermediate goal (from questpgr.c) */
120 /*** Indices of important monsters and objects ***/
121 short malenum, /* index (PM_) as a male (botl.c) */
122 femalenum, /* ...or as a female (NON_PM == same) */
123 petnum, /* PM_ of preferred pet (NON_PM == random) */
124 ldrnum, /* PM_ of quest leader (questpgr.c) */
125 guardnum, /* PM_ of quest guardians (questpgr.c) */
126 neminum, /* PM_ of quest nemesis (questpgr.c) */
127 enemy1num, /* specific quest enemies (NON_PM == random) */
129 char enemy1sym, /* quest enemies by class (S_) */
131 short questarti; /* index (ART_) of quest artifact (questpgr.c) */
134 short allow; /* bit mask of allowed variations */
135 #define ROLE_RACEMASK 0x0ff8 /* allowable races */
136 #define ROLE_GENDMASK 0xf000 /* allowable genders */
137 #define ROLE_MALE 0x1000
138 #define ROLE_FEMALE 0x2000
139 #define ROLE_NEUTER 0x4000
140 #define ROLE_ALIGNMASK AM_MASK /* allowable alignments */
141 #define ROLE_LAWFUL AM_LAWFUL
142 #define ROLE_NEUTRAL AM_NEUTRAL
143 #define ROLE_CHAOTIC AM_CHAOTIC
145 /*** Attributes (from attrib.c and exper.c) ***/
146 xchar attrbase[A_MAX]; /* lowest initial attributes */
147 xchar attrdist[A_MAX]; /* distribution of initial attributes */
148 struct RoleAdvance hpadv; /* hit point advancement */
149 struct RoleAdvance enadv; /* energy advancement */
150 xchar xlev; /* cutoff experience level */
151 xchar initrecord; /* initial alignment record */
153 /*** Spell statistics (from spell.c) ***/
154 int spelbase; /* base spellcasting penalty */
155 int spelheal; /* penalty (-bonus) for healing spells */
156 int spelshld; /* penalty for wearing any shield */
157 int spelarmr; /* penalty for wearing metal armour */
158 int spelstat; /* which stat (A_) is used */
159 int spelspec; /* spell (SPE_) the class excels at */
160 int spelsbon; /* penalty (-bonus) for that spell */
162 /*** Properties in variable-length arrays ***/
163 /* intrinsics (see attrib.c) */
164 /* initial inventory (see u_init.c) */
165 /* skills (see u_init.c) */
167 /*** Don't forget to add... ***/
168 /* quest leader, guardians, nemesis (monst.c) */
169 /* quest artifact (artilist.h) */
170 /* quest dungeon definition (dat/Xyz.dat) */
171 /* quest text (dat/quest.txt) */
172 /* dictionary entries (dat/data.bas) */
175 extern const struct Role roles[]; /* table of available roles */
176 extern struct Role urole;
177 #define Role_if(X) (urole.malenum == (X))
178 #define Role_switch (urole.malenum)
180 /* used during initialization for race, gender, and alignment
181 as well as for character class */
182 #define ROLE_NONE (-1)
183 #define ROLE_RANDOM (-2)
185 /*** Unified structure specifying race information ***/
188 /*** Strings that name various things ***/
189 const char *noun; /* noun ("human", "elf") */
190 const char *adj; /* adjective ("human", "elven") */
191 const char *coll; /* collective ("humanity", "elvenkind") */
192 const char *filecode; /* code for filenames */
193 struct RoleName individual; /* individual as a noun ("man", "elf") */
195 /*** Indices of important monsters and objects ***/
196 short malenum, /* PM_ as a male monster */
197 femalenum, /* ...or as a female (NON_PM == same) */
198 mummynum, /* PM_ as a mummy */
199 zombienum; /* PM_ as a zombie */
202 short allow; /* bit mask of allowed variations */
203 short selfmask, /* your own race's bit mask */
204 lovemask, /* bit mask of always peaceful */
205 hatemask; /* bit mask of always hostile */
208 xchar attrmin[A_MAX]; /* minimum allowable attribute */
209 xchar attrmax[A_MAX]; /* maximum allowable attribute */
210 struct RoleAdvance hpadv; /* hit point advancement */
211 struct RoleAdvance enadv; /* energy advancement */
213 int nv_range; /* night vision range */
214 int xray_range; /* X-ray vision range */
217 /*** Properties in variable-length arrays ***/
218 /* intrinsics (see attrib.c) */
220 /*** Don't forget to add... ***/
221 /* quest leader, guardians, nemesis (monst.c) */
222 /* quest dungeon definition (dat/Xyz.dat) */
223 /* quest text (dat/quest.txt) */
224 /* dictionary entries (dat/data.bas) */
227 extern const struct Race races[]; /* Table of available races */
228 extern struct Race urace;
229 #define Race_if(X) (urace.malenum == (X))
230 #define Race_switch (urace.malenum)
232 /*** Unified structure specifying gender information ***/
234 const char *adj; /* male/female/neuter */
235 const char *he; /* he/she/it */
236 const char *him; /* him/her/it */
237 const char *his; /* his/her/its */
238 const char *filecode; /* file code */
239 short allow; /* equivalent ROLE_ mask */
241 #define ROLE_GENDERS 2 /* number of permitted player genders */
242 /* increment to 3 if you allow neuter roles */
244 extern const struct Gender genders[]; /* table of available genders */
245 #define uhe() (genders[flags.female ? 1 : 0].he)
246 #define uhim() (genders[flags.female ? 1 : 0].him)
247 #define uhis() (genders[flags.female ? 1 : 0].his)
248 #define mhe(mtmp) (genders[pronoun_gender(mtmp)].he)
249 #define mhim(mtmp) (genders[pronoun_gender(mtmp)].him)
250 #define mhis(mtmp) (genders[pronoun_gender(mtmp)].his)
252 /*** Unified structure specifying alignment information ***/
254 const char *noun; /* law/balance/chaos */
255 const char *adj; /* lawful/neutral/chaotic */
256 const char *filecode; /* file code */
257 short allow; /* equivalent ROLE_ mask */
258 aligntyp value; /* equivalent A_ value */
260 #define ROLE_ALIGNS 3 /* number of permitted player alignments */
262 extern const struct Align aligns[]; /* table of available alignments */
264 /*** Information about the player ***/
267 schar dx, dy, dz; /* direction of move (or zap or ... ) */
268 schar di; /* direction of FF */
269 xchar tx, ty; /* destination of travel */
270 xchar ux0, uy0; /* initial position FF */
271 d_level uz, uz0; /* your level on this and the previous turn */
272 d_level utolev; /* level monster teleported you to, or uz */
273 uchar utotype; /* bitmask of goto_level() flags for utolev */
274 boolean umoved; /* changed map location (post-move) */
275 int last_str_turn; /* 0: none, 1: half turn, 2: full turn */
276 /* +: turn right, -: turn left */
277 int ulevel; /* 1 to MAXULEV */
279 unsigned utrap; /* trap timeout */
280 unsigned utraptype; /* defined if utrap nonzero */
281 #define TT_BEARTRAP 0
286 #define TT_BURIEDBALL 5
287 char urooms[5]; /* rooms (roomno + 3) occupied now */
288 char urooms0[5]; /* ditto, for previous position */
289 char uentered[5]; /* rooms (roomno + 3) entered this turn */
290 char ushops[5]; /* shop rooms (roomno + 3) occupied now */
291 char ushops0[5]; /* ditto, for previous position */
292 char ushops_entered[5]; /* ditto, shops entered this turn */
293 char ushops_left[5]; /* ditto, shops exited this turn */
295 int uhunger; /* refd only in eat.c and shk.c */
296 unsigned uhs; /* hunger state - see eat.c */
298 struct prop uprops[LAST_PROP + 1];
301 Bitfield(usick_type, 2);
302 #define SICK_VOMITABLE 0x01
303 #define SICK_NONVOMITABLE 0x02
304 #define SICK_ALL 0x03
306 /* These ranges can never be more than MAX_RANGE (vision.h). */
307 int nv_range; /* current night vision range */
308 int xray_range; /* current xray vision range */
311 * These variables are valid globally only when punished and blind.
313 #define BC_BALL 0x01 /* bit mask for ball in 'bc_felt' below */
314 #define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */
315 int bglyph; /* glyph under the ball */
316 int cglyph; /* glyph under the chain */
317 int bc_order; /* ball & chain order [see bc_order() in ball.c] */
318 int bc_felt; /* mask for ball/chain being felt */
320 int umonster; /* hero's "real" monster num */
321 int umonnum; /* current monster number */
323 int mh, mhmax, mtimedone; /* for polymorph-self */
324 struct attribs macurr, /* for monster attribs */
325 mamax; /* for monster attribs */
326 int ulycn; /* lycanthrope type */
329 unsigned uswldtim; /* time you have been swallowed */
331 Bitfield(uswallow, 1); /* true if swallowed */
332 Bitfield(uinwater, 1); /* if you're currently in water (only
333 underwater possible currently) */
334 Bitfield(uundetected, 1); /* if you're a hiding monster/piercer */
335 Bitfield(mfemale, 1); /* saved human value of flags.female */
336 Bitfield(uinvulnerable, 1); /* you're invulnerable (praying) */
337 Bitfield(uburied, 1); /* you're buried */
338 Bitfield(uedibility, 1); /* blessed food detection; sense unsafe food */
341 unsigned udg_cnt; /* how long you have been demigod */
342 struct u_achieve uachieve; /* achievements */
343 struct u_event uevent; /* certain events have happened */
344 struct u_have uhave; /* you're carrying special objects */
345 struct u_conduct uconduct; /* KMH, conduct */
346 struct u_roleplay uroleplay;
347 struct attribs acurr, /* your current attributes (eg. str)*/
348 aexe, /* for gain/loss via "exercise" */
349 abon, /* your bonus attributes (eg. str) */
350 amax, /* your max attributes (eg. str) */
351 atemp, /* used for temporary loss/gain */
352 atime; /* used for loss/gain countdown */
353 align ualign; /* character alignment */
357 aligntyp ualignbase[CONVERT]; /* for ualign conversion record */
358 schar uluck, moreluck; /* luck and luck bonus */
359 #define Luck (u.uluck + u.moreluck)
360 #define LUCKADD 3 /* added value when carrying luck stone */
362 #define LUCKMIN (-10)
366 uchar uspellprot; /* protection by SPE_PROTECTION */
367 uchar usptime; /* #moves until uspellprot-- */
368 uchar uspmtime; /* #moves between uspellprot-- */
370 int uen, uenmax; /* magical energy - M. Stephenson */
371 xchar uhpinc[MAXULEV], ueninc[MAXULEV]; /* increases from level gain */
372 int ugangr; /* if the gods are angry at you */
373 int ugifts; /* number of artifacts bestowed */
374 int ublessed, ublesscnt; /* blessing/duration from #pray */
378 long ucleansed; /* to record moves when player was cleansed */
379 long usleep; /* sleeping; monstermove you last started */
381 struct monst *ustuck;
382 struct monst *usteed;
385 int umortality; /* how many times you died */
386 int ugrave_arise; /* you die and become something aside from a ghost */
387 int weapon_slots; /* unused skill slots */
388 int skills_advanced; /* # of advances made so far */
389 xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */
390 struct skills weapon_skills[P_NUM_SKILLS];
391 boolean twoweap; /* KMH -- Using two-weapon combat */
393 }; /* end of `struct you' */
395 #define Upolyd (u.umonnum != u.umonster)