1 /* NetHack 3.6 you.h $NHDT-Date: 1547514642 2019/01/15 01:10:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.35 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2016. */
4 /* NetHack may be freely redistributed. See license for details. */
12 #include "prop.h" /* (needed here for util/makedefs.c) */
16 /*** Substructures ***/
19 const char *m; /* name when character is male */
20 const char *f; /* when female; null if same as male */
24 /* "fix" is the fixed amount, "rnd" is the random amount */
25 xchar infix, inrnd; /* at character initialization */
26 xchar lofix, lornd; /* gained per level < urole.xlev */
27 xchar hifix, hirnd; /* gained per level >= urole.xlev */
31 Bitfield(amulet, 1); /* carrying Amulet */
32 Bitfield(bell, 1); /* carrying Bell */
33 Bitfield(book, 1); /* carrying Book */
34 Bitfield(menorah, 1); /* carrying Candelabrum */
35 Bitfield(questart, 1); /* carrying the Quest Artifact */
40 Bitfield(minor_oracle, 1); /* received at least 1 cheap oracle */
41 Bitfield(major_oracle, 1); /* " expensive oracle */
42 Bitfield(read_tribute, 1); /* read a passage from a novel */
43 Bitfield(qcalled, 1); /* called by Quest leader to do task */
44 Bitfield(qexpelled, 1); /* expelled from the Quest dungeon */
45 Bitfield(qcompleted, 1); /* successfully completed Quest task */
46 Bitfield(uheard_tune, 2); /* 1=know about, 2=heard passtune */
48 Bitfield(uopened_dbridge, 1); /* opened the drawbridge */
49 Bitfield(invoked, 1); /* invoked Gate to the Sanctum level */
50 Bitfield(gehennom_entered, 1); /* entered Gehennom via Valley */
51 Bitfield(uhand_of_elbereth, 2); /* became Hand of Elbereth */
52 Bitfield(udemigod, 1); /* killed the wiz */
53 Bitfield(uvibrated, 1); /* stepped on "vibrating square" */
54 Bitfield(ascended, 1); /* has offered the Amulet */
58 Bitfield(amulet, 1); /* touched Amulet */
59 Bitfield(bell, 1); /* touched Bell */
60 Bitfield(book, 1); /* touched Book */
61 Bitfield(menorah, 1); /* touched Candelabrum */
62 Bitfield(enter_gehennom,
63 1); /* entered Gehennom (or Valley) by any means */
64 Bitfield(ascended, 1); /* not quite the same as u.uevent.ascended */
65 Bitfield(mines_luckstone, 1); /* got a luckstone at end of mines */
66 Bitfield(finish_sokoban, 1); /* obtained the sokoban prize */
68 Bitfield(killed_medusa, 1);
72 long realtime; /* accumulated playing time in seconds */
73 time_t start_timing; /* time game was started or restored or 'realtime'
74 was last updated (savegamestate for checkpoint) */
75 time_t finish_time; /* end of 'realtime' interval: time of save or
76 end of game; used for topten/logfile/xlogfile */
80 * These are voluntary challenges. Each field denotes the number of
81 * times a challenge has been violated.
83 struct u_conduct { /* number of times... */
84 long unvegetarian; /* eaten any animal */
85 long unvegan; /* ... or any animal byproduct */
86 long food; /* ... or any comestible */
87 long gnostic; /* used prayer, priest, or altar */
88 long weaphit; /* hit a monster with a weapon */
89 long killer; /* killed a monster yourself */
90 long literate; /* read something (other than BotD) */
91 long polypiles; /* polymorphed an object */
92 long polyselfs; /* transformed yourself */
93 long wishes; /* used a wish */
94 long wisharti; /* wished for an artifact */
95 /* genocides already listed at end of game */
99 boolean blind; /* permanently blind */
100 boolean nudist; /* has not worn any armor, ever */
101 long numbones; /* # of bones files loaded */
104 /*** Unified structure containing role information ***/
106 /*** Strings that name various things ***/
107 struct RoleName name; /* the role's name (from u_init.c) */
108 struct RoleName rank[9]; /* names for experience levels (from botl.c) */
109 const char *lgod, *ngod, *cgod; /* god names (from pray.c) */
110 const char *filecode; /* abbreviation for use in file names */
111 const char *homebase; /* quest leader's location (from questpgr.c) */
112 const char *intermed; /* quest intermediate goal (from questpgr.c) */
114 /*** Indices of important monsters and objects ***/
115 short malenum, /* index (PM_) as a male (botl.c) */
116 femalenum, /* ...or as a female (NON_PM == same) */
117 petnum, /* PM_ of preferred pet (NON_PM == random) */
118 ldrnum, /* PM_ of quest leader (questpgr.c) */
119 guardnum, /* PM_ of quest guardians (questpgr.c) */
120 neminum, /* PM_ of quest nemesis (questpgr.c) */
121 enemy1num, /* specific quest enemies (NON_PM == random) */
123 char enemy1sym, /* quest enemies by class (S_) */
125 short questarti; /* index (ART_) of quest artifact (questpgr.c) */
128 short allow; /* bit mask of allowed variations */
129 #define ROLE_RACEMASK 0x0ff8 /* allowable races */
130 #define ROLE_GENDMASK 0xf000 /* allowable genders */
131 #define ROLE_MALE 0x1000
132 #define ROLE_FEMALE 0x2000
133 #define ROLE_NEUTER 0x4000
134 #define ROLE_ALIGNMASK AM_MASK /* allowable alignments */
135 #define ROLE_LAWFUL AM_LAWFUL
136 #define ROLE_NEUTRAL AM_NEUTRAL
137 #define ROLE_CHAOTIC AM_CHAOTIC
139 /*** Attributes (from attrib.c and exper.c) ***/
140 xchar attrbase[A_MAX]; /* lowest initial attributes */
141 xchar attrdist[A_MAX]; /* distribution of initial attributes */
142 struct RoleAdvance hpadv; /* hit point advancement */
143 struct RoleAdvance enadv; /* energy advancement */
144 xchar xlev; /* cutoff experience level */
145 xchar initrecord; /* initial alignment record */
147 /*** Spell statistics (from spell.c) ***/
148 int spelbase; /* base spellcasting penalty */
149 int spelheal; /* penalty (-bonus) for healing spells */
150 int spelshld; /* penalty for wearing any shield */
151 int spelarmr; /* penalty for wearing metal armour */
152 int spelstat; /* which stat (A_) is used */
153 int spelspec; /* spell (SPE_) the class excels at */
154 int spelsbon; /* penalty (-bonus) for that spell */
156 /*** Properties in variable-length arrays ***/
157 /* intrinsics (see attrib.c) */
158 /* initial inventory (see u_init.c) */
159 /* skills (see u_init.c) */
161 /*** Don't forget to add... ***/
162 /* quest leader, guardians, nemesis (monst.c) */
163 /* quest artifact (artilist.h) */
164 /* quest dungeon definition (dat/Xyz.dat) */
165 /* quest text (dat/quest.txt) */
166 /* dictionary entries (dat/data.bas) */
169 extern const struct Role roles[]; /* table of available roles */
170 extern struct Role urole;
171 #define Role_if(X) (urole.malenum == (X))
172 #define Role_switch (urole.malenum)
174 /* used during initialization for race, gender, and alignment
175 as well as for character class */
176 #define ROLE_NONE (-1)
177 #define ROLE_RANDOM (-2)
179 /*** Unified structure specifying race information ***/
182 /*** Strings that name various things ***/
183 const char *noun; /* noun ("human", "elf") */
184 const char *adj; /* adjective ("human", "elven") */
185 const char *coll; /* collective ("humanity", "elvenkind") */
186 const char *filecode; /* code for filenames */
187 struct RoleName individual; /* individual as a noun ("man", "elf") */
189 /*** Indices of important monsters and objects ***/
190 short malenum, /* PM_ as a male monster */
191 femalenum, /* ...or as a female (NON_PM == same) */
192 mummynum, /* PM_ as a mummy */
193 zombienum; /* PM_ as a zombie */
196 short allow; /* bit mask of allowed variations */
197 short selfmask, /* your own race's bit mask */
198 lovemask, /* bit mask of always peaceful */
199 hatemask; /* bit mask of always hostile */
202 xchar attrmin[A_MAX]; /* minimum allowable attribute */
203 xchar attrmax[A_MAX]; /* maximum allowable attribute */
204 struct RoleAdvance hpadv; /* hit point advancement */
205 struct RoleAdvance enadv; /* energy advancement */
207 int nv_range; /* night vision range */
208 int xray_range; /* X-ray vision range */
211 /*** Properties in variable-length arrays ***/
212 /* intrinsics (see attrib.c) */
214 /*** Don't forget to add... ***/
215 /* quest leader, guardians, nemesis (monst.c) */
216 /* quest dungeon definition (dat/Xyz.dat) */
217 /* quest text (dat/quest.txt) */
218 /* dictionary entries (dat/data.bas) */
221 extern const struct Race races[]; /* Table of available races */
222 extern struct Race urace;
223 #define Race_if(X) (urace.malenum == (X))
224 #define Race_switch (urace.malenum)
226 /*** Unified structure specifying gender information ***/
228 const char *adj; /* male/female/neuter */
229 const char *he; /* he/she/it */
230 const char *him; /* him/her/it */
231 const char *his; /* his/her/its */
232 const char *filecode; /* file code */
233 short allow; /* equivalent ROLE_ mask */
235 #define ROLE_GENDERS 2 /* number of permitted player genders
236 increment to 3 if you allow neuter roles */
238 extern const struct Gender genders[]; /* table of available genders */
239 /* pronouns for the hero */
240 #define uhe() (genders[flags.female ? 1 : 0].he)
241 #define uhim() (genders[flags.female ? 1 : 0].him)
242 #define uhis() (genders[flags.female ? 1 : 0].his)
243 /* corresponding pronouns for monsters; yields "it" when mtmp can't be seen */
244 #define mhe(mtmp) (genders[pronoun_gender(mtmp, FALSE)].he)
245 #define mhim(mtmp) (genders[pronoun_gender(mtmp, FALSE)].him)
246 #define mhis(mtmp) (genders[pronoun_gender(mtmp, FALSE)].his)
247 /* override "it" if reason is lack of visibility rather than neuter species */
248 #define noit_mhe(mtmp) (genders[pronoun_gender(mtmp, TRUE)].he)
249 #define noit_mhim(mtmp) (genders[pronoun_gender(mtmp, TRUE)].him)
250 #define noit_mhis(mtmp) (genders[pronoun_gender(mtmp, TRUE)].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 */
273 /*** Information about the player ***/
275 xchar ux, uy; /* current map coordinates */
276 schar dx, dy, dz; /* direction of move (or zap or ... ) */
277 schar di; /* direction of FF */
278 xchar tx, ty; /* destination of travel */
279 xchar ux0, uy0; /* initial position FF */
280 d_level uz, uz0; /* your level on this and the previous turn */
281 d_level utolev; /* level monster teleported you to, or uz */
282 uchar utotype; /* bitmask of goto_level() flags for utolev */
283 boolean umoved; /* changed map location (post-move) */
284 int last_str_turn; /* 0: none, 1: half turn, 2: full turn
285 +: turn right, -: turn left */
286 int ulevel; /* 1 to MAXULEV */
288 unsigned utrap; /* trap timeout */
289 unsigned utraptype; /* defined if utrap nonzero. one of utraptypes */
290 char urooms[5]; /* rooms (roomno + 3) occupied now */
291 char urooms0[5]; /* ditto, for previous position */
292 char uentered[5]; /* rooms (roomno + 3) entered this turn */
293 char ushops[5]; /* shop rooms (roomno + 3) occupied now */
294 char ushops0[5]; /* ditto, for previous position */
295 char ushops_entered[5]; /* ditto, shops entered this turn */
296 char ushops_left[5]; /* ditto, shops exited this turn */
298 int uhunger; /* refd only in eat.c and shk.c */
299 unsigned uhs; /* hunger state - see eat.c */
301 struct prop uprops[LAST_PROP + 1];
304 Bitfield(usick_type, 2);
305 #define SICK_VOMITABLE 0x01
306 #define SICK_NONVOMITABLE 0x02
307 #define SICK_ALL 0x03
309 /* These ranges can never be more than MAX_RANGE (vision.h). */
310 int nv_range; /* current night vision range */
311 int xray_range; /* current xray vision range */
314 * These variables are valid globally only when punished and blind.
316 #define BC_BALL 0x01 /* bit mask for ball in 'bc_felt' below */
317 #define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */
318 int bglyph; /* glyph under the ball */
319 int cglyph; /* glyph under the chain */
320 int bc_order; /* ball & chain order [see bc_order() in ball.c] */
321 int bc_felt; /* mask for ball/chain being felt */
323 int umonster; /* hero's "real" monster num */
324 int umonnum; /* current monster number */
326 int mh, mhmax, mtimedone; /* for polymorph-self */
327 struct attribs macurr, /* for monster attribs */
328 mamax; /* for monster attribs */
329 int ulycn; /* lycanthrope type */
332 unsigned uswldtim; /* time you have been swallowed */
334 Bitfield(uswallow, 1); /* true if swallowed */
335 Bitfield(uinwater, 1); /* if you're currently in water (only
336 underwater possible currently) */
337 Bitfield(uundetected, 1); /* if you're a hiding monster/piercer */
338 Bitfield(mfemale, 1); /* saved human value of flags.female */
339 Bitfield(uinvulnerable, 1); /* you're invulnerable (praying) */
340 Bitfield(uburied, 1); /* you're buried */
341 Bitfield(uedibility, 1); /* blessed food detect; sense unsafe food */
344 unsigned udg_cnt; /* how long you have been demigod */
345 struct u_achieve uachieve; /* achievements */
346 struct u_event uevent; /* certain events have happened */
347 struct u_have uhave; /* you're carrying special objects */
348 struct u_conduct uconduct; /* KMH, conduct */
349 struct u_roleplay uroleplay;
350 struct attribs acurr, /* your current attributes (eg. str)*/
351 aexe, /* for gain/loss via "exercise" */
352 abon, /* your bonus attributes (eg. str) */
353 amax, /* your max attributes (eg. str) */
354 atemp, /* used for temporary loss/gain */
355 atime; /* used for loss/gain countdown */
356 align ualign; /* character alignment */
360 aligntyp ualignbase[CONVERT]; /* for ualign conversion record */
361 schar uluck, moreluck; /* luck and luck bonus */
362 #define Luck (u.uluck + u.moreluck)
363 #define LUCKADD 3 /* value of u.moreluck when carrying luck stone;
364 + when blessed or uncursed, - when cursed */
365 #define LUCKMAX 10 /* maximum value of u.ulUck */
366 #define LUCKMIN (-10) /* minimum value of u.uluck */
370 uchar uspellprot; /* protection by SPE_PROTECTION */
371 uchar usptime; /* #moves until uspellprot-- */
372 uchar uspmtime; /* #moves between uspellprot-- */
373 int uhp, uhpmax; /* hit points, aka health */
374 int uen, uenmax; /* magical energy - M. Stephenson */
375 xchar uhpinc[MAXULEV], /* increases to uhpmax for each level gain */
376 ueninc[MAXULEV]; /* increases to uenmax for each level gain */
377 int ugangr; /* if the gods are angry at you */
378 int ugifts; /* number of artifacts bestowed */
379 int ublessed, ublesscnt; /* blessing/duration from #pray */
383 long ucleansed; /* to record moves when player was cleansed */
384 long usleep; /* sleeping; monstermove you last started */
386 struct monst *ustuck; /* engulfer or grabber, maybe grabbee if Upolyd */
387 struct monst *usteed; /* mount when riding */
388 long ugallop; /* turns steed will run after being kicked */
389 int urideturns; /* time spent riding, for skill advancement */
390 int umortality; /* how many times you died */
391 int ugrave_arise; /* you die and become something aside from a ghost */
392 int weapon_slots; /* unused skill slots */
393 int skills_advanced; /* # of advances made so far */
394 xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */
395 struct skills weapon_skills[P_NUM_SKILLS];
396 boolean twoweap; /* KMH -- Using two-weapon combat */
398 }; /* end of `struct you' */
400 #define Upolyd (u.umonnum != u.umonster)