00001 /* SCCS Id: @(#)you.h 3.4 2000/05/21 */ 00002 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 00003 /* NetHack may be freely redistributed. See license for details. */ 00004 00005 #ifndef YOU_H 00006 #define YOU_H 00007 00008 #include "attrib.h" 00009 #include "monst.h" 00010 #ifndef PROP_H 00011 #include "prop.h" /* (needed here for util/makedefs.c) */ 00012 #endif 00013 #include "skills.h" 00014 00015 /*** Substructures ***/ 00016 00017 struct RoleName { 00018 const char *m; /* name when character is male */ 00019 const char *f; /* when female; null if same as male */ 00020 }; 00021 00022 struct RoleAdvance { 00023 /* "fix" is the fixed amount, "rnd" is the random amount */ 00024 xchar infix, inrnd; /* at character initialization */ 00025 xchar lofix, lornd; /* gained per level < urole.xlev */ 00026 xchar hifix, hirnd; /* gained per level >= urole.xlev */ 00027 }; 00028 00029 struct u_have { 00030 Bitfield(amulet,1); /* carrying Amulet */ 00031 Bitfield(bell,1); /* carrying Bell */ 00032 Bitfield(book,1); /* carrying Book */ 00033 Bitfield(menorah,1); /* carrying Candelabrum */ 00034 Bitfield(questart,1); /* carrying the Quest Artifact */ 00035 Bitfield(unused,3); 00036 }; 00037 00038 struct u_event { 00039 Bitfield(minor_oracle,1); /* received at least 1 cheap oracle */ 00040 Bitfield(major_oracle,1); /* " expensive oracle */ 00041 Bitfield(qcalled,1); /* called by Quest leader to do task */ 00042 Bitfield(qexpelled,1); /* expelled from the Quest dungeon */ 00043 Bitfield(qcompleted,1); /* successfully completed Quest task */ 00044 Bitfield(uheard_tune,2); /* 1=know about, 2=heard passtune */ 00045 Bitfield(uopened_dbridge,1); /* opened the drawbridge */ 00046 00047 Bitfield(invoked,1); /* invoked Gate to the Sanctum level */ 00048 Bitfield(gehennom_entered,1); /* entered Gehennom via Valley */ 00049 #ifdef ELBERETH 00050 Bitfield(uhand_of_elbereth,2); /* became Hand of Elbereth */ 00051 #endif 00052 Bitfield(udemigod,1); /* killed the wiz */ 00053 Bitfield(ascended,1); /* has offered the Amulet */ 00054 }; 00055 00056 /* KMH, conduct -- 00057 * These are voluntary challenges. Each field denotes the number of 00058 * times a challenge has been violated. 00059 */ 00060 struct u_conduct { /* number of times... */ 00061 long unvegetarian; /* eaten any animal */ 00062 long unvegan; /* ... or any animal byproduct */ 00063 long food; /* ... or any comestible */ 00064 long gnostic; /* used prayer, priest, or altar */ 00065 long weaphit; /* hit a monster with a weapon */ 00066 long killer; /* killed a monster yourself */ 00067 long literate; /* read something (other than BotD) */ 00068 long polypiles; /* polymorphed an object */ 00069 long polyselfs; /* transformed yourself */ 00070 long wishes; /* used a wish */ 00071 long wisharti; /* wished for an artifact */ 00072 long wishmagic; /* wished for a magic object */ 00073 long armoruses; /* put on a piece of armor */ 00074 long unblinded; /* starting non-blindfolded and removing a blindfold */ 00075 long robbed; /* killed an artifact-guardian (like an ordinary robber) */ 00076 long elbereths; /* engraved Elbereth */ 00077 /* genocides already listed at end of game */ 00078 }; 00079 00080 /* --- roleplay intrinsics --- 00081 * 00082 * In a lot of situations it makes sense to make special cases for 00083 * conduct-characters. Here's the structure to store a character's 00084 * abilities/intentions. 00085 * 00086 * These are allowed to change during gameplay. So e.g. it's possible 00087 * to gain/lose the ability to read. 00088 * 00089 * It also allows to stop giving special treatment to characters which 00090 * obviously abandoned a selected conduct. E.g vegetarians stop feeling 00091 * guilty after eating a lot of corpses. 00092 */ 00093 struct u_roleplay { /* Your character is a/an ... */ 00094 boolean ascet; /* foodless character */ 00095 boolean atheist; /* atheist */ 00096 boolean blindfolded; /* blindfolded character */ 00097 boolean illiterate; /* illiterate character */ 00098 boolean pacifist; /* pacifist */ 00099 boolean sadist; /* sadist */ 00100 boolean nudist; /* nudist */ 00101 boolean vegan; /* vegan */ 00102 boolean vegetarian; /* vegetarian */ 00103 }; 00104 00105 /*** Unified structure containing role information ***/ 00106 struct Role { 00107 /*** Strings that name various things ***/ 00108 struct RoleName name; /* the role's name (from u_init.c) */ 00109 struct RoleName rank[9]; /* names for experience levels (from botl.c) */ 00110 const char *lgod, *ngod, *cgod; /* god names (from pray.c) */ 00111 const char *filecode; /* abbreviation for use in file names */ 00112 const char *homebase; /* quest leader's location (from questpgr.c) */ 00113 const char *intermed; /* quest intermediate goal (from questpgr.c) */ 00114 00115 /*** Indices of important monsters and objects ***/ 00116 short malenum, /* index (PM_) as a male (botl.c) */ 00117 femalenum, /* ...or as a female (NON_PM == same) */ 00118 petnum, /* PM_ of preferred pet (NON_PM == random) */ 00119 ldrnum, /* PM_ of quest leader (questpgr.c) */ 00120 guardnum, /* PM_ of quest guardians (questpgr.c) */ 00121 neminum; /* PM_ of quest nemesis (questpgr.c) */ 00122 short questarti; /* index (ART_) of quest artifact (questpgr.c) */ 00123 00124 /*** Bitmasks ***/ 00125 short allow; /* bit mask of allowed variations */ 00126 #define ROLE_RACEMASK 0x0ff8 /* allowable races */ 00127 #define ROLE_GENDMASK 0xf000 /* allowable genders */ 00128 #define ROLE_MALE 0x1000 00129 #define ROLE_FEMALE 0x2000 00130 #define ROLE_NEUTER 0x4000 00131 #define ROLE_ALIGNMASK AM_MASK /* allowable alignments */ 00132 #define ROLE_LAWFUL AM_LAWFUL 00133 #define ROLE_NEUTRAL AM_NEUTRAL 00134 #define ROLE_CHAOTIC AM_CHAOTIC 00135 00136 /*** Attributes (from attrib.c and exper.c) ***/ 00137 xchar attrbase[A_MAX]; /* lowest initial attributes */ 00138 xchar attrdist[A_MAX]; /* distribution of initial attributes */ 00139 struct RoleAdvance hpadv; /* hit point advancement */ 00140 struct RoleAdvance enadv; /* energy advancement */ 00141 xchar xlev; /* cutoff experience level */ 00142 xchar initrecord; /* initial alignment record */ 00143 00144 /*** Spell statistics (from spell.c) ***/ 00145 int spelbase; /* base spellcasting penalty */ 00146 int spelheal; /* penalty (-bonus) for healing spells */ 00147 int spelshld; /* penalty for wearing any shield */ 00148 int spelarmr; /* penalty for wearing metal armour */ 00149 int spelstat; /* which stat (A_) is used */ 00150 int spelspec; /* spell (SPE_) the class excels at */ 00151 int spelsbon; /* penalty (-bonus) for that spell */ 00152 00153 /*** Properties in variable-length arrays ***/ 00154 /* intrinsics (see attrib.c) */ 00155 /* initial inventory (see u_init.c) */ 00156 /* skills (see u_init.c) */ 00157 00158 /*** Don't forget to add... ***/ 00159 /* quest leader, guardians, nemesis (monst.c) */ 00160 /* quest artifact (artilist.h) */ 00161 /* quest dungeon definition (dat/Xyz.dat) */ 00162 /* quest text (dat/quest.txt) */ 00163 /* dictionary entries (dat/data.bas) */ 00164 }; 00165 00166 extern const struct Role roles[]; /* table of available roles */ 00167 extern struct Role urole; 00168 #define Role_if(X) (urole.malenum == (X)) 00169 #define Role_switch (urole.malenum) 00170 00171 /* used during initialization for race, gender, and alignment 00172 as well as for character class */ 00173 #define ROLE_NONE (-1) 00174 #define ROLE_RANDOM (-2) 00175 00176 /*** Unified structure specifying race information ***/ 00177 00178 struct Race { 00179 /*** Strings that name various things ***/ 00180 const char *noun; /* noun ("human", "elf") */ 00181 const char *adj; /* adjective ("human", "elven") */ 00182 const char *coll; /* collective ("humanity", "elvenkind") */ 00183 const char *filecode; /* code for filenames */ 00184 struct RoleName individual; /* individual as a noun ("man", "elf") */ 00185 00186 /*** Indices of important monsters and objects ***/ 00187 short malenum, /* PM_ as a male monster */ 00188 femalenum, /* ...or as a female (NON_PM == same) */ 00189 mummynum, /* PM_ as a mummy */ 00190 zombienum; /* PM_ as a zombie */ 00191 00192 /*** Bitmasks ***/ 00193 short allow; /* bit mask of allowed variations */ 00194 short selfmask, /* your own race's bit mask */ 00195 lovemask, /* bit mask of always peaceful */ 00196 hatemask; /* bit mask of always hostile */ 00197 00198 /*** Attributes ***/ 00199 xchar attrmin[A_MAX]; /* minimum allowable attribute */ 00200 xchar attrmax[A_MAX]; /* maximum allowable attribute */ 00201 struct RoleAdvance hpadv; /* hit point advancement */ 00202 struct RoleAdvance enadv; /* energy advancement */ 00203 #if 0 /* DEFERRED */ 00204 int nv_range; /* night vision range */ 00205 int xray_range; /* X-ray vision range */ 00206 #endif 00207 00208 /*** Properties in variable-length arrays ***/ 00209 /* intrinsics (see attrib.c) */ 00210 00211 /*** Don't forget to add... ***/ 00212 /* quest leader, guardians, nemesis (monst.c) */ 00213 /* quest dungeon definition (dat/Xyz.dat) */ 00214 /* quest text (dat/quest.txt) */ 00215 /* dictionary entries (dat/data.bas) */ 00216 }; 00217 00218 extern const struct Race races[]; /* Table of available races */ 00219 extern struct Race urace; 00220 #define Race_if(X) (urace.malenum == (X)) 00221 #define Race_switch (urace.malenum) 00222 00223 /*** Unified structure specifying gender information ***/ 00224 struct Gender { 00225 const char *adj; /* male/female/neuter */ 00226 const char *he; /* he/she/it */ 00227 const char *him; /* him/her/it */ 00228 const char *his; /* his/her/its */ 00229 const char *filecode; /* file code */ 00230 short allow; /* equivalent ROLE_ mask */ 00231 }; 00232 #define ROLE_GENDERS 2 /* number of permitted player genders */ 00233 /* increment to 3 if you allow neuter roles */ 00234 00235 extern const struct Gender genders[]; /* table of available genders */ 00236 #define uhe() (genders[flags.female ? 1 : 0].he) 00237 #define uhim() (genders[flags.female ? 1 : 0].him) 00238 #define uhis() (genders[flags.female ? 1 : 0].his) 00239 #define mhe(mtmp) (genders[pronoun_gender(mtmp)].he) 00240 #define mhim(mtmp) (genders[pronoun_gender(mtmp)].him) 00241 #define mhis(mtmp) (genders[pronoun_gender(mtmp)].his) 00242 00243 00244 /*** Unified structure specifying alignment information ***/ 00245 struct Align { 00246 const char *noun; /* law/balance/chaos */ 00247 const char *adj; /* lawful/neutral/chaotic */ 00248 const char *filecode; /* file code */ 00249 short allow; /* equivalent ROLE_ mask */ 00250 aligntyp value; /* equivalent A_ value */ 00251 }; 00252 #define ROLE_ALIGNS 3 /* number of permitted player alignments */ 00253 00254 extern const struct Align aligns[]; /* table of available alignments */ 00255 00256 /* 00257 * The following structure contains information about a conduct 00258 * - a name (e.g. for a conduct-menu at character creation) 00259 * - nouns and adjectives for the highscore 00260 * - a flag for 'worth mentioning in the highscore' 00261 * - all strings necessary for show_conduct() 00262 */ 00263 /*** Unified structure specifying conduct information ***/ 00264 struct Conduct { 00265 const char *name; /* pacifism/nudism/... */ 00266 const char *noun; /* pacifist/nudist/... */ 00267 const char *adj; /* peaceful/nude/... */ 00268 00269 boolean highscore; /* conduct appears in the highscore */ 00270 00271 const char *prefix; /* "You " */ 00272 const char *presenttxt; /* "have been " */ 00273 const char *pasttxt; /* "were " */ 00274 const char *suffix; /* "a pacifist" */ 00275 const char *failtxt; /* "pretended to be a pacifist" */ 00276 00277 }; 00278 00279 extern const struct Conduct conducts[];/* table of available roleplay conducts*/ 00280 00281 /* 00282 * The following definitions get used to call violated(CONDUCT_XYZ), 00283 * and to access the information contained in the conducts[] array. 00284 */ 00285 00286 #define ROLE_CONDUCTS 10 /* number of roleplay conducts */ 00287 00288 #define FIRST_CONDUCT 0 00289 #define CONDUCT_PACIFISM 0 00290 #define CONDUCT_SADISM 1 00291 #define CONDUCT_ATHEISM 2 00292 #define CONDUCT_NUDISM 3 00293 #define CONDUCT_BLINDFOLDED 4 00294 #define CONDUCT_FOODLESS 5 00295 #define CONDUCT_VEGAN 6 00296 #define CONDUCT_VEGETARIAN 7 00297 #define CONDUCT_ILLITERACY 8 00298 #define CONDUCT_THIEVERY 9 00299 #define LAST_CONDUCT ROLE_CONDUCTS - 1 00300 00301 /*** Information about the player ***/ 00302 struct you { 00303 xchar ux, uy; 00304 schar dx, dy, dz; /* direction of move (or zap or ... ) */ 00305 schar di; /* direction of FF */ 00306 xchar tx, ty; /* destination of travel */ 00307 xchar ux0, uy0; /* initial position FF */ 00308 d_level uz, uz0; /* your level on this and the previous turn */ 00309 d_level utolev; /* level monster teleported you to, or uz */ 00310 uchar utotype; /* bitmask of goto_level() flags for utolev */ 00311 boolean umoved; /* changed map location (post-move) */ 00312 int last_str_turn; /* 0: none, 1: half turn, 2: full turn */ 00313 /* +: turn right, -: turn left */ 00314 int ulevel; /* 1 to MAXULEV */ 00315 int ulevelmax; 00316 unsigned utrap; /* trap timeout */ 00317 unsigned utraptype; /* defined if utrap nonzero */ 00318 #define TT_BEARTRAP 0 00319 #define TT_PIT 1 00320 #define TT_WEB 2 00321 #define TT_LAVA 3 00322 #define TT_INFLOOR 4 00323 char urooms[5]; /* rooms (roomno + 3) occupied now */ 00324 char urooms0[5]; /* ditto, for previous position */ 00325 char uentered[5]; /* rooms (roomno + 3) entered this turn */ 00326 char ushops[5]; /* shop rooms (roomno + 3) occupied now */ 00327 char ushops0[5]; /* ditto, for previous position */ 00328 char ushops_entered[5]; /* ditto, shops entered this turn */ 00329 char ushops_left[5]; /* ditto, shops exited this turn */ 00330 00331 int uhunger; /* refd only in eat.c and shk.c */ 00332 unsigned uhs; /* hunger state - see eat.c */ 00333 00334 struct prop uprops[LAST_PROP+1]; 00335 00336 unsigned umconf; 00337 char usick_cause[PL_PSIZ+20]; /* sizeof "unicorn horn named "+1 */ 00338 Bitfield(usick_type,2); 00339 #define SICK_VOMITABLE 0x01 00340 #define SICK_NONVOMITABLE 0x02 00341 #define SICK_ALL 0x03 00342 00343 /* These ranges can never be more than MAX_RANGE (vision.h). */ 00344 int nv_range; /* current night vision range */ 00345 int xray_range; /* current xray vision range */ 00346 00347 /* 00348 * These variables are valid globally only when punished and blind. 00349 */ 00350 #define BC_BALL 0x01 /* bit mask for ball in 'bc_felt' below */ 00351 #define BC_CHAIN 0x02 /* bit mask for chain in 'bc_felt' below */ 00352 int bglyph; /* glyph under the ball */ 00353 int cglyph; /* glyph under the chain */ 00354 int bc_order; /* ball & chain order [see bc_order() in ball.c] */ 00355 int bc_felt; /* mask for ball/chain being felt */ 00356 00357 int umonster; /* hero's "real" monster num */ 00358 int umonnum; /* current monster number */ 00359 00360 int mh, mhmax, mtimedone; /* for polymorph-self */ 00361 struct attribs macurr, /* for monster attribs */ 00362 mamax; /* for monster attribs */ 00363 int ulycn; /* lycanthrope type */ 00364 00365 unsigned ucreamed; 00366 unsigned uswldtim; /* time you have been swallowed */ 00367 00368 Bitfield(uswallow,1); /* true if swallowed */ 00369 Bitfield(uinwater,1); /* if you're currently in water (only 00370 underwater possible currently) */ 00371 Bitfield(uundetected,1); /* if you're a hiding monster/piercer */ 00372 Bitfield(mfemale,1); /* saved human value of flags.female */ 00373 Bitfield(uinvulnerable,1); /* you're invulnerable (praying) */ 00374 Bitfield(uburied,1); /* you're buried */ 00375 Bitfield(uedibility,1); /* blessed food detection; sense unsafe food */ 00376 /* 1 free bit! */ 00377 00378 unsigned udg_cnt; /* how long you have been demigod */ 00379 struct u_event uevent; /* certain events have happened */ 00380 struct u_have uhave; /* you're carrying special objects */ 00381 struct u_conduct uconduct; /* KMH, conduct */ 00382 struct u_roleplay roleplay; /* roleplay intrinsics */ 00383 struct attribs acurr, /* your current attributes (eg. str)*/ 00384 aexe, /* for gain/loss via "exercise" */ 00385 abon, /* your bonus attributes (eg. str) */ 00386 amax, /* your max attributes (eg. str) */ 00387 atemp, /* used for temporary loss/gain */ 00388 atime; /* used for loss/gain countdown */ 00389 align ualign; /* character alignment */ 00390 #define CONVERT 2 00391 #define A_ORIGINAL 1 00392 #define A_CURRENT 0 00393 aligntyp ualignbase[CONVERT]; /* for ualign conversion record */ 00394 schar uluck, moreluck; /* luck and luck bonus */ 00395 #define Luck (u.uluck + u.moreluck) 00396 #define LUCKADD 3 /* added value when carrying luck stone */ 00397 #define LUCKMAX 10 /* on moonlit nights 11 */ 00398 #define LUCKMIN (-10) 00399 schar uhitinc; 00400 schar udaminc; 00401 schar uac; 00402 uchar uspellprot; /* protection by SPE_PROTECTION */ 00403 uchar usptime; /* #moves until uspellprot-- */ 00404 uchar uspmtime; /* #moves between uspellprot-- */ 00405 int uhp,uhpmax; 00406 int uen, uenmax; /* magical energy - M. Stephenson */ 00407 int ugangr; /* if the gods are angry at you */ 00408 int ugifts; /* number of artifacts bestowed */ 00409 int ublessed, ublesscnt; /* blessing/duration from #pray */ 00410 #ifndef GOLDOBJ 00411 long ugold, ugold0; 00412 #else 00413 long umoney0; 00414 #endif 00415 long uexp, urexp; 00416 long urscore; 00417 long ucleansed; /* to record moves when player was cleansed */ 00418 long usleep; /* sleeping; monstermove you last started */ 00419 int uinvault; 00420 struct monst *ustuck; 00421 #ifdef STEED 00422 struct monst *usteed; 00423 long ugallop; 00424 int urideturns; 00425 #endif 00426 int umortality; /* how many times you died */ 00427 int ugrave_arise; /* you die and become something aside from a ghost */ 00428 time_t ubirthday; /* real world time when game began */ 00429 time_t udeathday; /* real world time when game ended */ 00430 00431 int weapon_slots; /* unused skill slots */ 00432 int skills_advanced; /* # of advances made so far */ 00433 xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */ 00434 struct skills weapon_skills[P_NUM_SKILLS]; 00435 boolean twoweap; /* KMH -- Using two-weapon combat */ 00436 00437 }; /* end of `struct you' */ 00438 00439 #define Upolyd (u.umonnum != u.umonster) 00440 00441 #endif /* YOU_H */