OSDN Git Service

adjust for patch
[jnethack/source.git] / include / you.h
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. */
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(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 */
46
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 */
54 };
55
56 struct u_achieve {
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 */
66
67     Bitfield(killed_medusa, 1);
68 };
69
70 struct u_realtime {
71 #if 0 /*C360-19*/
72     long
73         realtime; /* actual playing time up until the last restore, seconds */
74     time_t restored; /* time the game was started or restored */
75     time_t endtime;
76 #else
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 */
82 #endif
83 };
84
85 /* KMH, conduct --
86  * These are voluntary challenges.  Each field denotes the number of
87  * times a challenge has been violated.
88  */
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 */
102 };
103
104 struct u_roleplay {
105     boolean blind;  /* permanently blind */
106     boolean nudist; /* has not worn any armor, ever */
107     long numbones;  /* # of bones files loaded  */
108 };
109
110 /*** Unified structure containing role information ***/
111 struct Role {
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) */
119
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) */
128         enemy2num;
129     char enemy1sym, /* quest enemies by class (S_) */
130         enemy2sym;
131     short questarti; /* index (ART_) of quest artifact (questpgr.c) */
132
133     /*** Bitmasks ***/
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
144
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 */
152
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 */
161
162     /*** Properties in variable-length arrays ***/
163     /* intrinsics (see attrib.c) */
164     /* initial inventory (see u_init.c) */
165     /* skills (see u_init.c) */
166
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) */
173 };
174
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)
179
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)
184
185 /*** Unified structure specifying race information ***/
186
187 struct Race {
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") */
194
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 */
200
201     /*** Bitmasks ***/
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 */
206
207     /*** Attributes ***/
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 */
212 #if 0                         /* DEFERRED */
213         int   nv_range;         /* night vision range */
214         int   xray_range;       /* X-ray vision range */
215 #endif
216
217     /*** Properties in variable-length arrays ***/
218     /* intrinsics (see attrib.c) */
219
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) */
225 };
226
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)
231
232 /*** Unified structure specifying gender information ***/
233 struct Gender {
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 */
240 };
241 #define ROLE_GENDERS 2 /* number of permitted player genders */
242 /* increment to 3 if you allow neuter roles */
243
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)
251
252 /*** Unified structure specifying alignment information ***/
253 struct Align {
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 */
259 };
260 #define ROLE_ALIGNS 3 /* number of permitted player alignments */
261
262 extern const struct Align aligns[]; /* table of available alignments */
263
264 /*** Information about the player ***/
265 struct you {
266     xchar ux, uy;
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 */
278     int ulevelmax;
279     unsigned utrap;     /* trap timeout */
280     unsigned utraptype; /* defined if utrap nonzero */
281 #define TT_BEARTRAP 0
282 #define TT_PIT 1
283 #define TT_WEB 2
284 #define TT_LAVA 3
285 #define TT_INFLOOR 4
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 */
294
295     int uhunger;  /* refd only in eat.c and shk.c */
296     unsigned uhs; /* hunger state - see eat.c */
297
298     struct prop uprops[LAST_PROP + 1];
299
300     unsigned umconf;
301     Bitfield(usick_type, 2);
302 #define SICK_VOMITABLE 0x01
303 #define SICK_NONVOMITABLE 0x02
304 #define SICK_ALL 0x03
305
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 */
309
310 /*
311  * These variables are valid globally only when punished and blind.
312  */
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 */
319
320     int umonster; /* hero's "real" monster num */
321     int umonnum;  /* current monster number */
322
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 */
327
328     unsigned ucreamed;
329     unsigned uswldtim; /* time you have been swallowed */
330
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 */
339     /* 1 free bit! */
340
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 */
354 #define CONVERT 2
355 #define A_ORIGINAL 1
356 #define A_CURRENT 0
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 */
361 #define LUCKMAX 10
362 #define LUCKMIN (-10)
363     schar uhitinc;
364     schar udaminc;
365     schar uac;
366     uchar uspellprot; /* protection by SPE_PROTECTION */
367     uchar usptime;    /* #moves until uspellprot-- */
368     uchar uspmtime;   /* #moves between uspellprot-- */
369     int uhp, uhpmax;
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 */
375     long umoney0;
376     long uspare1;
377     long uexp, urexp;
378     long ucleansed; /* to record moves when player was cleansed */
379     long usleep;    /* sleeping; monstermove you last started */
380     int uinvault;
381     struct monst *ustuck;
382     struct monst *usteed;
383     long ugallop;
384     int urideturns;
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 */
392
393 }; /* end of `struct you' */
394
395 #define Upolyd (u.umonnum != u.umonster)
396
397 #endif /* YOU_H */