1 /* NetHack 3.6 you.h $NHDT-Date: 1450231172 2015/12/16 01:59:32 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */
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);
71 long realtime
; /* accumulated playing time in seconds */
72 time_t start_timing
; /* time game was started or restored or 'realtime'
73 was last updated (savegamestate for checkpoint) */
74 time_t finish_time
; /* end of 'realtime' interval: time of save or
75 end of game; used for topten/logfile/xlogfile */
79 * These are voluntary challenges. Each field denotes the number of
80 * times a challenge has been violated.
82 struct u_conduct
{ /* number of times... */
83 long unvegetarian
; /* eaten any animal */
84 long unvegan
; /* ... or any animal byproduct */
85 long food
; /* ... or any comestible */
86 long gnostic
; /* used prayer, priest, or altar */
87 long weaphit
; /* hit a monster with a weapon */
88 long killer
; /* killed a monster yourself */
89 long literate
; /* read something (other than BotD) */
90 long polypiles
; /* polymorphed an object */
91 long polyselfs
; /* transformed yourself */
92 long wishes
; /* used a wish */
93 long wisharti
; /* wished for an artifact */
94 /* genocides already listed at end of game */
98 boolean blind
; /* permanently blind */
99 boolean nudist
; /* has not worn any armor, ever */
100 long numbones
; /* # of bones files loaded */
103 /*** Unified structure containing role information ***/
105 /*** Strings that name various things ***/
106 struct RoleName name
; /* the role's name (from u_init.c) */
107 struct RoleName rank
[9]; /* names for experience levels (from botl.c) */
108 const char *lgod
, *ngod
, *cgod
; /* god names (from pray.c) */
109 const char *filecode
; /* abbreviation for use in file names */
110 const char *homebase
; /* quest leader's location (from questpgr.c) */
111 const char *intermed
; /* quest intermediate goal (from questpgr.c) */
113 /*** Indices of important monsters and objects ***/
114 short malenum
, /* index (PM_) as a male (botl.c) */
115 femalenum
, /* ...or as a female (NON_PM == same) */
116 petnum
, /* PM_ of preferred pet (NON_PM == random) */
117 ldrnum
, /* PM_ of quest leader (questpgr.c) */
118 guardnum
, /* PM_ of quest guardians (questpgr.c) */
119 neminum
, /* PM_ of quest nemesis (questpgr.c) */
120 enemy1num
, /* specific quest enemies (NON_PM == random) */
122 char enemy1sym
, /* quest enemies by class (S_) */
124 short questarti
; /* index (ART_) of quest artifact (questpgr.c) */
127 short allow
; /* bit mask of allowed variations */
128 #define ROLE_RACEMASK 0x0ff8 /* allowable races */
129 #define ROLE_GENDMASK 0xf000 /* allowable genders */
130 #define ROLE_MALE 0x1000
131 #define ROLE_FEMALE 0x2000
132 #define ROLE_NEUTER 0x4000
133 #define ROLE_ALIGNMASK AM_MASK /* allowable alignments */
134 #define ROLE_LAWFUL AM_LAWFUL
135 #define ROLE_NEUTRAL AM_NEUTRAL
136 #define ROLE_CHAOTIC AM_CHAOTIC
138 /*** Attributes (from attrib.c and exper.c) ***/
139 xchar attrbase
[A_MAX
]; /* lowest initial attributes */
140 xchar attrdist
[A_MAX
]; /* distribution of initial attributes */
141 struct RoleAdvance hpadv
; /* hit point advancement */
142 struct RoleAdvance enadv
; /* energy advancement */
143 xchar xlev
; /* cutoff experience level */
144 xchar initrecord
; /* initial alignment record */
146 /*** Spell statistics (from spell.c) ***/
147 int spelbase
; /* base spellcasting penalty */
148 int spelheal
; /* penalty (-bonus) for healing spells */
149 int spelshld
; /* penalty for wearing any shield */
150 int spelarmr
; /* penalty for wearing metal armour */
151 int spelstat
; /* which stat (A_) is used */
152 int spelspec
; /* spell (SPE_) the class excels at */
153 int spelsbon
; /* penalty (-bonus) for that spell */
155 /*** Properties in variable-length arrays ***/
156 /* intrinsics (see attrib.c) */
157 /* initial inventory (see u_init.c) */
158 /* skills (see u_init.c) */
160 /*** Don't forget to add... ***/
161 /* quest leader, guardians, nemesis (monst.c) */
162 /* quest artifact (artilist.h) */
163 /* quest dungeon definition (dat/Xyz.dat) */
164 /* quest text (dat/quest.txt) */
165 /* dictionary entries (dat/data.bas) */
168 extern const struct Role roles
[]; /* table of available roles */
169 extern struct Role urole
;
170 #define Role_if(X) (urole.malenum == (X))
171 #define Role_switch (urole.malenum)
173 /* used during initialization for race, gender, and alignment
174 as well as for character class */
175 #define ROLE_NONE (-1)
176 #define ROLE_RANDOM (-2)
178 /*** Unified structure specifying race information ***/
181 /*** Strings that name various things ***/
182 const char *noun
; /* noun ("human", "elf") */
183 const char *adj
; /* adjective ("human", "elven") */
184 const char *coll
; /* collective ("humanity", "elvenkind") */
185 const char *filecode
; /* code for filenames */
186 struct RoleName individual
; /* individual as a noun ("man", "elf") */
188 /*** Indices of important monsters and objects ***/
189 short malenum
, /* PM_ as a male monster */
190 femalenum
, /* ...or as a female (NON_PM == same) */
191 mummynum
, /* PM_ as a mummy */
192 zombienum
; /* PM_ as a zombie */
195 short allow
; /* bit mask of allowed variations */
196 short selfmask
, /* your own race's bit mask */
197 lovemask
, /* bit mask of always peaceful */
198 hatemask
; /* bit mask of always hostile */
201 xchar attrmin
[A_MAX
]; /* minimum allowable attribute */
202 xchar attrmax
[A_MAX
]; /* maximum allowable attribute */
203 struct RoleAdvance hpadv
; /* hit point advancement */
204 struct RoleAdvance enadv
; /* energy advancement */
206 int nv_range
; /* night vision range */
207 int xray_range
; /* X-ray vision range */
210 /*** Properties in variable-length arrays ***/
211 /* intrinsics (see attrib.c) */
213 /*** Don't forget to add... ***/
214 /* quest leader, guardians, nemesis (monst.c) */
215 /* quest dungeon definition (dat/Xyz.dat) */
216 /* quest text (dat/quest.txt) */
217 /* dictionary entries (dat/data.bas) */
220 extern const struct Race races
[]; /* Table of available races */
221 extern struct Race urace
;
222 #define Race_if(X) (urace.malenum == (X))
223 #define Race_switch (urace.malenum)
225 /*** Unified structure specifying gender information ***/
227 const char *adj
; /* male/female/neuter */
228 const char *he
; /* he/she/it */
229 const char *him
; /* him/her/it */
230 const char *his
; /* his/her/its */
231 const char *filecode
; /* file code */
232 short allow
; /* equivalent ROLE_ mask */
234 #define ROLE_GENDERS 2 /* number of permitted player genders
235 increment to 3 if you allow neuter roles */
237 extern const struct Gender genders
[]; /* table of available genders */
238 #define uhe() (genders[flags.female ? 1 : 0].he)
239 #define uhim() (genders[flags.female ? 1 : 0].him)
240 #define uhis() (genders[flags.female ? 1 : 0].his)
241 #define mhe(mtmp) (genders[pronoun_gender(mtmp)].he)
242 #define mhim(mtmp) (genders[pronoun_gender(mtmp)].him)
243 #define mhis(mtmp) (genders[pronoun_gender(mtmp)].his)
245 /*** Unified structure specifying alignment information ***/
247 const char *noun
; /* law/balance/chaos */
248 const char *adj
; /* lawful/neutral/chaotic */
249 const char *filecode
; /* file code */
250 short allow
; /* equivalent ROLE_ mask */
251 aligntyp value
; /* equivalent A_ value */
253 #define ROLE_ALIGNS 3 /* number of permitted player alignments */
255 extern const struct Align aligns
[]; /* table of available alignments */
257 /*** Information about the player ***/
259 xchar ux
, uy
; /* current map coordinates */
260 schar dx
, dy
, dz
; /* direction of move (or zap or ... ) */
261 schar di
; /* direction of FF */
262 xchar tx
, ty
; /* destination of travel */
263 xchar ux0
, uy0
; /* initial position FF */
264 d_level uz
, uz0
; /* your level on this and the previous turn */
265 d_level utolev
; /* level monster teleported you to, or uz */
266 uchar utotype
; /* bitmask of goto_level() flags for utolev */
267 boolean umoved
; /* changed map location (post-move) */
268 int last_str_turn
; /* 0: none, 1: half turn, 2: full turn
269 +: turn right, -: turn left */
270 int ulevel
; /* 1 to MAXULEV */
272 unsigned utrap
; /* trap timeout */
273 unsigned utraptype
; /* defined if utrap nonzero */
274 #define TT_BEARTRAP 0
279 #define TT_BURIEDBALL 5
280 char urooms
[5]; /* rooms (roomno + 3) occupied now */
281 char urooms0
[5]; /* ditto, for previous position */
282 char uentered
[5]; /* rooms (roomno + 3) entered this turn */
283 char ushops
[5]; /* shop rooms (roomno + 3) occupied now */
284 char ushops0
[5]; /* ditto, for previous position */
285 char ushops_entered
[5]; /* ditto, shops entered this turn */
286 char ushops_left
[5]; /* ditto, shops exited this turn */
288 int uhunger
; /* refd only in eat.c and shk.c */
289 unsigned uhs
; /* hunger state - see eat.c */
291 struct prop uprops
[LAST_PROP
+ 1];
294 Bitfield(usick_type
, 2);
295 #define SICK_VOMITABLE 0x01
296 #define SICK_NONVOMITABLE 0x02
297 #define SICK_ALL 0x03
299 /* These ranges can never be more than MAX_RANGE (vision.h). */
300 int nv_range
; /* current night vision range */
301 int xray_range
; /* current xray vision range */
304 * These variables are valid globally only when punished and blind.
306 #define BC_BALL 0x01 /* bit mask for ball in 'bc_felt' below */
307 #define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */
308 int bglyph
; /* glyph under the ball */
309 int cglyph
; /* glyph under the chain */
310 int bc_order
; /* ball & chain order [see bc_order() in ball.c] */
311 int bc_felt
; /* mask for ball/chain being felt */
313 int umonster
; /* hero's "real" monster num */
314 int umonnum
; /* current monster number */
316 int mh
, mhmax
, mtimedone
; /* for polymorph-self */
317 struct attribs macurr
, /* for monster attribs */
318 mamax
; /* for monster attribs */
319 int ulycn
; /* lycanthrope type */
322 unsigned uswldtim
; /* time you have been swallowed */
324 Bitfield(uswallow
, 1); /* true if swallowed */
325 Bitfield(uinwater
, 1); /* if you're currently in water (only
326 underwater possible currently) */
327 Bitfield(uundetected
, 1); /* if you're a hiding monster/piercer */
328 Bitfield(mfemale
, 1); /* saved human value of flags.female */
329 Bitfield(uinvulnerable
, 1); /* you're invulnerable (praying) */
330 Bitfield(uburied
, 1); /* you're buried */
331 Bitfield(uedibility
, 1); /* blessed food detect; sense unsafe food */
334 unsigned udg_cnt
; /* how long you have been demigod */
335 struct u_achieve uachieve
; /* achievements */
336 struct u_event uevent
; /* certain events have happened */
337 struct u_have uhave
; /* you're carrying special objects */
338 struct u_conduct uconduct
; /* KMH, conduct */
339 struct u_roleplay uroleplay
;
340 struct attribs acurr
, /* your current attributes (eg. str)*/
341 aexe
, /* for gain/loss via "exercise" */
342 abon
, /* your bonus attributes (eg. str) */
343 amax
, /* your max attributes (eg. str) */
344 atemp
, /* used for temporary loss/gain */
345 atime
; /* used for loss/gain countdown */
346 align ualign
; /* character alignment */
350 aligntyp ualignbase
[CONVERT
]; /* for ualign conversion record */
351 schar uluck
, moreluck
; /* luck and luck bonus */
352 #define Luck (u.uluck + u.moreluck)
353 #define LUCKADD 3 /* value of u.moreluck when carrying luck stone;
354 + when blessed or uncursed, - when cursed */
355 #define LUCKMAX 10 /* maximum value of u.ulUck */
356 #define LUCKMIN (-10) /* minimum value of u.uluck */
360 uchar uspellprot
; /* protection by SPE_PROTECTION */
361 uchar usptime
; /* #moves until uspellprot-- */
362 uchar uspmtime
; /* #moves between uspellprot-- */
363 int uhp
, uhpmax
; /* hit points, aka health */
364 int uen
, uenmax
; /* magical energy - M. Stephenson */
365 xchar uhpinc
[MAXULEV
], /* increases to uhpmax for each level gain */
366 ueninc
[MAXULEV
]; /* increases to uenmax for each level gain */
367 int ugangr
; /* if the gods are angry at you */
368 int ugifts
; /* number of artifacts bestowed */
369 int ublessed
, ublesscnt
; /* blessing/duration from #pray */
373 long ucleansed
; /* to record moves when player was cleansed */
374 long usleep
; /* sleeping; monstermove you last started */
376 struct monst
*ustuck
; /* engulfer or grabber, maybe grabbee if Upolyd */
377 struct monst
*usteed
; /* mount when riding */
378 long ugallop
; /* turns steed will run after being kicked */
379 int urideturns
; /* time spent riding, for skill advancement */
380 int umortality
; /* how many times you died */
381 int ugrave_arise
; /* you die and become something aside from a ghost */
382 int weapon_slots
; /* unused skill slots */
383 int skills_advanced
; /* # of advances made so far */
384 xchar skill_record
[P_SKILL_LIMIT
]; /* skill advancements */
385 struct skills weapon_skills
[P_NUM_SKILLS
];
386 boolean twoweap
; /* KMH -- Using two-weapon combat */
388 }; /* end of `struct you' */
390 #define Upolyd (u.umonnum != u.umonster)