OSDN Git Service

80949eff4d98299cd46db37ec8b59eb3f676179f
[hengband/hengband.git] / src / defines.h
1 /* File: defines.h */
2
3 /* Purpose: global constants and macro definitions */
4
5
6 /*
7  * Do not edit this file unless you know *exactly* what you are doing.
8  *
9  * Some of the values in this file were chosen to preserve game balance,
10  * while others are hard-coded based on the format of old save-files, the
11  * definition of arrays in various places, mathematical properties, fast
12  * computation, storage limits, or the format of external text files.
13  *
14  * Changing some of these values will induce crashes or memory errors or
15  * savefile mis-reads.  Most of the comments in this file are meant as
16  * reminders, not complete descriptions, and even a complete knowledge
17  * of the source may not be sufficient to fully understand the effects
18  * of changing certain definitions.
19  *
20  * Lastly, note that the code does not always use the symbolic constants
21  * below, and sometimes uses various hard-coded values that may not even
22  * be defined in this file, but which may be related to definitions here.
23  * This is of course bad programming practice, but nobody is perfect...
24  *
25  * For example, there are MANY things that depend on the screen being
26  * 80x24, with the top line used for messages, the bottom line being
27  * used for status, and exactly 22 lines used to show the dungeon.
28  * Just because your screen can hold 46 lines does not mean that the
29  * game will work if you try to use 44 lines to show the dungeon.
30  *
31  * You have been warned.
32  */
33
34
35 /*
36  * Name of the version/variant
37  */
38 #define VERSION_NAME "Hengband"
39
40
41 /*
42  * Current version number of Angband: 2.8.1
43  */
44 #define VERSION_MAJOR   2
45 #define VERSION_MINOR   8
46 #define VERSION_PATCH   1
47
48 #define SAVEFILE_VERSION 3
49
50 /* Added for ZAngband */
51 #define FAKE_VERSION   0
52 #define FAKE_VER_MAJOR 11
53 #define FAKE_VER_MINOR 1
54 #define FAKE_VER_PATCH 0
55
56 #define ANGBAND_2_8_1
57 #define ZANGBAND
58
59 /*
60  * This value is not currently used
61  */
62 #define VERSION_EXTRA   0
63
64
65 #ifdef JP
66  /*
67   * ÆüËܸìÈǤΥС¼¥¸¥ç¥ó
68   */
69 #define JVERSION_MAJOR 0
70 #define JVERSION_MINOR 9
71 #define JVERSION_PATCH 4
72 #define JVERSION_EXTRA 0
73
74 #endif
75 /*
76  * Number of grids in each block (vertically)
77  * Probably hard-coded to 11, see "generate.c"
78  */
79 #define BLOCK_HGT       11
80
81 /*
82  * Number of grids in each block (horizontally)
83  * Probably hard-coded to 11, see "generate.c"
84  */
85 #define BLOCK_WID       11
86
87
88 /*
89  * Number of grids in each panel (vertically)
90  * Must be a multiple of BLOCK_HGT
91  */
92 #define PANEL_HGT       11
93
94 /*
95  * Number of grids in each panel (horizontally)
96  * Must be a multiple of BLOCK_WID
97  */
98 #define PANEL_WID       33
99
100
101 /*
102  * Number of grids used to display the dungeon (vertically).
103  * Must be a multiple of 11, probably hard-coded to 22.
104  */
105 #define SCREEN_HGT      22
106
107 /*
108  * Number of grids used to display the dungeon (horizontally).
109  * Must be a multiple of 33, probably hard-coded to 66.
110  */
111 #define SCREEN_WID      66
112
113
114 /*
115  * Maximum dungeon height in grids, must be a multiple of SCREEN_HGT,
116  * probably hard-coded to SCREEN_HGT * 3.
117  */
118 #define MAX_HGT         66
119
120 /*
121  * Maximum dungeon width in grids, must be a multiple of SCREEN_WID,
122  * probably hard-coded to SCREEN_WID * 3.
123  */
124 #define MAX_WID         198
125
126
127 /*
128  * Quest constants
129  */
130 #define MAX_MON_QUEST       10
131 #define MAX_ITEM_QUEST       5
132
133 #define MIN_RANDOM_QUEST    40
134 #define MAX_RANDOM_QUEST    49
135
136 #define QUEST_OBERON         8
137 #define QUEST_SERPENT        9
138
139 /*
140  * Arena constants
141  */
142 #define MAX_ARENA_MONS          38      /* -KMW- */
143
144
145 /*
146  * Total number of stores (see "store.c", etc)
147  */
148 #define MAX_STORES      10
149
150 /*
151  * Number of buildings
152  */
153 #define MAX_BLDG                32
154
155 /*
156  * Total number of stores (see "store.c", etc)
157  */
158 #define MAX_STORES_PER_TOWN 12
159 #define MAX_STORE_TYPES     10
160
161 #define STORE_GENERAL   0
162 #define STORE_ARMOURY   1
163 #define STORE_WEAPON    2
164 #define STORE_TEMPLE    3
165 #define STORE_ALCHEMIST 4
166 #define STORE_MAGIC     5
167 #define STORE_BLACK     6
168 #define STORE_HOME      7
169 #define STORE_BOOK      8
170 #define STORE_MUSEUM    9
171
172
173 #define BUILDING_NON_MEMBER 0
174 #define BUILDING_MEMBER     1
175 #define BUILDING_OWNER      2
176
177 /*
178  * Total number of owners per store (see "store.c", etc)
179  */
180 #define MAX_OWNERS      32
181
182 /*
183  * Maximum number of player "sex" types (see "table.c", etc)
184  */
185 #define MAX_SEXES            2
186
187 /*
188  * Maximum number of player "class" types (see "table.c", etc)
189  */
190 #define MAX_CLASS            27
191
192 #define MAX_SEIKAKU          12
193
194 /* The number of "patrons" available (for Chaos Warriors) */
195 #define MAX_PATRON          16
196
197 /* Number of entries in the sanity-blast descriptions */
198 #define MAX_SAN_HORROR 20
199 #define MAX_SAN_FUNNY 22
200 #define MAX_SAN_COMMENT 5
201
202 /* Chaos Warrior: Reward types: */
203 #define REW_POLY_SLF    1
204 #define REW_GAIN_EXP    2
205 #define REW_LOSE_EXP    3
206 #define REW_GOOD_OBJ    4
207 #define REW_GREA_OBJ    5
208 #define REW_CHAOS_WP    6
209 #define REW_GOOD_OBS    7
210 #define REW_GREA_OBS    8
211 #define REW_TY_CURSE    9
212 #define REW_SUMMON_M    10
213 #define REW_H_SUMMON    11
214 #define REW_DO_HAVOC    12
215 #define REW_GAIN_ABL    13
216 #define REW_LOSE_ABL    14
217 #define REW_RUIN_ABL    15
218 #define REW_AUGM_ABL    16
219 #define REW_POLY_WND    17
220 #define REW_HEAL_FUL    18
221 #define REW_HURT_LOT    19
222 #define REW_CURSE_WP    20
223 #define REW_CURSE_AR    21
224 #define REW_PISS_OFF    22
225 #define REW_WRATH       23
226 #define REW_DESTRUCT    24
227 #define REW_GENOCIDE    25
228 #define REW_MASS_GEN    26
229 #define REW_DISPEL_C    27
230 #define REW_UNUSED_1    28
231 #define REW_UNUSED_2    29
232 #define REW_UNUSED_3    30
233 #define REW_UNUSED_4    31
234 #define REW_UNUSED_5    32
235 #define REW_IGNORE      33
236 #define REW_SER_UNDE    34
237 #define REW_SER_DEMO    35
238 #define REW_SER_MONS    36
239
240 /* Chaos mutations */
241
242 /* "Activatable" mutations must be in MUT1_* */
243 #define MUT1_SPIT_ACID                  0x00000001L
244 #define MUT1_BR_FIRE                    0x00000002L
245 #define MUT1_HYPN_GAZE                  0x00000004L
246 #define MUT1_TELEKINES                  0x00000008L
247 #define MUT1_VTELEPORT                  0x00000010L /* Voluntary teleport */
248 #define MUT1_MIND_BLST                  0x00000020L
249 #define MUT1_RADIATION                  0x00000040L
250 #define MUT1_VAMPIRISM                  0x00000080L
251 #define MUT1_SMELL_MET                  0x00000100L
252 #define MUT1_SMELL_MON                  0x00000200L
253 #define MUT1_BLINK                      0x00000400L
254 #define MUT1_EAT_ROCK                   0x00000800L
255 #define MUT1_SWAP_POS                   0x00001000L
256 #define MUT1_SHRIEK                     0x00002000L
257 #define MUT1_ILLUMINE                   0x00004000L
258 #define MUT1_DET_CURSE                  0x00008000L
259 #define MUT1_BERSERK                    0x00010000L
260 #define MUT1_POLYMORPH                  0x00020000L
261 #define MUT1_MIDAS_TCH                  0x00040000L
262 #define MUT1_GROW_MOLD                  0x00080000L
263 #define MUT1_RESIST                     0x00100000L
264 #define MUT1_EARTHQUAKE                 0x00200000L
265 #define MUT1_EAT_MAGIC                  0x00400000L
266 #define MUT1_WEIGH_MAG                  0x00800000L
267 #define MUT1_STERILITY                  0x01000000L
268 #define MUT1_PANIC_HIT                  0x02000000L
269 #define MUT1_DAZZLE                     0x04000000L
270 #define MUT1_LASER_EYE                  0x08000000L
271 #define MUT1_RECALL                     0x10000000L
272 #define MUT1_BANISH                     0x20000000L
273 #define MUT1_COLD_TOUCH                 0x40000000L
274 #define MUT1_LAUNCHER                   0x80000000L
275
276 /* Randomly activating mutations must be MUT2_* */
277 #define MUT2_BERS_RAGE                  0x00000001L
278 #define MUT2_COWARDICE                  0x00000002L
279 #define MUT2_RTELEPORT                  0x00000004L /* Random teleport, instability */
280 #define MUT2_ALCOHOL                    0x00000008L
281 #define MUT2_HALLU                      0x00000010L
282 #define MUT2_FLATULENT                  0x00000020L
283 #define MUT2_SCOR_TAIL                  0x00000040L
284 #define MUT2_HORNS                      0x00000080L
285 #define MUT2_BEAK                       0x00000100L
286 #define MUT2_ATT_DEMON                  0x00000200L
287 #define MUT2_PROD_MANA                  0x00000400L
288 #define MUT2_SPEED_FLUX                 0x00000800L
289 #define MUT2_BANISH_ALL                 0x00001000L
290 #define MUT2_EAT_LIGHT                  0x00002000L
291 #define MUT2_TRUNK                      0x00004000L
292 #define MUT2_ATT_ANIMAL                 0x00008000L
293 #define MUT2_TENTACLES                  0x00010000L
294 #define MUT2_RAW_CHAOS                  0x00020000L
295 #define MUT2_NORMALITY                  0x00040000L
296 #define MUT2_WRAITH                     0x00080000L
297 #define MUT2_POLY_WOUND                 0x00100000L
298 #define MUT2_WASTING                    0x00200000L
299 #define MUT2_ATT_DRAGON                 0x00400000L
300 #define MUT2_WEIRD_MIND                 0x00800000L
301 #define MUT2_NAUSEA                     0x01000000L
302 #define MUT2_CHAOS_GIFT                 0x02000000L
303 #define MUT2_WALK_SHAD                  0x04000000L
304 #define MUT2_WARNING                    0x08000000L
305 #define MUT2_INVULN                     0x10000000L
306 #define MUT2_SP_TO_HP                   0x20000000L
307 #define MUT2_HP_TO_SP                   0x40000000L
308 #define MUT2_DISARM                     0x80000000L
309
310
311
312 /* Other mutations will be mainly in MUT3_* */
313
314 #define MUT3_HYPER_STR                  0x00000001L
315 #define MUT3_PUNY                       0x00000002L
316 #define MUT3_HYPER_INT                  0x00000004L
317 #define MUT3_MORONIC                    0x00000008L
318 #define MUT3_RESILIENT                  0x00000010L
319 #define MUT3_XTRA_FAT                   0x00000020L
320 #define MUT3_ALBINO                     0x00000040L
321 #define MUT3_FLESH_ROT                  0x00000080L
322 #define MUT3_SILLY_VOI                  0x00000100L
323 #define MUT3_BLANK_FAC                  0x00000200L
324 #define MUT3_ILL_NORM                   0x00000400L
325 #define MUT3_XTRA_EYES                  0x00000800L
326 #define MUT3_MAGIC_RES                  0x00001000L
327 #define MUT3_XTRA_NOIS                  0x00002000L
328 #define MUT3_INFRAVIS                   0x00004000L
329 #define MUT3_XTRA_LEGS                  0x00008000L
330 #define MUT3_SHORT_LEG                  0x00010000L
331 #define MUT3_ELEC_TOUC                  0x00020000L
332 #define MUT3_FIRE_BODY                  0x00040000L
333 #define MUT3_WART_SKIN                  0x00080000L
334 #define MUT3_SCALES                     0x00100000L
335 #define MUT3_IRON_SKIN                  0x00200000L
336 #define MUT3_WINGS                      0x00400000L
337 #define MUT3_FEARLESS                   0x00800000L
338 #define MUT3_REGEN                      0x01000000L
339 #define MUT3_ESP                        0x02000000L
340 #define MUT3_LIMBER                     0x04000000L
341 #define MUT3_ARTHRITIS                  0x08000000L
342 #define MUT3_BAD_LUCK                   0x10000000L
343 #define MUT3_VULN_ELEM                  0x20000000L
344 #define MUT3_MOTION                     0x40000000L
345 #define MUT3_GOOD_LUCK                  0x80000000L
346
347
348 /* Monk martial arts... */
349 # define MAX_MA 17
350 # define MA_KNEE 1
351 # define MA_SLOW 2
352
353 /* Mindcraft */
354 #define MAX_MIND_POWERS  21
355
356 /* Hallucination stuff */
357 #ifdef JP
358 #define MAX_SILLY_ATTACK 41
359 #else
360 #define MAX_SILLY_ATTACK 29
361 #endif
362
363 #define MIND_MINDCRAFTER    0
364 #define MIND_KI             1
365 #define MIND_BERSERKER      2
366 #define MIND_MIRROR_MASTER  3
367 #define MIND_NINJUTSU       4
368
369
370 /*
371  * Size of memory reserved for initialization of some arrays
372  */
373 #define FAKE_NAME_SIZE  40 * 1024L
374 #define FAKE_TEXT_SIZE 150 * 1024L
375
376
377 /*
378  * Maximum number of high scores in the high score file
379  */
380 #define MAX_HISCORES    999
381
382
383 /*
384  * Maximum dungeon level.  The player can never reach this level
385  * in the dungeon, and this value is used for various calculations
386  * involving object and monster creation.  It must be at least 100.
387  * Setting it below 128 may prevent the creation of some objects.
388  */
389 #define MAX_DEPTH       128
390
391
392 /*
393  * Maximum size of the "lite" array (see "cave.c")
394  * Note that the "lite radius" will NEVER exceed 14, and we would
395  * never require more than 581 entries in the array for circular "lite".
396  */
397 #define LITE_MAX 600
398
399 /*
400  * Maximum size of the "view" array (see "cave.c")
401  * Note that the "view radius" will NEVER exceed 20, and even if the "view"
402  * was octagonal, we would never require more than 1520 entries in the array.
403  */
404 #define VIEW_MAX 1536
405
406 /*
407  * Maximum size of the "temp" array (see "cave.c")
408  * We must be as large as "VIEW_MAX" and "LITE_MAX" for proper functioning
409  * of "update_view()" and "update_lite()".  We must also be as large as the
410  * largest illuminatable room, but no room is larger than 800 grids.  We
411  * must also be large enough to allow "good enough" use as a circular queue,
412  * to calculate monster flow, but note that the flow code is "paranoid".
413  */
414 #define TEMP_MAX 1536
415
416
417 /*
418  * Number of keymap modes
419  */
420 #define KEYMAP_MODES    2
421
422 /*
423  * Mode for original keyset commands
424  */
425 #define KEYMAP_MODE_ORIG        0
426
427 /*
428  * Mode for roguelike keyset commands
429  */
430 #define KEYMAP_MODE_ROGUE       1
431
432
433 /*
434  * OPTION: Maximum number of macros (see "io.c")
435  * Default: assume at most 256 macros are used
436  */
437 #define MACRO_MAX       256
438
439 /*
440  * OPTION: Maximum number of "quarks" (see "io.c")
441  * Default: assume at most 512 different inscriptions are used
442  */
443 #define QUARK_MAX       2048
444 /* Was 512... 256 quarks added for random artifacts */
445 /* Was 768... increased greatly for auto inscription (by Mogami) */
446
447 /*
448  * OPTION: Maximum number of messages to remember (see "io.c")
449  * Default: assume maximal memorization of 2048 total messages
450  */
451 #define MESSAGE_MAX     2048
452
453 /*
454  * OPTION: Maximum space for the message text buffer (see "io.c")
455  * Default: assume that each of the 2048 messages is repeated an
456  * average of three times, and has an average length of 48
457  */
458 #define MESSAGE_BUF     32768
459
460
461 /*
462  * Maximum value storable in a "byte" (hard-coded)
463  */
464 #define MAX_UCHAR       255
465
466 /*
467  * Maximum value storable in a "s16b" (hard-coded)
468  */
469 #define MAX_SHORT       32767
470
471 /*
472  * Maximum length of object's name
473  */
474 #define MAX_NLEN        160
475
476 /*
477  * Special internal key
478  */
479 #define SPECIAL_KEY_QUEST    255
480 #define SPECIAL_KEY_BUILDING 254
481 #define SPECIAL_KEY_STORE    253
482 #define SPECIAL_KEY_QUIT     252
483
484 /*
485  * Store constants
486  */
487 #define STORE_INVEN_MAX 24              /* Max number of discrete objs in inven */
488 #define STORE_CHOICES   48              /* Number of items to choose stock from */
489 #define STORE_OBJ_LEVEL 5               /* Magic Level for normal stores */
490 #define STORE_TURNOVER  9               /* Normal shop turnover, per day */
491 #define STORE_MIN_KEEP  6               /* Min slots to "always" keep full */
492 #define STORE_MAX_KEEP  18              /* Max slots to "always" keep full */
493 #define STORE_SHUFFLE   21              /* 1/Chance (per day) of an owner changing */
494 #define STORE_TURNS     1000    /* Number of turns between turnovers */
495
496
497 /*
498  * Random energy
499  */
500 #define ENERGY_NEED() (randnor(100, 31))
501
502 /*
503  * Misc constants
504  */
505 #define TOWN_DAWN         10000    /* Number of ticks from dawn to dawn XXX */
506 #define TURNS_PER_TICK    10L      /* Number of energy-gain-turns per ticks */
507 #define BREAK_GLYPH       550      /* Rune of protection resistance */
508 #define BREAK_MINOR_GLYPH 299      /* For explosive runes */
509 #define BTH_PLUS_ADJ       3       /* Adjust BTH per plus-to-hit */
510 #define MON_MULT_ADJ       8       /* High value slows multiplication */
511 #define MON_SUMMON_ADJ     2       /* Adjust level of summoned creatures */
512 #define MON_DRAIN_LIFE     2       /* Percent of player exp drained per hit */
513 #define USE_DEVICE         3       /* x> Harder devices x< Easier devices     */
514
515
516 /* "Biases" for random artifact gen */
517
518 #define BIAS_ELEC            1
519 #define BIAS_POIS            2
520 #define BIAS_FIRE            3
521 #define BIAS_COLD            4
522 #define BIAS_ACID            5
523 #define BIAS_STR             6
524 #define BIAS_INT             7
525 #define BIAS_WIS             8
526 #define BIAS_DEX             9
527 #define BIAS_CON            10
528 #define BIAS_CHR            11
529 #define BIAS_CHAOS          12
530 #define BIAS_PRIESTLY       13
531 #define BIAS_NECROMANTIC    14
532 #define BIAS_LAW            15
533 #define BIAS_ROGUE          16
534 #define BIAS_MAGE           17
535 #define BIAS_WARRIOR        18
536 #define BIAS_RANGER         19
537
538
539 /*** Pet constants ***/
540
541
542 /*
543  * Commands
544  */
545 #define PET_DISMISS                                     1
546 #define PET_TARGET                                      2
547 #define PET_STAY_CLOSE                          3
548 #define PET_FOLLOW_ME                           4
549 #define PET_SEEK_AND_DESTROY            5
550 #define PET_ALLOW_SPACE                         6
551 #define PET_STAY_AWAY                           7
552 #define PET_OPEN_DOORS           8
553 #define PET_TAKE_ITEMS                          9
554 #define PET_TELEPORT                           10
555 #define PET_ATTACK_SPELL                       11
556 #define PET_SUMMON_SPELL                       12
557 #define PET_BALL_SPELL                         13
558 #define PET_RIDING                             14
559 #define PET_NAME                               15
560 #define PET_RYOUTE                             16
561
562 /*
563  * Follow distances
564  */
565 #define PET_CLOSE_DIST                          1
566 #define PET_FOLLOW_DIST                         6
567 #define PET_SEEK_DIST                           10
568 #define PET_DESTROY_DIST                        255
569 #define PET_SPACE_DIST                          (-10)
570 #define PET_AWAY_DIST                           (-25)
571
572 #define PF_OPEN_DOORS   0x0001
573 #define PF_PICKUP_ITEMS 0x0002
574 #define PF_TELEPORT     0x0004
575 #define PF_ATTACK_SPELL 0x0008
576 #define PF_SUMMON_SPELL 0x0010
577 #define PF_BALL_SPELL   0x0020
578 #define PF_RYOUTE       0x0040
579
580
581 /*
582  * There is a 1/20 (5%) chance of inflating the requested object_level
583  * during the creation of an object (see "get_obj_num()" in "object.c").
584  * Lower values yield better objects more often.
585  */
586 #define GREAT_OBJ       20
587
588 /*
589  * There is a 1/50 (2%) chance of inflating the requested monster_level
590  * during the creation of a monsters (see "get_mon_num()" in "monster.c").
591  * Lower values yield harder monsters more often.
592  */
593 #define NASTY_MON       50              /* 1/chance of inflated monster level */
594
595 /* 1/x chance of hurting even if invulnerable! */
596 #define PENETRATE_INVULNERABILITY 13
597
598
599
600 /*
601  * Refueling constants
602  */
603 #define FUEL_TORCH      5000    /* Maximum amount of fuel in a torch */
604 #define FUEL_LAMP       15000   /* Maximum amount of fuel in a lantern */
605
606
607 /*
608  * More maximum values
609  */
610 #define MAX_SIGHT       20      /* Maximum view distance */
611 #define MAX_RANGE       (p_ptr->inside_battle ? 36 : 18)      /* Maximum range (spells, etc) */
612
613
614
615 /*
616  * The town starts out with 4 residents during the day
617  */
618 #define MIN_M_ALLOC_TD          4
619
620 /*
621  * The town starts out with 8 residents during the night
622  */
623 #define MIN_M_ALLOC_TN          8
624
625
626 /*
627  * A monster can only "multiply" (reproduce) if there are fewer than 100
628  * monsters on the level capable of such spontaneous reproduction.  This
629  * is a hack which prevents the "m_list[]" array from exploding due to
630  * reproducing monsters.  Messy, but necessary.
631  */
632 #define MAX_REPRO       100
633
634
635 /*
636  * Player constants
637  */
638 #define PY_MAX_EXP      99999999L       /* Maximum exp */
639 #define PY_MAX_GOLD     999999999L      /* Maximum gold */
640 #define PY_MAX_LEVEL    50              /* Maximum level */
641
642 /*
643  * Player "food" crucial values
644  */
645 #define PY_FOOD_MAX             15000   /* Food value (Bloated) */
646 #define PY_FOOD_FULL    10000   /* Food value (Normal) */
647 #define PY_FOOD_ALERT   2000    /* Food value (Hungry) */
648 #define PY_FOOD_WEAK    1000    /* Food value (Weak) */
649 #define PY_FOOD_FAINT   500             /* Food value (Fainting) */
650 #define PY_FOOD_STARVE  100             /* Food value (Starving) */
651
652 /*
653  * Player regeneration constants
654  */
655 #define PY_REGEN_NORMAL         197             /* Regen factor*2^16 when full */
656 #define PY_REGEN_WEAK           98              /* Regen factor*2^16 when weak */
657 #define PY_REGEN_FAINT          33              /* Regen factor*2^16 when fainting */
658 #define PY_REGEN_HPBASE         1442    /* Min amount hp regen*2^16 */
659 #define PY_REGEN_MNBASE         524             /* Min amount mana regen*2^16 */
660
661 /*
662  * Possible realms that can be chosen;
663  * currently used only by birth.c and tables.c
664  */
665 #define CH_NONE         0x00
666 #define CH_LIFE         0x01
667 #define CH_SORCERY      0x02
668 #define CH_NATURE       0x04
669 #define CH_CHAOS        0x08
670 #define CH_DEATH        0x10
671 #define CH_TRUMP        0x20
672 #define CH_ARCANE       0x40
673 #define CH_ENCHANT      0x80
674 #define CH_DAEMON       0x100
675 #define CH_CRUSADE      0x200
676
677 #define CH_MUSIC        0x10000
678 #define CH_HISSATSU     0x20000
679
680
681 /*
682  * Magic realms
683  */
684 #define REALM_NONE         0
685 #define REALM_LIFE         1
686 #define REALM_SORCERY      2
687 #define REALM_NATURE       3
688 #define REALM_CHAOS        4
689 #define REALM_DEATH        5
690 #define REALM_TRUMP        6
691 #define REALM_ARCANE       7
692 #define REALM_ENCHANT      8
693 #define REALM_DAEMON       9
694 #define REALM_CRUSADE      10
695 #define MAX_MAGIC          10
696 #define MIN_TECHNIC        16
697 #define REALM_MUSIC        16
698 #define REALM_HISSATSU     17
699 #define MAX_REALM          17
700
701 #define VALID_REALM        (MAX_REALM + MAX_MAGIC - MIN_TECHNIC + 1)
702 #define NUM_TECHNIC        (MAX_REALM - MIN_TECHNIC + 1)
703
704 #define is_magic(A) ((A) < MAX_MAGIC + 1 ? TRUE : FALSE)
705 #define tval2realm(A) ((A) - TV_LIFE_BOOK + 1)
706 #define technic2magic(A)      (is_magic(A) ? (A) : (A) - MIN_TECHNIC + 1 + MAX_MAGIC)
707 #define is_good_realm(REALM)   ((REALM) == REALM_LIFE || (REALM) == REALM_CRUSADE)
708
709 /*
710  * Magic-books for the realms
711  */
712 #define REALM1_BOOK     (p_ptr->realm1 + TV_LIFE_BOOK - 1)
713 #define REALM2_BOOK     (p_ptr->realm2 + TV_LIFE_BOOK - 1)
714
715
716 /*
717  * Maximum number of "normal" pack slots, and the index of the "overflow"
718  * slot, which can hold an item, but only temporarily, since it causes the
719  * pack to "overflow", dropping the "last" item onto the ground.  Since this
720  * value is used as an actual slot, it must be less than "INVEN_RARM" (below).
721  * Note that "INVEN_PACK" is probably hard-coded by its use in savefiles, and
722  * by the fact that the screen can only show 23 items plus a one-line prompt.
723  */
724 #define INVEN_PACK              23
725
726 /*
727  * Indexes used for various "equipment" slots (hard-coded by savefiles, etc).
728  */
729 #define INVEN_RARM      24
730 #define INVEN_LARM      25
731 #define INVEN_BOW       26
732 #define INVEN_RIGHT     27
733 #define INVEN_LEFT      28
734 #define INVEN_NECK      29
735 #define INVEN_LITE      30
736 #define INVEN_BODY      31
737 #define INVEN_OUTER     32
738 #define INVEN_HEAD      33
739 #define INVEN_HANDS     34
740 #define INVEN_FEET      35
741
742 /*
743  * used for get_random_ego()
744  */
745 #define INVEN_AMMO     23
746
747 /*
748  * Total number of inventory slots (hard-coded).
749  */
750 #define INVEN_TOTAL     36
751
752
753 /*
754  * A "stack" of items is limited to less than 100 items (hard-coded).
755  */
756 #define MAX_STACK_SIZE                  100
757
758
759
760 /*
761  * Indexes of the various "stats" (hard-coded by savefiles, etc).
762  */
763 #define A_STR   0
764 #define A_INT   1
765 #define A_WIS   2
766 #define A_DEX   3
767 #define A_CON   4
768 #define A_CHR   5
769
770 /*
771  * Player sex constants (hard-coded by save-files, arrays, etc)
772  */
773 #define SEX_FEMALE              0
774 #define SEX_MALE                1
775
776
777 /*
778  * Player race constants (hard-coded by save-files, arrays, etc)
779  */
780 #define RACE_HUMAN               0
781 #define RACE_HALF_ELF            1
782 #define RACE_ELF                 2
783 #define RACE_HOBBIT              3
784 #define RACE_GNOME               4
785 #define RACE_DWARF               5
786 #define RACE_HALF_ORC            6
787 #define RACE_HALF_TROLL          7
788 #define RACE_AMBERITE            8
789 #define RACE_HIGH_ELF            9
790 #define RACE_BARBARIAN          10
791 #define RACE_HALF_OGRE          11
792 #define RACE_HALF_GIANT         12
793 #define RACE_HALF_TITAN         13
794 #define RACE_CYCLOPS            14
795 #define RACE_YEEK               15
796 #define RACE_KLACKON            16
797 #define RACE_KOBOLD             17
798 #define RACE_NIBELUNG           18
799 #define RACE_DARK_ELF           19
800 #define RACE_DRACONIAN          20
801 #define RACE_MIND_FLAYER        21
802 #define RACE_IMP                22
803 #define RACE_GOLEM              23
804 #define RACE_SKELETON           24
805 #define RACE_ZOMBIE             25
806 #define RACE_VAMPIRE            26
807 #define RACE_SPECTRE            27
808 #define RACE_SPRITE             28
809 #define RACE_BEASTMAN           29
810 #define RACE_ENT                30
811 #define RACE_ANGEL              31
812 #define RACE_DEMON              32
813 #define RACE_DUNADAN            33
814 #define RACE_S_FAIRY            34
815 #define RACE_KUTA               35
816 #define RACE_ANDROID            36
817
818 /*
819  * Maximum number of player "race" types (see "table.c", etc)
820  */
821 #define MAX_RACES               37
822
823
824 /*
825  * Player class constants (hard-coded by save-files, arrays, etc)
826  */
827 #define CLASS_WARRIOR            0
828 #define CLASS_MAGE               1
829 #define CLASS_PRIEST             2
830 #define CLASS_ROGUE              3
831 #define CLASS_RANGER             4
832 #define CLASS_PALADIN            5
833 #define CLASS_WARRIOR_MAGE       6
834 #define CLASS_CHAOS_WARRIOR      7
835 #define CLASS_MONK               8
836 #define CLASS_MINDCRAFTER        9
837 #define CLASS_HIGH_MAGE         10
838 #define CLASS_TOURIST           11
839 #define CLASS_IMITATOR          12
840 #define CLASS_BEASTMASTER       13
841 #define CLASS_SORCERER          14
842 #define CLASS_ARCHER            15
843 #define CLASS_MAGIC_EATER       16
844 #define CLASS_BARD              17
845 #define CLASS_RED_MAGE          18
846 #define CLASS_SAMURAI           19
847 #define CLASS_FORCETRAINER      20
848 #define CLASS_BLUE_MAGE         21
849 #define CLASS_CAVALRY           22
850 #define CLASS_BERSERKER         23
851 #define CLASS_SMITH             24
852 #define CLASS_MIRROR_MASTER     25
853 #define CLASS_NINJA             26
854
855 #define SEIKAKU_FUTUU   0
856 #define SEIKAKU_CHIKARA 1
857 #define SEIKAKU_KIREMONO        2
858 #define SEIKAKU_SHIAWASE        3
859 #define SEIKAKU_SUBASI  4
860 #define SEIKAKU_INOCHI  5
861 #define SEIKAKU_COMBAT  6
862 #define SEIKAKU_NAMAKE  7
863 #define SEIKAKU_SEXY    8
864 #define SEIKAKU_LUCKY   9
865 #define SEIKAKU_GAMAN   10
866 #define SEIKAKU_MUNCHKIN   11
867
868 /*** Screen Locations ***/
869
870 /*
871  * Some screen locations for various display routines
872  * Currently, row 8 and 15 are the only "blank" rows.
873  * That leaves a "border" around the "stat" values.
874  */
875
876 #define ROW_RACE                1
877 #define COL_RACE                0       /* <race name> */
878
879 /*#define ROW_CLASS               2 */
880 /*#define COL_CLASS               0 */      /* <class name> */
881
882 #define ROW_TITLE               2
883 #define COL_TITLE               0       /* <title> or <mode> */
884
885 /*#define ROW_SEIKAKU           4 */
886 /*#define COL_SEIKAKU           0*/     /* <seikaku> */
887
888 #define ROW_DAY                 21
889 #define COL_DAY                 0       /* day */
890
891 #define ROW_DUNGEON             22
892 #define COL_DUNGEON             0       /* dungeon */
893
894 #define ROW_LEVEL               3
895 #define COL_LEVEL               0       /* "LEVEL xxxxxx" */
896
897 #define ROW_EXP                 4
898 #define COL_EXP                 0       /* "EXP xxxxxxxx" */
899
900 #define ROW_GOLD                5
901 #define COL_GOLD                0       /* "AU xxxxxxxxx" */
902
903 #define ROW_EQUIPPY             6
904 #define COL_EQUIPPY             0       /* equippy chars */
905
906 #define ROW_STAT                7
907 #define COL_STAT                0       /* "xxx   xxxxxx" */
908
909 #define ROW_AC                  13
910 #define COL_AC                  0       /* "Cur AC xxxxx" */
911
912 #define ROW_HPMP                14
913 #define COL_HPMP                0
914
915 #define ROW_CURHP               14
916 #define COL_CURHP               0       /* "Cur HP xxxxx" */
917
918 #define ROW_CURSP               15
919 #define COL_CURSP               0       /* "Cur SP xxxxx" */
920
921 #define ROW_RIDING_INFO          16
922 #define COL_RIDING_INFO          0       /* "xxxxxxxxxxxx" */
923
924 #define ROW_INFO                17
925 #define COL_INFO                0       /* "xxxxxxxxxxxx" */
926
927 #define ROW_MAP                                         0
928 #define COL_MAP                  12
929
930 #define ROW_CUT                 18
931 #define COL_CUT                 0       /* <cut> */
932
933 #define ROW_STUN                19
934 #define COL_STUN                0       /* <stun> */
935
936 #define ROW_HUNGRY              20
937 #define COL_HUNGRY              0       /* "Weak" / "Hungry" / "Full" / "Gorged" */
938
939 #define ROW_STATE               20
940 #define COL_STATE                7      /* <state> */
941
942 #define ROW_SPEED               (-1)
943 #define COL_SPEED               (-24)      /* "Slow (-NN)" or "Fast (+NN)" */
944
945 #define ROW_STUDY               (-1)
946 #define COL_STUDY               (-13)      /* "Study" */
947
948 #define ROW_DEPTH               (-1)
949 #define COL_DEPTH               (-8)      /* "Lev NNN" / "NNNN ft" */
950
951 #define ROW_STATBAR             (-1)
952 #define COL_STATBAR              0
953 #define MAX_COL_STATBAR         (-26)
954
955
956 /*** Terrain Feature Indexes (see "lib/edit/f_info.txt") ***/
957
958 /* Nothing */
959 #define FEAT_NONE               0x00
960
961 /* Various */
962 #define FEAT_FLOOR              0x01
963 #define FEAT_INVIS              0x02
964 #define FEAT_GLYPH              0x03
965 #define FEAT_OPEN               0x04
966 #define FEAT_BROKEN             0x05
967 #define FEAT_LESS               0x06
968 #define FEAT_MORE               0x07
969
970 /* Quest features -KMW- */
971 #define FEAT_QUEST_ENTER                0x08
972 #define FEAT_QUEST_EXIT                 0x09
973 #define FEAT_QUEST_DOWN                 0x0A
974 #define FEAT_QUEST_UP                   0x0B
975
976 #define FEAT_LESS_LESS          0x0D
977 #define FEAT_MORE_MORE          0x0E
978
979 /* Feature 0x0E - 0x0F unused */
980
981 /* Traps */
982 #define FEAT_TRAP_TRAPDOOR      0x10
983 #define FEAT_TRAP_PIT           0x11
984 #define FEAT_TRAP_SPIKED_PIT    0x12
985 #define FEAT_TRAP_POISON_PIT    0x13
986 #define FEAT_TRAP_TY_CURSE      0x14
987 #define FEAT_TRAP_TELEPORT      0x15
988 #define FEAT_TRAP_FIRE          0x16
989 #define FEAT_TRAP_ACID          0x17
990 #define FEAT_TRAP_SLOW          0x18
991 #define FEAT_TRAP_LOSE_STR      0x19
992 #define FEAT_TRAP_LOSE_DEX      0x1A
993 #define FEAT_TRAP_LOSE_CON      0x1B
994 #define FEAT_TRAP_BLIND         0x1C
995 #define FEAT_TRAP_CONFUSE       0x1D
996 #define FEAT_TRAP_POISON        0x1E
997 #define FEAT_TRAP_SLEEP         0x1F
998
999 /* Doors */
1000 #define FEAT_DOOR_HEAD          0x20
1001 #define FEAT_DOOR_TAIL          0x2F
1002
1003 /* Extra */
1004 #define FEAT_SECRET             0x30
1005 #define FEAT_RUBBLE             0x31
1006
1007 /* Seams */
1008 #define FEAT_MAGMA              0x32
1009 #define FEAT_QUARTZ             0x33
1010 #define FEAT_MAGMA_H            0x34
1011 #define FEAT_QUARTZ_H           0x35
1012 #define FEAT_MAGMA_K            0x36
1013 #define FEAT_QUARTZ_K           0x37
1014
1015 /* Walls */
1016 #define FEAT_WALL_EXTRA         0x38
1017 #define FEAT_WALL_INNER         0x39
1018 #define FEAT_WALL_OUTER         0x3A
1019 #define FEAT_WALL_SOLID         0x3B
1020 #define FEAT_PERM_EXTRA         0x3C
1021 #define FEAT_PERM_INNER         0x3D
1022 #define FEAT_PERM_OUTER         0x3E
1023 #define FEAT_PERM_SOLID         0x3F
1024
1025 /* Glyph */
1026 #define FEAT_MINOR_GLYPH        0x40
1027
1028 /* Pattern */
1029 #define FEAT_PATTERN_START      0x41
1030 #define FEAT_PATTERN_1          0x42
1031 #define FEAT_PATTERN_2          0x43
1032 #define FEAT_PATTERN_3          0x44
1033 #define FEAT_PATTERN_4          0x45
1034 #define FEAT_PATTERN_END        0x46
1035 #define FEAT_PATTERN_OLD        0x47
1036 #define FEAT_PATTERN_XTRA1      0x48
1037 #define FEAT_PATTERN_XTRA2      0x49
1038
1039 /* Shops */
1040 #define FEAT_SHOP_HEAD          0x4A
1041 #define FEAT_SHOP_TAIL          0x52
1042
1043 /* Terrains */
1044 #define FEAT_DEEP_WATER         0x53
1045 #define FEAT_SHAL_WATER         0x54
1046 #define FEAT_DEEP_LAVA          0x55
1047 #define FEAT_SHAL_LAVA          0x56
1048 #define FEAT_DARK_PIT           0x57
1049 #define FEAT_DIRT               0x58
1050 #define FEAT_GRASS              0x59
1051
1052 #define FEAT_TRAP_TRAPS         0x5A
1053 #define FEAT_TRAP_ALARM         0x5B
1054
1055 #define FEAT_FLOWER             0x5D
1056 #define FEAT_DEEP_GRASS         0x5E
1057 #define FEAT_MUSEUM             0x5F
1058
1059 /* Feature 0x5A - 0x5F unused */
1060
1061 /* Terrain */
1062 #define FEAT_TREES              0x60
1063 #define FEAT_MOUNTAIN           0x61
1064
1065 /* Feature 0x62 - 0x7F unused */
1066
1067 /* Buildings */
1068 #define FEAT_BLDG_HEAD          0x80
1069 #define FEAT_BLDG_TAIL          0x9F
1070
1071 #define FEAT_TOWN               0xc0
1072 #define FEAT_ENTRANCE           0xc1
1073 #define FEAT_SWAMP              0xc2
1074
1075 /* for mirror master */
1076 #define FEAT_MIRROR             0xc3
1077
1078 /* unknown grid (not detected)  */
1079 #define FEAT_UNDETECTD          0xc4
1080
1081 /*
1082  * Wilderness terrains
1083  */
1084 #define TERRAIN_EDGE             0 /* Edge of the World */
1085 #define TERRAIN_TOWN             1 /* Town */
1086 #define TERRAIN_DEEP_WATER       2 /* Deep water */
1087 #define TERRAIN_SHALLOW_WATER    3 /* Shallow water */
1088 #define TERRAIN_SWAMP            4 /* Swamp */
1089 #define TERRAIN_DIRT             5 /* Dirt */
1090 #define TERRAIN_GRASS            6 /* Grass */
1091 #define TERRAIN_TREES            7 /* Trees */
1092 #define TERRAIN_DESERT           8 /* Desert */
1093 #define TERRAIN_SHALLOW_LAVA     9 /* Shallow lava */
1094 #define TERRAIN_DEEP_LAVA       10 /* Deep lava */
1095 #define TERRAIN_MOUNTAIN        11 /* Mountain */
1096
1097 #define MAX_WILDERNESS          12 /* Maximum wilderness index */
1098
1099
1100
1101 /*** Artifact indexes (see "lib/edit/a_info.txt") ***/
1102
1103 /* Lites */
1104 #define ART_GALADRIEL            1
1105 #define ART_ELENDIL              2
1106 #define ART_JUDGE                3
1107 #define ART_EDISON               7
1108 #define ART_PALANTIR             15
1109 #define ART_STONE_LORE           17
1110 #define ART_FLY_STONE            147
1111
1112 /* Amulets */
1113 #define ART_CARLAMMAS            4
1114 #define ART_INGWE                5
1115 #define ART_DWARVES              6
1116 #define ART_FARAMIR              18
1117 #define ART_BOROMIR              143
1118 #define ART_MAGATAMA             149
1119 #define ART_INROU                166
1120 #define ART_NIGHT                215
1121
1122 /* Rings */
1123 #define ART_FRAKIR               8
1124 #define ART_TULKAS               9
1125 #define ART_NARYA               10
1126 #define ART_NENYA               11
1127 #define ART_VILYA               12
1128 #define ART_POWER               13
1129 #define ART_AHO                 14
1130
1131 /* Dragon Scale */
1132 #define ART_RAZORBACK           129
1133 #define ART_BLADETURNER         130
1134 #define ART_SEIRYU              201
1135
1136 /* Hard Armour */
1137 #define ART_SOULKEEPER          19
1138 #define ART_ISILDUR             20
1139 #define ART_ROHIRRIM            21
1140 #define ART_LOHENGRIN           22
1141 #define ART_JULIAN              23
1142 #define ART_ARVEDUI             24
1143 #define ART_CASPANION           25
1144 #define ART_GILES               168
1145 #define ART_MORLOK              203
1146 #define ART_VETERAN             206
1147
1148 /* Soft Armour */
1149 #define ART_SHIVA_JACKET        26
1150 #define ART_HITHLOMIR           27
1151 #define ART_THALKETTOTH         28
1152 #define ART_HIMRING             127
1153 #define ART_ICANUS              131
1154 #define ART_NAMAKE_ARMOR        183
1155 #define ART_GHB                 192
1156 #define ART_DASAI               200
1157 #define ART_KESHO               204
1158
1159 /* Shields */
1160 #define ART_THORIN              30
1161 #define ART_CELEGORM            31
1162 #define ART_ANARION             32
1163 #define ART_GIL_GALAD           138
1164 #define ART_YENDOR              141
1165 #define ART_YATA                151
1166 #define ART_EARENDIL            186
1167 #define ART_PERSEUS             197
1168
1169 /* Helms and Crowns */
1170 #define ART_INDRA               33
1171 #define ART_CHAOS               34
1172 #define ART_BERUTHIEL           35
1173 #define ART_THRANDUIL           36
1174 #define ART_THENGEL             37
1175 #define ART_HAMMERHAND          38
1176 #define ART_DOR                 39
1177 #define ART_HOLHENNETH          40
1178 #define ART_TERROR              41
1179 #define ART_AMBER               42
1180 #define ART_NUMENOR             132
1181 #define ART_STONEMASK           146
1182
1183 /* Cloaks */
1184 #define ART_JACK                43
1185 #define ART_COLLUIN             44
1186 #define ART_HOLCOLLETH          45
1187 #define ART_THINGOL             46
1188 #define ART_THORONGIL           47
1189 #define ART_COLANNON            48
1190 #define ART_LUTHIEN             49
1191 #define ART_TUOR                50
1192 #define ART_MOOK                205
1193
1194 /* Gloves */
1195 #define ART_CAMBELEG            52
1196 #define ART_CAMMITHRIM          53
1197 #define ART_PAURHACH            54
1198 #define ART_CORWIN              55
1199 #define ART_PAURAEGEN           56
1200 #define ART_PAURNEN             57
1201 #define ART_THANOS              58
1202 #define ART_FINGOLFIN           59
1203 #define ART_PAURNIMMEN          185
1204
1205 /* Boots */
1206 #define ART_FEANOR              60
1207 #define ART_FLORA               61
1208 #define ART_THROR               62
1209 #define ART_SHIVA_BOOTS         63
1210 #define ART_GLASS               165
1211 #define ART_GETA                210
1212
1213 /* Digging */
1214 #define ART_NAIN                211
1215
1216 /* Swords */
1217 #define ART_MAEDHROS            64
1218 #define ART_CAINE               65
1219 #define ART_NARTHANC            66
1220 #define ART_NIMTHANC            67
1221 #define ART_DETHANC             68
1222 #define ART_RILIA               69
1223 #define ART_FIONA               70
1224 #define ART_CALRIS              71
1225 #define ART_GRAYSWANDIR         72
1226 #define ART_GLAMDRING           73
1227 #define ART_NOTHUNG             74
1228 #define ART_ORCRIST             75
1229 #define ART_GURTHANG            76
1230 #define ART_ZARCUTHRA           77
1231 #define ART_TWILIGHT            78
1232 #define ART_GONDRICAM           79
1233 #define ART_CRISDURIAN          80
1234 #define ART_AGLARANG            81
1235 #define ART_RINGIL              82
1236 #define ART_ANDURIL             83
1237 #define ART_WEREWINDLE          84
1238 #define ART_CHAINSWORD          85
1239 #define ART_FORASGIL            86
1240 #define ART_CARETH              87
1241 #define ART_STING               88
1242 #define ART_SOULSWORD           89
1243 #define ART_MERLIN              90
1244 #define ART_DOOMCALLER          91
1245 #define ART_VORPAL_BLADE        92
1246 #define ART_SLAYER              123
1247 #define ART_KUSANAGI            128
1248 #define ART_HURIN               133
1249 #define ART_AZAGHAL             135
1250 #define ART_NOVA                137
1251 #define ART_CHARIOT             140
1252 #define ART_WORPAL_BLADE        142
1253 #define ART_MURAMASA            144
1254 #define ART_ZANTETSU            150
1255 #define ART_SOULCRUSH           154
1256 #define ART_FALIS               155
1257 #define ART_HRUNTING            156
1258 #define ART_ANUBIS              158
1259 #define ART_GURENKI             160
1260 #define ART_TAILBITER           167
1261 #define ART_MUSASI_KATANA       171
1262 #define ART_MUSASI_WAKIZASI     172
1263 #define ART_QUICKTHORN          174
1264 #define ART_TINYTHORN           175
1265 #define ART_EXCALIBUR           176
1266 #define ART_EXCALIPUR           177
1267 #define ART_EXCALIBUR_J         179
1268 #define ART_ARUNRUTH            184
1269 #define ART_HAKABUSA            189
1270 #define ART_STORMBRINGER        190
1271 #define ART_NARSIL              191
1272 #define ART_KANNU               193
1273 #define ART_GRIMTOOTH           196
1274 #define ART_KAMUI               198
1275 #define ART_GOURYU              207
1276 #define ART_EOWYN               216
1277
1278 /* Polearms */
1279 #define ART_THEODEN             93
1280 #define ART_PAIN                94
1281 #define ART_OSONDIR             95
1282 #define ART_TIL                 96
1283 #define ART_RUNESPEAR           97
1284 #define ART_DESTINY             98
1285 #define ART_HAGEN               99
1286 #define ART_EORLINGAS           100
1287 #define ART_DURIN               101
1288 #define ART_EONWE               102
1289 #define ART_BALLI               103
1290 #define ART_LOTHARANG           104
1291 #define ART_DWARVES_AXE         105
1292 #define ART_BARUKKHELED         106
1293 #define ART_WRATH               107
1294 #define ART_ULMO                108
1295 #define ART_AVAVIR              109
1296 #define ART_BENKEI              152
1297 #define ART_TAIKOBO             159
1298 #define ART_TONBO               161
1299 #define ART_GAEBOLG             163
1300 #define ART_ARRYU               164
1301 #define ART_AEGLOS              187
1302 #define ART_BLOOD               199
1303 #define ART_NUMAHOKO            202
1304
1305 /* The sword of the Dawn */
1306 #define ART_DAWN                110
1307
1308 /* Hafted */
1309 #define ART_GROND               111
1310 #define ART_TOTILA              112
1311 #define ART_THUNDERFIST         113
1312 #define ART_BLOODSPIKE          114
1313 #define ART_FIRESTAR            115
1314 #define ART_TARATOL             116
1315 #define ART_AULE                117
1316 #define ART_NAR                 118
1317 #define ART_ERIRIL              119
1318 #define ART_GANDALF             120
1319 #define ART_DEATHWREAKER        121
1320 #define ART_TURMIL              122
1321 #define ART_MJOLLNIR            136
1322 #define ART_WINBLOWS            139
1323 #define ART_XIAOLONG            145
1324 #define ART_NYOIBOU             157
1325 #define ART_JONES               162
1326 #define ART_HYOUSIGI            169
1327 #define ART_MATOI               170
1328 #define ART_IRON_BALL           173
1329 #define ART_SAMSON              178
1330 #define ART_NAMAKE_HAMMER       181
1331 #define ART_BOLISHOI            188
1332 #define ART_SHUTEN_DOJI         194
1333 #define ART_G_HAMMER            195
1334 #define ART_AEGISFANG           208
1335 #define ART_HERMIT              209
1336 #define ART_GOTHMOG             212
1337 #define ART_JIZO                213
1338 #define ART_FUNDIN              214
1339
1340 /* Bows */
1341 #define ART_BELTHRONDING        124
1342 #define ART_BARD                125
1343 #define ART_BRAND               126
1344 #define ART_CRIMSON             16
1345 #define ART_BUCKLAND            134
1346 #define ART_YOICHI              148
1347 #define ART_HARAD               180
1348 #define ART_NAMAKE_BOW          182
1349
1350 /* Arrows */
1351 #define ART_BARD_ARROW          153
1352
1353 /*** Ego-Item indexes (see "lib/edit/e_info.txt") ***/
1354
1355
1356 /* Nothing */
1357 /* xxx */
1358 /* xxx */
1359 /* xxx */
1360
1361 /* Body Armor */
1362 #define EGO_RESIST_ACID         4
1363 #define EGO_RESIST_ELEC         5
1364 #define EGO_RESIST_FIRE         6
1365 #define EGO_RESIST_COLD         7
1366 #define EGO_RESISTANCE          8
1367 #define EGO_ELVENKIND           9
1368 #define EGO_DWARVEN             10
1369 #define EGO_PERMANENCE          11
1370 #define EGO_YOIYAMI             12
1371 /* xxx */
1372 /* xxx */
1373 /* xxx */
1374
1375 /* Shields */
1376 #define EGO_ENDURE_ACID         16
1377 #define EGO_ENDURE_ELEC         17
1378 #define EGO_ENDURE_FIRE         18
1379 #define EGO_ENDURE_COLD         19
1380 #define EGO_ENDURANCE           20
1381 #define EGO_REFLECTION          21
1382 #define EGO_NIGHT_DAY           22
1383
1384 /* Crowns and Helms */
1385 #define EGO_DARK                23
1386 #define EGO_INTELLIGENCE        24
1387 #define EGO_WISDOM              25
1388 #define EGO_BEAUTY              26
1389 #define EGO_MAGI                27
1390 #define EGO_MIGHT               28
1391 #define EGO_LORDLINESS          29
1392 #define EGO_SEEING              30
1393 #define EGO_INFRAVISION         31
1394 #define EGO_LITE                32
1395 #define EGO_TELEPATHY           33
1396 #define EGO_REGENERATION        34
1397 #define EGO_TELEPORTATION       35
1398 #define EGO_STUPIDITY           36
1399 #define EGO_NAIVETY             37
1400 #define EGO_UGLINESS            38
1401 #define EGO_SICKLINESS          39
1402
1403 /* Cloaks */
1404 #define EGO_PROTECTION          40
1405 #define EGO_STEALTH             41
1406 #define EGO_AMAN                42
1407 #define EGO_AURA_FIRE           43
1408 #define EGO_ENVELOPING          44
1409 #define EGO_VULNERABILITY       45
1410 #define EGO_IRRITATION          46
1411 #define EGO_AURA_ELEC           47
1412 #define EGO_AURA_COLD          128
1413 #define EGO_BAT                129
1414
1415 /* Gloves */
1416 #define EGO_FREE_ACTION         48
1417 #define EGO_SLAYING             49
1418 #define EGO_AGILITY             50
1419 #define EGO_POWER               51
1420 #define EGO_2WEAPON             52
1421 #define EGO_MAGIC_MASTERY       53
1422 #define EGO_WEAKNESS            54
1423 #define EGO_CLUMSINESS          55
1424
1425 /* Boots */
1426 #define EGO_SLOW_DESCENT        56
1427 #define EGO_QUIET               57
1428 #define EGO_MOTION              58
1429 #define EGO_SPEED               59
1430 #define EGO_JUMP                60
1431 #define EGO_NOISE               61
1432 #define EGO_SLOWNESS            62
1433 #define EGO_ANNOYANCE           63
1434
1435 /* Weapons */
1436 #define EGO_HA                  64
1437 #define EGO_DF                  65
1438 #define EGO_BLESS_BLADE         66
1439 /* xxx */
1440 #define EGO_WEST                68
1441 #define EGO_ATTACKS             69
1442 #define EGO_SLAYING_WEAPON      70
1443 #define EGO_FORCE_WEAPON        71
1444 #define EGO_BRAND_ACID          72
1445 #define EGO_BRAND_ELEC          73
1446 #define EGO_BRAND_FIRE          74
1447 #define EGO_BRAND_COLD          75
1448 #define EGO_BRAND_POIS          76
1449 #define EGO_CHAOTIC             77
1450 #define EGO_SHARPNESS           78
1451 #define EGO_EARTHQUAKES         79
1452 #define EGO_SLAY_ANIMAL         80
1453 #define EGO_SLAY_EVIL           81
1454 #define EGO_SLAY_UNDEAD         82
1455 #define EGO_SLAY_DEMON          83
1456 #define EGO_SLAY_ORC            84
1457 #define EGO_SLAY_TROLL          85
1458 #define EGO_SLAY_GIANT          86
1459 #define EGO_SLAY_DRAGON         87
1460 #define EGO_KILL_ANIMAL         88
1461 #define EGO_KILL_EVIL           89
1462 #define EGO_KILL_UNDEAD         90
1463 #define EGO_KILL_DEMON          91
1464 #define EGO_KILL_ORC            92
1465 #define EGO_KILL_TROLL          93
1466 #define EGO_KILL_GIANT          94
1467 #define EGO_KILL_DRAGON         95
1468 #define EGO_VAMPIRIC            96
1469 #define EGO_PRISM               97
1470 #define EGO_TRUMP               98
1471 #define EGO_PATTERN             99
1472 #define EGO_DIGGING             100
1473 #define EGO_SLAY_HUMAN          101
1474 #define EGO_MORGUL              102
1475 #define EGO_KILL_HUMAN          103
1476
1477 /* Bows */
1478 #define EGO_ACCURACY            104
1479 #define EGO_VELOCITY            105
1480 /* xxx */
1481 /* xxx */
1482 #define EGO_EXTRA_MIGHT         108
1483 #define EGO_EXTRA_SHOTS         109
1484 /* xxx */
1485 /* xxx */
1486
1487 /* Ammo */
1488 #define EGO_HURT_ANIMAL         112
1489 #define EGO_HURT_EVIL           113
1490 /* xxx */
1491 /* xxx */
1492 /* xxx */
1493 /* xxx */
1494 /* xxx */
1495 #define EGO_HURT_DRAGON         119
1496 #define EGO_SLAYING_BOLT        120
1497 #define EGO_LIGHTNING_BOLT      121
1498 #define EGO_FLAME               122
1499 #define EGO_FROST               123
1500 #define EGO_WOUNDING            124
1501 #define EGO_BACKBITING          125
1502 #define EGO_SHATTERED           126
1503 #define EGO_BLASTED             127
1504
1505 #define EGO_LITE_SHINE          140
1506 #define EGO_LITE_ILLUMINATION   141
1507 #define EGO_LITE_AURA_FIRE      142
1508 #define EGO_LITE_INFRA          143
1509 #define EGO_LITE_LONG           144
1510 #define EGO_LITE_DARKNESS       145
1511 #define EGO_LITE_EYE            146
1512
1513 #define EGO_RING_HERO           150
1514 #define EGO_RING_SLAY           151
1515 #define EGO_RING_SUPER_AC       152
1516 #define EGO_RING_MAGIC_MIS      153
1517 #define EGO_RING_FIRE_BOLT      154
1518 #define EGO_RING_COLD_BOLT      155
1519 #define EGO_RING_ELEC_BOLT      156
1520 #define EGO_RING_ACID_BOLT      157
1521 #define EGO_RING_MANA_BOLT      158
1522 #define EGO_RING_FIRE_BALL      159
1523 #define EGO_RING_COLD_BALL      160
1524 #define EGO_RING_ELEC_BALL      161
1525 #define EGO_RING_ACID_BALL      162
1526 #define EGO_RING_MANA_BALL      163
1527 #define EGO_RING_DRAGON_F       164
1528 #define EGO_RING_DRAGON_C       165
1529 #define EGO_RING_D_SPEED        166
1530 #define EGO_RING_BERSERKER      167
1531 #define EGO_RING_HUNTER         168
1532 #define EGO_RING_THROW          169
1533 #define EGO_RING_REGEN          170
1534 #define EGO_RING_LITE           171
1535 #define EGO_RING_M_DETECT       172
1536 #define EGO_RING_STEALTH        173
1537 #define EGO_RING_TELE_AWAY      174
1538 #define EGO_RING_TO_H           175
1539 #define EGO_RING_TO_D           176
1540 #define EGO_RING_RES_LITE       177
1541 #define EGO_RING_RES_DARK       178
1542 #define EGO_RING_WIZARD         179
1543 #define EGO_RING_TRUE           180
1544 #define EGO_RING_DRAIN_EXP      181
1545 #define EGO_RING_NO_MELEE       182
1546 #define EGO_RING_AGGRAVATE      183
1547 #define EGO_RING_TY_CURSE       184
1548 #define EGO_RING_RES_TIME       185
1549 #define EGO_RING_TELEPORT       186
1550 #define EGO_RING_ALBINO         187
1551
1552 #define EGO_AMU_SLOW_D          210
1553 #define EGO_AMU_INFRA           211
1554 #define EGO_AMU_SEE_INVIS       212
1555 #define EGO_AMU_HOLD_LIFE       213
1556 #define EGO_AMU_DRAIN_EXP       214
1557 #define EGO_AMU_FOOL            215
1558 #define EGO_AMU_AGGRAVATE       216
1559 #define EGO_AMU_TY_CURSE        217
1560 #define EGO_AMU_AC              218
1561 #define EGO_AMU_IDENT           219
1562 #define EGO_AMU_CHARM           220
1563 #define EGO_AMU_STEALTH         221
1564 #define EGO_AMU_JUMP            222
1565 #define EGO_AMU_TELEPORT        223
1566 #define EGO_AMU_D_DOOR          224
1567 #define EGO_AMU_DEFENDER        225
1568 #define EGO_AMU_RES_FIRE        226
1569 #define EGO_AMU_RES_FIRE_       227
1570 #define EGO_AMU_RES_COLD        228
1571 #define EGO_AMU_RES_COLD_       229
1572 #define EGO_AMU_RES_ELEC        230
1573 #define EGO_AMU_RES_ELEC_       231
1574 #define EGO_AMU_RES_ACID        232
1575 #define EGO_AMU_RES_ACID_       233
1576 #define EGO_AMU_LEVITATION      234
1577 #define EGO_AMU_GREAT           235
1578 #define EGO_AMU_DETECTION       236
1579 #define EGO_AMU_NAIVETY         237
1580
1581 /* Activation effects for random artifacts */
1582 #define ACT_SUNLIGHT            1
1583 #define ACT_BO_MISS_1           2
1584 #define ACT_BA_POIS_1           3
1585 #define ACT_BO_ELEC_1           4
1586 #define ACT_BO_ACID_1           5
1587 #define ACT_BO_COLD_1           6
1588 #define ACT_BO_FIRE_1           7
1589 #define ACT_BA_COLD_1           8
1590 #define ACT_BA_FIRE_1           9
1591 #define ACT_DRAIN_1             10
1592 #define ACT_BA_COLD_2           11
1593 #define ACT_BA_ELEC_2           12
1594 #define ACT_DRAIN_2             13
1595 #define ACT_VAMPIRE_1           14
1596 #define ACT_BO_MISS_2           15
1597 #define ACT_BA_FIRE_2           16
1598 #define ACT_BA_COLD_3           17
1599 #define ACT_BA_ELEC_3           18
1600 #define ACT_WHIRLWIND           19
1601 #define ACT_VAMPIRE_2           20
1602 #define ACT_CALL_CHAOS          21
1603 #define ACT_ROCKET              22
1604 #define ACT_DISP_EVIL           23
1605 #define ACT_BA_MISS_3           24
1606 #define ACT_DISP_GOOD           25
1607 /* 26 - 50 unused */
1608 #define ACT_CONFUSE             51
1609 #define ACT_SLEEP               52
1610 #define ACT_QUAKE               53
1611 #define ACT_TERROR              54
1612 #define ACT_TELE_AWAY           55
1613 #define ACT_BANISH_EVIL         56
1614 #define ACT_GENOCIDE            57
1615 #define ACT_MASS_GENO           58
1616 /* 59 - 64 unused */
1617 #define ACT_CHARM_ANIMAL        65
1618 #define ACT_CHARM_UNDEAD        66
1619 #define ACT_CHARM_OTHER         67
1620 #define ACT_CHARM_ANIMALS       68
1621 #define ACT_CHARM_OTHERS        69
1622 #define ACT_SUMMON_ANIMAL       70
1623 #define ACT_SUMMON_PHANTOM      71
1624 #define ACT_SUMMON_ELEMENTAL    72
1625 #define ACT_SUMMON_DEMON        73
1626 #define ACT_SUMMON_UNDEAD       74
1627 /* 75 - 80 unused */
1628 #define ACT_CURE_LW             81
1629 #define ACT_CURE_MW             82
1630 #define ACT_CURE_POISON         83
1631 #define ACT_REST_LIFE           84
1632 #define ACT_REST_ALL            85
1633 #define ACT_CURE_700            86
1634 #define ACT_CURE_1000           87
1635 /* 88 - 90 unused */
1636 #define ACT_ESP                 91
1637 #define ACT_BERSERK             92
1638 #define ACT_PROT_EVIL           93
1639 #define ACT_RESIST_ALL          94
1640 #define ACT_SPEED               95
1641 #define ACT_XTRA_SPEED          96
1642 #define ACT_WRAITH              97
1643 #define ACT_INVULN              98
1644 /* 99 - 110 unused */
1645 #define ACT_LIGHT               111
1646 #define ACT_MAP_LIGHT           112
1647 #define ACT_DETECT_ALL          113
1648 #define ACT_DETECT_XTRA         114
1649 #define ACT_ID_FULL             115
1650 #define ACT_ID_PLAIN            116
1651 #define ACT_RUNE_EXPLO          117
1652 #define ACT_RUNE_PROT           118
1653 #define ACT_SATIATE             119
1654 #define ACT_DEST_DOOR           120
1655 #define ACT_STONE_MUD           121
1656 #define ACT_RECHARGE            122
1657 #define ACT_ALCHEMY             123
1658 #define ACT_DIM_DOOR            124
1659 #define ACT_TELEPORT            125
1660 #define ACT_RECALL              126
1661 /* 127 -> unused */
1662
1663 /*** Object "tval" and "sval" codes ***/
1664
1665
1666 /*
1667  * The values for the "tval" field of various objects.
1668  *
1669  * This value is the primary means by which items are sorted in the
1670  * player inventory, followed by "sval" and "cost".
1671  *
1672  * Note that a "BOW" with tval = 19 and sval S = 10*N+P takes a missile
1673  * weapon with tval = 16+N, and does (xP) damage when so combined.  This
1674  * fact is not actually used in the source, but it kind of interesting.
1675  *
1676  * Note that as of 2.7.8, the "item flags" apply to all items, though
1677  * only armor and weapons and a few other items use any of these flags.
1678  */
1679
1680 #define TV_SKELETON      1      /* Skeletons ('s'), not specified */
1681 #define TV_BOTTLE        2      /* Empty bottles ('!') */
1682 #define TV_JUNK          3      /* Sticks, Pottery, etc ('~') */
1683 #define TV_WHISTLE       4      /* Whistle ('~') */
1684 #define TV_SPIKE         5      /* Spikes ('~') */
1685 #define TV_CHEST         7      /* Chests ('&') */
1686 #define TV_FIGURINE      8      /* Magical figurines */
1687 #define TV_STATUE        9      /* Statue, what a silly object... */
1688 #define TV_CORPSE       10      /* Corpses and Skeletons, specific */
1689 #define TV_CAPTURE      11      /* Monster ball */
1690 #define TV_NO_AMMO      15      /* Ammo for crimson */
1691 #define TV_SHOT         16      /* Ammo for slings */
1692 #define TV_ARROW        17      /* Ammo for bows */
1693 #define TV_BOLT         18      /* Ammo for x-bows */
1694 #define TV_BOW          19      /* Slings/Bows/Xbows */
1695 #define TV_DIGGING      20      /* Shovels/Picks */
1696 #define TV_HAFTED       21      /* Priest Weapons */
1697 #define TV_POLEARM      22      /* Axes and Pikes */
1698 #define TV_SWORD        23      /* Edged Weapons */
1699 #define TV_BOOTS        30      /* Boots */
1700 #define TV_GLOVES       31      /* Gloves */
1701 #define TV_HELM         32      /* Helms */
1702 #define TV_CROWN        33      /* Crowns */
1703 #define TV_SHIELD       34      /* Shields */
1704 #define TV_CLOAK        35      /* Cloaks */
1705 #define TV_SOFT_ARMOR   36      /* Soft Armor */
1706 #define TV_HARD_ARMOR   37      /* Hard Armor */
1707 #define TV_DRAG_ARMOR   38      /* Dragon Scale Mail */
1708 #define TV_LITE         39      /* Lites (including Specials) */
1709 #define TV_AMULET       40      /* Amulets (including Specials) */
1710 #define TV_RING         45      /* Rings (including Specials) */
1711 #define TV_CARD         50
1712 #define TV_STAFF        55
1713 #define TV_WAND         65
1714 #define TV_ROD          66
1715 #define TV_PARCHEMENT   69
1716 #define TV_SCROLL       70
1717 #define TV_POTION       75
1718 #define TV_FLASK        77
1719 #define TV_FOOD         80
1720 #define TV_LIFE_BOOK    90
1721 #define TV_SORCERY_BOOK 91
1722 #define TV_NATURE_BOOK  92
1723 #define TV_CHAOS_BOOK   93
1724 #define TV_DEATH_BOOK   94
1725 #define TV_TRUMP_BOOK   95
1726 #define TV_ARCANE_BOOK  96
1727 #define TV_ENCHANT_BOOK 97
1728 #define TV_DAEMON_BOOK  98
1729 #define TV_CRUSADE_BOOK 99
1730 #define TV_MUSIC_BOOK   105
1731 #define TV_HISSATSU_BOOK 106
1732 #define TV_GOLD         127     /* Gold can only be picked up by players */
1733
1734 /* Any subvalue */
1735 #define SV_ANY                                  255
1736
1737 /* The "sval" codes for TV_FIGURINE */
1738 #define SV_FIGURINE_NORMAL              0
1739
1740 #define SV_CAPTURE_NONE         0
1741
1742 /* The "sval" codes for TV_STATUE */
1743 #define SV_WOODEN_STATUE                0
1744 #define SV_CLAY_STATUE                  1
1745 #define SV_STONE_STATUE                 2
1746 #define SV_IRON_STATUE                  3
1747 #define SV_COPPER_STATUE                4
1748 #define SV_SILVER_STATUE                5
1749 #define SV_GOLDEN_STATUE                6
1750 #define SV_IVORY_STATUE                 7
1751 #define SV_MITHRIL_STATUE               8
1752 #define SV_ORNATE_STATUE                9
1753 #define SV_PHOTO                        50
1754
1755 /* The "sval" codes for TV_CORPSE */
1756 #define SV_SKELETON                             0
1757 #define SV_CORPSE                                       1
1758
1759 /* The "sval" codes for TV_SHOT/TV_ARROW/TV_BOLT */
1760 #define SV_AMMO_LIGHT                    0      /* pebbles */
1761 #define SV_AMMO_NORMAL                   1      /* shots, arrows, bolts */
1762 #define SV_AMMO_HEAVY                    2      /* seeker arrows and bolts, mithril shots */
1763
1764 /* The "sval" codes for TV_BOW (note information in "sval") */
1765 #define SV_SLING                         2      /* (x2) */
1766 #define SV_SHORT_BOW                    12      /* (x2) */
1767 #define SV_LONG_BOW                     13      /* (x3) */
1768 #define SV_LIGHT_XBOW                   23      /* (x3) */
1769 #define SV_HEAVY_XBOW                   24      /* (x4) */
1770 #define SV_CRIMSON                      50
1771 #define SV_NAMAKE_BOW                   63
1772
1773 /* The "sval" codes for TV_DIGGING */
1774 #define SV_SHOVEL                        1
1775 #define SV_GNOMISH_SHOVEL                2
1776 #define SV_DWARVEN_SHOVEL                3
1777 #define SV_PICK                          4
1778 #define SV_ORCISH_PICK                   5
1779 #define SV_DWARVEN_PICK                  6
1780 #define SV_MATTOCK                       7
1781
1782 /* The "sval" values for TV_HAFTED */
1783 #define SV_CLUB                          1      /* 1d4  */
1784 #define SV_WHIP                          2      /* 1d6  */
1785 #define SV_QUARTERSTAFF                  3      /* 1d9  */
1786 #define SV_NUNCHAKU                      4      /* 2d3  */
1787 #define SV_MACE                          5      /* 2d4  */
1788 #define SV_BALL_AND_CHAIN                6      /* 2d4  */
1789 #define SV_JO_STAFF                      7      /* 1d7  */
1790 #define SV_WAR_HAMMER                    8      /* 3d3  */
1791 #define SV_THREE_PIECE_ROD              11      /* 3d3  */
1792 #define SV_MORNING_STAR                 12      /* 2d6  */
1793 #define SV_FLAIL                        13      /* 2d6  */
1794 #define SV_BO_STAFF                     14      /* 1d11 */
1795 #define SV_LEAD_FILLED_MACE             15      /* 3d4  */
1796 #define SV_TETSUBO                      16      /* 2d7  */
1797 #define SV_TWO_HANDED_FLAIL             18      /* 3d6  */
1798 #define SV_GREAT_HAMMER                 19      /* 4d6  */
1799 #define SV_MACE_OF_DISRUPTION           20      /* 5d8  */
1800 #define SV_WIZSTAFF                     21      /* 1d4  */
1801 #define SV_GROND                        50      /* 3d4  */
1802 #define SV_NAMAKE_HAMMER                63
1803
1804 /* The "sval" values for TV_POLEARM */
1805 #define SV_HATCHET                       1      /* 1d5 */
1806 #define SV_SPEAR                         2      /* 1d6 */
1807 #define SV_SICKLE                        3      /* 2d3 */
1808 #define SV_AWL_PIKE                      4      /* 1d8 */
1809 #define SV_TRIDENT                       5      /* 1d9 */
1810 #define SV_FAUCHARD                      6  /* 1d10 */
1811 #define SV_BROAD_SPEAR                   7      /* 1d9 */
1812 #define SV_PIKE                          8      /* 2d5 */
1813 #define SV_NAGINATA                      9  /* 2d6 */
1814 #define SV_BEAKED_AXE                   10      /* 2d6 */
1815 #define SV_BROAD_AXE                    11      /* 2d6 */
1816 #define SV_LUCERNE_HAMMER               12      /* 2d5  */
1817 #define SV_GLAIVE                       13      /* 2d6 */
1818 #define SV_LAJATANG                     14      /* 2d7 */
1819 #define SV_HALBERD                      15      /* 3d4 */
1820 #define SV_GUISARME                     16  /* 2d5 */
1821 #define SV_SCYTHE                       17      /* 5d3 */
1822 #define SV_LANCE                        20      /* 2d8 */
1823 #define SV_BATTLE_AXE                   22      /* 2d8 */
1824 #define SV_GREAT_AXE                    25      /* 4d4 */
1825 #define SV_TRIFURCATE_SPEAR             26      /* 2d9 */
1826 #define SV_LOCHABER_AXE                 28      /* 3d8 */
1827 #define SV_HEAVY_LANCE                  29  /* 4d8 */
1828 #define SV_SCYTHE_OF_SLICING            30      /* 8d4 */
1829 #define SV_TSURIZAO                     40      /* 1d1 */
1830 #define SV_DEATH_SCYTHE                 50      /* 10d10 */
1831
1832 /* The "sval" codes for TV_SWORD */
1833 #define SV_BROKEN_DAGGER                 1  /* 1d1 */
1834 #define SV_BROKEN_SWORD                  2  /* 1d2 */
1835 #define SV_DAGGER                        4  /* 1d4 */
1836 #define SV_MAIN_GAUCHE                   5  /* 1d5 */
1837 #define SV_TANTO                         6  /* 1d5 */
1838 #define SV_RAPIER                        7  /* 1d6 */
1839 #define SV_SMALL_SWORD                   8  /* 1d6 */
1840 #define SV_BASILLARD                     9  /* 1d8 */
1841 #define SV_SHORT_SWORD                  10  /* 1d7 */
1842 #define SV_SABRE                        11  /* 1d7 */
1843 #define SV_CUTLASS                      12  /* 1d7 */
1844 #define SV_WAKIZASHI                    13  /* 2d4 */
1845 #define SV_KHOPESH                      14  /* 2d4 */
1846 #define SV_TULWAR                       15  /* 2d4 */
1847 #define SV_BROAD_SWORD                  16  /* 2d5 */
1848 #define SV_LONG_SWORD                   17  /* 2d5 */
1849 #define SV_SCIMITAR                     18  /* 2d5 */
1850 #define SV_NINJATO                      19  /* 1d9 */
1851 #define SV_KATANA                       20  /* 3d4 */
1852 #define SV_BASTARD_SWORD                21  /* 3d4 */
1853 #define SV_GREAT_SCIMITAR               22  /* 4d5 */
1854 #define SV_CLAYMORE                     23  /* 2d8 */
1855 #define SV_ESPADON                      24  /* 2d9 */
1856 #define SV_TWO_HANDED_SWORD             25  /* 3d6 */
1857 #define SV_FLAMBERGE                    26  /* 3d7 */
1858 #define SV_NO_DACHI                     27  /* 5d4 */
1859 #define SV_EXECUTIONERS_SWORD           28  /* 4d5 */
1860 #define SV_ZWEIHANDER                   29  /* 4d6 */
1861 #define SV_BLADE_OF_CHAOS               30  /* 6d5 */
1862 #define SV_DIAMOND_EDGE                 31  /* 7d5 */
1863 #define SV_DOKUBARI                     32  /* 1d1 */
1864 #define SV_HAYABUSA                     33  /* 1d4 */
1865
1866 /* The "sval" codes for TV_SHIELD */
1867 #define SV_SMALL_LEATHER_SHIELD          2
1868 #define SV_SMALL_METAL_SHIELD            3
1869 #define SV_LARGE_LEATHER_SHIELD          4
1870 #define SV_LARGE_METAL_SHIELD            5
1871 #define SV_DRAGON_SHIELD                 6
1872 #define SV_KNIGHT_SHIELD                 7
1873 #define SV_SHIELD_OF_DEFLECTION         10
1874 #define SV_YATA_MIRROR                  50
1875
1876 /* The "sval" codes for TV_HELM */
1877 #define SV_HARD_LEATHER_CAP              2
1878 #define SV_METAL_CAP                     3
1879 #define SV_JINGASA                       4  /* 4 */
1880 #define SV_IRON_HELM                     5
1881 #define SV_STEEL_HELM                    6
1882 #define SV_DRAGON_HELM                   7
1883 #define SV_KABUTO                        8  /* 7 */
1884 #define SV_IRON_CROWN                   10
1885 #define SV_GOLDEN_CROWN                 11
1886 #define SV_JEWELED_CROWN                12
1887 #define SV_MORGOTH                      50
1888
1889 /* The "sval" codes for TV_BOOTS */
1890 #define SV_PAIR_OF_SOFT_LEATHER_BOOTS    2
1891 #define SV_PAIR_OF_HARD_LEATHER_BOOTS    3
1892 #define SV_PAIR_OF_DRAGON_GREAVE         4
1893 #define SV_PAIR_OF_METAL_SHOD_BOOTS      6
1894
1895 /* The "sval" codes for TV_CLOAK */
1896 #define SV_CLOAK                         1
1897 #define SV_ELVEN_CLOAK                   2
1898 #define SV_FUR_CLOAK                     3
1899 #define SV_ETHEREAL_CLOAK                5
1900 #define SV_SHADOW_CLOAK                  6
1901
1902 /* The "sval" codes for TV_GLOVES */
1903 #define SV_SET_OF_LEATHER_GLOVES         1
1904 #define SV_SET_OF_GAUNTLETS              2
1905 #define SV_SET_OF_DRAGON_GLOVES          3
1906 #define SV_SET_OF_CESTI                  5
1907
1908 /* The "sval" codes for TV_SOFT_ARMOR */
1909 #define SV_T_SHIRT                       0
1910 #define SV_FILTHY_RAG                    1
1911 #define SV_ROBE                          2
1912 #define SV_PAPER_ARMOR                   3  /* 4 */
1913 #define SV_SOFT_LEATHER_ARMOR            4
1914 #define SV_SOFT_STUDDED_LEATHER          5
1915 #define SV_HARD_LEATHER_ARMOR            6
1916 #define SV_HARD_STUDDED_LEATHER          7
1917 #define SV_RHINO_HIDE_ARMOR              8
1918 #define SV_CORD_ARMOR                    9  /*  6 */
1919 #define SV_PADDED_ARMOR                 10  /*  4 */
1920 #define SV_LEATHER_SCALE_MAIL           11
1921 #define SV_LEATHER_JACK                 12
1922 #define SV_KUROSHOUZOKU                 13
1923 #define SV_STONE_AND_HIDE_ARMOR         15  /* 15 */
1924 #define SV_ABUNAI_MIZUGI                50
1925 #define SV_YOIYAMI_ROBE                 60
1926 #define SV_NAMAKE_ARMOR                 63
1927
1928 /* The "sval" codes for TV_HARD_ARMOR */
1929 #define SV_RUSTY_CHAIN_MAIL              1  /* 14- */
1930 #define SV_RING_MAIL                     2  /* 12  */
1931 #define SV_METAL_SCALE_MAIL              3  /* 13  */
1932 #define SV_CHAIN_MAIL                    4  /* 14  */
1933 #define SV_DOUBLE_RING_MAIL              5  /* 15  */
1934 #define SV_AUGMENTED_CHAIN_MAIL          6  /* 16  */
1935 #define SV_DOUBLE_CHAIN_MAIL             7  /* 16  */
1936 #define SV_BAR_CHAIN_MAIL                8  /* 18  */
1937 #define SV_METAL_BRIGANDINE_ARMOUR       9  /* 19  */
1938 #define SV_SPLINT_MAIL                  10  /* 19  */
1939 #define SV_DO_MARU                      11  /* 20  */
1940 #define SV_PARTIAL_PLATE_ARMOUR         12  /* 22  */
1941 #define SV_METAL_LAMELLAR_ARMOUR        13  /* 23  */
1942 #define SV_HARAMAKIDO                   14  /* 17  */
1943 #define SV_FULL_PLATE_ARMOUR            15  /* 25  */
1944 #define SV_O_YOROI                      16  /* 24  */
1945 #define SV_RIBBED_PLATE_ARMOUR          18  /* 28  */
1946 #define SV_MITHRIL_CHAIN_MAIL           20  /* 28+ */
1947 #define SV_MITHRIL_PLATE_MAIL           25  /* 35+ */
1948 #define SV_ADAMANTITE_PLATE_MAIL        30  /* 40+ */
1949
1950 /* The "sval" codes for TV_DRAG_ARMOR */
1951 #define SV_DRAGON_BLACK                  1
1952 #define SV_DRAGON_BLUE                   2
1953 #define SV_DRAGON_WHITE                  3
1954 #define SV_DRAGON_RED                    4
1955 #define SV_DRAGON_GREEN                  5
1956 #define SV_DRAGON_MULTIHUED              6
1957 #define SV_DRAGON_SHINING               10
1958 #define SV_DRAGON_LAW                   12
1959 #define SV_DRAGON_BRONZE                14
1960 #define SV_DRAGON_GOLD                  16
1961 #define SV_DRAGON_CHAOS                 18
1962 #define SV_DRAGON_BALANCE               20
1963 #define SV_DRAGON_POWER                 30
1964
1965 /* The sval codes for TV_LITE */
1966 #define SV_LITE_TORCH                    0
1967 #define SV_LITE_LANTERN                  1
1968 #define SV_LITE_FEANOR                   2
1969 #define SV_LITE_EDISON                   3
1970 #define SV_LITE_GALADRIEL                4
1971 #define SV_LITE_ELENDIL                  5
1972 #define SV_LITE_THRAIN                   6
1973 #define SV_LITE_LORE                     7
1974 #define SV_LITE_PALANTIR                 8
1975 #define SV_LITE_FLY_STONE                9
1976
1977 /* The "sval" codes for TV_AMULET */
1978 #define SV_AMULET_DOOM                   0
1979 #define SV_AMULET_TELEPORT               1
1980 #define SV_AMULET_ADORNMENT              2
1981 #define SV_AMULET_SLOW_DIGEST            3
1982 #define SV_AMULET_RESIST_ACID            4
1983 #define SV_AMULET_SEARCHING              5
1984 #define SV_AMULET_BRILLIANCE             6
1985 #define SV_AMULET_CHARISMA               7
1986 #define SV_AMULET_THE_MAGI               8
1987 #define SV_AMULET_REFLECTION             9
1988 #define SV_AMULET_CARLAMMAS             10
1989 #define SV_AMULET_INGWE                 11
1990 #define SV_AMULET_DWARVES               12
1991 #define SV_AMULET_NO_MAGIC              13
1992 #define SV_AMULET_NO_TELE               14
1993 #define SV_AMULET_RESISTANCE            15
1994 #define SV_AMULET_TELEPATHY             16
1995 #define SV_AMULET_FARAMIR               17
1996 #define SV_AMULET_BOROMIR               18
1997 #define SV_AMULET_MAGATAMA              19
1998 #define SV_AMULET_INROU                 20
1999 #define SV_AMULET_INTELLIGENCE          21
2000 #define SV_AMULET_WISDOM                22
2001 #define SV_AMULET_MAGIC_MASTERY         23
2002 #define SV_AMULET_NIGHT                 24
2003
2004 /* The sval codes for TV_RING */
2005 #define SV_RING_WOE                      0
2006 #define SV_RING_AGGRAVATION              1
2007 #define SV_RING_WEAKNESS                 2
2008 #define SV_RING_STUPIDITY                3
2009 #define SV_RING_TELEPORTATION            4
2010 #define SV_RING_SLOW_DIGESTION           6
2011 #define SV_RING_FEATHER_FALL             7
2012 #define SV_RING_RESIST_FIRE              8
2013 #define SV_RING_RESIST_COLD              9
2014 #define SV_RING_SUSTAIN_STR             10
2015 #define SV_RING_SUSTAIN_INT             11
2016 #define SV_RING_SUSTAIN_WIS             12
2017 #define SV_RING_SUSTAIN_DEX             13
2018 #define SV_RING_SUSTAIN_CON             14
2019 #define SV_RING_SUSTAIN_CHR             15
2020 #define SV_RING_PROTECTION              16
2021 #define SV_RING_ACID                    17
2022 #define SV_RING_FLAMES                  18
2023 #define SV_RING_ICE                     19
2024 #define SV_RING_RESIST_POIS             20
2025 #define SV_RING_FREE_ACTION             21
2026 #define SV_RING_SEE_INVIS               22
2027 #define SV_RING_SEARCHING               23
2028 #define SV_RING_STR                     24
2029 #define SV_RING_ELEC                    25
2030 #define SV_RING_DEX                     26
2031 #define SV_RING_CON                     27
2032 #define SV_RING_ACCURACY                28
2033 #define SV_RING_DAMAGE                  29
2034 #define SV_RING_SLAYING                 30
2035 #define SV_RING_SPEED                   31
2036 #define SV_RING_BARAHIR                 32
2037 #define SV_RING_TULKAS                  33
2038 #define SV_RING_NARYA                   34
2039 #define SV_RING_NENYA                   35
2040 #define SV_RING_VILYA                   36
2041 #define SV_RING_POWER                   37
2042 #define SV_RING_RES_FEAR                38
2043 #define SV_RING_RES_LD                  39
2044 #define SV_RING_RES_NETHER              40
2045 #define SV_RING_RES_NEXUS               41
2046 #define SV_RING_RES_SOUND               42
2047 #define SV_RING_RES_CONFUSION           43
2048 #define SV_RING_RES_SHARDS              44
2049 #define SV_RING_RES_DISENCHANT          45
2050 #define SV_RING_RES_CHAOS               46
2051 #define SV_RING_RES_BLINDNESS           47
2052 #define SV_RING_LORDLY                  48
2053 #define SV_RING_ATTACKS                 49
2054 #define SV_RING_AHO                     50
2055 #define SV_RING_SHOTS                   51
2056 #define SV_RING_SUSTAIN                 52
2057 #define SV_RING_DEC_MANA                53
2058 #define SV_RING_WARNING                 54
2059 #define SV_RING_MUSCLE                  55
2060
2061 #define SV_EXPRESS_CARD                  0
2062
2063 /* The "sval" codes for TV_STAFF */
2064 #define SV_STAFF_DARKNESS                0
2065 #define SV_STAFF_SLOWNESS                1
2066 #define SV_STAFF_HASTE_MONSTERS          2
2067 #define SV_STAFF_SUMMONING               3
2068 #define SV_STAFF_TELEPORTATION           4
2069 #define SV_STAFF_IDENTIFY                5
2070 #define SV_STAFF_REMOVE_CURSE            6
2071 #define SV_STAFF_STARLITE                7
2072 #define SV_STAFF_LITE                    8
2073 #define SV_STAFF_MAPPING                 9
2074 #define SV_STAFF_DETECT_GOLD            10
2075 #define SV_STAFF_DETECT_ITEM            11
2076 #define SV_STAFF_DETECT_TRAP            12
2077 #define SV_STAFF_DETECT_DOOR            13
2078 #define SV_STAFF_DETECT_INVIS           14
2079 #define SV_STAFF_DETECT_EVIL            15
2080 #define SV_STAFF_CURE_LIGHT             16
2081 #define SV_STAFF_CURING                 17
2082 #define SV_STAFF_HEALING                18
2083 #define SV_STAFF_THE_MAGI               19
2084 #define SV_STAFF_SLEEP_MONSTERS         20
2085 #define SV_STAFF_SLOW_MONSTERS          21
2086 #define SV_STAFF_SPEED                  22
2087 #define SV_STAFF_PROBING                23
2088 #define SV_STAFF_DISPEL_EVIL            24
2089 #define SV_STAFF_POWER                  25
2090 #define SV_STAFF_HOLINESS               26
2091 #define SV_STAFF_GENOCIDE               27
2092 #define SV_STAFF_EARTHQUAKES            28
2093 #define SV_STAFF_DESTRUCTION            29
2094 #define SV_STAFF_ANIMATE_DEAD           30
2095 #define SV_STAFF_MSTORM                 31
2096
2097
2098 /* The "sval" codes for TV_WAND */
2099 #define SV_WAND_HEAL_MONSTER             0
2100 #define SV_WAND_HASTE_MONSTER            1
2101 #define SV_WAND_CLONE_MONSTER            2
2102 #define SV_WAND_TELEPORT_AWAY            3
2103 #define SV_WAND_DISARMING                4
2104 #define SV_WAND_TRAP_DOOR_DEST           5
2105 #define SV_WAND_STONE_TO_MUD             6
2106 #define SV_WAND_LITE                     7
2107 #define SV_WAND_SLEEP_MONSTER            8
2108 #define SV_WAND_SLOW_MONSTER             9
2109 #define SV_WAND_CONFUSE_MONSTER         10
2110 #define SV_WAND_FEAR_MONSTER            11
2111 #define SV_WAND_DRAIN_LIFE              12
2112 #define SV_WAND_POLYMORPH               13
2113 #define SV_WAND_STINKING_CLOUD          14
2114 #define SV_WAND_MAGIC_MISSILE           15
2115 #define SV_WAND_ACID_BOLT               16
2116 #define SV_WAND_CHARM_MONSTER           17
2117 #define SV_WAND_FIRE_BOLT               18
2118 #define SV_WAND_COLD_BOLT               19
2119 #define SV_WAND_ACID_BALL               20
2120 #define SV_WAND_ELEC_BALL               21
2121 #define SV_WAND_FIRE_BALL               22
2122 #define SV_WAND_COLD_BALL               23
2123 #define SV_WAND_WONDER                  24
2124 #define SV_WAND_DISINTEGRATE            25
2125 #define SV_WAND_DRAGON_FIRE             26
2126 #define SV_WAND_DRAGON_COLD             27
2127 #define SV_WAND_DRAGON_BREATH           28
2128 #define SV_WAND_ROCKETS                 29
2129 #define SV_WAND_STRIKING                30
2130 #define SV_WAND_GENOCIDE                31
2131
2132 /* The "sval" codes for TV_ROD */
2133 #define SV_ROD_DETECT_TRAP               0
2134 #define SV_ROD_DETECT_DOOR               1
2135 #define SV_ROD_IDENTIFY                  2
2136 #define SV_ROD_RECALL                    3
2137 #define SV_ROD_ILLUMINATION              4
2138 #define SV_ROD_MAPPING                   5
2139 #define SV_ROD_DETECTION                 6
2140 #define SV_ROD_PROBING                   7
2141 #define SV_ROD_CURING                    8
2142 #define SV_ROD_HEALING                   9
2143 #define SV_ROD_RESTORATION              10
2144 #define SV_ROD_SPEED                    11
2145 #define SV_ROD_PESTICIDE                12
2146 #define SV_ROD_TELEPORT_AWAY            13
2147 #define SV_ROD_DISARMING                14
2148 #define SV_ROD_LITE                     15
2149 #define SV_ROD_SLEEP_MONSTER            16
2150 #define SV_ROD_SLOW_MONSTER             17
2151 #define SV_ROD_DRAIN_LIFE               18
2152 #define SV_ROD_POLYMORPH                19
2153 #define SV_ROD_ACID_BOLT                20
2154 #define SV_ROD_ELEC_BOLT                21
2155 #define SV_ROD_FIRE_BOLT                22
2156 #define SV_ROD_COLD_BOLT                23
2157 #define SV_ROD_ACID_BALL                24
2158 #define SV_ROD_ELEC_BALL                25
2159 #define SV_ROD_FIRE_BALL                26
2160 #define SV_ROD_COLD_BALL                27
2161 #define SV_ROD_HAVOC                    28
2162 #define SV_ROD_STONE_TO_MUD             29
2163 #define SV_ROD_AGGRAVATE                30
2164
2165
2166 /* The "sval" codes for TV_SCROLL */
2167
2168 #define SV_SCROLL_DARKNESS               0
2169 #define SV_SCROLL_AGGRAVATE_MONSTER      1
2170 #define SV_SCROLL_CURSE_ARMOR            2
2171 #define SV_SCROLL_CURSE_WEAPON           3
2172 #define SV_SCROLL_SUMMON_MONSTER         4
2173 #define SV_SCROLL_SUMMON_UNDEAD          5
2174 #define SV_SCROLL_SUMMON_PET             6
2175 #define SV_SCROLL_TRAP_CREATION          7
2176 #define SV_SCROLL_PHASE_DOOR             8
2177 #define SV_SCROLL_TELEPORT               9
2178 #define SV_SCROLL_TELEPORT_LEVEL        10
2179 #define SV_SCROLL_WORD_OF_RECALL        11
2180 #define SV_SCROLL_IDENTIFY              12
2181 #define SV_SCROLL_STAR_IDENTIFY         13
2182 #define SV_SCROLL_REMOVE_CURSE          14
2183 #define SV_SCROLL_STAR_REMOVE_CURSE     15
2184 #define SV_SCROLL_ENCHANT_ARMOR         16
2185 #define SV_SCROLL_ENCHANT_WEAPON_TO_HIT 17
2186 #define SV_SCROLL_ENCHANT_WEAPON_TO_DAM 18
2187 /* xxx enchant missile? */
2188 #define SV_SCROLL_STAR_ENCHANT_ARMOR    20
2189 #define SV_SCROLL_STAR_ENCHANT_WEAPON   21
2190 #define SV_SCROLL_RECHARGING            22
2191 #define SV_SCROLL_MUNDANITY             23
2192 #define SV_SCROLL_LIGHT                 24
2193 #define SV_SCROLL_MAPPING               25
2194 #define SV_SCROLL_DETECT_GOLD           26
2195 #define SV_SCROLL_DETECT_ITEM           27
2196 #define SV_SCROLL_DETECT_TRAP           28
2197 #define SV_SCROLL_DETECT_DOOR           29
2198 #define SV_SCROLL_DETECT_INVIS          30
2199 /* xxx (detect evil?) */
2200 #define SV_SCROLL_SATISFY_HUNGER        32
2201 #define SV_SCROLL_BLESSING              33
2202 #define SV_SCROLL_HOLY_CHANT            34
2203 #define SV_SCROLL_HOLY_PRAYER           35
2204 #define SV_SCROLL_MONSTER_CONFUSION     36
2205 #define SV_SCROLL_PROTECTION_FROM_EVIL  37
2206 #define SV_SCROLL_RUNE_OF_PROTECTION    38
2207 #define SV_SCROLL_TRAP_DOOR_DESTRUCTION 39
2208 /* xxx */
2209 #define SV_SCROLL_STAR_DESTRUCTION      41
2210 #define SV_SCROLL_DISPEL_UNDEAD         42
2211 #define SV_SCROLL_SPELL                 43
2212 #define SV_SCROLL_GENOCIDE              44
2213 #define SV_SCROLL_MASS_GENOCIDE         45
2214 #define SV_SCROLL_ACQUIREMENT           46
2215 #define SV_SCROLL_STAR_ACQUIREMENT      47
2216 #define SV_SCROLL_FIRE                  48
2217 #define SV_SCROLL_ICE                   49
2218 #define SV_SCROLL_CHAOS                 50
2219 #define SV_SCROLL_RUMOR                 51
2220 #define SV_SCROLL_ARTIFACT              52
2221 #define SV_SCROLL_RESET_RECALL          53
2222 #define SV_SCROLL_SUMMON_KIN            54
2223
2224 /* The "sval" codes for TV_POTION */
2225 #define SV_POTION_WATER                  0
2226 #define SV_POTION_APPLE_JUICE            1
2227 #define SV_POTION_SLIME_MOLD             2
2228 /* xxx (fixed color) */
2229 #define SV_POTION_SLOWNESS               4
2230 #define SV_POTION_SALT_WATER             5
2231 #define SV_POTION_POISON                 6
2232 #define SV_POTION_BLINDNESS              7
2233 /* xxx */
2234 #define SV_POTION_CONFUSION              9
2235 /* xxx */
2236 #define SV_POTION_SLEEP                 11
2237 /* xxx */
2238 #define SV_POTION_LOSE_MEMORIES         13
2239 /* xxx */
2240 #define SV_POTION_RUINATION             15
2241 #define SV_POTION_DEC_STR               16
2242 #define SV_POTION_DEC_INT               17
2243 #define SV_POTION_DEC_WIS               18
2244 #define SV_POTION_DEC_DEX               19
2245 #define SV_POTION_DEC_CON               20
2246 #define SV_POTION_DEC_CHR               21
2247 #define SV_POTION_DETONATIONS           22
2248 #define SV_POTION_DEATH                 23
2249 #define SV_POTION_INFRAVISION           24
2250 #define SV_POTION_DETECT_INVIS          25
2251 #define SV_POTION_SLOW_POISON           26
2252 #define SV_POTION_CURE_POISON           27
2253 #define SV_POTION_BOLDNESS              28
2254 #define SV_POTION_SPEED                 29
2255 #define SV_POTION_RESIST_HEAT           30
2256 #define SV_POTION_RESIST_COLD           31
2257 #define SV_POTION_HEROISM               32
2258 #define SV_POTION_BESERK_STRENGTH       33
2259 #define SV_POTION_CURE_LIGHT            34
2260 #define SV_POTION_CURE_SERIOUS          35
2261 #define SV_POTION_CURE_CRITICAL         36
2262 #define SV_POTION_HEALING               37
2263 #define SV_POTION_STAR_HEALING          38
2264 #define SV_POTION_LIFE                  39
2265 #define SV_POTION_RESTORE_MANA          40
2266 #define SV_POTION_RESTORE_EXP           41
2267 #define SV_POTION_RES_STR               42
2268 #define SV_POTION_RES_INT               43
2269 #define SV_POTION_RES_WIS               44
2270 #define SV_POTION_RES_DEX               45
2271 #define SV_POTION_RES_CON               46
2272 #define SV_POTION_RES_CHR               47
2273 #define SV_POTION_INC_STR               48
2274 #define SV_POTION_INC_INT               49
2275 #define SV_POTION_INC_WIS               50
2276 #define SV_POTION_INC_DEX               51
2277 #define SV_POTION_INC_CON               52
2278 #define SV_POTION_INC_CHR               53
2279 /* xxx */
2280 #define SV_POTION_AUGMENTATION          55
2281 #define SV_POTION_ENLIGHTENMENT         56
2282 #define SV_POTION_STAR_ENLIGHTENMENT    57
2283 #define SV_POTION_SELF_KNOWLEDGE        58
2284 #define SV_POTION_EXPERIENCE            59
2285 #define SV_POTION_RESISTANCE            60
2286 #define SV_POTION_CURING                61
2287 #define SV_POTION_INVULNERABILITY       62
2288 #define SV_POTION_NEW_LIFE              63
2289 #define SV_POTION_NEO_TSUYOSHI          64
2290 #define SV_POTION_TSUYOSHI              65
2291 #define SV_POTION_POLYMORPH             66
2292
2293 /* The "sval" codes for TV_FOOD */
2294 #define SV_FOOD_POISON                   0
2295 #define SV_FOOD_BLINDNESS                1
2296 #define SV_FOOD_PARANOIA                 2
2297 #define SV_FOOD_CONFUSION                3
2298 #define SV_FOOD_HALLUCINATION            4
2299 #define SV_FOOD_PARALYSIS                5
2300 #define SV_FOOD_WEAKNESS                 6
2301 #define SV_FOOD_SICKNESS                 7
2302 #define SV_FOOD_STUPIDITY                8
2303 #define SV_FOOD_NAIVETY                  9
2304 #define SV_FOOD_UNHEALTH                10
2305 #define SV_FOOD_DISEASE                 11
2306 #define SV_FOOD_CURE_POISON             12
2307 #define SV_FOOD_CURE_BLINDNESS          13
2308 #define SV_FOOD_CURE_PARANOIA           14
2309 #define SV_FOOD_CURE_CONFUSION          15
2310 #define SV_FOOD_CURE_SERIOUS            16
2311 #define SV_FOOD_RESTORE_STR             17
2312 #define SV_FOOD_RESTORE_CON             18
2313 #define SV_FOOD_RESTORING               19
2314 /* many missing mushrooms */
2315 #define SV_FOOD_BISCUIT                 32
2316 #define SV_FOOD_JERKY                   33
2317 #define SV_FOOD_RATION                  35
2318 #define SV_FOOD_SLIME_MOLD              36
2319 #define SV_FOOD_WAYBREAD                37
2320 #define SV_FOOD_PINT_OF_ALE             38
2321 #define SV_FOOD_PINT_OF_WINE            39
2322
2323
2324 /*
2325  * Special "sval" limit -- first "normal" food
2326  */
2327 #define SV_FOOD_MIN_FOOD                32
2328
2329 /*
2330  * Special "sval" limit -- first "aimed" rod
2331  */
2332 #define SV_ROD_MIN_DIRECTION    12
2333
2334 /*
2335  * Special "sval" limit -- first "large" chest
2336  */
2337 #define SV_CHEST_MIN_LARGE      4
2338 #define SV_CHEST_KANDUME        50
2339
2340 /*
2341  * Special "sval" limit -- first "good" magic/prayer book
2342  */
2343 #define SV_BOOK_MIN_GOOD    2
2344
2345
2346 #define OBJ_GOLD_LIST   480     /* First "gold" entry */
2347 #define MAX_GOLD        18      /* Number of "gold" entries */
2348
2349
2350 /*** General flag values ***/
2351
2352
2353 /*
2354  * Special cave grid flags
2355  */
2356 #define CAVE_MARK       0x0001    /* memorized feature */
2357 #define CAVE_GLOW       0x0002    /* self-illuminating */
2358 #define CAVE_ICKY       0x0004    /* part of a vault */
2359 #define CAVE_ROOM       0x0008    /* part of a room */
2360 #define CAVE_LITE       0x0010    /* lite flag  */
2361 #define CAVE_VIEW       0x0020    /* view flag */
2362 #define CAVE_TEMP       0x0040    /* temp flag */
2363 #define CAVE_XTRA       0x0080    /* misc flag */
2364 #define CAVE_MNLT       0x0100  /* Illuminated by monster */
2365
2366 #define CAVE_TRAP       0x8000
2367
2368 /* Used only while cave generation */
2369 #define CAVE_FLOOR      0x0200
2370 #define CAVE_EXTRA      0x0400
2371 #define CAVE_INNER      0x0800
2372 #define CAVE_OUTER      0x1000
2373 #define CAVE_SOLID      0x2000
2374 #define CAVE_VAULT      0x4000
2375 #define CAVE_MASK (CAVE_FLOOR | CAVE_EXTRA | CAVE_INNER | CAVE_OUTER | CAVE_SOLID | CAVE_VAULT)
2376
2377 /* Used only after cave generation */
2378 #define CAVE_UNSAFE     0x2000    /* Might have trap */
2379 #define CAVE_IN_DETECT  0x4000    /* trap detected area (inner circle only) */
2380
2381
2382 /*
2383  * Bit flags for the "project()" function
2384  *
2385  *   JUMP: Jump directly to the target location (this is a hack)
2386  *   BEAM: Work as a beam weapon (affect every grid passed through)
2387  *   THRU: Continue "through" the target (used for "bolts"/"beams")
2388  *   STOP: Stop as soon as we hit a monster (used for "bolts")
2389  *   GRID: Affect each grid in the "blast area" in some way
2390  *   ITEM: Affect each object in the "blast area" in some way
2391  *   KILL: Affect each monster in the "blast area" in some way
2392  *   HIDE: Hack -- disable "visual" feedback from projection
2393  */
2394 #define PROJECT_JUMP       0x01
2395 #define PROJECT_BEAM       0x02
2396 #define PROJECT_THRU       0x04
2397 #define PROJECT_STOP       0x08
2398 #define PROJECT_GRID       0x10
2399 #define PROJECT_ITEM       0x20
2400 #define PROJECT_KILL       0x40
2401 #define PROJECT_HIDE       0x80
2402 #define PROJECT_DISI       0x100
2403 #define PROJECT_PLAYER     0x200
2404 #define PROJECT_MONSTER    0x400
2405 #define PROJECT_NO_REF     0x800
2406 #define PROJECT_NO_HANGEKI 0x1000
2407 #define PROJECT_PATH       0x2000
2408 #define PROJECT_FAST       0x4000
2409
2410 /*
2411  * Bit flags for the "enchant()" function
2412  */
2413 #define ENCH_TOHIT      0x01 /* Enchant to hit */
2414 #define ENCH_TODAM      0x02 /* Enchant to damage */
2415 #define ENCH_TOAC       0x04 /* Enchant to AC */
2416 #define ENCH_FORCE      0x08 /* Force enchantment */
2417
2418 /*
2419  * Bit flags for the "target_set" function XXX XXX XXX
2420  *
2421  *      KILL: Target monsters
2422  *      LOOK: Describe grid fully
2423  *      XTRA: Currently unused flag
2424  *      GRID: Select from all grids
2425  */
2426 #define TARGET_KILL             0x01
2427 #define TARGET_LOOK             0x02
2428 #define TARGET_XTRA             0x04
2429 #define TARGET_GRID             0x08
2430
2431
2432 /*
2433  * Bit flags for control of get_check_strict()
2434  */
2435 #define CHECK_OKAY_CANCEL 0x01
2436 #define CHECK_NO_ESCAPE   0x02
2437 #define CHECK_NO_HISTORY  0x04
2438
2439
2440 /*
2441  * Some bit-flags for the "smart" field
2442  */
2443 #define SM_RES_ACID             0x00000001
2444 #define SM_RES_ELEC             0x00000002
2445 #define SM_RES_FIRE             0x00000004
2446 #define SM_RES_COLD             0x00000008
2447 #define SM_RES_POIS             0x00000010
2448 #define SM_RES_NETH             0x00000020
2449 #define SM_RES_LITE             0x00000040
2450 #define SM_RES_DARK             0x00000080
2451 #define SM_RES_FEAR             0x00000100
2452 #define SM_RES_CONF             0x00000200
2453 #define SM_RES_CHAOS            0x00000400
2454 #define SM_RES_DISEN            0x00000800
2455 #define SM_RES_BLIND            0x00001000
2456 #define SM_RES_NEXUS            0x00002000
2457 #define SM_RES_SOUND            0x00004000
2458 #define SM_RES_SHARD            0x00008000
2459 #define SM_OPP_ACID             0x00010000
2460 #define SM_OPP_ELEC             0x00020000
2461 #define SM_OPP_FIRE             0x00040000
2462 #define SM_OPP_COLD             0x00080000
2463 #define SM_OPP_POIS             0x00100000
2464 #define SM_OPP_XXX1             0x00200000 /* (unused) */
2465 #define SM_CLONED               0x00400000 /* XXX Cloned */
2466 #define SM_PET                  0x00800000 /* XXX Pet */
2467 #define SM_IMM_ACID             0x01000000
2468 #define SM_IMM_ELEC             0x02000000
2469 #define SM_IMM_FIRE             0x04000000
2470 #define SM_IMM_COLD             0x08000000
2471 #define SM_FRIENDLY             0x10000000 /* XXX Friendly */
2472 #define SM_IMM_REFLECT          0x20000000
2473 #define SM_IMM_FREE             0x40000000
2474 #define SM_IMM_MANA             0x80000000
2475
2476
2477 /*
2478  * Bit flags for the "get_item" function
2479  */
2480 #define USE_EQUIP       0x01    /* Allow equip items */
2481 #define USE_INVEN       0x02    /* Allow inven items */
2482 #define USE_FLOOR       0x04    /* Allow floor items */
2483
2484
2485 /*
2486  * Bit flags for the "p_ptr->notice" variable
2487  */
2488 #define PN_COMBINE      0x00000001L     /* Combine the pack */
2489 #define PN_REORDER      0x00000002L     /* Reorder the pack */
2490 /* xxx (many) */
2491
2492
2493 /*
2494  * Bit flags for the "p_ptr->update" variable
2495  */
2496 #define PU_BONUS        0x00000001L     /* Calculate bonuses */
2497 #define PU_TORCH        0x00000002L     /* Calculate torch radius */
2498 /* xxx (many) */
2499 #define PU_HP           0x00000010L     /* Calculate chp and mhp */
2500 #define PU_MANA         0x00000020L     /* Calculate csp and msp */
2501 #define PU_SPELLS       0x00000040L     /* Calculate spells */
2502 /* xxx (many) */
2503 /* xxx (many) */
2504 #define PU_UN_VIEW      0x00010000L     /* Forget view */
2505 #define PU_UN_LITE      0x00020000L     /* Forget lite */
2506 /* xxx (many) */
2507 #define PU_VIEW         0x00100000L     /* Update view */
2508 #define PU_LITE         0x00200000L     /* Update lite */
2509 #define PU_MON_LITE     0x00400000L     /* Monster illumination */
2510 /* xxx */
2511 #define PU_MONSTERS     0x01000000L     /* Update monsters */
2512 #define PU_DISTANCE     0x02000000L     /* Update distances */
2513 /* xxx */
2514 #define PU_FLOW         0x10000000L     /* Update flow */
2515 /* xxx (many) */
2516
2517
2518 /*
2519  * Bit flags for the "p_ptr->redraw" variable
2520  */
2521 #define PR_MISC         0x00000001L     /* Display Race/Class */
2522 #define PR_TITLE        0x00000002L     /* Display Title */
2523 #define PR_LEV          0x00000004L     /* Display Level */
2524 #define PR_EXP          0x00000008L     /* Display Experience */
2525 #define PR_STATS        0x00000010L     /* Display Stats */
2526 #define PR_ARMOR        0x00000020L     /* Display Armor */
2527 #define PR_HP           0x00000040L     /* Display Hitpoints */
2528 #define PR_MANA         0x00000080L     /* Display Mana */
2529 #define PR_GOLD         0x00000100L     /* Display Gold */
2530 #define PR_DEPTH        0x00000200L     /* Display Depth */
2531 #define PR_EQUIPPY      0x00000400L     /* Display equippy chars */
2532 #define PR_HEALTH       0x00000800L     /* Display Health Bar */
2533 #define PR_CUT          0x00001000L     /* Display Extra (Cut) */
2534 #define PR_STUN         0x00002000L     /* Display Extra (Stun) */
2535 #define PR_HUNGER       0x00004000L     /* Display Extra (Hunger) */
2536 #define PR_STATUS       0x00008000L     /* Display Status Bar */
2537 #define PR_DUNGEON      0x00010000L     /* Display Extra (Blind) */
2538 #define PR_UHEALTH      0x00020000L     /* Display Uma Health Bar */
2539 #define PR_XXX1         0x00040000L     /* Display Extra (Afraid) */
2540 #define PR_XXX2         0x00080000L     /* Display Extra (Poisoned) */
2541 #define PR_STATE        0x00100000L     /* Display Extra (State) */
2542 #define PR_SPEED        0x00200000L     /* Display Extra (Speed) */
2543 #define PR_STUDY        0x00400000L     /* Display Extra (Study) */
2544 #define PR_MANE         0x00800000L     /* Display Extra (Mane) */
2545 #define PR_EXTRA        0x01000000L     /* Display Extra Info */
2546 #define PR_BASIC        0x02000000L     /* Display Basic Info */
2547 #define PR_MAP          0x04000000L     /* Display Map */
2548 #define PR_WIPE         0x08000000L     /* Hack -- Total Redraw */
2549 /* xxx */
2550 /* xxx */
2551 /* xxx */
2552 /* xxx */
2553
2554 /*
2555  * Bit flags for the "p_ptr->window" variable (etc)
2556  */
2557 #define PW_INVEN        0x00000001L     /* Display inven/equip */
2558 #define PW_EQUIP        0x00000002L     /* Display equip/inven */
2559 #define PW_SPELL        0x00000004L     /* Display spell list */
2560 #define PW_PLAYER       0x00000008L     /* Display character */
2561 /* xxx */
2562 /* xxx */
2563 #define PW_MESSAGE      0x00000040L     /* Display messages */
2564 #define PW_OVERHEAD     0x00000080L     /* Display overhead view */
2565 #define PW_MONSTER      0x00000100L     /* Display monster recall */
2566 #define PW_OBJECT       0x00000200L     /* Display object recall */
2567 #define PW_DUNGEON      0x00000400L     /* Display dungeon view */
2568 #define PW_SNAPSHOT     0x00000800L     /* Display snap-shot */
2569 /* xxx */
2570 /* xxx */
2571 #define PW_BORG_1       0x00004000L     /* Display borg messages */
2572 #define PW_BORG_2       0x00008000L     /* Display borg status */
2573
2574 /*
2575  * Bit flags for the place_monster_???() (etc)
2576  */
2577 #define PM_ALLOW_SLEEP    0x00000001
2578 #define PM_ALLOW_GROUP    0x00000002
2579 #define PM_FORCE_FRIENDLY 0x00000004
2580 #define PM_FORCE_PET      0x00000008
2581 #define PM_NO_KAGE        0x00000010
2582 #define PM_NO_PET         0x00000020
2583 #define PM_ALLOW_UNIQUE   0x00000040
2584 #define PM_IGNORE_TERRAIN 0x00000080
2585 #define PM_HASTE          0x00000100
2586
2587
2588 /*
2589  * Bit flags for the "p_ptr->special_attack" variable. -LM-
2590  *
2591  * Note:  The elemental and poison attacks should be managed using the 
2592  * function "set_ele_attack", in spell2.c.  This provides for timeouts and
2593  * prevents the player from getting more than one at a time.
2594  */
2595 #define ATTACK_CONFUSE          0x00000001
2596 #define ATTACK_BLKBRTH          0x00000002
2597 #define ATTACK_FLEE             0x00000004
2598 #define ATTACK_SUPERSHOT        0x00000008
2599 #define ATTACK_ACID             0x00000010
2600 #define ATTACK_ELEC             0x00000020
2601 #define ATTACK_FIRE             0x00000040
2602 #define ATTACK_COLD             0x00000080
2603 #define ATTACK_POIS             0x00000100
2604 #define ATTACK_HOLY             0x00000200
2605 #define ATTACK_SUIKEN           0x00000400
2606
2607
2608 #define DEFENSE_ACID            0x00000001
2609 #define DEFENSE_ELEC            0x00000002
2610 #define DEFENSE_FIRE            0x00000004
2611 #define DEFENSE_COLD            0x00000008
2612 #define DEFENSE_POIS            0x00000010
2613 #define KAMAE_GENBU             0x00000020
2614 #define KAMAE_BYAKKO            0x00000040
2615 #define KAMAE_SEIRYU            0x00000080
2616 #define KAMAE_SUZAKU            0x00000100
2617 #define KATA_IAI                0x00000200
2618 #define KATA_FUUJIN             0x00000400
2619 #define KATA_KOUKIJIN           0x00000800
2620 #define KATA_MUSOU              0x00001000
2621 #define NINJA_KAWARIMI          0x00002000
2622 #define NINJA_S_STEALTH         0x00004000
2623
2624 #define MAX_KAMAE 4
2625 #define KAMAE_MASK (KAMAE_GENBU | KAMAE_BYAKKO | KAMAE_SEIRYU | KAMAE_SUZAKU)
2626
2627 #define MAX_KATA 4
2628 #define KATA_MASK (KATA_IAI | KATA_FUUJIN | KATA_KOUKIJIN | KATA_MUSOU)
2629
2630
2631 #define ACTION_NONE     0
2632 #define ACTION_SEARCH   1
2633 #define ACTION_REST     2
2634 #define ACTION_LEARN    3
2635 #define ACTION_FISH     4
2636 #define ACTION_KAMAE    5
2637 #define ACTION_KATA     6
2638 #define ACTION_SING     7
2639 #define ACTION_HAYAGAKE 8
2640
2641 /*** General index values ***/
2642
2643
2644 /*
2645  * Legal restrictions for "summon_specific()"
2646  */
2647 #define SUMMON_ANT                  11
2648 #define SUMMON_SPIDER               12
2649 #define SUMMON_HOUND                13
2650 #define SUMMON_HYDRA                14
2651 #define SUMMON_ANGEL                15
2652 #define SUMMON_DEMON                16
2653 #define SUMMON_UNDEAD               17
2654 #define SUMMON_DRAGON               18
2655 #define SUMMON_HI_UNDEAD            21
2656 #define SUMMON_HI_DRAGON            22
2657 #define SUMMON_HI_DEMON             23
2658 #define SUMMON_AMBERITES            31
2659 #define SUMMON_UNIQUE               32
2660 #define SUMMON_BIZARRE1             33
2661 #define SUMMON_BIZARRE2             34
2662 #define SUMMON_BIZARRE3             35
2663 #define SUMMON_BIZARRE4             36
2664 #define SUMMON_BIZARRE5             37
2665 #define SUMMON_BIZARRE6             38
2666 #define SUMMON_CYBER                39
2667 #define SUMMON_KIN                  40
2668 #define SUMMON_DAWN                 41
2669 #define SUMMON_ANIMAL               42
2670 #define SUMMON_ANIMAL_RANGER        43
2671 /*#define SUMMON_HI_UNDEAD_NO_UNIQUES 44*/
2672 /*#define SUMMON_HI_DRAGON_NO_UNIQUES 45*/
2673 /*#define SUMMON_NO_UNIQUES           46*/
2674 #define SUMMON_PHANTOM              47
2675 /*#define SUMMON_ELEMENTAL_NO_UNIQUES 48*/
2676 #define SUMMON_BLUE_HORROR          49
2677 #define SUMMON_LIVING               50
2678 #define SUMMON_HI_DRAGON_LIVING     51
2679 #define SUMMON_GOLEM                52
2680 #define SUMMON_ELEMENTAL            53
2681 #define SUMMON_VORTEX               54
2682 #define SUMMON_HYBRID               55
2683 #define SUMMON_BIRD                 56
2684 /*#define SUMMON_AQUATIC_NO_UNIQUES   57*/
2685 #define SUMMON_KAMIKAZE             58
2686 #define SUMMON_KAMIKAZE_LIVING      59
2687 #define SUMMON_MANES                60
2688 #define SUMMON_LOUSE                61
2689 #define SUMMON_GUARDIANS            62
2690 #define SUMMON_KNIGHTS              63
2691
2692
2693 /*
2694  * Spell types used by project(), and related functions.
2695  */
2696 #define GF_ELEC         1
2697 #define GF_POIS         2
2698 #define GF_ACID         3
2699 #define GF_COLD         4
2700 #define GF_FIRE         5
2701 #define GF_PSY_SPEAR    9
2702 #define GF_MISSILE      10
2703 #define GF_ARROW        11
2704 #define GF_PLASMA       12
2705 /* Replaced with GF_HOLY_FIRE and GF_HELL_FIRE */
2706 /* #define GF_HOLY_ORB     13 */
2707 #define GF_WATER        14
2708 #define GF_LITE         15
2709 #define GF_DARK         16
2710 #define GF_LITE_WEAK    17
2711 #define GF_DARK_WEAK    18
2712 #define GF_SHARDS       20
2713 #define GF_SOUND        21
2714 #define GF_CONFUSION    22
2715 #define GF_FORCE        23
2716 #define GF_INERTIA      24
2717 #define GF_MANA         26
2718 #define GF_METEOR       27
2719 #define GF_ICE          28
2720 #define GF_CHAOS        30
2721 #define GF_NETHER       31
2722 #define GF_DISENCHANT   32
2723 #define GF_NEXUS        33
2724 #define GF_TIME         34
2725 #define GF_GRAVITY      35
2726 #define GF_KILL_WALL    40
2727 #define GF_KILL_DOOR    41
2728 #define GF_KILL_TRAP    42
2729 #define GF_MAKE_WALL    45
2730 #define GF_MAKE_DOOR    46
2731 #define GF_MAKE_TRAP    47
2732 #define GF_MAKE_TREE    48
2733 #define GF_OLD_CLONE    51
2734 #define GF_OLD_POLY             52
2735 #define GF_OLD_HEAL             53
2736 #define GF_OLD_SPEED    54
2737 #define GF_OLD_SLOW             55
2738 #define GF_OLD_CONF             56
2739 #define GF_OLD_SLEEP    57
2740 #define GF_OLD_DRAIN    58
2741 #define GF_AWAY_UNDEAD  61
2742 #define GF_AWAY_EVIL    62
2743 #define GF_AWAY_ALL     63
2744 #define GF_TURN_UNDEAD  64
2745 #define GF_TURN_EVIL    65
2746 #define GF_TURN_ALL     66
2747 #define GF_DISP_UNDEAD  67
2748 #define GF_DISP_EVIL    68
2749 #define GF_DISP_ALL 69
2750 #define GF_DISP_DEMON   70      /* New types for Zangband begin here... */
2751 #define GF_DISP_LIVING  71
2752 #define GF_ROCKET       72
2753 #define GF_NUKE         73
2754 #define GF_MAKE_GLYPH   74
2755 #define GF_STASIS       75
2756 #define GF_STONE_WALL   76
2757 #define GF_DEATH_RAY    77
2758 #define GF_STUN         78
2759 #define GF_HOLY_FIRE    79
2760 #define GF_HELL_FIRE    80
2761 #define GF_DISINTEGRATE 81
2762 #define GF_CHARM        82
2763 #define GF_CONTROL_UNDEAD   83
2764 #define GF_CONTROL_ANIMAL   84
2765 #define GF_PSI         85
2766 #define GF_PSI_DRAIN   86
2767 #define GF_TELEKINESIS  87
2768 #define GF_JAM_DOOR     88
2769 #define GF_DOMINATION   89
2770 #define GF_DISP_GOOD    90
2771 #define GF_DRAIN_MANA   91
2772 #define GF_MIND_BLAST   92
2773 #define GF_BRAIN_SMASH  93
2774 #define GF_CAUSE_1      94
2775 #define GF_CAUSE_2      95
2776 #define GF_CAUSE_3      96
2777 #define GF_CAUSE_4      97
2778 #define GF_HAND_DOOM    98
2779 #define GF_CAPTURE      99
2780 #define GF_ANIM_DEAD   100
2781 #define GF_CONTROL_LIVING   101
2782 #define GF_IDENTIFY    102
2783 #define GF_ATTACK      103
2784 #define GF_ENGETSU     104
2785 #define GF_GENOCIDE    105
2786 #define GF_PHOTO       106
2787 #define GF_CONTROL_DEMON   107
2788 #define GF_LAVA_FLOW   108
2789 #define GF_BLOOD_CURSE 109
2790 #define GF_SEEKER 110
2791 #define GF_SUPER_RAY 111
2792 #define GF_STAR_HEAL 112
2793 #define GF_WATER_FLOW   113
2794 #define GF_CRUSADE     114
2795 #define GF_STASIS_EVIL 115
2796 #define GF_WOUNDS      116
2797
2798 #define MAX_GF                          117
2799
2800 /*
2801  * Some things which induce learning
2802  */
2803 #define DRS_ACID         1
2804 #define DRS_ELEC         2
2805 #define DRS_FIRE         3
2806 #define DRS_COLD         4
2807 #define DRS_POIS         5
2808 #define DRS_NETH         6
2809 #define DRS_LITE         7
2810 #define DRS_DARK         8
2811 #define DRS_FEAR         9
2812 #define DRS_CONF        10
2813 #define DRS_CHAOS       11
2814 #define DRS_DISEN       12
2815 #define DRS_BLIND       13
2816 #define DRS_NEXUS       14
2817 #define DRS_SOUND       15
2818 #define DRS_SHARD       16
2819 #define DRS_FREE        30
2820 #define DRS_MANA        31
2821 #define DRS_REFLECT     32
2822
2823
2824
2825 #define DAMAGE_FORCE    1
2826 #define DAMAGE_GENO     2
2827 #define DAMAGE_LOSELIFE 3
2828 #define DAMAGE_ATTACK   4
2829 #define DAMAGE_NOESCAPE 5
2830 #define DAMAGE_USELIFE  6
2831
2832
2833 /*
2834  * Hack -- first "normal" artifact in the artifact list.  All of
2835  * the artifacts with indexes from 1 to 15 are "special" (lights,
2836  * rings, amulets), and the ones from 16 to 127 are "normal".
2837  */
2838 #define ART_MIN_NORMAL          19
2839
2840 /*
2841  * Game generated inscription indices. These are stored in the object,
2842  * and are used to index the string array from tables.c.
2843  */
2844
2845 #define FEEL_NONE              0
2846 #define FEEL_BROKEN            1
2847 #define FEEL_TERRIBLE          2
2848 #define FEEL_WORTHLESS         3
2849 #define FEEL_CURSED            4
2850 #define FEEL_UNCURSED          5
2851 #define FEEL_AVERAGE           6
2852 #define FEEL_GOOD              7
2853 #define FEEL_EXCELLENT         8
2854 #define FEEL_SPECIAL           9
2855
2856 #define FEEL_MAX               9
2857
2858 /*
2859  * Hack -- special "xtra" object powers
2860  */
2861
2862 /* Sustain one stat */
2863 #define EGO_XTRA_SUSTAIN        1
2864
2865 /* High resist */
2866 #define EGO_XTRA_POWER          2
2867
2868 /* Special ability */
2869 #define EGO_XTRA_ABILITY        3
2870
2871 /*** Object flag values ***/
2872
2873
2874 /*
2875  * Chest trap flags (see "tables.c")
2876  */
2877 #define CHEST_LOSE_STR          0x0001
2878 #define CHEST_LOSE_CON          0x0002
2879 #define CHEST_POISON            0x0004
2880 #define CHEST_PARALYZE          0x0008
2881 #define CHEST_EXPLODE           0x0010
2882 #define CHEST_SUMMON            0x0020
2883 #define CHEST_SCATTER           0x0040
2884 #define CHEST_E_SUMMON          0x0080
2885 #define CHEST_BIRD_STORM        0x0100
2886 #define CHEST_H_SUMMON          0x0200
2887 #define CHEST_RUNES_OF_EVIL     0x0400
2888 #define CHEST_ALARM             0x0800
2889
2890
2891 /*
2892  * Special Object Flags
2893  */
2894 #define IDENT_SENSE     0x01    /* Item has been "sensed" */
2895 #define IDENT_FIXED     0x02    /* Item has been "haggled" */
2896 #define IDENT_EMPTY     0x04    /* Item charges are known */
2897 #define IDENT_KNOWN     0x08    /* Item abilities are known */
2898 #define IDENT_STOREB    0x10    /* Item is storebought !!!! */
2899 #define IDENT_MENTAL    0x20    /* Item information is known */
2900 #if 0
2901 #define IDENT_CURSED    0x40    /* Item is temporarily cursed */
2902 #endif
2903 #define IDENT_BROKEN    0x80    /* Item is permanently worthless */
2904
2905
2906
2907 /*
2908  * Special Monster Flags (all temporary)
2909  */
2910 #define MFLAG_VIEW      0x01    /* Monster is in line of sight */
2911 #define MFLAG_TEMP      0x02    /* Monster is marked for project_hack() */
2912 #define MFLAG_XXX2      0x04    /* (unused) */
2913 #define MFLAG_XXX3      0x08    /* (unused) */
2914 #define MFLAG_BORN      0x10    /* Monster is still being born */
2915 #define MFLAG_NICE      0x20    /* Monster is still being nice */
2916 #define MFLAG_SHOW      0x40    /* Monster is recently memorized */
2917 #define MFLAG_MARK      0x80    /* Monster is currently memorized */
2918
2919 #define MFLAG_KAGE      0x01    /* Monster is kage */
2920 #define MFLAG_NOPET     0x02    /* Cannot make monster pet */
2921 #define MFLAG_NOGENO    0x04    /* Cannot genocide */
2922 #define MFLAG_CHAMELEON 0x08    /* Monster is chameleon */
2923 #define MFLAG_NOFLOW    0x10    /* Monster is in no_flow_by_smell mode */
2924
2925
2926 /*
2927  * As of 2.7.8, the "object flags" are valid for all objects, and as
2928  * of 2.7.9, these flags are not actually stored with the object.
2929  *
2930  * Note that "flags1" contains all flags dependant on "pval" (including
2931  * stat bonuses, but NOT stat sustainers), plus all "extra attack damage"
2932  * flags (SLAY_XXX and BRAND_XXX).
2933  *
2934  * Note that "flags2" contains all "resistances" (including "Stat Sustainers",
2935  * actual immunities, and resistances).  Note that "Hold Life" is really an
2936  * "immunity" to ExpLoss, and "Free Action" is "immunity to paralysis".
2937  *
2938  * Note that "flags3" contains everything else -- including the three "CURSED"
2939  * flags, and the "BLESSED" flag, several "item display" parameters, some new
2940  * flags for powerful Bows, and flags which affect the player in a "general"
2941  * way (LITE, TELEPATHY, SEE_INVIS, SLOW_DIGEST, REGEN, FEATHER), including
2942  * all the "general" curses (TELEPORT, AGGRAVATE, EXP_DRAIN).  It also has
2943  * four new flags called "ITEM_IGNORE_XXX" which lets an item specify that
2944  * it can not be affected by various forms of destruction.  This is NOT as
2945  * powerful as actually granting resistance/immunity to the wearer.
2946  */
2947
2948 #define TR1_STR                 0x00000001L     /* STR += "pval" */
2949 #define TR1_INT                 0x00000002L     /* INT += "pval" */
2950 #define TR1_WIS                 0x00000004L     /* WIS += "pval" */
2951 #define TR1_DEX                 0x00000008L     /* DEX += "pval" */
2952 #define TR1_CON                 0x00000010L     /* CON += "pval" */
2953 #define TR1_CHR                 0x00000020L     /* CHR += "pval" */
2954 #define TR1_MAGIC_MASTERY       0x00000040L     /* Later */
2955 #define TR1_FORCE_WEAPON        0x00000080L     /* Later */
2956 #define TR1_STEALTH             0x00000100L     /* Stealth += "pval" */
2957 #define TR1_SEARCH              0x00000200L     /* Search += "pval" */
2958 #define TR1_INFRA               0x00000400L     /* Infra += "pval" */
2959 #define TR1_TUNNEL              0x00000800L     /* Tunnel += "pval" */
2960 #define TR1_SPEED               0x00001000L     /* Speed += "pval" */
2961 #define TR1_BLOWS               0x00002000L     /* Blows += "pval" */
2962 #define TR1_CHAOTIC             0x00004000L
2963 #define TR1_VAMPIRIC            0x00008000L
2964 #define TR1_SLAY_ANIMAL         0x00010000L
2965 #define TR1_SLAY_EVIL           0x00020000L
2966 #define TR1_SLAY_UNDEAD         0x00040000L
2967 #define TR1_SLAY_DEMON          0x00080000L
2968 #define TR1_SLAY_ORC            0x00100000L
2969 #define TR1_SLAY_TROLL          0x00200000L
2970 #define TR1_SLAY_GIANT          0x00400000L
2971 #define TR1_SLAY_DRAGON         0x00800000L
2972 #define TR1_KILL_DRAGON         0x01000000L     /* Execute Dragon */
2973 #define TR1_VORPAL              0x02000000L     /* Later */
2974 #define TR1_IMPACT              0x04000000L     /* Cause Earthquakes */
2975 #define TR1_BRAND_POIS          0x08000000L
2976 #define TR1_BRAND_ACID          0x10000000L
2977 #define TR1_BRAND_ELEC          0x20000000L
2978 #define TR1_BRAND_FIRE          0x40000000L
2979 #define TR1_BRAND_COLD          0x80000000L
2980
2981 #define TR2_SUST_STR            0x00000001L
2982 #define TR2_SUST_INT            0x00000002L
2983 #define TR2_SUST_WIS            0x00000004L
2984 #define TR2_SUST_DEX            0x00000008L
2985 #define TR2_SUST_CON            0x00000010L
2986 #define TR2_SUST_CHR            0x00000020L
2987 #define TR2_RIDING              0x00000040L     /* Later */
2988 #define TR2_XXX2                0x00000080L     /* Later */
2989 #define TR2_IM_ACID             0x00000100L
2990 #define TR2_IM_ELEC             0x00000200L
2991 #define TR2_IM_FIRE             0x00000400L
2992 #define TR2_IM_COLD             0x00000800L
2993 #define TR2_THROW               0x00001000L     /* Later */
2994 #define TR2_REFLECT             0x00002000L     /* Reflect 'bolts' */
2995 #define TR2_FREE_ACT            0x00004000L     /* Free Action */
2996 #define TR2_HOLD_LIFE           0x00008000L     /* Hold Life */
2997 #define TR2_RES_ACID            0x00010000L
2998 #define TR2_RES_ELEC            0x00020000L
2999 #define TR2_RES_FIRE            0x00040000L
3000 #define TR2_RES_COLD            0x00080000L
3001 #define TR2_RES_POIS            0x00100000L
3002 #define TR2_RES_FEAR            0x00200000L     /* Added for Zangband */
3003 #define TR2_RES_LITE            0x00400000L
3004 #define TR2_RES_DARK            0x00800000L
3005 #define TR2_RES_BLIND           0x01000000L
3006 #define TR2_RES_CONF            0x02000000L
3007 #define TR2_RES_SOUND           0x04000000L
3008 #define TR2_RES_SHARDS          0x08000000L
3009 #define TR2_RES_NETHER          0x10000000L
3010 #define TR2_RES_NEXUS           0x20000000L
3011 #define TR2_RES_CHAOS           0x40000000L
3012 #define TR2_RES_DISEN           0x80000000L
3013
3014
3015 #define TR3_SH_FIRE             0x00000001L     /* Immolation (Fire) */
3016 #define TR3_SH_ELEC             0x00000002L     /* Electric Sheath */
3017 #define TR3_SLAY_HUMAN          0x00000004L     /* Slay human */
3018 #define TR3_SH_COLD             0x00000008L     /* cold aura */
3019 #define TR3_NO_TELE             0x00000010L     /* Anti-teleportation */
3020 #define TR3_NO_MAGIC            0x00000020L     /* Anti-magic */
3021 #define TR3_DEC_MANA            0x00000040L     /* ??? */
3022 #define TR3_TY_CURSE            0x00000080L     /* The Ancient Curse */
3023 #define TR3_WARNING             0x00000100L     /* Warning */
3024 #define TR3_HIDE_TYPE           0x00000200L     /* Hide "pval" description */
3025 #define TR3_SHOW_MODS           0x00000400L     /* Always show Tohit/Todam */
3026 #define TR3_XXX1                0x00000800L     /* XXX1 */
3027 #define TR3_FEATHER             0x00001000L     /* Feather Falling */
3028 #define TR3_LITE                0x00002000L     /* Permanent Light */
3029 #define TR3_SEE_INVIS           0x00004000L     /* See Invisible */
3030 #define TR3_TELEPATHY           0x00008000L     /* Telepathy */
3031 #define TR3_SLOW_DIGEST         0x00010000L     /* Item slows down digestion */
3032 #define TR3_REGEN               0x00020000L     /* Item induces regeneration */
3033 #define TR3_XTRA_MIGHT          0x00040000L     /* Bows get extra multiplier */
3034 #define TR3_XTRA_SHOTS          0x00080000L     /* Bows get extra shots */
3035 #define TR3_IGNORE_ACID         0x00100000L     /* Item ignores Acid Damage */
3036 #define TR3_IGNORE_ELEC         0x00200000L     /* Item ignores Elec Damage */
3037 #define TR3_IGNORE_FIRE         0x00400000L     /* Item ignores Fire Damage */
3038 #define TR3_IGNORE_COLD         0x00800000L     /* Item ignores Cold Damage */
3039 #define TR3_ACTIVATE            0x01000000L     /* Item can be activated */
3040 #define TR3_DRAIN_EXP           0x02000000L     /* Item drains Experience */
3041 #define TR3_TELEPORT            0x04000000L     /* Item teleports player */
3042 #define TR3_AGGRAVATE           0x08000000L     /* Item aggravates monsters */
3043 #define TR3_BLESSED             0x10000000L     /* Item is Blessed */
3044
3045
3046 #define TRG_INSTA_ART           0x00000001L     /* Item must be an artifact */
3047 #define TRG_QUESTITEM           0x00000002L     /* quest level item -KMW- */
3048 #define TRG_XTRA_POWER          0x00000004L     /* Extra power */
3049 #define TRG_ONE_SUSTAIN         0x00000008L     /* One sustain */
3050 #define TRG_XTRA_RES_OR_POWER   0x00000010L     /* Extra resistance or power */
3051 #define TRG_XTRA_H_RES          0x00000020L     /* Extra high resistance */
3052 #define TRG_XTRA_E_RES          0x00000040L     /* Extra element resistance */
3053 #define TRG_XTRA_L_RES          0x00000080L     /* Extra lordly resistance */
3054 #define TRG_XTRA_D_RES          0x00000100L     /* Extra dragon resistance */
3055 #define TRG_XTRA_RES            0x00000200L     /* Extra resistance */
3056 #define TRG_CURSED              0x00000400L     /* Item is Cursed */
3057 #define TRG_HEAVY_CURSE         0x00000800L     /* Item is Heavily Cursed */
3058 #define TRG_PERMA_CURSE         0x00001000L     /* Item is Perma Cursed */
3059 #define TRG_RANDOM_CURSE0       0x00002000L     /* Item is Random Cursed */
3060 #define TRG_RANDOM_CURSE1       0x00004000L     /* Item is Random Cursed */
3061 #define TRG_RANDOM_CURSE2       0x00008000L     /* Item is Random Cursed */
3062
3063
3064 /*
3065  * Hack -- flag set 1 -- mask for "pval-dependant" flags.
3066  * Note that all "pval" dependant flags must be in "flags1".
3067  */
3068 #define TR1_PVAL_MASK   \
3069         (TR1_STR | TR1_INT | TR1_WIS | TR1_DEX | \
3070      TR1_CON | TR1_CHR | \
3071          TR1_MAGIC_MASTERY | TR1_STEALTH | TR1_SEARCH | TR1_INFRA | \
3072          TR1_TUNNEL | TR1_SPEED | TR1_BLOWS)
3073
3074
3075 #define MAX_CURSE 17
3076
3077 #define TRC_CURSED              0x00000001L
3078 #define TRC_HEAVY_CURSE         0x00000002L
3079 #define TRC_PERMA_CURSE         0x00000004L
3080 #define TRC_XXX1                0x00000008L
3081 #define TRC_TY_CURSE            0x00000010L
3082 #define TRC_AGGRAVATE           0x00000020L
3083 #define TRC_DRAIN_EXP           0x00000040L
3084 #define TRC_SLOW_REGEN          0x00000080L
3085 #define TRC_ADD_L_CURSE         0x00000100L
3086 #define TRC_ADD_H_CURSE         0x00000200L
3087 #define TRC_CALL_ANIMAL         0x00000400L
3088 #define TRC_CALL_DEMON          0x00000800L
3089 #define TRC_CALL_DRAGON         0x00001000L
3090 #define TRC_COWARDICE           0x00002000L
3091 #define TRC_TELEPORT            0x00004000L
3092 #define TRC_LOW_MELEE           0x00008000L
3093 #define TRC_LOW_AC              0x00010000L
3094 #define TRC_LOW_MAGIC           0x00020000L
3095 #define TRC_FAST_DIGEST         0x00040000L
3096 #define TRC_DRAIN_HP            0x00080000L
3097 #define TRC_DRAIN_MANA          0x00100000L
3098
3099 #define TRC_TELEPORT_SELF       0x00000001L
3100 #define TRC_CHAINSWORD          0x00000002L
3101
3102 #define TRC_SPECIAL_MASK \
3103         (TRC_TY_CURSE | TRC_AGGRAVATE)
3104
3105 #define TRC_HEAVY_MASK   \
3106         (TRC_TY_CURSE | TRC_AGGRAVATE | TRC_DRAIN_EXP | TRC_ADD_H_CURSE | \
3107          TRC_CALL_DEMON | TRC_CALL_DRAGON | TRC_TELEPORT)
3108
3109 #define TRC_P_FLAG_MASK  \
3110         (TRC_TY_CURSE | TRC_DRAIN_EXP | TRC_ADD_L_CURSE | TRC_ADD_H_CURSE | \
3111          TRC_CALL_ANIMAL | TRC_CALL_DEMON | TRC_CALL_DRAGON | TRC_COWARDICE | \
3112          TRC_TELEPORT | TRC_DRAIN_HP | TRC_DRAIN_MANA)
3113
3114
3115 /*** Monster blow constants ***/
3116
3117
3118 /*
3119  * New monster blow methods
3120  */
3121 #define RBM_HIT          1
3122 #define RBM_TOUCH        2
3123 #define RBM_PUNCH        3
3124 #define RBM_KICK         4
3125 #define RBM_CLAW         5
3126 #define RBM_BITE         6
3127 #define RBM_STING        7
3128 #define RBM_SLASH        8
3129 #define RBM_BUTT         9
3130 #define RBM_CRUSH       10
3131 #define RBM_ENGULF      11
3132 #define RBM_CHARGE      12
3133 #define RBM_CRAWL       13
3134 #define RBM_DROOL       14
3135 #define RBM_SPIT        15
3136 #define RBM_EXPLODE     16
3137 #define RBM_GAZE        17
3138 #define RBM_WAIL        18
3139 #define RBM_SPORE       19
3140 #define RBM_XXX4        20
3141 #define RBM_BEG         21
3142 #define RBM_INSULT      22
3143 #define RBM_MOAN        23
3144 #define RBM_SHOW        24
3145 #define RBM_SHOOT       25
3146
3147
3148 /*
3149  * New monster blow effects
3150  */
3151 #define RBE_HURT         1
3152 #define RBE_POISON       2
3153 #define RBE_UN_BONUS     3
3154 #define RBE_UN_POWER     4
3155 #define RBE_EAT_GOLD     5
3156 #define RBE_EAT_ITEM     6
3157 #define RBE_EAT_FOOD     7
3158 #define RBE_EAT_LITE     8
3159 #define RBE_ACID         9
3160 #define RBE_ELEC        10
3161 #define RBE_FIRE        11
3162 #define RBE_COLD        12
3163 #define RBE_BLIND       13
3164 #define RBE_CONFUSE     14
3165 #define RBE_TERRIFY     15
3166 #define RBE_PARALYZE    16
3167 #define RBE_LOSE_STR    17
3168 #define RBE_LOSE_INT    18
3169 #define RBE_LOSE_WIS    19
3170 #define RBE_LOSE_DEX    20
3171 #define RBE_LOSE_CON    21
3172 #define RBE_LOSE_CHR    22
3173 #define RBE_LOSE_ALL    23
3174 #define RBE_SHATTER     24
3175 #define RBE_EXP_10      25
3176 #define RBE_EXP_20      26
3177 #define RBE_EXP_40      27
3178 #define RBE_EXP_80      28
3179 #define RBE_DISEASE     29
3180 #define RBE_TIME        30
3181 #define RBE_EXP_VAMP    31
3182 #define RBE_DR_MANA     32
3183 #define RBE_SUPERHURT   33
3184
3185
3186 /*** Monster flag values (hard-coded) ***/
3187
3188
3189 /*
3190  * New monster race bit flags
3191  */
3192 #define RF1_UNIQUE              0x00000001  /* Unique Monster */
3193 #define RF1_QUESTOR             0x00000002  /* Quest Monster */
3194 #define RF1_MALE                0x00000004  /* Male gender */
3195 #define RF1_FEMALE              0x00000008  /* Female gender */
3196 #define RF1_CHAR_CLEAR          0x00000010  /* Absorbs symbol */
3197 #define RF1_CHAR_MULTI          0x00000020  /* Changes symbol */
3198 #define RF1_ATTR_CLEAR          0x00000040  /* Absorbs color */
3199 #define RF1_ATTR_MULTI          0x00000080  /* Changes color */
3200 #define RF1_FORCE_DEPTH         0x00000100  /* Start at "correct" depth */
3201 #define RF1_FORCE_MAXHP         0x00000200  /* Start with max hitpoints */
3202 #define RF1_FORCE_SLEEP         0x00000400  /* Start out sleeping */
3203 #define RF1_FORCE_EXTRA         0x00000800  /* Start out something */
3204 #define RF1_XXX1                0x00001000  /* XXX */
3205 #define RF1_FRIENDS             0x00002000  /* Arrive with some friends */
3206 #define RF1_ESCORT              0x00004000  /* Arrive with an escort */
3207 #define RF1_ESCORTS             0x00008000  /* Arrive with some escorts */
3208 #define RF1_NEVER_BLOW          0x00010000  /* Never make physical blow */
3209 #define RF1_NEVER_MOVE          0x00020000  /* Never make physical move */
3210 #define RF1_RAND_25             0x00040000  /* Moves randomly (25%) */
3211 #define RF1_RAND_50             0x00080000  /* Moves randomly (50%) */
3212 #define RF1_ONLY_GOLD           0x00100000  /* Drop only gold */
3213 #define RF1_ONLY_ITEM           0x00200000  /* Drop only items */
3214 #define RF1_DROP_60             0x00400000  /* Drop an item/gold (60%) */
3215 #define RF1_DROP_90             0x00800000  /* Drop an item/gold (90%) */
3216 #define RF1_DROP_1D2            0x01000000  /* Drop 1d2 items/gold */
3217 #define RF1_DROP_2D2            0x02000000  /* Drop 2d2 items/gold */
3218 #define RF1_DROP_3D2            0x04000000  /* Drop 3d2 items/gold */
3219 #define RF1_DROP_4D2            0x08000000  /* Drop 4d2 items/gold */
3220 #define RF1_DROP_GOOD           0x10000000  /* Drop good items */
3221 #define RF1_DROP_GREAT          0x20000000  /* Drop great items */
3222 #define RF1_XXX2                0x40000000  /* XXX */
3223 #define RF1_XXX3                0x80000000  /* XXX */
3224
3225 /*
3226  * New monster race bit flags
3227  */
3228 #define RF2_STUPID          0x00000001  /* Monster is stupid */
3229 #define RF2_SMART           0x00000002  /* Monster is smart */
3230 #define RF2_CAN_SPEAK       0x00000004  /* TY: can speak */
3231 #define RF2_REFLECTING      0x00000008  /* Reflects bolts */
3232 #define RF2_INVISIBLE       0x00000010  /* Monster avoids vision */
3233 #define RF2_COLD_BLOOD      0x00000020  /* Monster avoids infra */
3234 #define RF2_EMPTY_MIND      0x00000040  /* Monster avoids telepathy */
3235 #define RF2_WEIRD_MIND      0x00000080  /* Monster avoids telepathy? */
3236 #define RF2_MULTIPLY        0x00000100  /* Monster reproduces */
3237 #define RF2_REGENERATE      0x00000200  /* Monster regenerates */
3238 #define RF2_SHAPECHANGER    0x00000400  /* TY: shapechanger */
3239 #define RF2_ATTR_ANY        0x00000800  /* TY: Attr_any */
3240 #define RF2_POWERFUL        0x00001000  /* Monster has strong breath */
3241 #define RF2_ELDRITCH_HORROR 0x00002000  /* Sanity-blasting horror    */
3242 #define RF2_AURA_FIRE       0x00004000  /* Burns in melee */
3243 #define RF2_AURA_ELEC       0x00008000  /* Shocks in melee */
3244 #define RF2_OPEN_DOOR       0x00010000  /* Monster can open doors */
3245 #define RF2_BASH_DOOR       0x00020000  /* Monster can bash doors */
3246 #define RF2_PASS_WALL       0x00040000  /* Monster can pass walls */
3247 #define RF2_KILL_WALL       0x00080000  /* Monster can destroy walls */
3248 #define RF2_MOVE_BODY       0x00100000  /* Monster can move monsters */
3249 #define RF2_KILL_BODY       0x00200000  /* Monster can kill monsters */
3250 #define RF2_TAKE_ITEM       0x00400000  /* Monster can pick up items */
3251 #define RF2_KILL_ITEM       0x00800000  /* Monster can crush items */
3252 #define RF2_BRAIN_1         0x01000000
3253 #define RF2_BRAIN_2         0x02000000
3254 #define RF2_BRAIN_3         0x04000000
3255 #define RF2_BRAIN_4         0x08000000
3256 #define RF2_BRAIN_5         0x10000000
3257 #define RF2_BRAIN_6         0x20000000
3258 #define RF2_HUMAN           0x40000000
3259 #define RF2_QUANTUM         0x80000000  /* Monster has quantum behavior */
3260
3261 /*
3262  * New monster race bit flags
3263  */
3264 #define RF3_ORC             0x00000001  /* Orc */
3265 #define RF3_TROLL           0x00000002  /* Troll */
3266 #define RF3_GIANT           0x00000004  /* Giant */
3267 #define RF3_DRAGON          0x00000008  /* Dragon */
3268 #define RF3_DEMON           0x00000010  /* Demon */
3269 #define RF3_UNDEAD          0x00000020  /* Undead */
3270 #define RF3_EVIL            0x00000040  /* Evil */
3271 #define RF3_ANIMAL          0x00000080  /* Animal */
3272 #define RF3_AMBERITE        0x00000100  /* TY: Amberite */
3273 #define RF3_GOOD            0x00000200  /* Good */
3274 #define RF3_AURA_COLD       0x00000400  /* Freezes in melee */
3275 #define RF3_NONLIVING       0x00000800  /* TY: Non-Living (?) */
3276 #define RF3_HURT_LITE       0x00001000  /* Hurt by lite */
3277 #define RF3_HURT_ROCK       0x00002000  /* Hurt by rock remover */
3278 #define RF3_HURT_FIRE       0x00004000  /* Hurt badly by fire */
3279 #define RF3_HURT_COLD       0x00008000  /* Hurt badly by cold */
3280 #define RF3_IM_ACID         0x00010000  /* Resist acid a lot */
3281 #define RF3_IM_ELEC         0x00020000  /* Resist elec a lot */
3282 #define RF3_IM_FIRE         0x00040000  /* Resist fire a lot */
3283 #define RF3_IM_COLD         0x00080000  /* Resist cold a lot */
3284 #define RF3_IM_POIS         0x00100000  /* Resist poison a lot */
3285 #define RF3_RES_TELE        0x00200000  /* Resist teleportation */
3286 #define RF3_RES_NETH        0x00400000  /* Resist nether a lot */
3287 #define RF3_RES_WATE        0x00800000  /* Resist water */
3288 #define RF3_RES_PLAS        0x01000000  /* Resist plasma */
3289 #define RF3_RES_NEXU        0x02000000  /* Resist nexus */
3290 #define RF3_RES_DISE        0x04000000  /* Resist disenchantment */
3291 #define RF3_RES_ALL         0x08000000  /* Resist all */
3292 #define RF3_NO_FEAR         0x10000000  /* Cannot be scared */
3293 #define RF3_NO_STUN         0x20000000  /* Cannot be stunned */
3294 #define RF3_NO_CONF         0x40000000  /* Cannot be confused */
3295 #define RF3_NO_SLEEP        0x80000000  /* Cannot be slept */
3296
3297 /*
3298  * New monster race bit flags
3299  */
3300 #define RF4_SHRIEK          0x00000001  /* Shriek for help */
3301 #define RF4_XXX1            0x00000002  /* XXX */
3302 #define RF4_DISPEL          0x00000004  /* Dispel magic */
3303 #define RF4_ROCKET          0x00000008  /* TY: Rocket */
3304 #define RF4_SHOOT           0x00000010  /* Fire missiles */
3305 #define RF4_XXX2            0x00000020
3306 #define RF4_XXX3            0x00000040
3307 #define RF4_XXX4            0x00000080
3308 #define RF4_BR_ACID         0x00000100  /* Breathe Acid */
3309 #define RF4_BR_ELEC         0x00000200  /* Breathe Elec */
3310 #define RF4_BR_FIRE         0x00000400  /* Breathe Fire */
3311 #define RF4_BR_COLD         0x00000800  /* Breathe Cold */
3312 #define RF4_BR_POIS         0x00001000  /* Breathe Poison */
3313 #define RF4_BR_NETH         0x00002000  /* Breathe Nether */
3314 #define RF4_BR_LITE         0x00004000  /* Breathe Lite */
3315 #define RF4_BR_DARK         0x00008000  /* Breathe Dark */
3316 #define RF4_BR_CONF         0x00010000  /* Breathe Confusion */
3317 #define RF4_BR_SOUN         0x00020000  /* Breathe Sound */
3318 #define RF4_BR_CHAO         0x00040000  /* Breathe Chaos */
3319 #define RF4_BR_DISE         0x00080000  /* Breathe Disenchant */
3320 #define RF4_BR_NEXU         0x00100000  /* Breathe Nexus */
3321 #define RF4_BR_TIME         0x00200000  /* Breathe Time */
3322 #define RF4_BR_INER         0x00400000  /* Breathe Inertia */
3323 #define RF4_BR_GRAV         0x00800000  /* Breathe Gravity */
3324 #define RF4_BR_SHAR         0x01000000  /* Breathe Shards */
3325 #define RF4_BR_PLAS         0x02000000  /* Breathe Plasma */
3326 #define RF4_BR_WALL         0x04000000  /* Breathe Force */
3327 #define RF4_BR_MANA         0x08000000  /* Breathe Mana */
3328 #define RF4_BA_NUKE         0x10000000  /* TY: Nuke Ball */
3329 #define RF4_BR_NUKE         0x20000000  /* TY: Toxic Breath */
3330 #define RF4_BA_CHAO         0x40000000  /* TY: Logrus Ball */
3331 #define RF4_BR_DISI         0x80000000  /* Breathe Disintegration */
3332
3333 /*
3334  * New monster race bit flags
3335  */
3336 #define RF5_BA_ACID         0x00000001  /* Acid Ball */
3337 #define RF5_BA_ELEC         0x00000002  /* Elec Ball */
3338 #define RF5_BA_FIRE         0x00000004  /* Fire Ball */
3339 #define RF5_BA_COLD         0x00000008  /* Cold Ball */
3340 #define RF5_BA_POIS         0x00000010  /* Poison Ball */
3341 #define RF5_BA_NETH         0x00000020  /* Nether Ball */
3342 #define RF5_BA_WATE         0x00000040  /* Water Ball */
3343 #define RF5_BA_MANA         0x00000080  /* Mana Storm */
3344 #define RF5_BA_DARK         0x00000100  /* Darkness Storm */
3345 #define RF5_DRAIN_MANA      0x00000200  /* Drain Mana */
3346 #define RF5_MIND_BLAST      0x00000400  /* Blast Mind */
3347 #define RF5_BRAIN_SMASH     0x00000800  /* Smash Brain */
3348 #define RF5_CAUSE_1         0x00001000  /* Cause Light Wound */
3349 #define RF5_CAUSE_2         0x00002000  /* Cause Serious Wound */
3350 #define RF5_CAUSE_3         0x00004000  /* Cause Critical Wound */
3351 #define RF5_CAUSE_4         0x00008000  /* Cause Mortal Wound */
3352 #define RF5_BO_ACID         0x00010000  /* Acid Bolt */
3353 #define RF5_BO_ELEC         0x00020000  /* Elec Bolt (unused) */
3354 #define RF5_BO_FIRE         0x00040000  /* Fire Bolt */
3355 #define RF5_BO_COLD         0x00080000  /* Cold Bolt */
3356 #define RF5_BA_LITE         0x00100000  /* StarBurst */
3357 #define RF5_BO_NETH         0x00200000  /* Nether Bolt */
3358 #define RF5_BO_WATE         0x00400000  /* Water Bolt */
3359 #define RF5_BO_MANA         0x00800000  /* Mana Bolt */
3360 #define RF5_BO_PLAS         0x01000000  /* Plasma Bolt */
3361 #define RF5_BO_ICEE         0x02000000  /* Ice Bolt */
3362 #define RF5_MISSILE         0x04000000  /* Magic Missile */
3363 #define RF5_SCARE           0x08000000  /* Frighten Player */
3364 #define RF5_BLIND           0x10000000  /* Blind Player */
3365 #define RF5_CONF            0x20000000  /* Confuse Player */
3366 #define RF5_SLOW            0x40000000  /* Slow Player */
3367 #define RF5_HOLD            0x80000000  /* Paralyze Player */
3368
3369 /*
3370  * New monster race bit flags
3371  */
3372 #define RF6_HASTE           0x00000001  /* Speed self */
3373 #define RF6_HAND_DOOM       0x00000002  /* Hand of Doom */
3374 #define RF6_HEAL            0x00000004  /* Heal self */
3375 #define RF6_INVULNER        0x00000008  /* INVULNERABILITY! */
3376 #define RF6_BLINK           0x00000010  /* Teleport Short */
3377 #define RF6_TPORT           0x00000020  /* Teleport Long */
3378 #define RF6_WORLD           0x00000040  /* world */
3379 #define RF6_SPECIAL         0x00000080  /* Special Attack */
3380 #define RF6_TELE_TO         0x00000100  /* Move player to monster */
3381 #define RF6_TELE_AWAY       0x00000200  /* Move player far away */
3382 #define RF6_TELE_LEVEL      0x00000400  /* Move player vertically */
3383 #define RF6_PSY_SPEAR       0x00000800  /* Psyco-spear */
3384 #define RF6_DARKNESS        0x00001000  /* Create Darkness */
3385 #define RF6_TRAPS           0x00002000  /* Create Traps */
3386 #define RF6_FORGET          0x00004000  /* Cause amnesia */
3387 #define RF6_RAISE_DEAD      0x00008000  /* Raise Dead */
3388 #define RF6_S_KIN           0x00010000  /* Summon "kin" */
3389 #define RF6_S_CYBER         0x00020000  /* Summon Cyberdemons! */
3390 #define RF6_S_MONSTER       0x00040000  /* Summon Monster */
3391 #define RF6_S_MONSTERS      0x00080000  /* Summon Monsters */
3392 #define RF6_S_ANT           0x00100000  /* Summon Ants */
3393 #define RF6_S_SPIDER        0x00200000  /* Summon Spiders */
3394 #define RF6_S_HOUND         0x00400000  /* Summon Hounds */
3395 #define RF6_S_HYDRA         0x00800000  /* Summon Hydras */
3396 #define RF6_S_ANGEL         0x01000000  /* Summon Angel */
3397 #define RF6_S_DEMON         0x02000000  /* Summon Demon */
3398 #define RF6_S_UNDEAD        0x04000000  /* Summon Undead */
3399 #define RF6_S_DRAGON        0x08000000  /* Summon Dragon */
3400 #define RF6_S_HI_UNDEAD     0x10000000  /* Summon Greater Undead */
3401 #define RF6_S_HI_DRAGON     0x20000000  /* Summon Ancient Dragon */
3402 #define RF6_S_AMBERITES     0x40000000  /* Summon Amberites */
3403 #define RF6_S_UNIQUE        0x80000000  /* Summon Unique Monster */
3404
3405 /*
3406  * New monster race bit flags
3407  */
3408 #define RF7_AQUATIC             0x00000001  /* Aquatic monster */
3409 #define RF7_CAN_SWIM            0x00000002  /* Monster can swim */
3410 #define RF7_CAN_FLY             0x00000004  /* Monster can fly */
3411 #define RF7_FRIENDLY            0x00000008  /* Monster is friendly */
3412 #define RF7_UNIQUE_7            0x00000010  /* Is a "Nazgul" unique */
3413 #define RF7_UNIQUE2             0x00000020  /* Fake unique */
3414 #define RF7_RIDING              0x00000040  /* Good for riding */
3415 #define RF7_KAGE                0x00000080  /* Is kage */
3416 #define RF7_HAS_LITE_1          0x00000100  /* Monster carries light */
3417 #define RF7_SELF_LITE_1         0x00000200  /* Monster lights itself */
3418 #define RF7_HAS_LITE_2          0x00000400  /* Monster carries light */
3419 #define RF7_SELF_LITE_2         0x00000800  /* Monster lights itself */
3420 #define RF7_GUARDIAN            0x00001000  /* Guardian of a dungeon */
3421 #define RF7_CHAMELEON           0x00002000  /* Chameleon can change */
3422 #define RF7_KILL_EXP            0x00004000  /* No exp until you kill it */
3423 #define RF7_TANUKI              0x00008000  /* Tanuki disguise */
3424
3425 /*
3426  * Monster race flags
3427  */
3428 #define RF8_WILD_ONLY           0x00000001
3429 #define RF8_WILD_TOWN           0x00000002
3430 #define RF8_XXX8X02             0x00000004
3431 #define RF8_WILD_SHORE          0x00000008
3432 #define RF8_WILD_OCEAN          0x00000010
3433 #define RF8_WILD_WASTE          0x00000020
3434 #define RF8_WILD_WOOD           0x00000040
3435 #define RF8_WILD_VOLCANO        0x00000080
3436 #define RF8_XXX8X08             0x00000100
3437 #define RF8_WILD_MOUNTAIN       0x00000200
3438 #define RF8_WILD_GRASS          0x00000400
3439 #define RF8_WILD_ALL            0x80000000
3440
3441 /*
3442  * Monster drop info
3443  */
3444
3445 #define RF9_DROP_CORPSE         0x00000001
3446 #define RF9_DROP_SKELETON       0x00000002
3447 #define RF9_EAT_BLIND           0x00000004
3448 #define RF9_EAT_CONF            0x00000008
3449 #define RF9_EAT_MANA            0x00000010
3450 #define RF9_EAT_NEXUS           0x00000020
3451 #define RF9_EAT_SLEEP           0x00000040
3452 #define RF9_EAT_BERSERKER       0x00000080
3453 #define RF9_EAT_ACIDIC          0x00000100
3454 #define RF9_EAT_SPEED           0x00000200
3455 #define RF9_EAT_CURE            0x00000400
3456 #define RF9_EAT_FIRE_RES        0x00000800
3457 #define RF9_EAT_COLD_RES        0x00001000
3458 #define RF9_EAT_ACID_RES        0x00002000
3459 #define RF9_EAT_ELEC_RES        0x00004000
3460 #define RF9_EAT_POIS_RES        0x00008000
3461 #define RF9_EAT_INSANITY        0x00010000
3462 #define RF9_EAT_DRAIN_EXP       0x00020000
3463 #define RF9_EAT_POISONOUS       0x00040000
3464 #define RF9_EAT_GIVE_STR        0x00080000
3465 #define RF9_EAT_GIVE_INT        0x00100000
3466 #define RF9_EAT_GIVE_WIS        0x00200000
3467 #define RF9_EAT_GIVE_DEX        0x00400000
3468 #define RF9_EAT_GIVE_CON        0x00800000
3469 #define RF9_EAT_GIVE_CHR        0x01000000
3470 #define RF9_EAT_LOSE_STR        0x02000000
3471 #define RF9_EAT_LOSE_INT        0x04000000
3472 #define RF9_EAT_LOSE_WIS        0x08000000
3473 #define RF9_EAT_LOSE_DEX        0x01000000
3474 #define RF9_EAT_LOSE_CON        0x20000000
3475 #define RF9_EAT_LOSE_CHR        0x40000000
3476 #define RF9_EAT_DRAIN_MANA      0x80000000
3477
3478 /*
3479  * Hack -- choose "intelligent" spells when desperate
3480  */
3481
3482 #define RF4_INT_MASK \
3483    (RF4_DISPEL)
3484
3485 #define RF5_INT_MASK \
3486   (RF5_HOLD | RF5_SLOW | RF5_CONF | RF5_BLIND | RF5_SCARE)
3487
3488 #define RF6_INT_MASK \
3489    (RF6_BLINK |  RF6_TPORT | RF6_TELE_LEVEL | RF6_TELE_AWAY | \
3490     RF6_HEAL | RF6_INVULNER | RF6_HASTE | RF6_TRAPS | \
3491     RF6_S_KIN | RF6_S_CYBER | RF6_S_MONSTER | RF6_S_MONSTERS | \
3492     RF6_S_ANT | RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | \
3493     RF6_S_ANGEL | RF6_S_DRAGON | RF6_S_UNDEAD | RF6_S_DEMON | \
3494     RF6_S_HI_DRAGON | RF6_S_HI_UNDEAD | RF6_S_AMBERITES | RF6_S_UNIQUE)
3495
3496
3497 #define RF4_RIDING_MASK \
3498   (RF4_SHRIEK)
3499
3500 #define RF5_RIDING_MASK \
3501    0L
3502
3503 #define RF6_RIDING_MASK \
3504    (RF6_BLINK | RF6_TPORT | RF6_TRAPS | RF6_DARKNESS | RF6_SPECIAL)
3505
3506
3507 /*
3508  * Hack -- "bolt" spells that may hurt fellow monsters
3509  */
3510 #define RF4_BOLT_MASK \
3511   (RF4_ROCKET | RF4_SHOOT)
3512
3513 #define RF5_BOLT_MASK \
3514    (RF5_BO_ACID | RF5_BO_ELEC | RF5_BO_FIRE | RF5_BO_COLD | \
3515     RF5_BO_NETH | RF5_BO_WATE | RF5_BO_MANA | \
3516     RF5_BO_PLAS | RF5_BO_ICEE | RF5_MISSILE)
3517
3518 #define RF6_BOLT_MASK 0
3519
3520 /*
3521  * Hack -- "beam" spells that may hurt fellow monsters
3522  */
3523 #define RF4_BEAM_MASK 0
3524
3525 #define RF5_BEAM_MASK 0
3526
3527 #define RF6_BEAM_MASK (RF6_PSY_SPEAR)
3528
3529 /*
3530  * Hack -- 'ball' spells that may hurt friends
3531  */
3532 #define RF4_BALL_MASK \
3533         (RF4_ROCKET | RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | \
3534         RF4_BR_COLD | RF4_BR_POIS | RF4_BR_NETH | RF4_BR_LITE | \
3535         RF4_BR_DARK | RF4_BR_CONF | RF4_BR_SOUN | RF4_BR_CHAO | \
3536         RF4_BR_DISE | RF4_BR_NEXU | RF4_BR_SHAR | \
3537         RF4_BR_SOUN | RF4_BR_TIME | RF4_BR_INER | RF4_BR_GRAV | \
3538         RF4_BR_PLAS | RF4_BR_WALL | RF4_BR_MANA | RF4_BA_NUKE | \
3539         RF4_BR_NUKE | RF4_BA_CHAO | RF4_BR_DISI)
3540
3541 #define RF5_BALL_MASK \
3542         (RF5_BA_ACID | RF5_BA_ELEC | RF5_BA_FIRE | RF5_BA_COLD | \
3543          RF5_BA_POIS | RF5_BA_LITE | \
3544         RF5_BA_NETH | RF5_BA_DARK | RF5_BA_WATE | RF5_BA_MANA)
3545
3546 #define RF6_BALL_MASK \
3547         0L
3548
3549
3550 /*
3551  * Hack -- 'breath' spells that may hurt friends
3552  */
3553 #define RF4_BREATH_MASK \
3554         (RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | \
3555         RF4_BR_COLD | RF4_BR_POIS | RF4_BR_NETH | RF4_BR_LITE | \
3556         RF4_BR_DARK | RF4_BR_CONF | RF4_BR_SOUN | RF4_BR_CHAO | \
3557         RF4_BR_DISE | RF4_BR_NEXU | RF4_BR_SHAR | \
3558         RF4_BR_SOUN | RF4_BR_TIME | RF4_BR_INER | RF4_BR_GRAV | \
3559         RF4_BR_PLAS | RF4_BR_WALL | RF4_BR_MANA | \
3560         RF4_BR_NUKE | RF4_BR_DISI)
3561
3562 #define RF5_BREATH_MASK \
3563     0L
3564
3565 #define RF6_BREATH_MASK \
3566     0L
3567
3568 /* Hack -- summon spells */
3569
3570 #define RF4_SUMMON_MASK \
3571     0L
3572
3573 #define RF5_SUMMON_MASK \
3574     0L
3575
3576 #define RF6_SUMMON_MASK \
3577     (RF6_S_KIN | RF6_S_CYBER | RF6_S_MONSTER | RF6_S_MONSTERS | RF6_S_ANT | \
3578      RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | RF6_S_ANGEL | RF6_S_DEMON | \
3579      RF6_S_UNDEAD | RF6_S_DRAGON | RF6_S_HI_UNDEAD | RF6_S_HI_DRAGON | \
3580      RF6_S_AMBERITES | RF6_S_UNIQUE)
3581
3582
3583 /*
3584  * Hack -- "attack" spells
3585  */
3586 #define RF4_ATTACK_MASK \
3587   (RF4_SHRIEK | RF4_DISPEL | RF4_ROCKET | RF4_SHOOT | \
3588    RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | \
3589    RF4_BR_COLD | RF4_BR_POIS | RF4_BR_NETH | RF4_BR_LITE | RF4_BR_DARK | \
3590    RF4_BR_CONF | RF4_BR_SOUN | RF4_BR_CHAO | RF4_BR_DISE | RF4_BR_NEXU | \
3591    RF4_BR_TIME | RF4_BR_INER | RF4_BR_GRAV | RF4_BR_SHAR | RF4_BR_PLAS | \
3592    RF4_BR_WALL | RF4_BR_MANA | RF4_BA_NUKE | RF4_BR_NUKE | RF4_BA_CHAO | \
3593    RF4_BR_DISI)
3594
3595 #define RF5_ATTACK_MASK \
3596    (RF5_BA_ACID | RF5_BA_ELEC | RF5_BA_FIRE | RF5_BA_COLD | \
3597     RF5_BA_POIS | RF5_BA_NETH | RF5_BA_WATE | RF5_BA_MANA | \
3598     RF5_BA_DARK | RF5_DRAIN_MANA | RF5_MIND_BLAST | RF5_BRAIN_SMASH | \
3599     RF5_CAUSE_1 | RF5_CAUSE_2 | RF5_CAUSE_3 | RF5_CAUSE_4 | \
3600     RF5_BO_ACID | RF5_BO_ELEC | RF5_BO_FIRE | RF5_BO_COLD | \
3601     RF5_BA_LITE | RF5_BO_NETH | RF5_BO_WATE | RF5_BO_MANA | \
3602     RF5_BO_PLAS | RF5_BO_ICEE | RF5_MISSILE | RF5_SCARE | \
3603     RF5_BLIND | RF5_CONF | RF5_SLOW | RF5_HOLD)
3604
3605 #define RF6_ATTACK_MASK \
3606   (RF6_HAND_DOOM | RF6_TELE_TO | RF6_TELE_AWAY | RF6_PSY_SPEAR | \
3607    RF6_DARKNESS | RF6_TRAPS | RF6_FORGET)
3608
3609
3610 /*
3611  * Hack -- "indirect" spells
3612  */
3613 #define RF4_INDIRECT_MASK \
3614   (RF4_SHRIEK | RF4_XXX1 | RF4_XXX2 | RF4_XXX3 | RF4_XXX4)
3615
3616 #define RF5_INDIRECT_MASK \
3617   0L
3618
3619 #define RF6_INDIRECT_MASK \
3620   (RF6_HASTE | RF6_HEAL | RF6_INVULNER | RF6_BLINK | RF6_WORLD | \
3621    RF6_TPORT | RF6_RAISE_DEAD | \
3622    RF6_S_KIN | RF6_S_CYBER | RF6_S_MONSTER | RF6_S_MONSTERS | \
3623    RF6_S_ANT | RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | \
3624    RF6_S_ANGEL | RF6_S_DEMON | RF6_S_UNDEAD | RF6_S_DRAGON | \
3625    RF6_S_HI_UNDEAD | RF6_S_HI_DRAGON | RF6_S_AMBERITES | RF6_S_UNIQUE)
3626
3627
3628 /*
3629  * Hack -- "no magic" spells
3630  */
3631 #define RF4_NOMAGIC_MASK \
3632         (RF4_SHRIEK | RF4_ROCKET | RF4_SHOOT | \
3633          RF4_BR_ACID | RF4_BR_ELEC | \
3634          RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS | RF4_BR_NETH | \
3635          RF4_BR_LITE | RF4_BR_DARK | RF4_BR_CONF | RF4_BR_SOUN | \
3636          RF4_BR_CHAO | RF4_BR_DISE | RF4_BR_NEXU | RF4_BR_SHAR | \
3637         RF4_BR_SOUN | RF4_BR_TIME | RF4_BR_INER | RF4_BR_GRAV | \
3638         RF4_BR_PLAS | RF4_BR_WALL | RF4_BR_MANA | \
3639         RF4_BR_NUKE | RF4_BR_DISI)
3640
3641 #define RF5_NOMAGIC_MASK \
3642      0L
3643
3644 #define RF6_NOMAGIC_MASK \
3645      (RF6_SPECIAL)
3646
3647
3648 #define MR1_SINKA 0x01
3649
3650
3651 #define is_friendly(A) \
3652          (bool)(((A)->smart & SM_FRIENDLY) ? TRUE : FALSE)
3653
3654 #define is_friendly_idx(IDX) \
3655          (bool)((IDX) > 0 && is_friendly(&m_list[(IDX)]))
3656
3657 #define is_pet(A) \
3658          (bool)(((A)->smart & SM_PET) ? TRUE : FALSE)
3659
3660 #define is_hostile(A) \
3661          (bool)((is_friendly(A) || is_pet(A)) ? FALSE : TRUE)
3662
3663
3664 /*** Macro Definitions ***/
3665
3666
3667 /*
3668  * Hack -- The main "screen"
3669  */
3670 #define term_screen     (angband_term[0])
3671
3672
3673 #ifndef SCRIPT_OBJ_KIND
3674 /*
3675  * Determine if a given inventory item is "aware"
3676  */
3677 #define object_aware_p(T) \
3678     (k_info[(T)->k_idx].aware)
3679
3680 /*
3681  * Determine if a given inventory item is "tried"
3682  */
3683 #define object_tried_p(T) \
3684     (k_info[(T)->k_idx].tried)
3685
3686
3687 /*
3688  * Determine if a given inventory item is "known"
3689  * Test One -- Check for special "known" tag
3690  * Test Two -- Check for "Easy Know" + "Aware"
3691  */
3692 #define object_known_p(T) \
3693     (((T)->ident & (IDENT_KNOWN)) || \
3694      (k_info[(T)->k_idx].easy_know && k_info[(T)->k_idx].aware))
3695
3696
3697 /*
3698  * Return the "attr" for a given item.
3699  * Use "flavor" if available.
3700  * Default to user definitions.
3701  */
3702 #define object_attr(T) \
3703         ((k_info[(T)->k_idx].flavor) ? \
3704          (misc_to_attr[k_info[(T)->k_idx].flavor]) : \
3705          (k_info[(T)->k_idx].x_attr))
3706
3707 /*
3708  * Return the "char" for a given item.
3709  * Use "flavor" if available.
3710  * Default to user definitions.
3711  */
3712 #define object_char(T) \
3713         ((k_info[(T)->k_idx].flavor) ? \
3714          (misc_to_char[k_info[(T)->k_idx].flavor]) : \
3715          (k_info[(T)->k_idx].x_char))
3716
3717
3718 #else /* SCRIPT_OBJ_KIND */
3719
3720
3721 /*
3722  * Determine if a given inventory item is "aware"
3723  */
3724 #define object_aware_p(T) \
3725     ((T)->aware)
3726
3727 /*
3728  * Determine if a given inventory item is "tried"
3729  */
3730 #define object_tried_p(T) \
3731     ((T)->tried)
3732
3733
3734 /*
3735  * Determine if a given inventory item is "known"
3736  * Test One -- Check for special "known" tag
3737  * Test Two -- Check for "Easy Know" + "Aware"
3738  */
3739 #define object_known_p(T) \
3740     (((T)->ident & (IDENT_KNOWN)) || \
3741      ((T)->easy_know && (T)->aware))
3742
3743
3744 /*
3745  * Return the "attr" for a given item.
3746  * Use "flavor" if available.
3747  * Default to user definitions.
3748  */
3749 #define object_attr(T) \
3750         (((T)->flavor) ? \
3751          (misc_to_attr[(T)->flavor]) : \
3752          ((T)->x_attr))
3753
3754 /*
3755  * Return the "char" for a given item.
3756  * Use "flavor" if available.
3757  * Default to user definitions.
3758  */
3759 #define object_char(T) \
3760         (((T)->flavor) ? \
3761          (misc_to_char[(T)->flavor]) : \
3762          ((T)->x_char))
3763
3764 #endif /* SCRIPT_OBJ_KIND */
3765
3766
3767
3768
3769 /*
3770  * Artifacts use the "name1" field
3771  */
3772 #define artifact_p(T) \
3773         ((T)->name1 ? TRUE : FALSE)
3774
3775 /*
3776  * Ego-Items use the "name2" field
3777  */
3778 #define ego_item_p(T) \
3779         ((T)->name2 ? TRUE : FALSE)
3780
3781
3782 /*
3783  * Broken items.
3784  */
3785 #define broken_p(T) \
3786         ((T)->ident & (IDENT_BROKEN))
3787
3788 /*
3789  * Cursed items.
3790  */
3791 #define cursed_p(T) \
3792         ((T)->curse_flags)
3793
3794
3795 /*
3796  * Convert an "attr"/"char" pair into a "pict" (P)
3797  */
3798 #define PICT(A,C) \
3799         ((((u16b)(A)) << 8) | ((byte)(C)))
3800
3801 /*
3802  * Convert a "pict" (P) into an "attr" (A)
3803  */
3804 #define PICT_A(P) \
3805         ((byte)((P) >> 8))
3806
3807 /*
3808  * Convert a "pict" (P) into an "char" (C)
3809  */
3810 #define PICT_C(P) \
3811         ((char)((byte)(P)))
3812
3813
3814 /*
3815  * Convert a "location" (Y,X) into a "grid" (G)
3816  */
3817 #define GRID(Y,X) \
3818         (256 * (Y) + (X))
3819
3820 /*
3821  * Convert a "grid" (G) into a "location" (Y)
3822  */
3823 #define GRID_Y(G) \
3824         ((int)((G) / 256U))
3825
3826 /*
3827  * Convert a "grid" (G) into a "location" (X)
3828  */
3829 #define GRID_X(G) \
3830         ((int)((G) % 256U))
3831
3832
3833 /*
3834  * Determines if a map location is fully inside the outer walls
3835  */
3836 #define in_bounds(Y,X) \
3837    (((Y) > 0) && ((X) > 0) && ((Y) < cur_hgt-1) && ((X) < cur_wid-1))
3838
3839 /*
3840  * Determines if a map location is on or inside the outer walls
3841  */
3842 #define in_bounds2(Y,X) \
3843    (((Y) >= 0) && ((X) >= 0) && ((Y) < cur_hgt) && ((X) < cur_wid))
3844
3845 /*
3846  * Determines if a map location is on or inside the outer walls
3847  * (unsigned version)
3848  */
3849 #define in_bounds2u(Y,X) \
3850    (((Y) < cur_hgt) && ((X) < cur_wid))
3851
3852 /*
3853  * Determines if a map location is currently "on screen" -RAK-
3854  * Note that "panel_contains(Y,X)" always implies "in_bounds2(Y,X)".
3855  */
3856 #define panel_contains(Y,X) \
3857   (((Y) >= panel_row_min) && ((Y) <= panel_row_max) && \
3858    ((X) >= panel_col_min) && ((X) <= panel_col_max))
3859
3860
3861
3862 /*
3863  * Determine if a "legal" grid is a "floor" grid
3864  *
3865  * Line 1 -- forbid doors, rubble, seams, walls
3866  *
3867  * Note that the terrain features are split by a one bit test
3868  * into those features which block line of sight and those that
3869  * do not, allowing an extremely fast single bit check below.
3870  *
3871  * Add in the fact that some new terrain (water & lava) do NOT block sight
3872  * -KMW-
3873  */
3874 #define cave_floor_bold(Y,X) \
3875         (!(cave[Y][X].feat & 0x20))
3876
3877
3878 /*
3879  * Determine if a "legal" grid is a "clean" floor grid
3880  *
3881  * Line 1 -- forbid non-floors
3882  * Line 2 -- forbid deep water -KMW-
3883  * Line 3 -- forbid deep lava -KMW-
3884  * Line 4 -- forbid normal objects
3885  */
3886 #define cave_clean_bold(Y,X) \
3887         (((cave[Y][X].feat == FEAT_FLOOR) || \
3888           (cave[Y][X].feat == FEAT_SHAL_WATER) || \
3889           (cave[Y][X].feat == FEAT_SHAL_LAVA) || \
3890           (cave[Y][X].feat == FEAT_DEEP_GRASS) || \
3891           (cave[Y][X].feat == FEAT_FLOWER) || \
3892           (cave[Y][X].feat == FEAT_GRASS) || \
3893           (cave[Y][X].feat == FEAT_DIRT)) && \
3894           !(cave[Y][X].info & CAVE_TRAP) && \
3895           (cave[Y][X].o_idx == 0))
3896
3897
3898 /*
3899  * Determine if a "legal" grid is an "empty" floor grid
3900  *
3901  * Line 1 -- forbid doors, rubble, seams, walls
3902  * Line 2 -- forbid normal monsters
3903  * Line 3 -- forbid the player
3904  */
3905 #define cave_empty_bold(Y,X) \
3906     (cave_floor_bold(Y,X) && \
3907      !(cave[Y][X].m_idx) && \
3908      !(((Y) == py) && ((X) == px)))
3909
3910
3911 /*
3912  * Determine if a "legal" grid is an "empty" floor grid
3913  *
3914  * Line 1 -- forbid doors, rubble, seams, walls
3915  * Line 2 -- forbid normal monsters
3916  * Line 3 -- forbid the player
3917  */
3918 #define cave_empty_bold2(Y,X) \
3919     (((cave_floor_bold(Y,X) && (cave[Y][X].feat != FEAT_DARK_PIT)) || (character_dungeon && (cave[Y][X].feat == FEAT_TREES)))&& \
3920      !(cave[Y][X].m_idx) && \
3921      !(((Y) == py) && ((X) == px)))
3922
3923
3924 /*
3925  * Determine if a "legal" grid is an "naked" floor grid
3926  *
3927  * Line 1 -- forbid non-floors, non-shallow water & lava -KMW-
3928  * Line 4 -- forbid normal objects
3929  * Line 5 -- forbid player/monsters
3930  */
3931 #define cave_naked_bold(Y,X) \
3932         (((cave[Y][X].feat == FEAT_FLOOR) || \
3933           (cave[Y][X].feat == FEAT_SHAL_WATER) || \
3934           (cave[Y][X].feat == FEAT_SHAL_LAVA) || \
3935           (cave[Y][X].feat == FEAT_GRASS) || \
3936           (cave[Y][X].feat == FEAT_DEEP_GRASS) || \
3937           (cave[Y][X].feat == FEAT_FLOWER) || \
3938           (cave[Y][X].feat == FEAT_DIRT)) && \
3939           !(cave[Y][X].info & CAVE_TRAP) && \
3940           (cave[Y][X].o_idx == 0) && \
3941           (cave[Y][X].m_idx == 0))
3942
3943
3944
3945 /*
3946  * Determine if a "legal" grid is "permanent"
3947  *
3948  * Line 1   -- perma-walls
3949  * Line 2-3 -- stairs
3950  * Line 4-5 -- building doors -KMW-
3951  * Line 6-7 -- shop doors
3952  */
3953 #define cave_perma_bold(Y,X) \
3954         (((cave[Y][X].feat >= FEAT_PERM_EXTRA) && \
3955           (cave[Y][X].feat <= FEAT_PERM_SOLID)) || \
3956          ((cave[Y][X].feat == FEAT_LESS) || \
3957           (cave[Y][X].feat == FEAT_MORE) || \
3958           (cave[Y][X].feat == FEAT_ENTRANCE)) || \
3959          ((cave[Y][X].feat == FEAT_LESS_LESS) || \
3960           (cave[Y][X].feat == FEAT_MORE_MORE)) || \
3961          ((cave[Y][X].feat >= FEAT_BLDG_HEAD) && \
3962           (cave[Y][X].feat <= FEAT_BLDG_TAIL)) || \
3963          ((cave[Y][X].feat >= FEAT_SHOP_HEAD) && \
3964           (cave[Y][X].feat <= FEAT_SHOP_TAIL)) || \
3965           (cave[Y][X].feat == FEAT_MUSEUM))
3966
3967
3968 /*
3969  * Grid based version of "cave_floor_bold()"
3970  */
3971 #define cave_floor_grid(C) \
3972     (!((C)->feat & 0x20))
3973
3974
3975 /*
3976  * Grid based version of "cave_clean_bold()"
3977  */
3978 #define cave_clean_grid(C) \
3979     (((C)->feat == FEAT_FLOOR) && \
3980      (!(C)->o_idx))
3981
3982 /*
3983  * Grid based version of "cave_empty_bold()"
3984  */
3985 #define cave_empty_grid(C) \
3986     (cave_floor_grid(C) && \
3987      !((C)->m_idx) && \
3988      !((C) == &cave[py][px]))
3989
3990 /*
3991  * Grid based version of "cave_empty_bold()"
3992  */
3993 #define cave_empty_grid2(C) \
3994     ((cave_floor_grid(C) || ((C)->feat == FEAT_TREES)) && \
3995      !((C)->m_idx) && \
3996      !((C) == &cave[py][px]))
3997
3998 /*
3999  * Grid based version of "cave_empty_bold()"
4000  */
4001 #define cave_naked_grid(C) \
4002     (((C)->feat == FEAT_FLOOR) && \
4003      !((C)->o_idx) && \
4004      !((C)->m_idx) && \
4005      !((C) == &cave[py][px]))
4006
4007
4008 /*
4009  * Grid based version of "cave_perma_bold()"
4010  */
4011 #define cave_perma_grid(C) \
4012         ((((C)->feat >= FEAT_PERM_EXTRA) && \
4013           ((C)->feat <= FEAT_PERM_SOLID)) || \
4014           ((C)->feat == FEAT_LESS) || \
4015           ((C)->feat == FEAT_MORE) || \
4016           ((C)->feat == FEAT_ENTRANCE) || \
4017           ((C)->feat == FEAT_LESS_LESS) || \
4018           ((C)->feat == FEAT_MORE_MORE) || \
4019           ((C)->feat == FEAT_MOUNTAIN) || \
4020          (((C)->feat >= FEAT_QUEST_ENTER) && \
4021           ((C)->feat <= FEAT_QUEST_UP)) || \
4022          (((C)->feat >= FEAT_PATTERN_START) && \
4023           ((C)->feat <= FEAT_PATTERN_XTRA2)) || \
4024          (((C)->feat >= FEAT_SHOP_HEAD) && \
4025           ((C)->feat <= FEAT_SHOP_TAIL)) || \
4026           ((C)->feat == FEAT_MUSEUM) || \
4027          (((C)->feat >= FEAT_BLDG_HEAD) && \
4028           ((C)->feat <= FEAT_BLDG_TAIL)))
4029
4030
4031 #define pattern_tile(Y,X) \
4032      ((cave[Y][X].feat <= FEAT_PATTERN_XTRA2) && (cave[Y][X].feat >= FEAT_PATTERN_START))
4033
4034 /*
4035  * Does the grid stop disintegration?
4036  */
4037 #define cave_stop_disintegration(Y,X) \
4038         (((cave[Y][X].feat >= FEAT_PERM_EXTRA) && \
4039           (cave[Y][X].feat <= FEAT_PERM_SOLID)) || \
4040           (cave[Y][X].feat == FEAT_MOUNTAIN) || \
4041          ((cave[Y][X].feat >= FEAT_SHOP_HEAD) && \
4042           (cave[Y][X].feat <= FEAT_SHOP_TAIL)) || \
4043          ((cave[Y][X].feat >= FEAT_BLDG_HEAD) && \
4044           (cave[Y][X].feat <= FEAT_BLDG_TAIL)) || \
4045           (cave[Y][X].feat == FEAT_MUSEUM))
4046
4047
4048 /*
4049  * Determine if a "legal" grid is within "los" of the player
4050  *
4051  * Note the use of comparison to zero to force a "boolean" result
4052  */
4053 #define player_has_los_grid(C) \
4054     (((C)->info & (CAVE_VIEW)) != 0)
4055
4056 /*
4057  * Determine if a "legal" grid is within "los" of the player
4058  *
4059  * Note the use of comparison to zero to force a "boolean" result
4060  */
4061 #define player_has_los_bold(Y,X) \
4062     (((cave[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->inside_battle)
4063
4064
4065 #define update_playtime() \
4066 {\
4067         u32b tmp;\
4068         tmp = time(NULL);\
4069         playtime += (tmp - start_time);\
4070         start_time = tmp;\
4071 }
4072
4073 /*
4074  * Hack -- Prepare to use the "Secure" routines
4075  */
4076 #if defined(SET_UID) && defined(SECURE)
4077 extern int PlayerUID;
4078 # define getuid() PlayerUID
4079 # define geteuid() PlayerUID
4080 #endif
4081
4082
4083
4084 /*** Color constants ***/
4085
4086
4087 /*
4088  * Angband "attributes" (with symbols, and base (R,G,B) codes)
4089  *
4090  * The "(R,G,B)" codes are given in "fourths" of the "maximal" value,
4091  * and should "gamma corrected" on most (non-Macintosh) machines.
4092  */
4093 #define TERM_DARK                0  /* 'd' */   /* 0,0,0 */
4094 #define TERM_WHITE               1  /* 'w' */   /* 4,4,4 */
4095 #define TERM_SLATE               2  /* 's' */   /* 2,2,2 */
4096 #define TERM_ORANGE              3  /* 'o' */   /* 4,2,0 */
4097 #define TERM_RED                 4  /* 'r' */   /* 3,0,0 */
4098 #define TERM_GREEN               5  /* 'g' */   /* 0,2,1 */
4099 #define TERM_BLUE                6  /* 'b' */   /* 0,0,4 */
4100 #define TERM_UMBER               7  /* 'u' */   /* 2,1,0 */
4101 #define TERM_L_DARK              8  /* 'D' */   /* 1,1,1 */
4102 #define TERM_L_WHITE             9  /* 'W' */   /* 3,3,3 */
4103 #define TERM_VIOLET             10  /* 'v' */   /* 4,0,4 */
4104 #define TERM_YELLOW             11  /* 'y' */   /* 4,4,0 */
4105 #define TERM_L_RED              12  /* 'R' */   /* 4,0,0 */
4106 #define TERM_L_GREEN            13  /* 'G' */   /* 0,4,0 */
4107 #define TERM_L_BLUE             14  /* 'B' */   /* 0,4,4 */
4108 #define TERM_L_UMBER            15  /* 'U' */   /* 3,2,1 */
4109
4110
4111 /*** Sound constants ***/
4112
4113
4114 /*
4115  * Mega-Hack -- some primitive sound support (see "main-win.c")
4116  *
4117  * Some "sound" constants for "Term_xtra(TERM_XTRA_SOUND, val)"
4118  */
4119 #define SOUND_HIT        1
4120 #define SOUND_MISS       2
4121 #define SOUND_FLEE       3
4122 #define SOUND_DROP       4
4123 #define SOUND_KILL       5
4124 #define SOUND_LEVEL      6
4125 #define SOUND_DEATH      7
4126 #define SOUND_STUDY      8
4127 #define SOUND_TELEPORT   9
4128 #define SOUND_SHOOT     10
4129 #define SOUND_QUAFF     11
4130 #define SOUND_ZAP       12
4131 #define SOUND_WALK      13
4132 #define SOUND_TPOTHER   14
4133 #define SOUND_HITWALL   15
4134 #define SOUND_EAT       16
4135 #define SOUND_STORE1    17
4136 #define SOUND_STORE2    18
4137 #define SOUND_STORE3    19
4138 #define SOUND_STORE4    20
4139 #define SOUND_DIG       21
4140 #define SOUND_OPENDOOR  22
4141 #define SOUND_SHUTDOOR  23
4142 #define SOUND_TPLEVEL   24
4143 #define SOUND_SCROLL    25
4144 #define SOUND_BUY           26
4145 #define SOUND_SELL          27
4146 #define SOUND_WARN          28
4147 #define SOUND_ROCKET    29 /* Somebody's shooting rockets */
4148 #define SOUND_N_KILL    30 /* The player kills a non-living/undead monster */
4149 #define SOUND_U_KILL    31 /* The player kills a unique */
4150 #define SOUND_QUEST     32 /* The player has just completed a quest */
4151 #define SOUND_HEAL      33 /* The player was healed a little bit */
4152 #define SOUND_X_HEAL    34 /* The player was healed full health */
4153 #define SOUND_BITE      35 /* A monster bites you */
4154 #define SOUND_CLAW      36 /* A monster claws you */
4155 #define SOUND_M_SPELL   37 /* A monster casts a miscellaneous spell */
4156 #define SOUND_SUMMON    38 /* A monster casts a summoning spell  */
4157 #define SOUND_BREATH    39 /* A monster breathes */
4158 #define SOUND_BALL      40 /* A monster casts a ball / bolt spell */
4159 #define SOUND_M_HEAL    41 /* A monster heals itself somehow */
4160 #define SOUND_ATK_SPELL 42 /* A monster casts a misc. offensive spell */
4161 #define SOUND_EVIL      43 /* Something nasty has just happened! */
4162 #define SOUND_TOUCH     44 /* A monster touches you */
4163 #define SOUND_STING     45 /* A monster stings you */
4164 #define SOUND_CRUSH     46 /* A monster crushes / envelopes you */
4165 #define SOUND_SLIME     47 /* A monster drools/spits/etc on you */
4166 #define SOUND_WAIL      48 /* A monster wails */
4167 #define SOUND_WINNER    49 /* Just won the game! */
4168 #define SOUND_FIRE      50 /* An item was burned  */
4169 #define SOUND_ACID      51 /* An item was destroyed by acid */
4170 #define SOUND_ELEC      52 /* An item was destroyed by electricity */
4171 #define SOUND_COLD      53 /* An item was shattered */
4172 #define SOUND_ILLEGAL   54 /* Illegal command attempted */
4173 #define SOUND_FAIL      55 /* Fail to get a spell off / activate an item */
4174 #define SOUND_WAKEUP    56 /* A monster wakes up */
4175 #define SOUND_INVULN    57 /* Invulnerability! */
4176 #define SOUND_FALL      58 /* Falling through a trapdoor... */
4177 #define SOUND_PAIN      59 /* A monster is in pain! */
4178 #define SOUND_DESTITEM  60 /* An item was destroyed by misc. means */
4179 #define SOUND_MOAN      61 /* A monster makes a moan/beg/insult attack */
4180 #define SOUND_SHOW      62 /* A monster makes a "show" attack */
4181 #define SOUND_UNUSED    63 /* (no sound for gaze attacks) */
4182 #define SOUND_EXPLODE   64 /* Something (or somebody) explodes */
4183
4184 /*
4185  * Mega-Hack -- maximum known sounds
4186  */
4187 #define SOUND_MAX 65
4188
4189 #define MAX_VIRTUE 18
4190
4191 #define V_COMPASSION        1
4192 #define V_HONOUR            2
4193 #define V_JUSTICE           3
4194 #define V_SACRIFICE         4
4195 #define V_KNOWLEDGE         5
4196 #define V_FAITH             6
4197 #define V_ENLIGHTEN         7
4198 #define V_ENCHANT           8
4199 #define V_CHANCE            9
4200 #define V_NATURE           10
4201 #define V_HARMONY          11
4202 #define V_VITALITY         12
4203 #define V_UNLIFE           13
4204 #define V_PATIENCE         14
4205 #define V_TEMPERANCE       15
4206 #define V_DILIGENCE        16
4207 #define V_VALOUR           17
4208 #define V_INDIVIDUALISM    18
4209
4210
4211 /*** Hack ***/
4212
4213
4214 /*
4215  * Hack -- attempt to reduce various values
4216  */
4217 #ifdef ANGBAND_LITE
4218 # undef MACRO_MAX
4219 # define MACRO_MAX      128
4220 # undef QUARK_MAX
4221 # define QUARK_MAX      128
4222 # undef MESSAGE_MAX
4223 # define MESSAGE_MAX    128
4224 # undef MESSAGE_BUF
4225 # define MESSAGE_BUF    4096
4226 #endif
4227
4228
4229 /*
4230  * Buildings actions
4231  */
4232 #define BACT_NOTHING                 0
4233 #define BACT_RESEARCH_ITEM           1
4234 #define BACT_TOWN_HISTORY            2
4235 #define BACT_RACE_LEGENDS            3
4236 #define BACT_GREET_KING              4
4237 #define BACT_KING_LEGENDS            5
4238 #define BACT_QUEST                   6
4239 #define BACT_GOLD                    7
4240 #define BACT_POSTER                  8
4241 #define BACT_ARENA_RULES             9
4242 #define BACT_ARENA                  10
4243 #define BACT_ARENA_LEGENDS          11
4244 #define BACT_IN_BETWEEN             12
4245 #define BACT_GAMBLE_RULES           13
4246 #define BACT_CRAPS                  14
4247 #define BACT_SPIN_WHEEL             15
4248 #define BACT_DICE_SLOTS             16
4249 #define BACT_REST                   17
4250 #define BACT_FOOD                   18
4251 #define BACT_RUMORS                 19
4252 #define BACT_RESEARCH_MONSTER       20
4253 #define BACT_COMPARE_WEAPONS        21
4254 #define BACT_LEGENDS                22
4255 #define BACT_ENCHANT_WEAPON         23
4256 #define BACT_ENCHANT_ARMOR          24
4257 #define BACT_RECHARGE               25
4258 #define BACT_IDENTS                 26
4259 #define BACT_LEARN                  27
4260 #define BACT_HEALING                28
4261 #define BACT_RESTORE                29
4262 #define BACT_ENCHANT_ARROWS         30
4263 #define BACT_ENCHANT_BOW            31
4264 #define BACT_GREET                  32
4265 #define BACT_RECALL                 33
4266 #define BACT_TELEPORT_LEVEL         34
4267 #define BACT_LOSE_MUTATION          35
4268 #define BACT_BATTLE                 36
4269 #define BACT_TSUCHINOKO             37
4270 #define BACT_TARGET                 38
4271 #define BACT_KUBI                   39
4272 #define BACT_KANKIN                 40
4273 #define BACT_HEIKOUKA               41
4274 #define BACT_TELE_TOWN              42
4275 #define BACT_POKER                  43
4276 #define BACT_IDENT_ONE              44
4277 #define BACT_RECHARGE_ALL           45
4278 #define MAX_BACT                    46
4279
4280 /*
4281  * Quest status
4282  */
4283 #define QUEST_STATUS_UNTAKEN         0
4284 #define QUEST_STATUS_TAKEN           1
4285 #define QUEST_STATUS_COMPLETED       2
4286 #define QUEST_STATUS_REWARDED        3
4287 #define QUEST_STATUS_FINISHED        4
4288 #define QUEST_STATUS_FAILED          5
4289 #define QUEST_STATUS_FAILED_DONE     6
4290
4291 /*
4292  * Quest type
4293  */
4294 #define QUEST_TYPE_KILL_LEVEL                1
4295 #define QUEST_TYPE_KILL_ANY_LEVEL            2
4296 #define QUEST_TYPE_FIND_ARTIFACT             3
4297 #define QUEST_TYPE_FIND_EXIT                 4
4298 #define QUEST_TYPE_KILL_NUMBER               5
4299 #define QUEST_TYPE_KILL_ALL                  6
4300 #define QUEST_TYPE_RANDOM                    7
4301
4302 /*
4303  * Initialization flags
4304  */
4305 #define INIT_SHOW_TEXT          0x01
4306 #define INIT_ASSIGN             0x02
4307 #define INIT_CREATE_DUNGEON     0x04
4308 #define INIT_ONLY_FEATURES      0x08
4309 #define INIT_ONLY_BUILDINGS     0x10
4310
4311 /*
4312  * Quest flags
4313  */
4314 #define QUEST_FLAG_SILENT  0x01 /* no messages fro completion */
4315 #define QUEST_FLAG_PRESET  0x02 /* quest is outside the main dungeon */
4316 #define QUEST_FLAG_ONCE    0x04 /* quest is marked finished after leaving */
4317
4318 /*
4319  * Available graphic modes
4320  */
4321 #define GRAPHICS_NONE       0
4322 #define GRAPHICS_ORIGINAL   1
4323 #define GRAPHICS_ADAM_BOLT  2
4324
4325 /*
4326  * Modes for the random name generator
4327  */
4328 #define NAME_DWARF  1
4329 #define NAME_ELF    2
4330 #define NAME_GNOME  3
4331 #define NAME_HOBBIT 4
4332 #define NAME_HUMAN  5
4333 #define NAME_ORC    6
4334
4335 #ifdef JP
4336 #define JVERB_AND 1
4337 #define JVERB_TO  2
4338 #define JVERB_OR  3
4339 #endif
4340
4341 /*
4342  * Modes for the tokenizer
4343  */
4344 #define TOKENIZE_CHECKQUOTE 0x01  /* Special handling of single quotes */
4345
4346 /*
4347  * Parse errors
4348  */
4349 #define PARSE_ERROR_GENERIC                  1
4350 #define PARSE_ERROR_ABSOLETE_FILE            2
4351 #define PARSE_ERROR_MISSING_RECORD_HEADER    3
4352 #define PARSE_ERROR_NON_SEQUENTIAL_RECORDS   4
4353 #define PARSE_ERROR_INVALID_FLAG             5
4354 #define PARSE_ERROR_UNDEFINED_DIRECTIVE      6
4355 #define PARSE_ERROR_OUT_OF_MEMORY            7
4356 #define PARSE_ERROR_OUT_OF_BOUNDS            8
4357 #define PARSE_ERROR_TOO_FEW_ARGUMENTS        9
4358 #define PARSE_ERROR_MAX                     10
4359
4360 #define GINOU_SUDE       0
4361 #define GINOU_NITOURYU   1
4362 #define GINOU_RIDING      2
4363
4364 #define NO_TOWN 6
4365 #define SECRET_TOWN 5
4366
4367 #define NIKKI_HIGAWARI     0
4368 #define NIKKI_BUNSHOU      1
4369 #define NIKKI_ART          2
4370 #define NIKKI_UNIQUE       3
4371 #define NIKKI_FIX_QUEST_C  4
4372 #define NIKKI_FIX_QUEST_F  5
4373 #define NIKKI_RAND_QUEST_C 6
4374 #define NIKKI_RAND_QUEST_F 7
4375 #define NIKKI_MAXDEAPTH    8
4376 #define NIKKI_TRUMP        9
4377 #define NIKKI_STAIR       10
4378 #define NIKKI_RECALL      11
4379 #define NIKKI_TO_QUEST    12
4380 #define NIKKI_TELE_LEV    13
4381 #define NIKKI_BUY         14
4382 #define NIKKI_SELL        15
4383 #define NIKKI_ARENA       16
4384 #define NIKKI_HANMEI      17
4385 #define NIKKI_LEVELUP     18
4386 #define NIKKI_GAMESTART   19
4387 #define NIKKI_WIZ_TELE    20
4388 #define NIKKI_NAMED_PET   21
4389
4390 #define MAX_MANE 16
4391 #define MAX_MONSPELLS 96
4392
4393 #define EATER_EXT 36
4394 #define EATER_CHARGE 0x10000L
4395 #define EATER_ROD_CHARGE 0x10L
4396
4397 #define MAX_KUBI 20
4398
4399 #define DETECT_RAD_DEFAULT 30
4400 #define DETECT_RAD_MAP     30
4401 #define DETECT_RAD_ALL     255
4402
4403 /* Monster Spells */
4404 #define MS_SHRIEK         0
4405 #define MS_XXX1           1
4406 #define MS_DISPEL         2
4407 #define MS_ROCKET         3
4408 #define MS_SHOOT          4
4409 #define MS_XXX2           5
4410 #define MS_XXX3           6
4411 #define MS_XXX4           7
4412 #define MS_BR_ACID        8
4413 #define MS_BR_ELEC        9
4414 #define MS_BR_FIRE        10
4415 #define MS_BR_COLD        11
4416 #define MS_BR_POIS        12
4417 #define MS_BR_NETHER      13
4418 #define MS_BR_LITE        14
4419 #define MS_BR_DARK        15
4420 #define MS_BR_CONF        16
4421 #define MS_BR_SOUND       17
4422 #define MS_BR_CHAOS       18
4423 #define MS_BR_DISEN       19
4424 #define MS_BR_NEXUS       20
4425 #define MS_BR_TIME        21
4426 #define MS_BR_INERTIA     22
4427 #define MS_BR_GRAVITY     23
4428 #define MS_BR_SHARDS      24
4429 #define MS_BR_PLASMA      25
4430 #define MS_BR_FORCE       26
4431 #define MS_BR_MANA        27
4432 #define MS_BALL_NUKE      28
4433 #define MS_BR_NUKE        29
4434 #define MS_BALL_CHAOS     30
4435 #define MS_BR_DISI        31
4436 #define MS_BALL_ACID      32
4437 #define MS_BALL_ELEC      33
4438 #define MS_BALL_FIRE      34
4439 #define MS_BALL_COLD      35
4440 #define MS_BALL_POIS      36
4441 #define MS_BALL_NETHER    37
4442 #define MS_BALL_WATER     38
4443 #define MS_BALL_MANA      39
4444 #define MS_BALL_DARK      40
4445 #define MS_DRAIN_MANA     41
4446 #define MS_MIND_BLAST     42
4447 #define MS_BRAIN_SMASH    43
4448 #define MS_CAUSE_1        44
4449 #define MS_CAUSE_2        45
4450 #define MS_CAUSE_3        46
4451 #define MS_CAUSE_4        47
4452 #define MS_BOLT_ACID      48
4453 #define MS_BOLT_ELEC      49
4454 #define MS_BOLT_FIRE      50
4455 #define MS_BOLT_COLD      51
4456 #define MS_STARBURST      52
4457 #define MS_BOLT_NETHER    53
4458 #define MS_BOLT_WATER     54
4459 #define MS_BOLT_MANA      55
4460 #define MS_BOLT_PLASMA    56
4461 #define MS_BOLT_ICE       57
4462 #define MS_MAGIC_MISSILE  58
4463 #define MS_SCARE          59
4464 #define MS_BLIND          60
4465 #define MS_CONF           61
4466 #define MS_SLOW           62
4467 #define MS_SLEEP          63
4468 #define MS_SPEED          64
4469 #define MS_HAND_DOOM      65
4470 #define MS_HEAL           66
4471 #define MS_INVULNER       67
4472 #define MS_BLINK          68
4473 #define MS_TELEPORT       69
4474 #define MS_WORLD          70
4475 #define MS_SPECIAL        71
4476 #define MS_TELE_TO        72
4477 #define MS_TELE_AWAY      73
4478 #define MS_TELE_LEVEL     74
4479 #define MS_PSY_SPEAR      75
4480 #define MS_DARKNESS       76
4481 #define MS_MAKE_TRAP      77
4482 #define MS_FORGET         78
4483 #define MS_RAISE_DEAD     79
4484 #define MS_S_KIN          80
4485 #define MS_S_CYBER        81
4486 #define MS_S_MONSTER      82
4487 #define MS_S_MONSTERS     83
4488 #define MS_S_ANT          84
4489 #define MS_S_SPIDER       85
4490 #define MS_S_HOUND        86
4491 #define MS_S_HYDRA        87
4492 #define MS_S_ANGEL        88
4493 #define MS_S_DEMON        89
4494 #define MS_S_UNDEAD       90
4495 #define MS_S_DRAGON       91
4496 #define MS_S_HI_UNDEAD    92
4497 #define MS_S_HI_DRAGON    93
4498 #define MS_S_AMBERITE     94
4499 #define MS_S_UNIQUE       95
4500
4501
4502 #define MON_BEGGAR        12
4503 #define MON_LEPER         13
4504 #define MON_BLACK_MARKET  14
4505 #define MON_GHB           39
4506 #define MON_NOV_PRIEST    45
4507 #define MON_GRIP          53
4508 #define MON_WOLF          54
4509 #define MON_FANG          55
4510 #define MON_LOUSE         69
4511 #define MON_COPPER_COINS  85
4512 #define MON_NOV_PALADIN   97
4513 #define MON_GREEN_G       100
4514 #define MON_NOV_PRIEST_G  109
4515 #define MON_SILVER_COINS  117
4516 #define MON_MANES         128
4517 #define MON_LOST_SOUL     133
4518 #define MON_ROBIN_HOOD    138
4519 #define MON_NOV_PALADIN_G 147
4520 #define MON_PHANTOM_W     152
4521 #define MON_WOUNDED_BEAR  159
4522 #define MON_BLUE_HORROR   189
4523 #define MON_GOLD_COINS    195
4524 #define MON_VORPAL_BUNNY  205
4525 #define MON_PRIEST        225
4526 #define MON_MITHRIL_COINS 239
4527 #define MON_PINK_HORROR   242
4528 #define MON_UMBER_HULK    283
4529 #define MON_SHAGRAT       314
4530 #define MON_GORBAG        315
4531 #define MON_FIRE_VOR      354
4532 #define MON_WATER_VOR     355
4533 #define MON_ARCH_VILE     357
4534 #define MON_COLD_VOR      358
4535 #define MON_ENERGY_VOR    359
4536 #define MON_JADE_MONK     370
4537 #define MON_HAGEN         383
4538 #define MON_PHANTOM_B     385
4539 #define MON_ANGEL         417
4540 #define MON_ADAMANT_COINS 423
4541 #define MON_BARNEY        441
4542 #define MON_ARCHANGEL     456
4543 #define MON_GHOST         477
4544 #define MON_NINJA         485
4545 #define MON_IVORY_MONK    492
4546 #define MON_LOG_MASTER    498
4547 #define MON_GOEMON        505
4548 #define MON_CHERUB        511
4549 #define MON_WATER_ELEM    512
4550 #define MON_JURT          517
4551 #define MON_LICH          518
4552 #define MON_BLOODLETTER   523
4553 #define MON_GRAV_HOUND    540
4554 #define MON_REVENANT      555
4555 #define MON_RAAL          557
4556 #define MON_COLOSSUS      558
4557 #define MON_CRYPT_THING   577
4558 #define MON_NEXUS_VOR     587
4559 #define MON_PLASMA_VOR    588
4560 #define MON_TIME_VOR      589
4561 #define MON_MANDOR        598
4562 #define MON_SHIM_VOR      600
4563 #define MON_SERAPH        605
4564 #define MON_KAVLAX        616
4565 #define MON_JUBJUB        640
4566 #define MON_CLUB_DEMON    648
4567 #define MON_MASTER_LICH   658
4568 #define MON_RINALDO       660
4569 #define MON_ARCHON        661
4570 #define MON_UND_BEHOLDER  664
4571 #define MON_JACK_SHADOWS  670
4572 #define MON_LLOIGOR       682
4573 #define MON_DREADMASTER   690
4574 #define MON_DAWN          693
4575 #define MON_NAZGUL        696
4576 #define MON_SMAUG         697
4577 #define MON_STORMBRINGER  698
4578 #define MON_ULTRA_PALADIN 699
4579 #define MON_FAFNER        712
4580 #define MON_TIME_HOUND    725
4581 #define MON_PLASMA_HOUND  726
4582 #define MON_BULLGATES     732
4583 #define MON_SANTACLAUS    733
4584 #define MON_LORD_CHAOS    737
4585 #define MON_TINDALOS      739
4586 #define MON_DEMILICH      742
4587 #define MON_NIGHTCRAWLER  744
4588 #define MON_CHAOS_VOR     751
4589 #define MON_AETHER_VOR    752
4590 #define MON_FUNDIN        762
4591 #define MON_DWORKIN       763
4592 #define MON_NIGHTWALKER   768
4593 #define MON_RAPHAEL       769
4594 #define MON_SARUMAN       771
4595 #define MON_GANDALF       772
4596 #define MON_BRAND         773
4597 #define MON_SHADOWLORD    774
4598 #define MON_ARCHLICH      776
4599 #define MON_CHAOS_HOUND   779
4600 #define MON_ULT_BEHOLDER  781
4601 #define MON_SHAMBLER      786
4602 #define MON_BLEYS         789
4603 #define MON_FIONA         791
4604 #define MON_SKY_DRAKE     793
4605 #define MON_JULIAN        794
4606 #define MON_CAIN          799
4607 #define MON_GERARD        807
4608 #define MON_UNGOLIANT     808
4609 #define MON_ATLACH_NACHA  809
4610 #define MON_Y_GOLONAC     810
4611 #define MON_AETHER_HOUND  811
4612 #define MON_WARP_DEMON    812
4613 #define MON_ERIC          813
4614 #define MON_UNMAKER       815
4615 #define MON_CYBER         816
4616 #define MON_KLING         819
4617 #define MON_CORWIN        820
4618 #define MON_ANGMAR        825
4619 #define MON_CANTORAS      830
4620 #define MON_GODZILLA      832
4621 #define MON_SPAWN_CTH     836
4622 #define MON_SURTUR        837
4623 #define MON_TARRASQUE     838
4624 #define MON_LUNGORTHIN    839
4625 #define MON_CYBER_KING    843
4626 #define MON_WYRM_POWER    847
4627 #define MON_NODENS        849
4628 #define MON_JORMUNGAND    854
4629 #define MON_DESTROYER     855
4630 #define MON_GOTHMOG       856
4631 #define MON_G_CTHULHU     857
4632 #define MON_SAURON        858
4633 #define MON_UNICORN_ORD   859
4634 #define MON_OBERON        860
4635 #define MON_MORGOTH       861
4636 #define MON_SERPENT       862
4637 #define MON_ONE_RING      864
4638 #define MON_CAAWS         866
4639 #define MON_CULVERIN      867
4640 #define MON_EBONY_MONK    870
4641 #define MON_HAGURE        871
4642 #define MON_OROCHI        872
4643 #define MON_ECHIZEN       873
4644 #define MON_SPECT_WYRM    874
4645 #define MON_DIO           878
4646 #define MON_OHMU          879
4647 #define MON_WONG          880
4648 #define MON_ZOMBI_SERPENT 883
4649 #define MON_D_ELF_SHADE   886
4650 #define MON_MANA_HOUND    887
4651 #define MON_VENOM_WYRM    890
4652 #define MON_BAZOOKER      896
4653 #define MON_SHARD_VOR     897
4654 #define MON_MASTER_MYS    916
4655 #define MON_G_MASTER_MYS  917
4656 #define MON_TSUCHINOKO    926
4657 #define MON_GCWADL        929
4658 #define MON_CALDARM       931
4659 #define MON_BANORLUPART   932
4660 #define MON_BANOR         933
4661 #define MON_LUPART        934
4662 #define MON_KENSHIROU     936
4663 #define MON_W_KNIGHT      938
4664 #define MON_PLANETAR      942
4665 #define MON_SOLAR         943
4666 #define MON_BIKETAL       945
4667 #define MON_RICH          948
4668 #define MON_IKETA         949
4669 #define MON_B_DEATH_SWORD 953
4670 #define MON_YASE_HORSE    955
4671 #define MON_HORSE         956
4672 #define MON_BOTEI         963
4673 #define MON_KAGE          964
4674 #define MON_JAIAN         967
4675 #define MON_BELD          973
4676 #define MON_THAT_BAT      975
4677 #define MON_SHUTEN        979
4678 #define MON_HOUOU         988
4679 #define MON_KIRIN         989
4680 #define MON_BAHAMUT       1000
4681 #define MON_SUKE          1001
4682 #define MON_KAKU          1002
4683 #define MON_GHOST_Q       1003
4684 #define MON_PIP           1004
4685 #define MON_A_GOLD        1010
4686 #define MON_A_SILVER      1011
4687 #define MON_ROLENTO       1013
4688 #define MON_RAOU          1018
4689 #define MON_SHURYUUDAN    1023
4690 #define MON_WAHHA         1031
4691 #define MON_DEBBY         1032
4692 #define MON_KNI_TEMPLAR   1037
4693 #define MON_PALADIN       1038
4694 #define MON_CHAMELEON     1040
4695 #define MON_CHAMELEON_K   1041
4696 #define MON_TOPAZ_MONK    1047
4697 #define MON_LOUSY         1063
4698 #define MON_JIZOTAKO      1065
4699 #define MON_TANUKI        1067
4700
4701 #define MAX_AUTOPICK 1009
4702 #define DO_AUTOPICK    0x01
4703 #define DO_AUTODESTROY 0x02
4704 #define DO_DISPLAY     0x04
4705 #define DONT_AUTOPICK  0x08
4706 #define ITEM_DISPLAY   0x10
4707
4708 #define MAGIC_GLOVE_REDUCE_MANA 0x0001
4709 #define MAGIC_FAIL_5PERCENT     0x0002
4710 #define MAGIC_GAIN_EXP          0x0004
4711
4712 #define VIRTUE_LARGE 1
4713 #define VIRTUE_SMALL 2
4714
4715 #define SPELL_DD_S 27
4716 #define SPELL_DD_T 13
4717 #define SPELL_SW   22
4718 #define SPELL_KABE 20
4719
4720 #define KNOW_STAT   0x01
4721 #define KNOW_HPRATE 0x02
4722
4723 /*
4724  * Music songs
4725  */
4726 #define MUSIC_NONE              0
4727 #define MUSIC_SLOW              1
4728 #define MUSIC_BLESS             2
4729 #define MUSIC_STUN              3
4730 #define MUSIC_L_LIFE            4
4731 #define MUSIC_FEAR              5
4732 #define MUSIC_HERO              6
4733 #define MUSIC_MIND              7
4734 #define MUSIC_STEALTH           8
4735 #define MUSIC_ID                9
4736 #define MUSIC_CONF              10
4737 #define MUSIC_SOUND             11
4738 #define MUSIC_CHARM             12
4739 #define MUSIC_WALL              13
4740 #define MUSIC_RESIST            14
4741 #define MUSIC_SPEED             15
4742 #define MUSIC_DISPEL            16
4743 #define MUSIC_SARUMAN           17
4744 #define MUSIC_QUAKE             18
4745 #define MUSIC_STASIS            19
4746 #define MUSIC_SHERO             20
4747 #define MUSIC_H_LIFE            21
4748 #define MUSIC_INVULN            22
4749 #define MUSIC_PSI               23
4750
4751 #define MUSIC_DETECT            101
4752
4753 #define music_singing(X) ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] == X))
4754
4755 #define HISSATSU_NONE   0
4756 #define HISSATSU_2      1
4757 #define HISSATSU_3WAY   2
4758 #define HISSATSU_SUTEMI 3
4759 #define HISSATSU_FIRE   4
4760 #define HISSATSU_COLD   5
4761 #define HISSATSU_POISON 6
4762 #define HISSATSU_ELEC   7
4763 #define HISSATSU_NYUSIN 8
4764 #define HISSATSU_FUKI   9
4765 #define HISSATSU_MAJIN  10
4766 #define HISSATSU_BOOMER 11
4767 #define HISSATSU_DRAIN  12
4768 #define HISSATSU_SEKIRYUKA 13
4769 #define HISSATSU_OTAKEBI 14
4770 #define HISSATSU_SHOUGE 15
4771 #define HISSATSU_CONF   16
4772 #define HISSATSU_ISSEN  17
4773 #define HISSATSU_KYUSHO 18
4774 #define HISSATSU_KONSIN 19
4775 #define HISSATSU_HYAKU  20
4776 #define HISSATSU_MINEUCHI 21
4777 #define HISSATSU_MEKIKI 22
4778 #define HISSATSU_ZANMA  23
4779 #define HISSATSU_UNDEAD 24
4780 #define HISSATSU_HAGAN  25
4781 #define HISSATSU_QUAKE  26
4782 #define HISSATSU_COUNTER 27
4783 #define HISSATSU_HARAI  28
4784 #define HISSATSU_3DAN   29
4785 #define HISSATSU_100NIN 30
4786
4787 #define HISSATSU_IAI    100
4788
4789
4790 #define ESSENCE_STR           1
4791 #define ESSENCE_INT           2
4792 #define ESSENCE_WIS           3
4793 #define ESSENCE_DEX           4
4794 #define ESSENCE_CON           5
4795 #define ESSENCE_CHR           6
4796 #define ESSENCE_MAGIC_MASTERY 7
4797 #define ESSENCE_STEALTH       9
4798 #define ESSENCE_SEARCH        10
4799 #define ESSENCE_INFRA         11
4800 #define ESSENCE_TUNNEL        12
4801 #define ESSENCE_SPEED         13
4802 #define ESSENCE_BLOWS         14
4803 #define ESSENCE_CHAOTIC       15
4804 #define ESSENCE_VAMPIRIC      16
4805 #define ESSENCE_S_ANIMAL      17
4806 #define ESSENCE_S_EVIL        18
4807 #define ESSENCE_S_UNDEAD      19
4808 #define ESSENCE_S_DEMON       20
4809 #define ESSENCE_S_ORC         21
4810 #define ESSENCE_S_TROLL       22
4811 #define ESSENCE_S_GIANT       23
4812 #define ESSENCE_S_DRAGON      24
4813 #define ESSENCE__K__DRAGON    25
4814 #define ESSENCE_EARTHQUAKE    27
4815 #define ESSENCE_B_POIS        28
4816 #define ESSENCE_B_ACID        29
4817 #define ESSENCE_B_ELEC        30
4818 #define ESSENCE_B_FIRE        31
4819 #define ESSENCE_B_COLD        32
4820 #define ESSENCE_S_STR         33
4821 #define ESSENCE_IM_ACID       41
4822 #define ESSENCE_REFLECT       46
4823 #define ESSENCE_FREE_ACT      47
4824 #define ESSENCE_HOLD_LIFE     48
4825 #define ESSENCE_RES_ACID      49
4826 #define ESSENCE_RES_ELEC      50
4827 #define ESSENCE_RES_FIRE      51
4828 #define ESSENCE_RES_COLD      52
4829 #define ESSENCE_RES_POIS      53
4830 #define ESSENCE_RES_FEAR      54
4831 #define ESSENCE_RES_LITE      55
4832 #define ESSENCE_RES_DARK      56
4833 #define ESSENCE_RES_BLIND     57
4834 #define ESSENCE_RES_CONF      58
4835 #define ESSENCE_RES_SOUND     59
4836 #define ESSENCE_RES_SHARDS    60
4837 #define ESSENCE_RES_NETHER    61
4838 #define ESSENCE_RES_NEXUS     62
4839 #define ESSENCE_RES_CHAOS     63
4840 #define ESSENCE_RES_DISEN     64
4841 #define ESSENCE__SH__FIRE     65
4842 #define ESSENCE__SH__ELEC     66
4843 #define ESSENCE_S_HUMAN       67
4844 #define ESSENCE__SH__COLD     68
4845 #define ESSENCE_NO_MAGIC      70
4846 #define ESSENCE_WARNING       73
4847 #define ESSENCE_FEATHER       77
4848 #define ESSENCE_LITE          78
4849 #define ESSENCE_SEE_INVIS     79
4850 #define ESSENCE_TELEPATHY     80
4851 #define ESSENCE_SLOW_DIGEST   81
4852 #define ESSENCE_REGEN         82
4853 #define ESSENCE_TELEPROT      91
4854 #define ESSENCE_ATTACK        97
4855 #define ESSENCE_AC            98
4856 #define ESSENCE_TMP_RES_ACID  99
4857 #define ESSENCE_TMP_RES_ELEC  100
4858 #define ESSENCE_TMP_RES_FIRE  101
4859 #define ESSENCE_TMP_RES_COLD  102
4860 #define ESSENCE_SH_FIRE       103
4861 #define ESSENCE_SH_ELEC       104
4862 #define ESSENCE_SH_COLD       105
4863 #define ESSENCE_RESISTANCE    106
4864 #define ESSENCE_SUSTAIN       107
4865 #define ESSENCE_SLAY_GLOVE    108
4866
4867 #define MAX_ESSENCE 108
4868
4869 #define ESSENCE_MASK1 0xFCFD5F7F
4870 #define ESSENCE_MASK2 0xFFFFE000
4871 #define ESSENCE_MASK3 0x0003F020
4872
4873 #define DUNGEON_MODE_NONE       0
4874 #define DUNGEON_MODE_AND        1
4875 #define DUNGEON_MODE_NAND       2
4876 #define DUNGEON_MODE_OR         3
4877 #define DUNGEON_MODE_NOR        4
4878
4879 /*** Dungeon type flags -- DG ***/
4880 #define DF1_WINNER              0x00000001L
4881 #define DF1_MAZE                0x00000002L
4882 #define DF1_SMALLEST            0x00000004L
4883 #define DF1_BEGINNER            0x00000008L
4884 #define DF1_BIG                 0x00000010L
4885 #define DF1_NO_DOORS            0x00000020L
4886 #define DF1_WATER_RIVER         0x00000040L
4887 #define DF1_LAVA_RIVER          0x00000080L
4888 #define DF1_WATER_RIVERS        0x00000100L
4889 #define DF1_LAVA_RIVERS         0x00000200L
4890 #define DF1_CAVE                0x00000400L
4891 #define DF1_CAVERN              0x00000800L
4892 #define DF1_NO_UP               0x00001000L
4893 #define DF1_HOT                 0x00002000L
4894 #define DF1_COLD                0x00004000L
4895 #define DF1_NO_DOWN             0x00008000L
4896 #define DF1_FORGET              0x00010000L
4897 #define DF1_LAKE_WATER          0x00020000L
4898 #define DF1_LAKE_LAVA           0x00040000L
4899 #define DF1_LAKE_RUBBLE         0x00080000L
4900 #define DF1_LAKE_TREE           0x00100000L
4901 #define DF1_NO_VAULT            0x00200000L
4902 #define DF1_ARENA               0x00400000L
4903 #define DF1_DESTROY             0x00800000L
4904 #define DF1_NO_CAVE             0x02000000L
4905 #define DF1_NO_MAGIC            0x04000000L
4906 #define DF1_NO_MELEE            0x08000000L
4907 #define DF1_CHAMELEON           0x10000000L
4908 #define DF1_DARKNESS            0x20000000L
4909
4910 #define DF1_LAKE_MASK (DF1_LAKE_WATER | DF1_LAKE_LAVA | DF1_LAKE_RUBBLE | DF1_LAKE_TREE)
4911
4912 #define DUNGEON_ANGBAND  1
4913 #define DUNGEON_GALGALS  2
4914 #define DUNGEON_ORC      3
4915 #define DUNGEON_MAZE     4
4916 #define DUNGEON_DRAGON   5
4917 #define DUNGEON_GRAVE    6
4918 #define DUNGEON_WOOD     7
4919 #define DUNGEON_VOLCANO  8
4920 #define DUNGEON_HELL     9
4921 #define DUNGEON_HEAVEN   10
4922 #define DUNGEON_OCEAN    11
4923 #define DUNGEON_CASTLE   12
4924 #define DUNGEON_CTH      13
4925 #define DUNGEON_MOUNTAIN 14
4926 #define DUNGEON_GOLD     15
4927 #define DUNGEON_NO_MAGIC 16
4928 #define DUNGEON_NO_MELEE 17
4929 #define DUNGEON_CHAMELEON 18
4930 #define DUNGEON_DARKNESS 19
4931
4932
4933 #define MIMIC_NONE       0
4934 #define MIMIC_DEMON      1
4935 #define MIMIC_DEMON_LORD 2
4936 #define MIMIC_VAMPIRE    3
4937
4938
4939 #define MIMIC_FLAGS choice
4940 #define MIMIC_IS_NONLIVING 0x00000001
4941 #define MIMIC_IS_DEMON     0x00000002
4942 #define MIMIC_IS_UNDEAD    0x00000004
4943
4944
4945 #define prace_is_(A) (!p_ptr->mimic_form && (p_ptr->prace == A))
4946
4947 /* Sub-alignment flags for neutral monsters */
4948 #define SUB_ALIGN_NEUTRAL 0x0000
4949 #define SUB_ALIGN_EVIL    0x0001
4950 #define SUB_ALIGN_GOOD    0x0002
4951
4952 /*
4953  * World Score -- internet resource value
4954  */
4955 #define HTTP_PROXY ""                   /* Default proxy url */
4956 #define HTTP_PROXY_PORT 0               /* Default proxy port */
4957 #define HTTP_TIMEOUT    20              /* Timeout length (second) */
4958 #define SCORE_SERVER "www.kmc.gr.jp"    /* Default score server url */
4959 #define SCORE_PORT 80                   /* Default score server port */
4960
4961 #define MAX_MACRO_MOD 12
4962 #define MAX_MACRO_TRIG 200
4963
4964 #define SCREEN_BUF_SIZE 65536           /* max screen dump buffer size */