OSDN Git Service

1f737d87f506a509370278eccd49f0b2d0991b83
[hengband/hengband.git] / src / defines.h
1 /* File: defines.h */
2
3 /*
4  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
5  *
6  * This software may be copied and distributed for educational, research,
7  * and not for profit purposes provided that this copyright and statement
8  * are included in all such copies.  Other copyrights may also apply.
9  */
10
11 /* Purpose: global constants and macro definitions */
12
13
14 /*
15  * Do not edit this file unless you know *exactly* what you are doing.
16  *
17  * Some of the values in this file were chosen to preserve game balance,
18  * while others are hard-coded based on the format of old save-files, the
19  * definition of arrays in various places, mathematical properties, fast
20  * computation, storage limits, or the format of external text files.
21  *
22  * Changing some of these values will induce crashes or memory errors or
23  * savefile mis-reads.  Most of the comments in this file are meant as
24  * reminders, not complete descriptions, and even a complete knowledge
25  * of the source may not be sufficient to fully understand the effects
26  * of changing certain definitions.
27  *
28  * Lastly, note that the code does not always use the symbolic constants
29  * below, and sometimes uses various hard-coded values that may not even
30  * be defined in this file, but which may be related to definitions here.
31  * This is of course bad programming practice, but nobody is perfect...
32  *
33  * For example, there are MANY things that depend on the screen being
34  * 80x24, with the top line used for messages, the bottom line being
35  * used for status, and exactly 22 lines used to show the dungeon.
36  * Just because your screen can hold 46 lines does not mean that the
37  * game will work if you try to use 44 lines to show the dungeon.
38  *
39  * You have been warned.
40  */
41
42
43 /*
44  * Name of the version/variant
45  */
46 #define VERSION_NAME "Hengband"
47
48
49 /*
50  * "Program Version Number" of the game
51  *
52  * FAKE_VER_MAJOR=1,2 were reserved for ZAngband version 1.x.x/2.x.x .
53  *
54  * Program Version of Hengband version is
55  *   "(FAKE_VER_MAJOR-10).(FAKE_VER_MINOR).(FAKE_VER_PATCH)".
56  */
57 #define FAKE_VERSION   0
58 #define FAKE_VER_MAJOR 12
59 #define FAKE_VER_MINOR 1
60 #define FAKE_VER_PATCH 3
61
62
63 /*
64  * "Savefile Version Number" for Hengband 1.1.1 and later
65  *
66  * First three digits may be same as the Program Version.  But not
67  * always same.  It means that newer version may preserves lower
68  * compatibility with the older version.
69  *
70  * For example, newer Hengband 1.4.4 creates savefiles marked with
71  * Savefile Version 1.4.0.0 .  It means that Hengband 1.4.0 can load a
72  * savefile of Hengband 1.4.4 (lower compatibility!).
73  *
74  * Upper compatibility is always guaranteed.
75  */
76 #define H_VER_MAJOR 2
77 #define H_VER_MINOR 1
78 #define H_VER_PATCH 2
79 #define H_VER_EXTRA 2
80
81
82 #define ANGBAND_2_8_1
83 #define ZANGBAND
84
85 /*
86  * Number of grids in each block (vertically)
87  * Probably hard-coded to 11, see "generate.c"
88  */
89 #define BLOCK_HGT       11
90
91 /*
92  * Number of grids in each block (horizontally)
93  * Probably hard-coded to 11, see "generate.c"
94  */
95 #define BLOCK_WID       11
96
97
98 /*
99  * Number of grids in each panel (vertically)
100  * Must be a multiple of BLOCK_HGT
101  */
102 #define PANEL_HGT       11
103
104 /*
105  * Number of grids in each panel (horizontally)
106  * Must be a multiple of BLOCK_WID
107  */
108 #define PANEL_WID       33
109
110
111 /*
112  * Number of grids used to display the dungeon (vertically).
113  * Must be a multiple of 11, probably hard-coded to 22.
114  */
115 #define SCREEN_HGT      22
116
117 /*
118  * Number of grids used to display the dungeon (horizontally).
119  * Must be a multiple of 33, probably hard-coded to 66.
120  */
121 #define SCREEN_WID      66
122
123
124 /*
125  * Maximum dungeon height in grids, must be a multiple of SCREEN_HGT,
126  * probably hard-coded to SCREEN_HGT * 3.
127  */
128 #define MAX_HGT         66
129
130 /*
131  * Maximum dungeon width in grids, must be a multiple of SCREEN_WID,
132  * probably hard-coded to SCREEN_WID * 3.
133  */
134 #define MAX_WID         198
135
136
137 /*
138  * Quest constants
139  */
140 #define MIN_RANDOM_QUEST    40
141 #define MAX_RANDOM_QUEST    49
142
143 /* Check is the quest index is "fixed" */
144 #define is_fixed_quest_idx(Q_IDX) (((Q_IDX) < MIN_RANDOM_QUEST) || ((Q_IDX) > MAX_RANDOM_QUEST))
145
146 #define QUEST_TOWER1         5
147 #define QUEST_TOWER2         6
148 #define QUEST_TOWER3         7
149 #define QUEST_OBERON         8
150 #define QUEST_SERPENT        9
151
152 /*
153  * Arena constants
154  */
155 #define MAX_ARENA_MONS          41      /* -KMW- */
156 #define ARENA_DEFEATED_OLD_VER (-(MAX_SHORT))
157
158
159 /*
160  * Total number of stores (see "store.c", etc)
161  */
162 #define MAX_STORES      10
163
164 /*
165  * Number of buildings
166  */
167 #define MAX_BLDG                32
168
169 /*
170  * Store types
171  */
172 #define STORE_GENERAL   0
173 #define STORE_ARMOURY   1
174 #define STORE_WEAPON    2
175 #define STORE_TEMPLE    3
176 #define STORE_ALCHEMIST 4
177 #define STORE_MAGIC     5
178 #define STORE_BLACK     6
179 #define STORE_HOME      7
180 #define STORE_BOOK      8
181 #define STORE_MUSEUM    9
182
183
184 #define BUILDING_NON_MEMBER 0
185 #define BUILDING_MEMBER     1
186 #define BUILDING_OWNER      2
187
188 /*
189  * Total number of owners per store (see "store.c", etc)
190  */
191 #define MAX_OWNERS      32
192
193 /*
194  * Maximum number of player "sex" types (see "table.c", etc)
195  */
196 #define MAX_SEXES            2
197
198 /*
199  * Maximum number of player "class" types (see "table.c", etc)
200  */
201 #define MAX_CLASS            28
202
203 #define MAX_SEIKAKU          12
204
205 /* The number of "patrons" available (for Chaos Warriors) */
206 #define MAX_PATRON          16
207
208 /* Number of entries in the sanity-blast descriptions */
209 #define MAX_SAN_HORROR 20
210 #define MAX_SAN_FUNNY 22
211 #define MAX_SAN_COMMENT 5
212
213 /* Chaos Warrior: Reward types: */
214 #define REW_POLY_SLF    1
215 #define REW_GAIN_EXP    2
216 #define REW_LOSE_EXP    3
217 #define REW_GOOD_OBJ    4
218 #define REW_GREA_OBJ    5
219 #define REW_CHAOS_WP    6
220 #define REW_GOOD_OBS    7
221 #define REW_GREA_OBS    8
222 #define REW_TY_CURSE    9
223 #define REW_SUMMON_M    10
224 #define REW_H_SUMMON    11
225 #define REW_DO_HAVOC    12
226 #define REW_GAIN_ABL    13
227 #define REW_LOSE_ABL    14
228 #define REW_RUIN_ABL    15
229 #define REW_AUGM_ABL    16
230 #define REW_POLY_WND    17
231 #define REW_HEAL_FUL    18
232 #define REW_HURT_LOT    19
233 #define REW_CURSE_WP    20
234 #define REW_CURSE_AR    21
235 #define REW_PISS_OFF    22
236 #define REW_WRATH       23
237 #define REW_DESTRUCT    24
238 #define REW_GENOCIDE    25
239 #define REW_MASS_GEN    26
240 #define REW_DISPEL_C    27
241 #define REW_UNUSED_1    28
242 #define REW_UNUSED_2    29
243 #define REW_UNUSED_3    30
244 #define REW_UNUSED_4    31
245 #define REW_UNUSED_5    32
246 #define REW_IGNORE      33
247 #define REW_SER_UNDE    34
248 #define REW_SER_DEMO    35
249 #define REW_SER_MONS    36
250
251 /* Chaos mutations */
252
253 /* "Activatable" mutations must be in MUT1_* */
254 #define MUT1_SPIT_ACID                  0x00000001L
255 #define MUT1_BR_FIRE                    0x00000002L
256 #define MUT1_HYPN_GAZE                  0x00000004L
257 #define MUT1_TELEKINES                  0x00000008L
258 #define MUT1_VTELEPORT                  0x00000010L /* Voluntary teleport */
259 #define MUT1_MIND_BLST                  0x00000020L
260 #define MUT1_RADIATION                  0x00000040L
261 #define MUT1_VAMPIRISM                  0x00000080L
262 #define MUT1_SMELL_MET                  0x00000100L
263 #define MUT1_SMELL_MON                  0x00000200L
264 #define MUT1_BLINK                      0x00000400L
265 #define MUT1_EAT_ROCK                   0x00000800L
266 #define MUT1_SWAP_POS                   0x00001000L
267 #define MUT1_SHRIEK                     0x00002000L
268 #define MUT1_ILLUMINE                   0x00004000L
269 #define MUT1_DET_CURSE                  0x00008000L
270 #define MUT1_BERSERK                    0x00010000L
271 #define MUT1_POLYMORPH                  0x00020000L
272 #define MUT1_MIDAS_TCH                  0x00040000L
273 #define MUT1_GROW_MOLD                  0x00080000L
274 #define MUT1_RESIST                     0x00100000L
275 #define MUT1_EARTHQUAKE                 0x00200000L
276 #define MUT1_EAT_MAGIC                  0x00400000L
277 #define MUT1_WEIGH_MAG                  0x00800000L
278 #define MUT1_STERILITY                  0x01000000L
279 #define MUT1_PANIC_HIT                  0x02000000L
280 #define MUT1_DAZZLE                     0x04000000L
281 #define MUT1_LASER_EYE                  0x08000000L
282 #define MUT1_RECALL                     0x10000000L
283 #define MUT1_BANISH                     0x20000000L
284 #define MUT1_COLD_TOUCH                 0x40000000L
285 #define MUT1_LAUNCHER                   0x80000000L
286
287 /* Randomly activating mutations must be MUT2_* */
288 #define MUT2_BERS_RAGE                  0x00000001L
289 #define MUT2_COWARDICE                  0x00000002L
290 #define MUT2_RTELEPORT                  0x00000004L /* Random teleport, instability */
291 #define MUT2_ALCOHOL                    0x00000008L
292 #define MUT2_HALLU                      0x00000010L
293 #define MUT2_FLATULENT                  0x00000020L
294 #define MUT2_SCOR_TAIL                  0x00000040L
295 #define MUT2_HORNS                      0x00000080L
296 #define MUT2_BEAK                       0x00000100L
297 #define MUT2_ATT_DEMON                  0x00000200L
298 #define MUT2_PROD_MANA                  0x00000400L
299 #define MUT2_SPEED_FLUX                 0x00000800L
300 #define MUT2_BANISH_ALL                 0x00001000L
301 #define MUT2_EAT_LIGHT                  0x00002000L
302 #define MUT2_TRUNK                      0x00004000L
303 #define MUT2_ATT_ANIMAL                 0x00008000L
304 #define MUT2_TENTACLES                  0x00010000L
305 #define MUT2_RAW_CHAOS                  0x00020000L
306 #define MUT2_NORMALITY                  0x00040000L
307 #define MUT2_WRAITH                     0x00080000L
308 #define MUT2_POLY_WOUND                 0x00100000L
309 #define MUT2_WASTING                    0x00200000L
310 #define MUT2_ATT_DRAGON                 0x00400000L
311 #define MUT2_WEIRD_MIND                 0x00800000L
312 #define MUT2_NAUSEA                     0x01000000L
313 #define MUT2_CHAOS_GIFT                 0x02000000L
314 #define MUT2_WALK_SHAD                  0x04000000L
315 #define MUT2_WARNING                    0x08000000L
316 #define MUT2_INVULN                     0x10000000L
317 #define MUT2_SP_TO_HP                   0x20000000L
318 #define MUT2_HP_TO_SP                   0x40000000L
319 #define MUT2_DISARM                     0x80000000L
320
321
322
323 /* Other mutations will be mainly in MUT3_* */
324
325 #define MUT3_HYPER_STR                  0x00000001L
326 #define MUT3_PUNY                       0x00000002L
327 #define MUT3_HYPER_INT                  0x00000004L
328 #define MUT3_MORONIC                    0x00000008L
329 #define MUT3_RESILIENT                  0x00000010L
330 #define MUT3_XTRA_FAT                   0x00000020L
331 #define MUT3_ALBINO                     0x00000040L
332 #define MUT3_FLESH_ROT                  0x00000080L
333 #define MUT3_SILLY_VOI                  0x00000100L
334 #define MUT3_BLANK_FAC                  0x00000200L
335 #define MUT3_ILL_NORM                   0x00000400L
336 #define MUT3_XTRA_EYES                  0x00000800L
337 #define MUT3_MAGIC_RES                  0x00001000L
338 #define MUT3_XTRA_NOIS                  0x00002000L
339 #define MUT3_INFRAVIS                   0x00004000L
340 #define MUT3_XTRA_LEGS                  0x00008000L
341 #define MUT3_SHORT_LEG                  0x00010000L
342 #define MUT3_ELEC_TOUC                  0x00020000L
343 #define MUT3_FIRE_BODY                  0x00040000L
344 #define MUT3_WART_SKIN                  0x00080000L
345 #define MUT3_SCALES                     0x00100000L
346 #define MUT3_IRON_SKIN                  0x00200000L
347 #define MUT3_WINGS                      0x00400000L
348 #define MUT3_FEARLESS                   0x00800000L
349 #define MUT3_REGEN                      0x01000000L
350 #define MUT3_ESP                        0x02000000L
351 #define MUT3_LIMBER                     0x04000000L
352 #define MUT3_ARTHRITIS                  0x08000000L
353 #define MUT3_BAD_LUCK                   0x10000000L
354 #define MUT3_VULN_ELEM                  0x20000000L
355 #define MUT3_MOTION                     0x40000000L
356 #define MUT3_GOOD_LUCK                  0x80000000L
357
358
359 /* Monk martial arts... */
360 # define MAX_MA 17
361 # define MA_KNEE 1
362 # define MA_SLOW 2
363
364 /* Mindcraft */
365 #define MAX_MIND_POWERS  21
366
367 /* Hallucination stuff */
368 #ifdef JP
369 #define MAX_SILLY_ATTACK 41
370 #else
371 #define MAX_SILLY_ATTACK 29
372 #endif
373
374 #define MIND_MINDCRAFTER    0
375 #define MIND_KI             1
376 #define MIND_BERSERKER      2
377 #define MIND_MIRROR_MASTER  3
378 #define MIND_NINJUTSU       4
379
380
381 /*
382  * Size of memory reserved for initialization of some arrays
383  */
384 #define FAKE_NAME_SIZE  40 * 1024L
385 #define FAKE_TEXT_SIZE 150 * 1024L
386 #define FAKE_TAG_SIZE   10 * 1024L
387
388
389 /*
390  * Maximum number of high scores in the high score file
391  */
392 #define MAX_HISCORES    999
393
394
395 /*
396  * Maximum dungeon level.  The player can never reach this level
397  * in the dungeon, and this value is used for various calculations
398  * involving object and monster creation.  It must be at least 100.
399  * Setting it below 128 may prevent the creation of some objects.
400  */
401 #define MAX_DEPTH       128
402
403
404 /*
405  * Maximum number of saved floors.
406  */
407 #define MAX_SAVED_FLOORS       20
408
409
410 /*
411  * Maximum size of the "lite" array (see "cave.c")
412  * Note that the "lite radius" will NEVER exceed 14, and we would
413  * never require more than 581 entries in the array for circular "lite".
414  */
415 #define LITE_MAX 600
416
417 /*
418  * Maximum size of the "mon_lite" array (see "cave.c")
419  * Note that the "view radius" will NEVER exceed 20, monster illumination
420  * flags are dependent on CAVE_VIEW, and even if the "view" was octagonal,
421  * we would never require more than 1520 entries in the array.
422  */
423 #define MON_LITE_MAX 1536
424
425 /*
426  * Maximum size of the "view" array (see "cave.c")
427  * Note that the "view radius" will NEVER exceed 20, and even if the "view"
428  * was octagonal, we would never require more than 1520 entries in the array.
429  */
430 #define VIEW_MAX 1536
431
432 /*
433  * Maximum size of the "temp" array (see "cave.c")
434  * We must be as large as "VIEW_MAX" and "LITE_MAX" for proper functioning
435  * of "update_view()" and "update_lite()".  We must also be as large as the
436  * largest illuminatable room, but no room is larger than 800 grids.  We
437  * must also be large enough to allow "good enough" use as a circular queue,
438  * to calculate monster flow, but note that the flow code is "paranoid".
439  */
440 #define TEMP_MAX 2298
441
442 /*
443  * Maximum size of the "redraw" array (see "cave.c")
444  * We must be large for proper functioning of delayed redrawing.
445  * We must also be as large as two times of the largest view area.
446  * Note that maximum view grids are 1149 entries.
447  */
448 #define REDRAW_MAX 2298
449
450
451 /*
452  * Number of keymap modes
453  */
454 #define KEYMAP_MODES    2
455
456 /*
457  * Mode for original keyset commands
458  */
459 #define KEYMAP_MODE_ORIG        0
460
461 /*
462  * Mode for roguelike keyset commands
463  */
464 #define KEYMAP_MODE_ROGUE       1
465
466
467 /*
468  * OPTION: Maximum number of macros (see "io.c")
469  * Default: assume at most 256 macros are used
470  */
471 #define MACRO_MAX       256
472
473 /*
474  * OPTION: Maximum number of "quarks" (see "io.c")
475  * Default: assume at most 512 different inscriptions are used
476  */
477 #define QUARK_MAX       768
478 /* Was 512... 256 quarks added for random artifacts */
479
480 /*
481  * OPTION: Maximum number of messages to remember (see "io.c")
482  * Default: assume maximal memorization of 2048 total messages
483  */
484 #define MESSAGE_MAX     2048
485
486 /*
487  * OPTION: Maximum space for the message text buffer (see "io.c")
488  * Default: assume that each of the 2048 messages is repeated an
489  * average of three times, and has an average length of 48
490  */
491 #define MESSAGE_BUF     32768
492
493
494 /*
495  * Maximum value storable in a "byte" (hard-coded)
496  */
497 #define MAX_UCHAR       255
498
499 /*
500  * Maximum value storable in a "s16b" (hard-coded)
501  */
502 #define MAX_SHORT       32767
503
504 /*
505  * Maximum length of object's name
506  */
507 #define MAX_NLEN        160
508
509 /*
510  * Special internal key
511  */
512 #define SPECIAL_KEY_QUEST    255
513 #define SPECIAL_KEY_BUILDING 254
514 #define SPECIAL_KEY_STORE    253
515 #define SPECIAL_KEY_QUIT     252
516
517 /*
518  * Store constants
519  */
520 #define STORE_INVEN_MAX 24              /* Max number of discrete objs in inven */
521 #define STORE_CHOICES   48              /* Number of items to choose stock from */
522 #define STORE_OBJ_LEVEL 5               /* Magic Level for normal stores */
523 #define STORE_TURNOVER  9               /* Normal shop turnover, per day */
524 #define STORE_MIN_KEEP  6               /* Min slots to "always" keep full */
525 #define STORE_MAX_KEEP  18              /* Max slots to "always" keep full */
526 #define STORE_SHUFFLE   21              /* 1/Chance (per day) of an owner changing */
527 #define STORE_TICKS     1000            /* Number of ticks between turnovers */
528
529
530 /*
531  * Random energy
532  */
533 #define ENERGY_NEED() (randnor(100, 25))
534
535
536 /*
537  * Extract energy from speed (Assumes that SPEED is unsigned)
538  */
539 #define SPEED_TO_ENERGY(SPEED) \
540         (((SPEED) > 199) ? 49 : extract_energy[(SPEED)])
541
542
543 /*
544  * Misc constants
545  */
546 #define TOWN_DAWN         10000    /* Number of ticks from dawn to dawn XXX */
547 #define TURNS_PER_TICK    10L      /* Number of energy-gain-turns per ticks */
548 #define MAX_DAYS          20000    /* Maximum days */
549 #define BREAK_GLYPH       550      /* Rune of protection resistance */
550 #define BREAK_MINOR_GLYPH 299      /* For explosive runes */
551 #define BTH_PLUS_ADJ       3       /* Adjust BTH per plus-to-hit */
552 #define MON_MULT_ADJ       8       /* High value slows multiplication */
553 #define MON_SUMMON_ADJ     2       /* Adjust level of summoned creatures */
554 #define MON_DRAIN_LIFE     2       /* Percent of player exp drained per hit */
555 #define USE_DEVICE         3       /* x> Harder devices x< Easier devices     */
556
557
558 /* "Biases" for random artifact gen */
559
560 #define BIAS_ELEC            1
561 #define BIAS_POIS            2
562 #define BIAS_FIRE            3
563 #define BIAS_COLD            4
564 #define BIAS_ACID            5
565 #define BIAS_STR             6
566 #define BIAS_INT             7
567 #define BIAS_WIS             8
568 #define BIAS_DEX             9
569 #define BIAS_CON            10
570 #define BIAS_CHR            11
571 #define BIAS_CHAOS          12
572 #define BIAS_PRIESTLY       13
573 #define BIAS_NECROMANTIC    14
574 #define BIAS_LAW            15
575 #define BIAS_ROGUE          16
576 #define BIAS_MAGE           17
577 #define BIAS_WARRIOR        18
578 #define BIAS_RANGER         19
579
580
581 /*** Pet constants ***/
582
583
584 /*
585  * Commands
586  */
587 #define PET_DISMISS             1
588 #define PET_TARGET              2
589 #define PET_STAY_CLOSE          3
590 #define PET_FOLLOW_ME           4
591 #define PET_SEEK_AND_DESTROY    5
592 #define PET_ALLOW_SPACE         6
593 #define PET_STAY_AWAY           7
594 #define PET_OPEN_DOORS          8
595 #define PET_TAKE_ITEMS          9
596 #define PET_TELEPORT            10
597 #define PET_ATTACK_SPELL        11
598 #define PET_SUMMON_SPELL        12
599 #define PET_BALL_SPELL          13
600 #define PET_RIDING              14
601 #define PET_NAME                15
602 #define PET_RYOUTE              16
603
604 /*
605  * Follow distances
606  */
607 #define PET_CLOSE_DIST                          1
608 #define PET_FOLLOW_DIST                         6
609 #define PET_SEEK_DIST                           10
610 #define PET_DESTROY_DIST                        255
611 #define PET_SPACE_DIST                          (-10)
612 #define PET_AWAY_DIST                           (-25)
613
614 #define PF_OPEN_DOORS   0x0001
615 #define PF_PICKUP_ITEMS 0x0002
616 #define PF_TELEPORT     0x0004
617 #define PF_ATTACK_SPELL 0x0008
618 #define PF_SUMMON_SPELL 0x0010
619 #define PF_BALL_SPELL   0x0020
620 #define PF_RYOUTE       0x0040
621
622
623 #define CAN_TWO_HANDS_WIELDING() (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE))
624
625
626 /*
627  * There is a 1/20 (5%) chance of inflating the requested object_level
628  * during the creation of an object (see "get_obj_num()" in "object.c").
629  * Lower values yield better objects more often.
630  */
631 #define GREAT_OBJ       10
632
633 /*
634  * There is a 1/25 (4%) chance of inflating the requested monster_level
635  * during the creation of a monsters (see "get_mon_num()" in "monster.c").
636  * Lower values yield harder monsters more often.
637  */
638 #define NASTY_MON_BASE     25
639 #define NASTY_MON_MAX      3
640 #define NASTY_MON_PLUS_MAX 25
641
642 /* 1/x chance of hurting even if invulnerable! */
643 #define PENETRATE_INVULNERABILITY 13
644
645
646
647 /*
648  * Refueling constants
649  */
650 #define FUEL_TORCH      5000    /* Maximum amount of fuel in a torch */
651 #define FUEL_LAMP       15000   /* Maximum amount of fuel in a lantern */
652
653
654 /*
655  * More maximum values
656  */
657 #define MAX_SIGHT       20      /* Maximum view distance */
658 #define MAX_RANGE       (p_ptr->inside_battle ? 36 : 18)      /* Maximum range (spells, etc) */
659 #define AAF_LIMIT       100     /* Limit of sensing radius */
660
661
662
663 /*
664  * The town starts out with 4 residents during the day
665  */
666 #define MIN_M_ALLOC_TD          4
667
668 /*
669  * The town starts out with 8 residents during the night
670  */
671 #define MIN_M_ALLOC_TN          8
672
673
674 /*
675  * A monster can only "multiply" (reproduce) if there are fewer than 100
676  * monsters on the level capable of such spontaneous reproduction.  This
677  * is a hack which prevents the "m_list[]" array from exploding due to
678  * reproducing monsters.  Messy, but necessary.
679  */
680 #define MAX_REPRO       100
681
682
683 /*
684  * Player constants
685  */
686 #define PY_MAX_EXP      99999999L       /* Maximum exp */
687 #define PY_MAX_GOLD     999999999L      /* Maximum gold */
688 #define PY_MAX_LEVEL    50              /* Maximum level */
689
690 /*
691  * Player "food" crucial values
692  */
693 #define PY_FOOD_MAX     15000   /* Food value (Bloated) */
694 #define PY_FOOD_FULL    10000   /* Food value (Normal) */
695 #define PY_FOOD_ALERT   2000    /* Food value (Hungry) */
696 #define PY_FOOD_WEAK    1000    /* Food value (Weak) */
697 #define PY_FOOD_FAINT   500     /* Food value (Fainting) */
698 #define PY_FOOD_STARVE  100     /* Food value (Starving) */
699
700 /*
701  * Player regeneration constants
702  */
703 #define PY_REGEN_NORMAL         197     /* Regen factor*2^16 when full */
704 #define PY_REGEN_WEAK           98      /* Regen factor*2^16 when weak */
705 #define PY_REGEN_FAINT          33      /* Regen factor*2^16 when fainting */
706 #define PY_REGEN_HPBASE         1442    /* Min amount hp regen*2^16 */
707 #define PY_REGEN_MNBASE         524     /* Min amount mana regen*2^16 */
708
709 /*
710  * Possible realms that can be chosen;
711  * currently used only by birth.c and tables.c
712  */
713 #define CH_NONE         0x00
714 #define CH_LIFE         0x01
715 #define CH_SORCERY      0x02
716 #define CH_NATURE       0x04
717 #define CH_CHAOS        0x08
718 #define CH_DEATH        0x10
719 #define CH_TRUMP        0x20
720 #define CH_ARCANE       0x40
721 #define CH_ENCHANT      0x80
722 #define CH_DAEMON       0x100
723 #define CH_CRUSADE      0x200
724
725 #define CH_MUSIC        0x08000 /* This is 16th bit */
726 #define CH_HISSATSU     0x10000
727 #define CH_HEX          0x20000
728
729
730 /*
731  * Magic realms
732  */
733 #define REALM_NONE         0
734 #define REALM_LIFE         1
735 #define REALM_SORCERY      2
736 #define REALM_NATURE       3
737 #define REALM_CHAOS        4
738 #define REALM_DEATH        5
739 #define REALM_TRUMP        6
740 #define REALM_ARCANE       7
741 #define REALM_CRAFT      8
742 #define REALM_DAEMON       9
743 #define REALM_CRUSADE      10
744 #define MAX_MAGIC          10
745 #define MIN_TECHNIC        16
746 #define REALM_MUSIC        16
747 #define REALM_HISSATSU     17
748 #define REALM_HEX          18
749 #define MAX_REALM          18
750
751 #define VALID_REALM        (MAX_REALM + MAX_MAGIC - MIN_TECHNIC + 1)
752 #define NUM_TECHNIC        (MAX_REALM - MIN_TECHNIC + 1)
753
754 #define is_magic(A) ((((A) > REALM_NONE) && ((A) < MAX_MAGIC + 1)) ? TRUE : FALSE)
755 #define tval2realm(A) ((A) - TV_LIFE_BOOK + 1)
756 #define technic2magic(A)      (is_magic(A) ? (A) : (A) - MIN_TECHNIC + 1 + MAX_MAGIC)
757 #define is_good_realm(REALM)   ((REALM) == REALM_LIFE || (REALM) == REALM_CRUSADE)
758
759 /*
760  * Magic-books for the realms
761  */
762 #define REALM1_BOOK     (p_ptr->realm1 + TV_LIFE_BOOK - 1)
763 #define REALM2_BOOK     (p_ptr->realm2 + TV_LIFE_BOOK - 1)
764
765
766 /*
767  * Mode constant for do_spell()
768  */
769 #define SPELL_NAME   0
770 #define SPELL_DESC   1
771 #define SPELL_INFO   2
772 #define SPELL_CAST   3
773 #define SPELL_FAIL   4
774 #define SPELL_STOP   5
775 #define SPELL_CONT   6
776
777
778 /*
779  * Maximum number of "normal" pack slots, and the index of the "overflow"
780  * slot, which can hold an item, but only temporarily, since it causes the
781  * pack to "overflow", dropping the "last" item onto the ground.  Since this
782  * value is used as an actual slot, it must be less than "INVEN_RARM" (below).
783  * Note that "INVEN_PACK" is probably hard-coded by its use in savefiles, and
784  * by the fact that the screen can only show 23 items plus a one-line prompt.
785  */
786 #define INVEN_PACK              23
787
788 /*
789  * Indexes used for various "equipment" slots (hard-coded by savefiles, etc).
790  */
791 #define INVEN_RARM      24
792 #define INVEN_LARM      25
793 #define INVEN_BOW       26
794 #define INVEN_RIGHT     27
795 #define INVEN_LEFT      28
796 #define INVEN_NECK      29
797 #define INVEN_LITE      30
798 #define INVEN_BODY      31
799 #define INVEN_OUTER     32
800 #define INVEN_HEAD      33
801 #define INVEN_HANDS     34
802 #define INVEN_FEET      35
803
804 /*
805  * used for get_random_ego()
806  */
807 #define INVEN_AMMO     23
808
809 /*
810  * Total number of inventory slots (hard-coded).
811  */
812 #define INVEN_TOTAL     36
813
814 /*
815  * Fake inventory slot for selecting force (hard-coded).
816  */
817 #define INVEN_FORCE     1111
818
819
820 /*
821  * Indexes of the various "stats" (hard-coded by savefiles, etc).
822  */
823 #define A_STR   0
824 #define A_INT   1
825 #define A_WIS   2
826 #define A_DEX   3
827 #define A_CON   4
828 #define A_CHR   5
829
830 /*
831  * Player sex constants (hard-coded by save-files, arrays, etc)
832  */
833 #define SEX_FEMALE              0
834 #define SEX_MALE                1
835
836
837 /*
838  * Player race constants (hard-coded by save-files, arrays, etc)
839  */
840 #define RACE_HUMAN               0
841 #define RACE_HALF_ELF            1
842 #define RACE_ELF                 2
843 #define RACE_HOBBIT              3
844 #define RACE_GNOME               4
845 #define RACE_DWARF               5
846 #define RACE_HALF_ORC            6
847 #define RACE_HALF_TROLL          7
848 #define RACE_AMBERITE            8
849 #define RACE_HIGH_ELF            9
850 #define RACE_BARBARIAN          10
851 #define RACE_HALF_OGRE          11
852 #define RACE_HALF_GIANT         12
853 #define RACE_HALF_TITAN         13
854 #define RACE_CYCLOPS            14
855 #define RACE_YEEK               15
856 #define RACE_KLACKON            16
857 #define RACE_KOBOLD             17
858 #define RACE_NIBELUNG           18
859 #define RACE_DARK_ELF           19
860 #define RACE_DRACONIAN          20
861 #define RACE_MIND_FLAYER        21
862 #define RACE_IMP                22
863 #define RACE_GOLEM              23
864 #define RACE_SKELETON           24
865 #define RACE_ZOMBIE             25
866 #define RACE_VAMPIRE            26
867 #define RACE_SPECTRE            27
868 #define RACE_SPRITE             28
869 #define RACE_BEASTMAN           29
870 #define RACE_ENT                30
871 #define RACE_ANGEL              31
872 #define RACE_DEMON              32
873 #define RACE_DUNADAN            33
874 #define RACE_S_FAIRY            34
875 #define RACE_KUTAR              35
876 #define RACE_ANDROID            36
877
878 /*
879  * Maximum number of player "race" types (see "table.c", etc)
880  */
881 #define MAX_RACES               37
882
883
884 /*
885  * Player class constants (hard-coded by save-files, arrays, etc)
886  */
887 #define CLASS_WARRIOR            0
888 #define CLASS_MAGE               1
889 #define CLASS_PRIEST             2
890 #define CLASS_ROGUE              3
891 #define CLASS_RANGER             4
892 #define CLASS_PALADIN            5
893 #define CLASS_WARRIOR_MAGE       6
894 #define CLASS_CHAOS_WARRIOR      7
895 #define CLASS_MONK               8
896 #define CLASS_MINDCRAFTER        9
897 #define CLASS_HIGH_MAGE         10
898 #define CLASS_TOURIST           11
899 #define CLASS_IMITATOR          12
900 #define CLASS_BEASTMASTER       13
901 #define CLASS_SORCERER          14
902 #define CLASS_ARCHER            15
903 #define CLASS_MAGIC_EATER       16
904 #define CLASS_BARD              17
905 #define CLASS_RED_MAGE          18
906 #define CLASS_SAMURAI           19
907 #define CLASS_FORCETRAINER      20
908 #define CLASS_BLUE_MAGE         21
909 #define CLASS_CAVALRY           22
910 #define CLASS_BERSERKER         23
911 #define CLASS_SMITH             24
912 #define CLASS_MIRROR_MASTER     25
913 #define CLASS_NINJA             26
914 #define CLASS_SNIPER            27
915
916 #define SEIKAKU_FUTUU    0
917 #define SEIKAKU_CHIKARA  1
918 #define SEIKAKU_KIREMONO 2
919 #define SEIKAKU_SHIAWASE 3
920 #define SEIKAKU_SUBASI   4
921 #define SEIKAKU_INOCHI   5
922 #define SEIKAKU_COMBAT   6
923 #define SEIKAKU_NAMAKE   7
924 #define SEIKAKU_SEXY     8
925 #define SEIKAKU_LUCKY    9
926 #define SEIKAKU_GAMAN    10
927 #define SEIKAKU_MUNCHKIN 11
928
929 /*** Screen Locations ***/
930
931 /*
932  * Some screen locations for various display routines
933  * Currently, row 8 and 15 are the only "blank" rows.
934  * That leaves a "border" around the "stat" values.
935  */
936
937 #define ROW_RACE                1
938 #define COL_RACE                0       /* <race name> */
939
940 /*#define ROW_CLASS               2 */
941 /*#define COL_CLASS               0 */      /* <class name> */
942
943 #define ROW_TITLE               2
944 #define COL_TITLE               0       /* <title> or <mode> */
945
946 /*#define ROW_SEIKAKU           4 */
947 /*#define COL_SEIKAKU           0*/     /* <seikaku> */
948
949 #define ROW_DAY                 21
950 #define COL_DAY                 0       /* day */
951
952 #define ROW_DUNGEON             22
953 #define COL_DUNGEON             0       /* dungeon */
954
955 #define ROW_LEVEL               3
956 #define COL_LEVEL               0       /* "LEVEL xxxxxx" */
957
958 #define ROW_EXP                 4
959 #define COL_EXP                 0       /* "EXP xxxxxxxx" */
960
961 #define ROW_GOLD                5
962 #define COL_GOLD                0       /* "AU xxxxxxxxx" */
963
964 #define ROW_EQUIPPY             6
965 #define COL_EQUIPPY             0       /* equippy chars */
966
967 #define ROW_STAT                7
968 #define COL_STAT                0       /* "xxx   xxxxxx" */
969
970 #define ROW_AC                  13
971 #define COL_AC                  0       /* "Cur AC xxxxx" */
972
973 #define ROW_HPMP                14
974 #define COL_HPMP                0
975
976 #define ROW_CURHP               14
977 #define COL_CURHP               0       /* "Cur HP xxxxx" */
978
979 #define ROW_CURSP               15
980 #define COL_CURSP               0       /* "Cur SP xxxxx" */
981
982 #define ROW_RIDING_INFO          16
983 #define COL_RIDING_INFO          0       /* "xxxxxxxxxxxx" */
984
985 #define ROW_INFO                17
986 #define COL_INFO                0       /* "xxxxxxxxxxxx" */
987
988 #define ROW_MAP                                         0
989 #define COL_MAP                  12
990
991 #define ROW_CUT                 18
992 #define COL_CUT                 0       /* <cut> */
993
994 #define ROW_STUN                19
995 #define COL_STUN                0       /* <stun> */
996
997 #define ROW_HUNGRY              20
998 #define COL_HUNGRY              0       /* "Weak" / "Hungry" / "Full" / "Gorged" */
999
1000 #define ROW_STATE               20
1001 #define COL_STATE                7      /* <state> */
1002
1003 #define ROW_SPEED               (-1)
1004 #define COL_SPEED               (-24)      /* "Slow (-NN)" or "Fast (+NN)" */
1005
1006 #define ROW_STUDY               (-1)
1007 #define COL_STUDY               (-13)      /* "Study" */
1008
1009 #define ROW_DEPTH               (-1)
1010 #define COL_DEPTH               (-8)      /* "Lev NNN" / "NNNN ft" */
1011
1012 #define ROW_STATBAR             (-1)
1013 #define COL_STATBAR              0
1014 #define MAX_COL_STATBAR         (-26)
1015
1016
1017 /*
1018  * Number of feats we change to (Excluding default). Used in f_info.txt.
1019  */
1020 #define MAX_FEAT_STATES  8
1021
1022
1023 /*
1024  * Wilderness terrains
1025  */
1026 #define TERRAIN_EDGE             0 /* Edge of the World */
1027 #define TERRAIN_TOWN             1 /* Town */
1028 #define TERRAIN_DEEP_WATER       2 /* Deep water */
1029 #define TERRAIN_SHALLOW_WATER    3 /* Shallow water */
1030 #define TERRAIN_SWAMP            4 /* Swamp */
1031 #define TERRAIN_DIRT             5 /* Dirt */
1032 #define TERRAIN_GRASS            6 /* Grass */
1033 #define TERRAIN_TREES            7 /* Trees */
1034 #define TERRAIN_DESERT           8 /* Desert */
1035 #define TERRAIN_SHALLOW_LAVA     9 /* Shallow lava */
1036 #define TERRAIN_DEEP_LAVA       10 /* Deep lava */
1037 #define TERRAIN_MOUNTAIN        11 /* Mountain */
1038
1039 #define MAX_WILDERNESS          12 /* Maximum wilderness index */
1040
1041
1042 /*
1043  * Feature flags - should be used instead of feature indexes unless generating.
1044  * Originally from UnAngband, and modified into TR-like style in Hengband
1045  */
1046
1047
1048 #define FF_LOS           0
1049 #define FF_PROJECT       1
1050 #define FF_MOVE          2
1051 #define FF_PLACE         3
1052 #define FF_DROP          4
1053 #define FF_SECRET        5
1054 #define FF_NOTICE        6
1055 #define FF_REMEMBER      7
1056 #define FF_OPEN          8
1057 #define FF_CLOSE         9
1058 #define FF_BASH          10
1059 #define FF_SPIKE         11
1060 #define FF_DISARM        12
1061 #define FF_STORE         13
1062 #define FF_TUNNEL        14
1063 #define FF_MAY_HAVE_GOLD 15
1064 #define FF_HAS_GOLD      16
1065 #define FF_HAS_ITEM      17
1066 #define FF_DOOR          18
1067 #define FF_TRAP          19
1068 #define FF_STAIRS        20
1069 #define FF_GLYPH         21
1070 #define FF_LESS          22
1071 #define FF_MORE          23
1072 #define FF_AVOID_RUN     24
1073 #define FF_FLOOR         25
1074 #define FF_WALL          26
1075 #define FF_PERMANENT     27
1076 /* #define FF_XXX00         28 */
1077 /* #define FF_XXX01         29 */
1078 /* #define FF_XXX02         30 */
1079 #define FF_HIT_TRAP      31
1080
1081 /* #define FF_BRIDGE        32 */
1082 /* #define FF_RIVER         33 */
1083 /* #define FF_LAKE          34 */
1084 /* #define FF_BRIDGED       35 */
1085 /* #define FF_COVERED       36 */
1086 #define FF_GLOW          37
1087 #define FF_ENSECRET      38
1088 #define FF_WATER         39
1089 #define FF_LAVA          40
1090 #define FF_SHALLOW       41
1091 #define FF_DEEP          42
1092 /* #define FF_FILLED        43 */
1093 #define FF_HURT_ROCK     44
1094 /* #define FF_HURT_FIRE     45 */
1095 /* #define FF_HURT_COLD     46 */
1096 /* #define FF_HURT_ACID     47 */
1097 /* #define FF_ICE           48 */
1098 /* #define FF_ACID          49 */
1099 /* #define FF_OIL           50 */
1100 /* #define FF_XXX04      51 */
1101 /* #define FF_CAN_CLIMB     52 */
1102 #define FF_CAN_FLY       53
1103 #define FF_CAN_SWIM      54
1104 #define FF_CAN_PASS      55
1105 /* #define FF_CAN_OOZE      56 */
1106 #define FF_CAN_DIG       57
1107 /* #define FF_HIDE_ITEM     58 */
1108 /* #define FF_HIDE_SNEAK    59 */
1109 /* #define FF_HIDE_SWIM     60 */
1110 /* #define FF_HIDE_DIG      61 */
1111 /* #define FF_KILL_HUGE     62 */
1112 /* #define FF_KILL_MOVE     63 */
1113
1114 /* #define FF_PICK_TRAP     64 */
1115 /* #define FF_PICK_DOOR     65 */
1116 /* #define FF_ALLOC         66 */
1117 /* #define FF_CHEST         67 */
1118 /* #define FF_DROP_1D2      68 */
1119 /* #define FF_DROP_2D2      69 */
1120 /* #define FF_DROP_GOOD     70 */
1121 /* #define FF_DROP_GREAT    71 */
1122 /* #define FF_HURT_POIS     72 */
1123 /* #define FF_HURT_ELEC     73 */
1124 /* #define FF_HURT_WATER    74 */
1125 /* #define FF_HURT_BWATER   75 */
1126 /* #define FF_USE_FEAT      76 */
1127 /* #define FF_GET_FEAT      77 */
1128 /* #define FF_GROUND        78 */
1129 /* #define FF_OUTSIDE       79 */
1130 /* #define FF_EASY_HIDE     80 */
1131 /* #define FF_EASY_CLIMB    81 */
1132 /* #define FF_MUST_CLIMB    82 */
1133 #define FF_TREE          83
1134 /* #define FF_NEED_TREE     84 */
1135 /* #define FF_BLOOD         85 */
1136 /* #define FF_DUST          86 */
1137 /* #define FF_SLIME         87 */
1138 #define FF_PLANT         88
1139 /* #define FF_XXX2          89 */
1140 /* #define FF_INSTANT       90 */
1141 /* #define FF_EXPLODE       91 */
1142 /* #define FF_TIMED         92 */
1143 /* #define FF_ERUPT         93 */
1144 /* #define FF_STRIKE        94 */
1145 /* #define FF_SPREAD        95 */
1146
1147 #define FF_SPECIAL       96
1148 #define FF_HURT_DISI     97
1149 #define FF_QUEST_ENTER   98
1150 #define FF_QUEST_EXIT    99
1151 #define FF_QUEST         100
1152 #define FF_SHAFT         101
1153 #define FF_MOUNTAIN      102
1154 #define FF_BLDG          103
1155 #define FF_MINOR_GLYPH   104
1156 #define FF_PATTERN       105
1157 #define FF_TOWN          106
1158 #define FF_ENTRANCE      107
1159 #define FF_MIRROR        108
1160 #define FF_UNPERM        109
1161 #define FF_TELEPORTABLE  110
1162 #define FF_CONVERT       111
1163 #define FF_GLASS         112
1164
1165 #define FF_FLAG_MAX      113
1166 #define FF_FLAG_SIZE     (1 + ((FF_FLAG_MAX - 1) / 32))
1167
1168 /* Which features are dynamic */
1169 #define have_dynamic_flags(ARRAY) \
1170         (!!((ARRAY)[(FF_INSTANT / 32)] & \
1171             ((1UL << (FF_INSTANT % 32)) | \
1172              (1UL << (FF_EXPLODE % 32)) | \
1173              (1UL << (FF_TIMED % 32)) | \
1174              (1UL << (FF_ERUPT % 32)) | \
1175              (1UL << (FF_STRIKE % 32)) | \
1176              (1UL << (FF_SPREAD % 32)))))
1177
1178
1179 /*
1180  * Feature action flags
1181  */
1182 #define FAF_DESTROY     0x01
1183 #define FAF_NO_DROP     0x02
1184 #define FAF_CRASH_GLASS 0x04
1185
1186
1187 /*
1188  * Bit flags for teleportation
1189  */
1190 #define TELEPORT_NONMAGICAL 0x00000001
1191 #define TELEPORT_PASSIVE    0x00000002
1192 #define TELEPORT_DEC_VALOUR 0x00000004
1193
1194
1195 /* Types of doors */
1196 #define DOOR_DEFAULT    -1
1197 #define DOOR_DOOR        0
1198 #define DOOR_GLASS_DOOR  1
1199 #define DOOR_CURTAIN     2
1200
1201 #define MAX_DOOR_TYPES   3
1202
1203 #define feat_locked_door_random(DOOR_TYPE) \
1204         (feat_door[(DOOR_TYPE)].num_locked ? \
1205          feat_door[(DOOR_TYPE)].locked[randint0(feat_door[(DOOR_TYPE)].num_locked)] : feat_none)
1206
1207 #define feat_jammed_door_random(DOOR_TYPE) \
1208         (feat_door[(DOOR_TYPE)].num_jammed ? \
1209          feat_door[(DOOR_TYPE)].jammed[randint0(feat_door[(DOOR_TYPE)].num_jammed)] : feat_none)
1210
1211
1212 /* Types of normal traps */
1213 #define NOT_TRAP        -1
1214 #define TRAP_TRAPDOOR    0
1215 #define TRAP_PIT         1
1216 #define TRAP_SPIKED_PIT  2
1217 #define TRAP_POISON_PIT  3
1218 #define TRAP_TY_CURSE    4
1219 #define TRAP_TELEPORT    5
1220 #define TRAP_FIRE        6
1221 #define TRAP_ACID        7
1222 #define TRAP_SLOW        8
1223 #define TRAP_LOSE_STR    9
1224 #define TRAP_LOSE_DEX   10
1225 #define TRAP_LOSE_CON   11
1226 #define TRAP_BLIND      12
1227 #define TRAP_CONFUSE    13
1228 #define TRAP_POISON     14
1229 #define TRAP_SLEEP      15
1230 #define TRAP_TRAPS      16
1231 #define TRAP_ALARM      17
1232
1233
1234 /* Types of special traps */
1235 #define TRAP_OPEN       18
1236 #define TRAP_ARMAGEDDON 19
1237 #define TRAP_PIRANHA    20
1238
1239
1240 /* Maximum locked/jammed doors */
1241 #define MAX_LJ_DOORS 8
1242
1243
1244 /* Types of pattern tiles */
1245 #define NOT_PATTERN_TILE      -1
1246 #define PATTERN_TILE_START    0
1247 #define PATTERN_TILE_1        1
1248 #define PATTERN_TILE_2        2
1249 #define PATTERN_TILE_3        3
1250 #define PATTERN_TILE_4        4
1251 #define PATTERN_TILE_END      5
1252 #define PATTERN_TILE_OLD      6
1253 #define PATTERN_TILE_TELEPORT 7
1254 #define PATTERN_TILE_WRECKED  8
1255
1256
1257 /* Types of conversions */
1258 #define CONVERT_TYPE_FLOOR   0
1259 #define CONVERT_TYPE_WALL    1
1260 #define CONVERT_TYPE_INNER   2
1261 #define CONVERT_TYPE_OUTER   3
1262 #define CONVERT_TYPE_SOLID   4
1263 #define CONVERT_TYPE_STREAM1 5
1264 #define CONVERT_TYPE_STREAM2 6
1265
1266
1267 /*
1268  * Bit flags for the *_can_enter() and monster_can_cross_terrain()
1269  */
1270 #define CEM_RIDING              0x0001
1271 #define CEM_P_CAN_ENTER_PATTERN 0x0002
1272
1273
1274 /* Lighting levels of features' attr and char */
1275
1276 #define F_LIT_STANDARD 0 /* Standard */
1277 #define F_LIT_LITE     1 /* Brightly lit */
1278 #define F_LIT_DARK     2 /* Darkened */
1279
1280 #define F_LIT_NS_BEGIN 1 /* Nonstandard */
1281 #define F_LIT_MAX      3
1282
1283
1284 /*** Artifact indexes (see "lib/edit/a_info.txt") ***/
1285
1286 /* Lites */
1287 #define ART_GALADRIEL            1
1288 #define ART_ELENDIL              2
1289 #define ART_JUDGE                3
1290 #define ART_EDISON               7
1291 #define ART_PALANTIR             15
1292 #define ART_STONE_LORE           17
1293 #define ART_FLY_STONE            147
1294 #define ART_ORB_OF_FATE          245 
1295 /* Amulets */
1296 #define ART_CARLAMMAS            4
1297 #define ART_INGWE                5
1298 #define ART_DWARVES              6
1299 #define ART_FARAMIR              18
1300 #define ART_BOROMIR              143
1301 #define ART_MAGATAMA             149
1302 #define ART_INROU                166
1303 #define ART_NIGHT                215
1304 #define ART_SACRED_KNIGHTS       217
1305 #define ART_HELL                 218
1306 #define ART_CHARMED              219
1307 #define ART_GOGO                 220
1308
1309 /* Rings */
1310 #define ART_FRAKIR               8
1311 #define ART_TULKAS               9
1312 #define ART_NARYA               10
1313 #define ART_NENYA               11
1314 #define ART_VILYA               12
1315 #define ART_POWER               13
1316 #define ART_AHO                 14
1317
1318 /* Dragon Scale */
1319 #define ART_RAZORBACK           129
1320 #define ART_BLADETURNER         130
1321 #define ART_SEIRYU              201
1322
1323 /* Hard Armour */
1324 #define ART_SOULKEEPER          19
1325 #define ART_ISILDUR             20
1326 #define ART_ROHIRRIM            21
1327 #define ART_LOHENGRIN           22
1328 #define ART_JULIAN              23
1329 #define ART_ARVEDUI             24
1330 #define ART_CASPANION           25
1331 #define ART_GILES               168
1332 #define ART_MORLOK              203
1333 #define ART_VETERAN             206
1334
1335 /* Soft Armour */
1336 #define ART_SHIVA_JACKET        26
1337 #define ART_HITHLOMIR           27
1338 #define ART_THALKETTOTH         28
1339 #define ART_HIMRING             127
1340 #define ART_ICANUS              131
1341 #define ART_NAMAKE_ARMOR        183
1342 #define ART_GHB                 192
1343 #define ART_DASAI               200
1344 #define ART_KESHO               204
1345 #define ART_MILIM               246
1346
1347 /* Shields */
1348 #define ART_THORIN              30
1349 #define ART_CELEGORM            31
1350 #define ART_ANARION             32
1351 #define ART_GIL_GALAD           138
1352 #define ART_YENDOR              141
1353 #define ART_YATA                151
1354 #define ART_EARENDIL            186
1355 #define ART_PERSEUS             197
1356
1357 /* Helms and Crowns */
1358 #define ART_INDRA               33
1359 #define ART_CHAOS               34
1360 #define ART_BERUTHIEL           35
1361 #define ART_THRANDUIL           36
1362 #define ART_THENGEL             37
1363 #define ART_HAMMERHAND          38
1364 #define ART_DOR                 39
1365 #define ART_HOLHENNETH          40
1366 #define ART_TERROR              41
1367 #define ART_AMBER               42
1368 #define ART_NUMENOR             132
1369 #define ART_STONEMASK           146
1370
1371 /* Cloaks */
1372 #define ART_JACK                43
1373 #define ART_COLLUIN             44
1374 #define ART_HOLCOLLETH          45
1375 #define ART_THINGOL             46
1376 #define ART_THORONGIL           47
1377 #define ART_COLANNON            48
1378 #define ART_LUTHIEN             49
1379 #define ART_TUOR                50
1380 #define ART_MOOK                205
1381 #define ART_HEAVENLY_MAIDEN     233
1382
1383 /* Gloves */
1384 #define ART_CAMBELEG            52
1385 #define ART_CAMMITHRIM          53
1386 #define ART_PAURHACH            54
1387 #define ART_CORWIN              55
1388 #define ART_PAURAEGEN           56
1389 #define ART_PAURNEN             57
1390 #define ART_THANOS              58
1391 #define ART_FINGOLFIN           59
1392 #define ART_PAURNIMMEN          185
1393
1394 /* Boots */
1395 #define ART_FEANOR              60
1396 #define ART_FLORA               61
1397 #define ART_THROR               62
1398 #define ART_SHIVA_BOOTS         63
1399 #define ART_GLASS               165
1400 #define ART_GETA                210
1401
1402 /* Digging */
1403 #define ART_NAIN                211
1404
1405 /* Swords */
1406 #define ART_MAEDHROS            64
1407 #define ART_CAINE               65
1408 #define ART_NARTHANC            66
1409 #define ART_NIMTHANC            67
1410 #define ART_DETHANC             68
1411 #define ART_RILIA               69
1412 #define ART_FIONA               70
1413 #define ART_CALRIS              71
1414 #define ART_GRAYSWANDIR         72
1415 #define ART_GLAMDRING           73
1416 #define ART_NOTHUNG             74
1417 #define ART_ORCRIST             75
1418 #define ART_GURTHANG            76
1419 #define ART_ZARCUTHRA           77
1420 #define ART_TWILIGHT            78
1421 #define ART_GONDRICAM           79
1422 #define ART_CRISDURIAN          80
1423 #define ART_AGLARANG            81
1424 #define ART_RINGIL              82
1425 #define ART_ANDURIL             83
1426 #define ART_WEREWINDLE          84
1427 #define ART_CHAINSWORD          85
1428 #define ART_FORASGIL            86
1429 #define ART_CARETH              87
1430 #define ART_STING               88
1431 #define ART_SOULSWORD           89
1432 #define ART_MERLIN              90
1433 #define ART_DOOMCALLER          91
1434 #define ART_VORPAL_BLADE        92
1435 #define ART_SLAYER              123
1436 #define ART_KUSANAGI            128
1437 #define ART_HURIN               133
1438 #define ART_AZAGHAL             135
1439 #define ART_NOVA                137
1440 #define ART_CHARIOT             140
1441 #define ART_WORPAL_BLADE        142
1442 #define ART_MURAMASA            144
1443 #define ART_ZANTETSU            150
1444 #define ART_SOULCRUSH           154
1445 #define ART_FALIS               155
1446 #define ART_HRUNTING            156
1447 #define ART_ANUBIS              158
1448 #define ART_GURENKI             160
1449 #define ART_TAILBITER           167
1450 #define ART_MUSASI_KATANA       171
1451 #define ART_MUSASI_WAKIZASI     172
1452 #define ART_QUICKTHORN          174
1453 #define ART_TINYTHORN           175
1454 #define ART_EXCALIBUR           176
1455 #define ART_EXCALIPUR           177
1456 #define ART_EXCALIBUR_J         179
1457 #define ART_ARUNRUTH            184
1458 #define ART_HAKABUSA            189
1459 #define ART_STORMBRINGER        190
1460 #define ART_NARSIL              191
1461 #define ART_KANNU               193
1462 #define ART_GRIMTOOTH           196
1463 #define ART_KAMUI               198
1464 #define ART_GOURYU              207
1465 #define ART_EOWYN               216
1466 #define ART_NANACHO             248
1467
1468 /* Polearms */
1469 #define ART_THEODEN             93
1470 #define ART_PAIN                94
1471 #define ART_OSONDIR             95
1472 #define ART_TIL                 96
1473 #define ART_RUNESPEAR           97
1474 #define ART_DESTINY             98
1475 #define ART_HAGEN               99
1476 #define ART_EORLINGAS           100
1477 #define ART_DURIN               101
1478 #define ART_EONWE               102
1479 #define ART_BALLI               103
1480 #define ART_LOTHARANG           104
1481 #define ART_DWARVES_AXE         105
1482 #define ART_BARUKKHELED         106
1483 #define ART_WRATH               107
1484 #define ART_ULMO                108
1485 #define ART_AVAVIR              109
1486 #define ART_BENKEI              152
1487 #define ART_TAIKOBO             159
1488 #define ART_TONBO               161
1489 #define ART_GAEBOLG             163
1490 #define ART_ARRYU               164
1491 #define ART_AEGLOS              187
1492 #define ART_BLOOD               199
1493 #define ART_NUMAHOKO            202
1494
1495 /* The sword of the Dawn */
1496 #define ART_DAWN                110
1497
1498 /* Hafted */
1499 #define ART_GROND               111
1500 #define ART_TOTILA              112
1501 #define ART_THUNDERFIST         113
1502 #define ART_BLOODSPIKE          114
1503 #define ART_FIRESTAR            115
1504 #define ART_TARATOL             116
1505 #define ART_AULE                117
1506 #define ART_NAR                 118
1507 #define ART_ERIRIL              119
1508 #define ART_GANDALF             120
1509 #define ART_DEATHWREAKER        121
1510 #define ART_TURMIL              122
1511 #define ART_MJOLLNIR            136
1512 #define ART_WINBLOWS            139
1513 #define ART_XIAOLONG            145
1514 #define ART_NYOIBOU             157
1515 #define ART_JONES               162
1516 #define ART_HYOUSIGI            169
1517 #define ART_MATOI               170
1518 #define ART_IRON_BALL           173
1519 #define ART_SAMSON              178
1520 #define ART_NAMAKE_HAMMER       181
1521 #define ART_BOLISHOI            188
1522 #define ART_SHUTEN_DOJI         194
1523 #define ART_G_HAMMER            195
1524 #define ART_AEGISFANG           208
1525 #define ART_HERMIT              209
1526 #define ART_GOTHMOG             212
1527 #define ART_JIZO                213
1528 #define ART_FUNDIN              214
1529 #define ART_AESCULAPIUS         225
1530
1531 /* Bows */
1532 #define ART_BELTHRONDING        124
1533 #define ART_BARD                125
1534 #define ART_BRAND               126
1535 #define ART_CRIMSON             16
1536 #define ART_BUCKLAND            134
1537 #define ART_YOICHI              148
1538 #define ART_HARAD               180
1539 #define ART_NAMAKE_BOW          182
1540 #define ART_ROBIN_HOOD          221
1541 #define ART_HELLFIRE            222
1542
1543 /* Arrows */
1544 #define ART_BARD_ARROW          153
1545
1546 /*** Ego-Item indexes (see "lib/edit/e_info.txt") ***/
1547
1548
1549 /* Nothing */
1550 /* xxx */
1551 /* xxx */
1552 /* xxx */
1553
1554 /* Body Armor */
1555 #define EGO_A_MORGUL            4
1556 #define EGO_A_DEMON             5
1557 #define EGO_DRUID               6
1558 #define EGO_OLOG                7
1559 #define EGO_RESISTANCE          8
1560 #define EGO_ELVENKIND           9
1561 #define EGO_DWARVEN             10
1562 #define EGO_PERMANENCE          11
1563 #define EGO_YOIYAMI             12
1564 #define EGO_URUKISH             13
1565 /* xxx */
1566 /* xxx */
1567
1568 /* Shields */
1569 #define EGO_ENDURE_ACID         16
1570 #define EGO_ENDURE_ELEC         17
1571 #define EGO_ENDURE_FIRE         18
1572 #define EGO_ENDURE_COLD         19
1573 #define EGO_ENDURANCE           20
1574 #define EGO_REFLECTION          21
1575 #define EGO_NIGHT_DAY           22
1576 #define EGO_S_PROTECTION        238
1577 #define EGO_S_DWARVEN           239
1578
1579 /* Crowns and Helms */
1580 #define EGO_DARK                23
1581 #define EGO_BRILLIANCE          24
1582 #define EGO_H_PROTECTION        25
1583 //#define EGO_BEAUTY              26
1584 #define EGO_MAGI                27
1585 #define EGO_MIGHT               28
1586 #define EGO_LORDLINESS          29
1587 #define EGO_SEEING              30
1588 #define EGO_INFRAVISION         31
1589 #define EGO_LITE                32
1590 #define EGO_TELEPATHY           33
1591 #define EGO_REGENERATION        34
1592 #define EGO_TELEPORTATION       35
1593 #define EGO_FOOL                36
1594 //#define EGO_NAIVETY             37
1595 //#define EGO_UGLINESS            38
1596 #define EGO_SICKLINESS          39
1597
1598 /* Cloaks */
1599 #define EGO_PROTECTION          40
1600 #define EGO_STEALTH             41
1601 #define EGO_AMAN                42
1602 #define EGO_AURA_FIRE           43
1603 #define EGO_ENVELOPING          44
1604 #define EGO_VULNERABILITY       45
1605 #define EGO_IRRITATION          46
1606 #define EGO_AURA_ELEC           47
1607 #define EGO_AURA_COLD          128
1608 #define EGO_BAT                129
1609
1610 /* Gloves */
1611 #define EGO_FREE_ACTION         48
1612 #define EGO_SLAYING             49
1613 #define EGO_AGILITY             50
1614 #define EGO_POWER               51
1615 #define EGO_2WEAPON             52
1616 #define EGO_MAGIC_MASTERY       53
1617 #define EGO_WEAKNESS            54
1618 #define EGO_CLUMSINESS          55
1619
1620 /* Boots */
1621 #define EGO_SLOW_DESCENT        56
1622 #define EGO_QUIET               57
1623 #define EGO_MOTION              58
1624 #define EGO_SPEED               59
1625 #define EGO_JUMP                60
1626 #define EGO_NOISE               61
1627 #define EGO_SLOWNESS            62
1628 #define EGO_ANNOYANCE           63
1629
1630 /* Weapons */
1631 #define EGO_HA                  64
1632 #define EGO_DF                  65
1633 #define EGO_BLESS_BLADE         66
1634 /* xxx */
1635 #define EGO_WEST                68
1636 #define EGO_ATTACKS             69
1637 #define EGO_SLAYING_WEAPON      70
1638 #define EGO_FORCE_WEAPON        71
1639 #define EGO_BRAND_ACID          72
1640 #define EGO_BRAND_ELEC          73
1641 #define EGO_BRAND_FIRE          74
1642 #define EGO_BRAND_COLD          75
1643 #define EGO_BRAND_POIS          76
1644 #define EGO_CHAOTIC             77
1645 #define EGO_SHARPNESS           78
1646 #define EGO_EARTHQUAKES         79
1647 #define EGO_XXX_1               80
1648 #define EGO_XXX_2               81
1649 #define EGO_XXX_3               82
1650 #define EGO_XXX_4               83
1651 #define EGO_XXX_5               84
1652 #define EGO_XXX_6               85
1653 #define EGO_XXX_7               86
1654 #define EGO_WEIRD               87
1655 #define EGO_KILL_ANIMAL         88
1656 #define EGO_KILL_EVIL           89
1657 #define EGO_KILL_UNDEAD         90
1658 #define EGO_KILL_DEMON          91
1659 #define EGO_KILL_ORC            92
1660 #define EGO_KILL_TROLL          93
1661 #define EGO_KILL_GIANT          94
1662 #define EGO_KILL_DRAGON         95
1663 #define EGO_VAMPIRIC            96
1664 #define EGO_PRISM               97
1665 #define EGO_TRUMP               98
1666 #define EGO_PATTERN             99
1667 #define EGO_DIGGING             100
1668 #define EGO_DEMON               101
1669 #define EGO_MORGUL              102
1670 #define EGO_KILL_HUMAN          103
1671
1672 /* Bows */
1673 #define EGO_ACCURACY            104
1674 #define EGO_VELOCITY            105
1675 /* xxx */
1676 /* xxx */
1677 #define EGO_EXTRA_MIGHT         108
1678 #define EGO_EXTRA_SHOTS         109
1679 /* xxx */
1680 /* xxx */
1681
1682 /* Ammo */
1683 #define EGO_HURT_ANIMAL         112
1684 #define EGO_HURT_EVIL           113
1685 /* xxx */
1686 /* xxx */
1687 /* xxx */
1688 /* xxx */
1689 /* xxx */
1690 #define EGO_HURT_DRAGON         119
1691 #define EGO_SLAYING_BOLT        120
1692 #define EGO_LIGHTNING_BOLT      121
1693 #define EGO_FLAME               122
1694 #define EGO_FROST               123
1695 #define EGO_WOUNDING            124
1696 #define EGO_BACKBITING          125
1697 #define EGO_SHATTERED           126
1698 #define EGO_BLASTED             127
1699
1700 #define EGO_LITE_SHINE          140
1701 #define EGO_LITE_ILLUMINATION   141
1702 #define EGO_LITE_AURA_FIRE      142
1703 #define EGO_LITE_INFRA          143
1704 #define EGO_LITE_LONG           144
1705 #define EGO_LITE_DARKNESS       145
1706 #define EGO_LITE_EYE            146
1707
1708 #define EGO_RING_HERO           150
1709 #define EGO_RING_SLAY           151
1710 #define EGO_RING_SUPER_AC       152
1711 #define EGO_RING_MAGIC_MIS      153
1712 #define EGO_RING_FIRE_BOLT      154
1713 #define EGO_RING_COLD_BOLT      155
1714 #define EGO_RING_ELEC_BOLT      156
1715 #define EGO_RING_ACID_BOLT      157
1716 #define EGO_RING_MANA_BOLT      158
1717 #define EGO_RING_FIRE_BALL      159
1718 #define EGO_RING_COLD_BALL      160
1719 #define EGO_RING_ELEC_BALL      161
1720 #define EGO_RING_ACID_BALL      162
1721 #define EGO_RING_MANA_BALL      163
1722 #define EGO_RING_DRAGON_F       164
1723 #define EGO_RING_DRAGON_C       165
1724 #define EGO_RING_D_SPEED        166
1725 #define EGO_RING_BERSERKER      167
1726 #define EGO_RING_HUNTER         168
1727 #define EGO_RING_THROW          169
1728 #define EGO_RING_REGEN          170
1729 #define EGO_RING_LITE           171
1730 #define EGO_RING_M_DETECT       172
1731 #define EGO_RING_STEALTH        173
1732 #define EGO_RING_TELE_AWAY      174
1733 #define EGO_RING_TO_H           175
1734 #define EGO_RING_TO_D           176
1735 #define EGO_RING_RES_LITE       177
1736 #define EGO_RING_RES_DARK       178
1737 #define EGO_RING_WIZARD         179
1738 #define EGO_RING_TRUE           180
1739 #define EGO_RING_DRAIN_EXP      181
1740 #define EGO_RING_NO_MELEE       182
1741 #define EGO_RING_AGGRAVATE      183
1742 #define EGO_RING_TY_CURSE       184
1743 #define EGO_RING_RES_TIME       185
1744 #define EGO_RING_TELEPORT       186
1745 #define EGO_RING_ALBINO         187
1746
1747 #define EGO_AMU_SLOW_D          210
1748 #define EGO_AMU_INFRA           211
1749 #define EGO_AMU_SEE_INVIS       212
1750 #define EGO_AMU_HOLD_LIFE       213
1751 #define EGO_AMU_DRAIN_EXP       214
1752 #define EGO_AMU_FOOL            215
1753 #define EGO_AMU_AGGRAVATE       216
1754 #define EGO_AMU_TY_CURSE        217
1755 #define EGO_AMU_AC              218
1756 #define EGO_AMU_IDENT           219
1757 #define EGO_AMU_CHARM           220
1758 #define EGO_AMU_STEALTH         221
1759 #define EGO_AMU_JUMP            222
1760 #define EGO_AMU_TELEPORT        223
1761 #define EGO_AMU_D_DOOR          224
1762 #define EGO_AMU_DEFENDER        225
1763 #define EGO_AMU_RES_FIRE        226
1764 #define EGO_AMU_RES_FIRE_       227
1765 #define EGO_AMU_RES_COLD        228
1766 #define EGO_AMU_RES_COLD_       229
1767 #define EGO_AMU_RES_ELEC        230
1768 #define EGO_AMU_RES_ELEC_       231
1769 #define EGO_AMU_RES_ACID        232
1770 #define EGO_AMU_RES_ACID_       233
1771 #define EGO_AMU_LEVITATION      234
1772 #define EGO_AMU_GREAT           235
1773 #define EGO_AMU_DETECTION       236
1774 #define EGO_AMU_NAIVETY         237
1775 // MAX 239
1776
1777 /* Activation effects for random artifacts */
1778 #define ACT_SUNLIGHT            1
1779 #define ACT_BO_MISS_1           2
1780 #define ACT_BA_POIS_1           3
1781 #define ACT_BO_ELEC_1           4
1782 #define ACT_BO_ACID_1           5
1783 #define ACT_BO_COLD_1           6
1784 #define ACT_BO_FIRE_1           7
1785 #define ACT_BA_COLD_1           8
1786 #define ACT_BA_FIRE_1           9
1787 #define ACT_DRAIN_1             10
1788 #define ACT_BA_COLD_2           11
1789 #define ACT_BA_ELEC_2           12
1790 #define ACT_DRAIN_2             13
1791 #define ACT_VAMPIRE_1           14
1792 #define ACT_BO_MISS_2           15
1793 #define ACT_BA_FIRE_3           16
1794 #define ACT_BA_COLD_3           17
1795 #define ACT_BA_ELEC_3           18
1796 #define ACT_WHIRLWIND           19
1797 #define ACT_VAMPIRE_2           20
1798 #define ACT_CALL_CHAOS          21
1799 #define ACT_ROCKET              22
1800 #define ACT_DISP_EVIL           23
1801 #define ACT_BA_MISS_3           24
1802 #define ACT_DISP_GOOD           25
1803 #define ACT_BO_MANA             26
1804 #define ACT_BA_FIRE_2           27
1805 #define ACT_BA_WATER            28
1806 #define ACT_BA_STAR             29
1807 #define ACT_BA_DARK             30
1808 #define ACT_BA_MANA             31
1809 #define ACT_PESTICIDE           32
1810 #define ACT_BLINDING_LIGHT      33
1811 #define ACT_BIZARRE             34
1812 #define ACT_CAST_BA_STAR        35
1813 #define ACT_BLADETURNER         36
1814 #define ACT_BA_ACID_1           37
1815 #define ACT_BR_FIRE             38
1816 #define ACT_BR_COLD             39
1817 #define ACT_BR_DRAGON           40
1818 #define ACT_BA_FIRE_4           41
1819 #define ACT_BA_NUKE_1           42
1820 /* 42 - 50 unused */
1821 #define ACT_CONFUSE             51
1822 #define ACT_SLEEP               52
1823 #define ACT_QUAKE               53
1824 #define ACT_TERROR              54
1825 #define ACT_TELE_AWAY           55
1826 #define ACT_BANISH_EVIL         56
1827 #define ACT_GENOCIDE            57
1828 #define ACT_MASS_GENO           58
1829 #define ACT_SCARE_AREA          59
1830 #define ACT_AGGRAVATE           60
1831 /* 59 - 64 unused */
1832 #define ACT_CHARM_ANIMAL        65
1833 #define ACT_CHARM_UNDEAD        66
1834 #define ACT_CHARM_OTHER         67
1835 #define ACT_CHARM_ANIMALS       68
1836 #define ACT_CHARM_OTHERS        69
1837 #define ACT_SUMMON_ANIMAL       70
1838 #define ACT_SUMMON_PHANTOM      71
1839 #define ACT_SUMMON_ELEMENTAL    72
1840 #define ACT_SUMMON_DEMON        73
1841 #define ACT_SUMMON_UNDEAD       74
1842 #define ACT_SUMMON_HOUND        75
1843 #define ACT_SUMMON_DAWN         76
1844 #define ACT_SUMMON_OCTOPUS      77
1845 /* 76 - 80 unused */
1846 #define ACT_CHOIR_SINGS         80
1847 #define ACT_CURE_LW             81
1848 #define ACT_CURE_MW             82
1849 #define ACT_CURE_POISON         83
1850 #define ACT_REST_LIFE           84
1851 #define ACT_REST_ALL            85
1852 #define ACT_CURE_700            86
1853 #define ACT_CURE_1000           87
1854 #define ACT_CURING              88
1855 #define ACT_CURE_MANA_FULL      89
1856 /* 90 unused */
1857 #define ACT_ESP                 91
1858 #define ACT_BERSERK             92
1859 #define ACT_PROT_EVIL           93
1860 #define ACT_RESIST_ALL          94
1861 #define ACT_SPEED               95
1862 #define ACT_XTRA_SPEED          96
1863 #define ACT_WRAITH              97
1864 #define ACT_INVULN              98
1865 #define ACT_HELO                99
1866 #define ACT_HELO_SPEED          100
1867 #define ACT_RESIST_ACID         101
1868 #define ACT_RESIST_FIRE         102
1869 #define ACT_RESIST_COLD         103
1870 #define ACT_RESIST_ELEC         104
1871 #define ACT_RESIST_POIS         105
1872 /* 106 - 110 unused */
1873 #define ACT_LIGHT               111
1874 #define ACT_MAP_LIGHT           112
1875 #define ACT_DETECT_ALL          113
1876 #define ACT_DETECT_XTRA         114
1877 #define ACT_ID_FULL             115
1878 #define ACT_ID_PLAIN            116
1879 #define ACT_RUNE_EXPLO          117
1880 #define ACT_RUNE_PROT           118
1881 #define ACT_SATIATE             119
1882 #define ACT_DEST_DOOR           120
1883 #define ACT_STONE_MUD           121
1884 #define ACT_RECHARGE            122
1885 #define ACT_ALCHEMY             123
1886 #define ACT_DIM_DOOR            124
1887 #define ACT_TELEPORT            125
1888 #define ACT_RECALL              126
1889 #define ACT_JUDGE               127
1890 #define ACT_TELEKINESIS         128
1891 #define ACT_DETECT_UNIQUE       129
1892 #define ACT_ESCAPE              130
1893 #define ACT_DISP_CURSE_XTRA     131
1894 #define ACT_BRAND_FIRE_BOLTS    132
1895 #define ACT_RECHARGE_XTRA       133
1896 #define ACT_LORE                134
1897 #define ACT_SHIKOFUMI           135
1898 #define ACT_PHASE_DOOR          136
1899 #define ACT_DETECT_ALL_MONS     137
1900 #define ACT_ULTIMATE_RESIST     138
1901 /* 127 -> unused */
1902 #define ACT_FALLING_STAR        246
1903 #define ACT_STRAIN_HASTE        247
1904 #define ACT_TELEPORT_LEVEL      248
1905 #define ACT_GRAND_CROSS         249
1906 #define ACT_CAST_OFF            250
1907 #define ACT_FISHING             251
1908 #define ACT_INROU               252
1909 #define ACT_MURAMASA            253
1910 #define ACT_BLOODY_MOON         254
1911 #define ACT_CRIMSON             255
1912
1913 /*** Object "tval" and "sval" codes ***/
1914
1915
1916 /*
1917  * The values for the "tval" field of various objects.
1918  *
1919  * This value is the primary means by which items are sorted in the
1920  * player inventory, followed by "sval" and "cost".
1921  *
1922  * Note that a "BOW" with tval = 19 and sval S = 10*N+P takes a missile
1923  * weapon with tval = 16+N, and does (xP) damage when so combined.  This
1924  * fact is not actually used in the source, but it kind of interesting.
1925  *
1926  * Note that as of 2.7.8, the "item flags" apply to all items, though
1927  * only armor and weapons and a few other items use any of these flags.
1928  */
1929
1930 #define TV_SKELETON      1      /* Skeletons ('s'), not specified */
1931 #define TV_BOTTLE        2      /* Empty bottles ('!') */
1932 #define TV_JUNK          3      /* Sticks, Pottery, etc ('~') */
1933 #define TV_WHISTLE       4      /* Whistle ('~') */
1934 #define TV_SPIKE         5      /* Spikes ('~') */
1935 #define TV_CHEST         7      /* Chests ('&') */
1936 #define TV_FIGURINE      8      /* Magical figurines */
1937 #define TV_STATUE        9      /* Statue, what a silly object... */
1938 #define TV_CORPSE       10      /* Corpses and Skeletons, specific */
1939 #define TV_CAPTURE      11      /* Monster ball */
1940 #define TV_NO_AMMO      15      /* Ammo for crimson */
1941 #define TV_SHOT         16      /* Ammo for slings */
1942 #define TV_ARROW        17      /* Ammo for bows */
1943 #define TV_BOLT         18      /* Ammo for x-bows */
1944 #define TV_BOW          19      /* Slings/Bows/Xbows */
1945 #define TV_DIGGING      20      /* Shovels/Picks */
1946 #define TV_HAFTED       21      /* Priest Weapons */
1947 #define TV_POLEARM      22      /* Axes and Pikes */
1948 #define TV_SWORD        23      /* Edged Weapons */
1949 #define TV_BOOTS        30      /* Boots */
1950 #define TV_GLOVES       31      /* Gloves */
1951 #define TV_HELM         32      /* Helms */
1952 #define TV_CROWN        33      /* Crowns */
1953 #define TV_SHIELD       34      /* Shields */
1954 #define TV_CLOAK        35      /* Cloaks */
1955 #define TV_SOFT_ARMOR   36      /* Soft Armor */
1956 #define TV_HARD_ARMOR   37      /* Hard Armor */
1957 #define TV_DRAG_ARMOR   38      /* Dragon Scale Mail */
1958 #define TV_LITE         39      /* Lites (including Specials) */
1959 #define TV_AMULET       40      /* Amulets (including Specials) */
1960 #define TV_RING         45      /* Rings (including Specials) */
1961 #define TV_CARD         50
1962 #define TV_STAFF        55
1963 #define TV_WAND         65
1964 #define TV_ROD          66
1965 #define TV_PARCHMENT    69
1966 #define TV_SCROLL       70
1967 #define TV_POTION       75
1968 #define TV_FLASK        77
1969 #define TV_FOOD         80
1970 #define TV_LIFE_BOOK    90
1971 #define TV_SORCERY_BOOK 91
1972 #define TV_NATURE_BOOK  92
1973 #define TV_CHAOS_BOOK   93
1974 #define TV_DEATH_BOOK   94
1975 #define TV_TRUMP_BOOK   95
1976 #define TV_ARCANE_BOOK  96
1977 #define TV_CRAFT_BOOK 97
1978 #define TV_DAEMON_BOOK  98
1979 #define TV_CRUSADE_BOOK 99
1980 #define TV_MUSIC_BOOK   105
1981 #define TV_HISSATSU_BOOK 106
1982 #define TV_HEX_BOOK     107
1983 #define TV_GOLD         127     /* Gold can only be picked up by players */
1984
1985 #define TV_EQUIP_BEGIN    TV_SHOT
1986 #define TV_EQUIP_END      TV_CARD
1987 #define TV_MISSILE_BEGIN  TV_SHOT
1988 #define TV_MISSILE_END    TV_BOLT
1989 #define TV_WEARABLE_BEGIN TV_BOW
1990 #define TV_WEARABLE_END   TV_CARD
1991 #define TV_WEAPON_BEGIN   TV_BOW
1992 #define TV_WEAPON_END     TV_SWORD
1993 #define TV_ARMOR_BEGIN    TV_BOOTS
1994 #define TV_ARMOR_END      TV_DRAG_ARMOR
1995
1996 /* Any subvalue */
1997 #define SV_ANY                                  255
1998
1999 /* The "sval" codes for TV_FIGURINE */
2000 #define SV_FIGURINE_NORMAL              0
2001
2002 #define SV_CAPTURE_NONE         0
2003
2004 /* The "sval" codes for TV_STATUE */
2005 #define SV_WOODEN_STATUE                0
2006 #define SV_CLAY_STATUE                  1
2007 #define SV_STONE_STATUE                 2
2008 #define SV_IRON_STATUE                  3
2009 #define SV_COPPER_STATUE                4
2010 #define SV_SILVER_STATUE                5
2011 #define SV_GOLDEN_STATUE                6
2012 #define SV_IVORY_STATUE                 7
2013 #define SV_MITHRIL_STATUE               8
2014 #define SV_ORNATE_STATUE                9
2015 #define SV_PHOTO                        50
2016
2017 /* The "sval" codes for TV_CORPSE */
2018 #define SV_SKELETON                     0
2019 #define SV_CORPSE                       1
2020
2021 /* The "sval" codes for TV_SHOT/TV_ARROW/TV_BOLT */
2022 #define SV_AMMO_LIGHT                    0      /* pebbles */
2023 #define SV_AMMO_NORMAL                   1      /* shots, arrows, bolts */
2024 #define SV_AMMO_HEAVY                    2      /* seeker arrows and bolts, mithril shots */
2025
2026 /* The "sval" codes for TV_BOW (note information in "sval") */
2027 #define SV_SLING                         2      /* (x2) */
2028 #define SV_SHORT_BOW                    12      /* (x2) */
2029 #define SV_LONG_BOW                     13      /* (x3) */
2030 #define SV_LIGHT_XBOW                   23      /* (x3) */
2031 #define SV_HEAVY_XBOW                   24      /* (x4) */
2032 #define SV_CRIMSON                      50      /* (x0) */
2033 #define SV_NAMAKE_BOW                   63      /* (x3) */
2034
2035 /* The "sval" codes for TV_DIGGING */
2036 #define SV_SHOVEL                        1
2037 #define SV_GNOMISH_SHOVEL                2
2038 #define SV_DWARVEN_SHOVEL                3
2039 #define SV_PICK                          4
2040 #define SV_ORCISH_PICK                   5
2041 #define SV_DWARVEN_PICK                  6
2042 #define SV_MATTOCK                       7
2043
2044 /* The "sval" values for TV_HAFTED */
2045 #define SV_CLUB                          1      /* 1d4  */
2046 #define SV_WHIP                          2      /* 1d6  */
2047 #define SV_QUARTERSTAFF                  3      /* 1d9  */
2048 #define SV_NUNCHAKU                      4      /* 2d3  */
2049 #define SV_MACE                          5      /* 2d4  */
2050 #define SV_BALL_AND_CHAIN                6      /* 2d4  */
2051 #define SV_JO_STAFF                      7      /* 1d7  */
2052 #define SV_WAR_HAMMER                    8      /* 3d3  */
2053 #define SV_THREE_PIECE_ROD              11      /* 3d3  */
2054 #define SV_MORNING_STAR                 12      /* 2d6  */
2055 #define SV_FLAIL                        13      /* 2d6  */
2056 #define SV_BO_STAFF                     14      /* 1d11 */
2057 #define SV_LEAD_FILLED_MACE             15      /* 3d4  */
2058 #define SV_TETSUBO                      16      /* 2d7  */
2059 #define SV_TWO_HANDED_FLAIL             18      /* 3d6  */
2060 #define SV_GREAT_HAMMER                 19      /* 4d6  */
2061 #define SV_MACE_OF_DISRUPTION           20      /* 5d8  */
2062 #define SV_WIZSTAFF                     21      /* 1d2  */
2063 #define SV_GROND                        50      /* 3d9  */
2064 #define SV_NAMAKE_HAMMER                63      /* 1d77 */
2065
2066 /* The "sval" values for TV_POLEARM */
2067 #define SV_HATCHET                       1      /* 1d5 */
2068 #define SV_SPEAR                         2      /* 1d6 */
2069 #define SV_SICKLE                        3      /* 2d3 */
2070 #define SV_AWL_PIKE                      4      /* 1d8 */
2071 #define SV_TRIDENT                       5      /* 1d9 */
2072 #define SV_FAUCHARD                      6  /* 1d10 */
2073 #define SV_BROAD_SPEAR                   7      /* 1d9 */
2074 #define SV_PIKE                          8      /* 2d5 */
2075 #define SV_NAGINATA                      9  /* 2d6 */
2076 #define SV_BEAKED_AXE                   10      /* 2d6 */
2077 #define SV_BROAD_AXE                    11      /* 2d6 */
2078 #define SV_LUCERNE_HAMMER               12      /* 2d5  */
2079 #define SV_GLAIVE                       13      /* 2d6 */
2080 #define SV_LAJATANG                     14      /* 2d7 */
2081 #define SV_HALBERD                      15      /* 3d4 */
2082 #define SV_GUISARME                     16  /* 2d5 */
2083 #define SV_SCYTHE                       17      /* 5d3 */
2084 #define SV_LANCE                        20      /* 2d8 */
2085 #define SV_BATTLE_AXE                   22      /* 2d8 */
2086 #define SV_GREAT_AXE                    25      /* 4d4 */
2087 #define SV_TRIFURCATE_SPEAR             26      /* 2d9 */
2088 #define SV_LOCHABER_AXE                 28      /* 3d8 */
2089 #define SV_HEAVY_LANCE                  29  /* 4d8 */
2090 #define SV_SCYTHE_OF_SLICING            30      /* 8d4 */
2091 #define SV_TSURIZAO                     40      /* 1d1 */
2092 #define SV_DEATH_SCYTHE                 50      /* 10d10 */
2093
2094 /* The "sval" codes for TV_SWORD */
2095 #define SV_BROKEN_DAGGER                 1  /* 1d1 */
2096 #define SV_BROKEN_SWORD                  2  /* 1d2 */
2097 #define SV_DAGGER                        4  /* 1d4 */
2098 #define SV_MAIN_GAUCHE                   5  /* 1d5 */
2099 #define SV_TANTO                         6  /* 1d5 */
2100 #define SV_RAPIER                        7  /* 1d6 */
2101 #define SV_SMALL_SWORD                   8  /* 1d6 */
2102 #define SV_BASILLARD                     9  /* 1d8 */
2103 #define SV_SHORT_SWORD                  10  /* 1d7 */
2104 #define SV_SABRE                        11  /* 1d7 */
2105 #define SV_CUTLASS                      12  /* 1d7 */
2106 #define SV_WAKIZASHI                    13  /* 2d4 */
2107 #define SV_KHOPESH                      14  /* 2d4 */
2108 #define SV_TULWAR                       15  /* 2d4 */
2109 #define SV_BROAD_SWORD                  16  /* 2d5 */
2110 #define SV_LONG_SWORD                   17  /* 2d5 */
2111 #define SV_SCIMITAR                     18  /* 2d5 */
2112 #define SV_NINJATO                      19  /* 1d9 */
2113 #define SV_KATANA                       20  /* 3d4 */
2114 #define SV_BASTARD_SWORD                21  /* 3d4 */
2115 #define SV_GREAT_SCIMITAR               22  /* 4d5 */
2116 #define SV_CLAYMORE                     23  /* 2d8 */
2117 #define SV_ESPADON                      24  /* 2d9 */
2118 #define SV_TWO_HANDED_SWORD             25  /* 3d6 */
2119 #define SV_FLAMBERGE                    26  /* 3d7 */
2120 #define SV_NO_DACHI                     27  /* 5d4 */
2121 #define SV_EXECUTIONERS_SWORD           28  /* 4d5 */
2122 #define SV_ZWEIHANDER                   29  /* 4d6 */
2123 #define SV_BLADE_OF_CHAOS               30  /* 6d5 */
2124 #define SV_DIAMOND_EDGE                 31  /* 7d5 */
2125 #define SV_DOKUBARI                     32  /* 1d1 */
2126 #define SV_HAYABUSA                     33  /* 1d6 */
2127
2128 /* The "sval" codes for TV_SHIELD */
2129 #define SV_SMALL_LEATHER_SHIELD          2
2130 #define SV_SMALL_METAL_SHIELD            3
2131 #define SV_LARGE_LEATHER_SHIELD          4
2132 #define SV_LARGE_METAL_SHIELD            5
2133 #define SV_DRAGON_SHIELD                 6
2134 #define SV_KNIGHT_SHIELD                 7
2135 #define SV_MIRROR_SHIELD                10
2136 #define SV_YATA_MIRROR                  50
2137
2138 /* The "sval" codes for TV_HELM */
2139 #define SV_HARD_LEATHER_CAP              2
2140 #define SV_METAL_CAP                     3
2141 #define SV_JINGASA                       4  /* 4 */
2142 #define SV_IRON_HELM                     5
2143 #define SV_STEEL_HELM                    6
2144 #define SV_DRAGON_HELM                   7
2145 #define SV_KABUTO                        8  /* 7 */
2146
2147 /* The "sval" codes for TV_CROWN */
2148 #define SV_IRON_CROWN                   10
2149 #define SV_GOLDEN_CROWN                 11
2150 #define SV_JEWELED_CROWN                12
2151 #define SV_CHAOS                        50
2152
2153 /* The "sval" codes for TV_BOOTS */
2154 #define SV_PAIR_OF_SOFT_LEATHER_BOOTS    2
2155 #define SV_PAIR_OF_HARD_LEATHER_BOOTS    3
2156 #define SV_PAIR_OF_DRAGON_GREAVE         4
2157 #define SV_PAIR_OF_METAL_SHOD_BOOTS      6
2158
2159 /* The "sval" codes for TV_CLOAK */
2160 #define SV_CLOAK                         1
2161 #define SV_ELVEN_CLOAK                   2
2162 #define SV_FUR_CLOAK                     3
2163 #define SV_ETHEREAL_CLOAK                5
2164 #define SV_SHADOW_CLOAK                  6
2165
2166 /* The "sval" codes for TV_GLOVES */
2167 #define SV_SET_OF_LEATHER_GLOVES         1
2168 #define SV_SET_OF_GAUNTLETS              2
2169 #define SV_SET_OF_DRAGON_GLOVES          3
2170 #define SV_SET_OF_CESTI                  5
2171
2172 /* The "sval" codes for TV_SOFT_ARMOR */
2173 #define SV_T_SHIRT                       0
2174 #define SV_FILTHY_RAG                    1
2175 #define SV_ROBE                          2
2176 #define SV_PAPER_ARMOR                   3  /* 4 */
2177 #define SV_SOFT_LEATHER_ARMOR            4
2178 #define SV_SOFT_STUDDED_LEATHER          5
2179 #define SV_HARD_LEATHER_ARMOR            6
2180 #define SV_HARD_STUDDED_LEATHER          7
2181 #define SV_RHINO_HIDE_ARMOR              8
2182 #define SV_CORD_ARMOR                    9  /*  6 */
2183 #define SV_PADDED_ARMOR                 10  /*  4 */
2184 #define SV_LEATHER_SCALE_MAIL           11
2185 #define SV_LEATHER_JACK                 12
2186 #define SV_KUROSHOUZOKU                 13
2187 #define SV_STONE_AND_HIDE_ARMOR         15  /* 15 */
2188 #define SV_ABUNAI_MIZUGI                50
2189 #define SV_YOIYAMI_ROBE                 60
2190 #define SV_NAMAKE_ARMOR                 63
2191
2192 /* The "sval" codes for TV_HARD_ARMOR */
2193 #define SV_RUSTY_CHAIN_MAIL              1  /* 14- */
2194 #define SV_RING_MAIL                     2  /* 12  */
2195 #define SV_METAL_SCALE_MAIL              3  /* 13  */
2196 #define SV_CHAIN_MAIL                    4  /* 14  */
2197 #define SV_DOUBLE_RING_MAIL              5  /* 15  */
2198 #define SV_AUGMENTED_CHAIN_MAIL          6  /* 16  */
2199 #define SV_DOUBLE_CHAIN_MAIL             7  /* 16  */
2200 #define SV_BAR_CHAIN_MAIL                8  /* 18  */
2201 #define SV_METAL_BRIGANDINE_ARMOUR       9  /* 19  */
2202 #define SV_SPLINT_MAIL                  10  /* 19  */
2203 #define SV_DO_MARU                      11  /* 20  */
2204 #define SV_PARTIAL_PLATE_ARMOUR         12  /* 22  */
2205 #define SV_METAL_LAMELLAR_ARMOUR        13  /* 23  */
2206 #define SV_HARAMAKIDO                   14  /* 17  */
2207 #define SV_FULL_PLATE_ARMOUR            15  /* 25  */
2208 #define SV_O_YOROI                      16  /* 24  */
2209 #define SV_RIBBED_PLATE_ARMOUR          18  /* 28  */
2210 #define SV_MITHRIL_CHAIN_MAIL           20  /* 28+ */
2211 #define SV_MITHRIL_PLATE_MAIL           25  /* 35+ */
2212 #define SV_ADAMANTITE_PLATE_MAIL        30  /* 40+ */
2213
2214 /* The "sval" codes for TV_DRAG_ARMOR */
2215 #define SV_DRAGON_BLACK                  1
2216 #define SV_DRAGON_BLUE                   2
2217 #define SV_DRAGON_WHITE                  3
2218 #define SV_DRAGON_RED                    4
2219 #define SV_DRAGON_GREEN                  5
2220 #define SV_DRAGON_MULTIHUED              6
2221 #define SV_DRAGON_SHINING               10
2222 #define SV_DRAGON_LAW                   12
2223 #define SV_DRAGON_BRONZE                14
2224 #define SV_DRAGON_GOLD                  16
2225 #define SV_DRAGON_CHAOS                 18
2226 #define SV_DRAGON_BALANCE               20
2227 #define SV_DRAGON_POWER                 30
2228
2229 /* The sval codes for TV_LITE */
2230 #define SV_LITE_TORCH                    0
2231 #define SV_LITE_LANTERN                  1
2232 #define SV_LITE_FEANOR                   2
2233 #define SV_LITE_EDISON                   3
2234 #define SV_LITE_GALADRIEL                4
2235 #define SV_LITE_ELENDIL                  5
2236 #define SV_LITE_JUDGE                    6
2237 #define SV_LITE_LORE                     7
2238 #define SV_LITE_PALANTIR                 8
2239 #define SV_LITE_FLY_STONE                9
2240
2241 /* The "sval" codes for TV_AMULET */
2242 #define SV_AMULET_DOOM                   0
2243 #define SV_AMULET_TELEPORT               1
2244 #define SV_AMULET_ADORNMENT              2
2245 #define SV_AMULET_SLOW_DIGEST            3
2246 #define SV_AMULET_RESIST_ACID            4
2247 #define SV_AMULET_SEARCHING              5
2248 #define SV_AMULET_BRILLIANCE             6
2249 #define SV_AMULET_CHARISMA               7
2250 #define SV_AMULET_THE_MAGI               8
2251 #define SV_AMULET_REFLECTION             9
2252 #define SV_AMULET_CARLAMMAS             10
2253 #define SV_AMULET_INGWE                 11
2254 #define SV_AMULET_DWARVES               12
2255 #define SV_AMULET_NO_MAGIC              13
2256 #define SV_AMULET_NO_TELE               14
2257 #define SV_AMULET_RESISTANCE            15
2258 #define SV_AMULET_TELEPATHY             16
2259 #define SV_AMULET_FARAMIR               17
2260 #define SV_AMULET_BOROMIR               18
2261 #define SV_AMULET_MAGATAMA              19
2262 #define SV_AMULET_INROU                 20
2263 #define SV_AMULET_INTELLIGENCE          21
2264 #define SV_AMULET_WISDOM                22
2265 #define SV_AMULET_MAGIC_MASTERY         23
2266 #define SV_AMULET_NIGHT                 24
2267
2268 /* The sval codes for TV_RING */
2269 #define SV_RING_WOE                      0
2270 #define SV_RING_AGGRAVATION              1
2271 #define SV_RING_WEAKNESS                 2
2272 #define SV_RING_STUPIDITY                3
2273 #define SV_RING_TELEPORTATION            4
2274 #define SV_RING_SLOW_DIGESTION           6
2275 #define SV_RING_LEVITATION_FALL             7
2276 #define SV_RING_RESIST_FIRE              8
2277 #define SV_RING_RESIST_COLD              9
2278 #define SV_RING_SUSTAIN_STR             10
2279 #define SV_RING_SUSTAIN_INT             11
2280 #define SV_RING_SUSTAIN_WIS             12
2281 #define SV_RING_SUSTAIN_CON             13
2282 #define SV_RING_SUSTAIN_DEX             14
2283 #define SV_RING_SUSTAIN_CHR             15
2284 #define SV_RING_PROTECTION              16
2285 #define SV_RING_ACID                    17
2286 #define SV_RING_FLAMES                  18
2287 #define SV_RING_ICE                     19
2288 #define SV_RING_RESIST_POIS             20
2289 #define SV_RING_FREE_ACTION             21
2290 #define SV_RING_SEE_INVIS               22
2291 #define SV_RING_SEARCHING               23
2292 #define SV_RING_STR                     24
2293 #define SV_RING_ELEC                    25
2294 #define SV_RING_DEX                     26
2295 #define SV_RING_CON                     27
2296 #define SV_RING_ACCURACY                28
2297 #define SV_RING_DAMAGE                  29
2298 #define SV_RING_SLAYING                 30
2299 #define SV_RING_SPEED                   31
2300 #define SV_RING_FRAKIR                  32
2301 #define SV_RING_TULKAS                  33
2302 #define SV_RING_NARYA                   34
2303 #define SV_RING_NENYA                   35
2304 #define SV_RING_VILYA                   36
2305 #define SV_RING_POWER                   37
2306 #define SV_RING_RES_FEAR                38
2307 #define SV_RING_RES_LD                  39
2308 #define SV_RING_RES_NETHER              40
2309 #define SV_RING_RES_NEXUS               41
2310 #define SV_RING_RES_SOUND               42
2311 #define SV_RING_RES_CONFUSION           43
2312 #define SV_RING_RES_SHARDS              44
2313 #define SV_RING_RES_DISENCHANT          45
2314 #define SV_RING_RES_CHAOS               46
2315 #define SV_RING_RES_BLINDNESS           47
2316 #define SV_RING_LORDLY                  48
2317 #define SV_RING_ATTACKS                 49
2318 #define SV_RING_AHO                     50
2319 #define SV_RING_SHOTS                   51
2320 #define SV_RING_SUSTAIN                 52
2321 #define SV_RING_DEC_MANA                53
2322 #define SV_RING_WARNING                 54
2323 #define SV_RING_MUSCLE                  55
2324
2325 #define SV_EXPRESS_CARD                  0
2326
2327 /* The "sval" codes for TV_STAFF */
2328 #define SV_STAFF_DARKNESS                0
2329 #define SV_STAFF_SLOWNESS                1
2330 #define SV_STAFF_HASTE_MONSTERS          2
2331 #define SV_STAFF_SUMMONING               3
2332 #define SV_STAFF_TELEPORTATION           4
2333 #define SV_STAFF_IDENTIFY                5
2334 #define SV_STAFF_REMOVE_CURSE            6
2335 #define SV_STAFF_STARLITE                7
2336 #define SV_STAFF_LITE                    8
2337 #define SV_STAFF_MAPPING                 9
2338 #define SV_STAFF_DETECT_GOLD            10
2339 #define SV_STAFF_DETECT_ITEM            11
2340 #define SV_STAFF_DETECT_TRAP            12
2341 #define SV_STAFF_DETECT_DOOR            13
2342 #define SV_STAFF_DETECT_INVIS           14
2343 #define SV_STAFF_DETECT_EVIL            15
2344 #define SV_STAFF_CURE_LIGHT             16
2345 #define SV_STAFF_CURING                 17
2346 #define SV_STAFF_HEALING                18
2347 #define SV_STAFF_THE_MAGI               19
2348 #define SV_STAFF_SLEEP_MONSTERS         20
2349 #define SV_STAFF_SLOW_MONSTERS          21
2350 #define SV_STAFF_SPEED                  22
2351 #define SV_STAFF_PROBING                23
2352 #define SV_STAFF_DISPEL_EVIL            24
2353 #define SV_STAFF_POWER                  25
2354 #define SV_STAFF_HOLINESS               26
2355 #define SV_STAFF_GENOCIDE               27
2356 #define SV_STAFF_EARTHQUAKES            28
2357 #define SV_STAFF_DESTRUCTION            29
2358 #define SV_STAFF_ANIMATE_DEAD           30
2359 #define SV_STAFF_MSTORM                 31
2360 #define SV_STAFF_NOTHING                32
2361
2362
2363 /* The "sval" codes for TV_WAND */
2364 #define SV_WAND_HEAL_MONSTER             0
2365 #define SV_WAND_HASTE_MONSTER            1
2366 #define SV_WAND_CLONE_MONSTER            2
2367 #define SV_WAND_TELEPORT_AWAY            3
2368 #define SV_WAND_DISARMING                4
2369 #define SV_WAND_TRAP_DOOR_DEST           5
2370 #define SV_WAND_STONE_TO_MUD             6
2371 #define SV_WAND_LITE                     7
2372 #define SV_WAND_SLEEP_MONSTER            8
2373 #define SV_WAND_SLOW_MONSTER             9
2374 #define SV_WAND_CONFUSE_MONSTER         10
2375 #define SV_WAND_FEAR_MONSTER            11
2376 #define SV_WAND_DRAIN_LIFE              12
2377 #define SV_WAND_POLYMORPH               13
2378 #define SV_WAND_STINKING_CLOUD          14
2379 #define SV_WAND_MAGIC_MISSILE           15
2380 #define SV_WAND_ACID_BOLT               16
2381 #define SV_WAND_CHARM_MONSTER           17
2382 #define SV_WAND_FIRE_BOLT               18
2383 #define SV_WAND_COLD_BOLT               19
2384 #define SV_WAND_ACID_BALL               20
2385 #define SV_WAND_ELEC_BALL               21
2386 #define SV_WAND_FIRE_BALL               22
2387 #define SV_WAND_COLD_BALL               23
2388 #define SV_WAND_WONDER                  24
2389 #define SV_WAND_DISINTEGRATE            25
2390 #define SV_WAND_DRAGON_FIRE             26
2391 #define SV_WAND_DRAGON_COLD             27
2392 #define SV_WAND_DRAGON_BREATH           28
2393 #define SV_WAND_ROCKETS                 29
2394 #define SV_WAND_STRIKING                30
2395 #define SV_WAND_GENOCIDE                31
2396
2397 /* The "sval" codes for TV_ROD */
2398 #define SV_ROD_DETECT_TRAP               0
2399 #define SV_ROD_DETECT_DOOR               1
2400 #define SV_ROD_IDENTIFY                  2
2401 #define SV_ROD_RECALL                    3
2402 #define SV_ROD_ILLUMINATION              4
2403 #define SV_ROD_MAPPING                   5
2404 #define SV_ROD_DETECTION                 6
2405 #define SV_ROD_PROBING                   7
2406 #define SV_ROD_CURING                    8
2407 #define SV_ROD_HEALING                   9
2408 #define SV_ROD_RESTORATION              10
2409 #define SV_ROD_SPEED                    11
2410 #define SV_ROD_PESTICIDE                12
2411 #define SV_ROD_TELEPORT_AWAY            13
2412 #define SV_ROD_DISARMING                14
2413 #define SV_ROD_LITE                     15
2414 #define SV_ROD_SLEEP_MONSTER            16
2415 #define SV_ROD_SLOW_MONSTER             17
2416 #define SV_ROD_DRAIN_LIFE               18
2417 #define SV_ROD_POLYMORPH                19
2418 #define SV_ROD_ACID_BOLT                20
2419 #define SV_ROD_ELEC_BOLT                21
2420 #define SV_ROD_FIRE_BOLT                22
2421 #define SV_ROD_COLD_BOLT                23
2422 #define SV_ROD_ACID_BALL                24
2423 #define SV_ROD_ELEC_BALL                25
2424 #define SV_ROD_FIRE_BALL                26
2425 #define SV_ROD_COLD_BALL                27
2426 #define SV_ROD_HAVOC                    28
2427 #define SV_ROD_STONE_TO_MUD             29
2428 #define SV_ROD_AGGRAVATE                30
2429
2430
2431 /* The "sval" codes for TV_SCROLL */
2432
2433 #define SV_SCROLL_DARKNESS               0
2434 #define SV_SCROLL_AGGRAVATE_MONSTER      1
2435 #define SV_SCROLL_CURSE_ARMOR            2
2436 #define SV_SCROLL_CURSE_WEAPON           3
2437 #define SV_SCROLL_SUMMON_MONSTER         4
2438 #define SV_SCROLL_SUMMON_UNDEAD          5
2439 #define SV_SCROLL_SUMMON_PET             6
2440 #define SV_SCROLL_TRAP_CREATION          7
2441 #define SV_SCROLL_PHASE_DOOR             8
2442 #define SV_SCROLL_TELEPORT               9
2443 #define SV_SCROLL_TELEPORT_LEVEL        10
2444 #define SV_SCROLL_WORD_OF_RECALL        11
2445 #define SV_SCROLL_IDENTIFY              12
2446 #define SV_SCROLL_STAR_IDENTIFY         13
2447 #define SV_SCROLL_REMOVE_CURSE          14
2448 #define SV_SCROLL_STAR_REMOVE_CURSE     15
2449 #define SV_SCROLL_ENCHANT_ARMOR         16
2450 #define SV_SCROLL_ENCHANT_WEAPON_TO_HIT 17
2451 #define SV_SCROLL_ENCHANT_WEAPON_TO_DAM 18
2452 /* xxx enchant missile? */
2453 #define SV_SCROLL_STAR_ENCHANT_ARMOR    20
2454 #define SV_SCROLL_STAR_ENCHANT_WEAPON   21
2455 #define SV_SCROLL_RECHARGING            22
2456 #define SV_SCROLL_MUNDANITY             23
2457 #define SV_SCROLL_LIGHT                 24
2458 #define SV_SCROLL_MAPPING               25
2459 #define SV_SCROLL_DETECT_GOLD           26
2460 #define SV_SCROLL_DETECT_ITEM           27
2461 #define SV_SCROLL_DETECT_TRAP           28
2462 #define SV_SCROLL_DETECT_DOOR           29
2463 #define SV_SCROLL_DETECT_INVIS          30
2464 /* xxx (detect evil?) */
2465 #define SV_SCROLL_SATISFY_HUNGER        32
2466 #define SV_SCROLL_BLESSING              33
2467 #define SV_SCROLL_HOLY_CHANT            34
2468 #define SV_SCROLL_HOLY_PRAYER           35
2469 #define SV_SCROLL_MONSTER_CONFUSION     36
2470 #define SV_SCROLL_PROTECTION_FROM_EVIL  37
2471 #define SV_SCROLL_RUNE_OF_PROTECTION    38
2472 #define SV_SCROLL_TRAP_DOOR_DESTRUCTION 39
2473 /* xxx */
2474 #define SV_SCROLL_STAR_DESTRUCTION      41
2475 #define SV_SCROLL_DISPEL_UNDEAD         42
2476 #define SV_SCROLL_SPELL                 43
2477 #define SV_SCROLL_GENOCIDE              44
2478 #define SV_SCROLL_MASS_GENOCIDE         45
2479 #define SV_SCROLL_ACQUIREMENT           46
2480 #define SV_SCROLL_STAR_ACQUIREMENT      47
2481 #define SV_SCROLL_FIRE                  48
2482 #define SV_SCROLL_ICE                   49
2483 #define SV_SCROLL_CHAOS                 50
2484 #define SV_SCROLL_RUMOR                 51
2485 #define SV_SCROLL_ARTIFACT              52
2486 #define SV_SCROLL_RESET_RECALL          53
2487 #define SV_SCROLL_SUMMON_KIN            54
2488 #define SV_SCROLL_AMUSEMENT             55
2489 #define SV_SCROLL_STAR_AMUSEMENT        56
2490
2491 /* The "sval" codes for TV_POTION */
2492 #define SV_POTION_WATER                  0
2493 #define SV_POTION_APPLE_JUICE            1
2494 #define SV_POTION_SLIME_MOLD             2
2495 /* xxx (fixed color) */
2496 #define SV_POTION_SLOWNESS               4
2497 #define SV_POTION_SALT_WATER             5
2498 #define SV_POTION_POISON                 6
2499 #define SV_POTION_BLINDNESS              7
2500 /* xxx */
2501 #define SV_POTION_CONFUSION              9
2502 /* xxx */
2503 #define SV_POTION_SLEEP                 11
2504 /* xxx */
2505 #define SV_POTION_LOSE_MEMORIES         13
2506 /* xxx */
2507 #define SV_POTION_RUINATION             15
2508 #define SV_POTION_DEC_STR               16
2509 #define SV_POTION_DEC_INT               17
2510 #define SV_POTION_DEC_WIS               18
2511 #define SV_POTION_DEC_DEX               19
2512 #define SV_POTION_DEC_CON               20
2513 #define SV_POTION_DEC_CHR               21
2514 #define SV_POTION_DETONATIONS           22
2515 #define SV_POTION_DEATH                 23
2516 #define SV_POTION_INFRAVISION           24
2517 #define SV_POTION_DETECT_INVIS          25
2518 #define SV_POTION_SLOW_POISON           26
2519 #define SV_POTION_CURE_POISON           27
2520 #define SV_POTION_BOLDNESS              28
2521 #define SV_POTION_SPEED                 29
2522 #define SV_POTION_RESIST_HEAT           30
2523 #define SV_POTION_RESIST_COLD           31
2524 #define SV_POTION_HEROISM               32
2525 #define SV_POTION_BESERK_STRENGTH       33
2526 #define SV_POTION_CURE_LIGHT            34
2527 #define SV_POTION_CURE_SERIOUS          35
2528 #define SV_POTION_CURE_CRITICAL         36
2529 #define SV_POTION_HEALING               37
2530 #define SV_POTION_STAR_HEALING          38
2531 #define SV_POTION_LIFE                  39
2532 #define SV_POTION_RESTORE_MANA          40
2533 #define SV_POTION_RESTORE_EXP           41
2534 #define SV_POTION_RES_STR               42
2535 #define SV_POTION_RES_INT               43
2536 #define SV_POTION_RES_WIS               44
2537 #define SV_POTION_RES_DEX               45
2538 #define SV_POTION_RES_CON               46
2539 #define SV_POTION_RES_CHR               47
2540 #define SV_POTION_INC_STR               48
2541 #define SV_POTION_INC_INT               49
2542 #define SV_POTION_INC_WIS               50
2543 #define SV_POTION_INC_DEX               51
2544 #define SV_POTION_INC_CON               52
2545 #define SV_POTION_INC_CHR               53
2546 /* xxx */
2547 #define SV_POTION_AUGMENTATION          55
2548 #define SV_POTION_ENLIGHTENMENT         56
2549 #define SV_POTION_STAR_ENLIGHTENMENT    57
2550 #define SV_POTION_SELF_KNOWLEDGE        58
2551 #define SV_POTION_EXPERIENCE            59
2552 #define SV_POTION_RESISTANCE            60
2553 #define SV_POTION_CURING                61
2554 #define SV_POTION_INVULNERABILITY       62
2555 #define SV_POTION_NEW_LIFE              63
2556 #define SV_POTION_NEO_TSUYOSHI          64
2557 #define SV_POTION_TSUYOSHI              65
2558 #define SV_POTION_POLYMORPH             66
2559
2560 /* The "sval" codes for TV_FLASK */
2561 #define SV_FLASK_OIL                   0
2562
2563 /* The "sval" codes for TV_FOOD */
2564 #define SV_FOOD_POISON                   0
2565 #define SV_FOOD_BLINDNESS                1
2566 #define SV_FOOD_PARANOIA                 2
2567 #define SV_FOOD_CONFUSION                3
2568 #define SV_FOOD_HALLUCINATION            4
2569 #define SV_FOOD_PARALYSIS                5
2570 #define SV_FOOD_WEAKNESS                 6
2571 #define SV_FOOD_SICKNESS                 7
2572 #define SV_FOOD_STUPIDITY                8
2573 #define SV_FOOD_NAIVETY                  9
2574 #define SV_FOOD_UNHEALTH                10
2575 #define SV_FOOD_DISEASE                 11
2576 #define SV_FOOD_CURE_POISON             12
2577 #define SV_FOOD_CURE_BLINDNESS          13
2578 #define SV_FOOD_CURE_PARANOIA           14
2579 #define SV_FOOD_CURE_CONFUSION          15
2580 #define SV_FOOD_CURE_SERIOUS            16
2581 #define SV_FOOD_RESTORE_STR             17
2582 #define SV_FOOD_RESTORE_CON             18
2583 #define SV_FOOD_RESTORING               19
2584 /* many missing mushrooms */
2585 #define SV_FOOD_BISCUIT                 32
2586 #define SV_FOOD_JERKY                   33
2587 #define SV_FOOD_RATION                  35
2588 #define SV_FOOD_SLIME_MOLD              36
2589 #define SV_FOOD_WAYBREAD                37
2590 #define SV_FOOD_PINT_OF_ALE             38
2591 #define SV_FOOD_PINT_OF_WINE            39
2592
2593
2594 /*
2595  * Special "sval" limit -- first "normal" food
2596  */
2597 #define SV_FOOD_MIN_FOOD                32
2598
2599 /*
2600  * Special "sval" limit -- first "aimed" rod
2601  */
2602 #define SV_ROD_MIN_DIRECTION    12
2603
2604 /*
2605  * Special "sval" limit -- first "large" chest
2606  */
2607 #define SV_CHEST_MIN_LARGE      4
2608 #define SV_CHEST_KANDUME        50
2609
2610 /*
2611  * Special "sval" limit -- first "good" magic/prayer book
2612  */
2613 #define SV_BOOK_MIN_GOOD    2
2614
2615
2616 #define OBJ_GOLD_LIST   480     /* First "gold" entry */
2617 #define MAX_GOLD        18      /* Number of "gold" entries */
2618
2619
2620 /*** General flag values ***/
2621
2622
2623 /*
2624  * Special cave grid flags
2625  */
2626 #define CAVE_MARK       0x0001    /* memorized feature */
2627 #define CAVE_GLOW       0x0002    /* self-illuminating */
2628 #define CAVE_ICKY       0x0004    /* part of a vault */
2629 #define CAVE_ROOM       0x0008    /* part of a room */
2630 #define CAVE_LITE       0x0010    /* lite flag  */
2631 #define CAVE_VIEW       0x0020    /* view flag */
2632 #define CAVE_TEMP       0x0040    /* temp flag */
2633 #define CAVE_XTRA       0x0080    /* misc flag */
2634 #define CAVE_MNLT       0x0100    /* Illuminated by monster */
2635 #define CAVE_MNDK       0x8000    /* Darken by monster */
2636
2637 /* Used only while cave generation */
2638 #define CAVE_FLOOR      0x0200
2639 #define CAVE_EXTRA      0x0400
2640 #define CAVE_INNER      0x0800
2641 #define CAVE_OUTER      0x1000
2642 #define CAVE_SOLID      0x2000
2643 #define CAVE_VAULT      0x4000
2644 #define CAVE_MASK (CAVE_FLOOR | CAVE_EXTRA | CAVE_INNER | CAVE_OUTER | CAVE_SOLID | CAVE_VAULT)
2645
2646 /* Used only after cave generation */
2647 #define CAVE_KNOWN      0x0200    /* Directly viewed or map detected flag */
2648 #define CAVE_NOTE       0x0400    /* Flag for delayed visual update (needs note_spot()) */
2649 #define CAVE_REDRAW     0x0800    /* Flag for delayed visual update (needs lite_spot()) */
2650 #define CAVE_OBJECT     0x1000    /* Mirror, glyph, etc. */
2651 #define CAVE_UNSAFE     0x2000    /* Might have trap */
2652 #define CAVE_IN_DETECT  0x4000    /* trap detected area (inner circle only) */
2653
2654
2655 /*
2656  * Bit flags for the "project()" function
2657  *
2658  *   JUMP: Jump directly to the target location (this is a hack)
2659  *   BEAM: Work as a beam weapon (affect every grid passed through)
2660  *   THRU: Continue "through" the target (used for "bolts"/"beams")
2661  *   STOP: Stop as soon as we hit a monster (used for "bolts")
2662  *   GRID: Affect each grid in the "blast area" in some way
2663  *   ITEM: Affect each object in the "blast area" in some way
2664  *   KILL: Affect each monster in the "blast area" in some way
2665  *   HIDE: Hack -- disable "visual" feedback from projection
2666  *   DISI: Disintegrate non-permanent features
2667  *   PLAYER: Main target is player (used for riding player)
2668  *   AIMED: Target is only player or monster, so don't affect another.
2669  *          Depend on PROJECT_PLAYER.
2670  *          (used for minimum (rad == 0) balls on riding player)
2671  *   REFLECTABLE: Refrectable spell attacks (used for "bolts")
2672  *   NO_HANGEKI: Avoid counter attacks of monsters
2673  *   PATH: Only used for printing project path
2674  *   FAST: Hide "visual" of flying bolts until blast
2675  */
2676 #define PROJECT_JUMP        0x01
2677 #define PROJECT_BEAM        0x02
2678 #define PROJECT_THRU        0x04
2679 #define PROJECT_STOP        0x08
2680 #define PROJECT_GRID        0x10
2681 #define PROJECT_ITEM        0x20
2682 #define PROJECT_KILL        0x40
2683 #define PROJECT_HIDE        0x80
2684 #define PROJECT_DISI        0x100
2685 #define PROJECT_PLAYER      0x200
2686 #define PROJECT_AIMED       0x400
2687 #define PROJECT_REFLECTABLE 0x800
2688 #define PROJECT_NO_HANGEKI  0x1000
2689 #define PROJECT_PATH        0x2000
2690 #define PROJECT_FAST        0x4000
2691 #define PROJECT_LOS         0x8000
2692
2693
2694 /*
2695  * Special caster ID for project()
2696  */
2697 #define PROJECT_WHO_UNCTRL_POWER -1
2698 #define PROJECT_WHO_GLASS_SHARDS -2
2699
2700
2701 /*
2702  * Bit flags for the "enchant()" function
2703  */
2704 #define ENCH_TOHIT      0x01 /* Enchant to hit */
2705 #define ENCH_TODAM      0x02 /* Enchant to damage */
2706 #define ENCH_TOAC       0x04 /* Enchant to AC */
2707 #define ENCH_FORCE      0x08 /* Force enchantment */
2708
2709 /*
2710  * Bit flags for the "target_set" function XXX XXX XXX
2711  *
2712  *      KILL: Target monsters
2713  *      LOOK: Describe grid fully
2714  *      XTRA: Currently unused flag
2715  *      GRID: Select from all grids
2716  */
2717 #define TARGET_KILL             0x01
2718 #define TARGET_LOOK             0x02
2719 #define TARGET_XTRA             0x04
2720 #define TARGET_GRID             0x08
2721
2722
2723 /*
2724  * Bit flags for control of get_check_strict()
2725  */
2726 #define CHECK_OKAY_CANCEL 0x01
2727 #define CHECK_NO_ESCAPE   0x02
2728 #define CHECK_NO_HISTORY  0x04
2729 #define CHECK_DEFAULT_Y   0x08
2730
2731
2732 /*
2733  * Some bit-flags for the "smart" field
2734  */
2735 #define SM_RES_ACID             0x00000001
2736 #define SM_RES_ELEC             0x00000002
2737 #define SM_RES_FIRE             0x00000004
2738 #define SM_RES_COLD             0x00000008
2739 #define SM_RES_POIS             0x00000010
2740 #define SM_RES_NETH             0x00000020
2741 #define SM_RES_LITE             0x00000040
2742 #define SM_RES_DARK             0x00000080
2743 #define SM_RES_FEAR             0x00000100
2744 #define SM_RES_CONF             0x00000200
2745 #define SM_RES_CHAOS            0x00000400
2746 #define SM_RES_DISEN            0x00000800
2747 #define SM_RES_BLIND            0x00001000
2748 #define SM_RES_NEXUS            0x00002000
2749 #define SM_RES_SOUND            0x00004000
2750 #define SM_RES_SHARD            0x00008000
2751 #define SM_OPP_ACID             0x00010000
2752 #define SM_OPP_ELEC             0x00020000
2753 #define SM_OPP_FIRE             0x00040000
2754 #define SM_OPP_COLD             0x00080000
2755 #define SM_OPP_POIS             0x00100000
2756 #define SM_OPP_XXX1             0x00200000 /* (unused) */
2757 #define SM_CLONED               0x00400000 /* XXX Cloned */
2758 #define SM_PET                  0x00800000 /* XXX Pet */
2759 #define SM_IMM_ACID             0x01000000
2760 #define SM_IMM_ELEC             0x02000000
2761 #define SM_IMM_FIRE             0x04000000
2762 #define SM_IMM_COLD             0x08000000
2763 #define SM_FRIENDLY             0x10000000 /* XXX Friendly */
2764 #define SM_IMM_REFLECT          0x20000000
2765 #define SM_IMM_FREE             0x40000000
2766 #define SM_IMM_MANA             0x80000000
2767
2768
2769 /*
2770  * Bit flags for the "get_item" function
2771  */
2772 #define USE_EQUIP       0x01    /* Allow equip items */
2773 #define USE_INVEN       0x02    /* Allow inven items */
2774 #define USE_FLOOR       0x04    /* Allow floor items */
2775
2776
2777 /*
2778  * Bit flags for the "p_ptr->notice" variable
2779  */
2780 #define PN_COMBINE      0x00000001L     /* Combine the pack */
2781 #define PN_REORDER      0x00000002L     /* Reorder the pack */
2782 #define PN_AUTODESTROY  0x00000004L     /* Auto-destroy marked item */
2783 /* xxx (many) */
2784
2785
2786 /*
2787  * Bit flags for the "p_ptr->update" variable
2788  */
2789 #define PU_BONUS        0x00000001L     /* Calculate bonuses */
2790 #define PU_TORCH        0x00000002L     /* Calculate torch radius */
2791 /* xxx (many) */
2792 #define PU_HP           0x00000010L     /* Calculate chp and mhp */
2793 #define PU_MANA         0x00000020L     /* Calculate csp and msp */
2794 #define PU_SPELLS       0x00000040L     /* Calculate spells */
2795 /* xxx (many) */
2796 /* xxx (many) */
2797 #define PU_UN_VIEW      0x00010000L     /* Forget view */
2798 #define PU_UN_LITE      0x00020000L     /* Forget lite */
2799 /* xxx (many) */
2800 #define PU_VIEW         0x00100000L     /* Update view */
2801 #define PU_LITE         0x00200000L     /* Update lite */
2802 #define PU_MON_LITE     0x00400000L     /* Monster illumination */
2803 #define PU_DELAY_VIS    0x00800000L     /* Mega-Hack -- Delayed visual update */
2804 #define PU_MONSTERS     0x01000000L     /* Update monsters */
2805 #define PU_DISTANCE     0x02000000L     /* Update distances */
2806 /* xxx */
2807 #define PU_FLOW         0x10000000L     /* Update flow */
2808 /* xxx (many) */
2809
2810
2811 /*
2812  * Bit flags for the "p_ptr->redraw" variable
2813  */
2814 #define PR_MISC         0x00000001L     /* Display Race/Class */
2815 #define PR_TITLE        0x00000002L     /* Display Title */
2816 #define PR_LEV          0x00000004L     /* Display Level */
2817 #define PR_EXP          0x00000008L     /* Display Experience */
2818 #define PR_STATS        0x00000010L     /* Display Stats */
2819 #define PR_ARMOR        0x00000020L     /* Display Armor */
2820 #define PR_HP           0x00000040L     /* Display Hitpoints */
2821 #define PR_MANA         0x00000080L     /* Display Mana */
2822 #define PR_GOLD         0x00000100L     /* Display Gold */
2823 #define PR_DEPTH        0x00000200L     /* Display Depth */
2824 #define PR_EQUIPPY      0x00000400L     /* Display equippy chars */
2825 #define PR_HEALTH       0x00000800L     /* Display Health Bar */
2826 #define PR_CUT          0x00001000L     /* Display Extra (Cut) */
2827 #define PR_STUN         0x00002000L     /* Display Extra (Stun) */
2828 #define PR_HUNGER       0x00004000L     /* Display Extra (Hunger) */
2829 #define PR_STATUS       0x00008000L     /* Display Status Bar */
2830 #define PR_XXX0         0x00010000L     /* (unused) */
2831 #define PR_UHEALTH      0x00020000L     /* Display Uma Health Bar */
2832 #define PR_XXX1         0x00040000L     /* (unused) */
2833 #define PR_XXX2         0x00080000L     /* (unused) */
2834 #define PR_STATE        0x00100000L     /* Display Extra (State) */
2835 #define PR_SPEED        0x00200000L     /* Display Extra (Speed) */
2836 #define PR_STUDY        0x00400000L     /* Display Extra (Study) */
2837 #define PR_IMITATION    0x00800000L     /* Display Extra (Imitation) */
2838 #define PR_EXTRA        0x01000000L     /* Display Extra Info */
2839 #define PR_BASIC        0x02000000L     /* Display Basic Info */
2840 #define PR_MAP          0x04000000L     /* Display Map */
2841 #define PR_WIPE         0x08000000L     /* Hack -- Total Redraw */
2842 /* xxx */
2843 /* xxx */
2844 /* xxx */
2845 /* xxx */
2846
2847 /*
2848  * Bit flags for the "p_ptr->window" variable (etc)
2849  */
2850 #define PW_INVEN        0x00000001L     /* Display inven/equip */
2851 #define PW_EQUIP        0x00000002L     /* Display equip/inven */
2852 #define PW_SPELL        0x00000004L     /* Display spell list */
2853 #define PW_PLAYER       0x00000008L     /* Display character */
2854 #define PW_MONSTER_LIST 0x00000010L     /* Display monster list */
2855 /* xxx */
2856 /* xxx */
2857 #define PW_MESSAGE      0x00000040L     /* Display messages */
2858 #define PW_OVERHEAD     0x00000080L     /* Display overhead view */
2859 #define PW_MONSTER      0x00000100L     /* Display monster recall */
2860 #define PW_OBJECT       0x00000200L     /* Display object recall */
2861 #define PW_DUNGEON      0x00000400L     /* Display dungeon view */
2862 #define PW_SNAPSHOT     0x00000800L     /* Display snap-shot */
2863 /* xxx */
2864 /* xxx */
2865 #define PW_BORG_1       0x00004000L     /* Display borg messages */
2866 #define PW_BORG_2       0x00008000L     /* Display borg status */
2867
2868 /*
2869  * Bit flags for the place_monster_???() (etc)
2870  */
2871 #define PM_ALLOW_SLEEP    0x00000001
2872 #define PM_ALLOW_GROUP    0x00000002
2873 #define PM_FORCE_FRIENDLY 0x00000004
2874 #define PM_FORCE_PET      0x00000008
2875 #define PM_NO_KAGE        0x00000010
2876 #define PM_NO_PET         0x00000020
2877 #define PM_ALLOW_UNIQUE   0x00000040
2878 #define PM_IGNORE_TERRAIN 0x00000080
2879 #define PM_HASTE          0x00000100
2880 #define PM_KAGE           0x00000200
2881 #define PM_MULTIPLY       0x00000400
2882
2883
2884 /* Bit flags for monster_desc() */
2885 #define MD_OBJECTIVE      0x00000001 /* Objective (or Reflexive) */
2886 #define MD_POSSESSIVE     0x00000002 /* Possessive (or Reflexive) */
2887 #define MD_INDEF_HIDDEN   0x00000004 /* Use indefinites for hidden monsters ("something") */
2888 #define MD_INDEF_VISIBLE  0x00000008 /* Use indefinites for visible monsters ("a kobold") */
2889 #define MD_PRON_HIDDEN    0x00000010 /* Pronominalize hidden monsters */
2890 #define MD_PRON_VISIBLE   0x00000020 /* Pronominalize visible monsters */
2891 #define MD_ASSUME_HIDDEN  0x00000040 /* Assume the monster is hidden */
2892 #define MD_ASSUME_VISIBLE 0x00000080 /* Assume the monster is visible */
2893 #define MD_TRUE_NAME      0x00000100 /* Chameleon's true name */
2894 #define MD_IGNORE_HALLU   0x00000200 /* Ignore hallucination, and penetrate shape change */
2895
2896
2897 /*
2898  * Bit flags for object_desc()
2899  */
2900 #define OD_NAME_ONLY        0x00000001  /* Omit values, pval, inscription */
2901 #define OD_NAME_AND_ENCHANT 0x00000002  /* Omit pval, inscription */
2902 #define OD_OMIT_INSCRIPTION 0x00000004  /* Omit inscription */
2903 #define OD_OMIT_PREFIX      0x00000008  /* Omit numeric prefix */
2904 #define OD_NO_PLURAL        0x00000010  /* Don't use plural */
2905 #define OD_STORE            0x00000020  /* Assume to be aware and known */
2906 #define OD_NO_FLAVOR        0x00000040  /* Allow to hidden flavor */
2907 #define OD_FORCE_FLAVOR     0x00000080  /* Get un-shuffled flavor name */
2908
2909
2910 /*
2911  * Bit flags for the "p_ptr->special_attack" variable. -LM-
2912  *
2913  * Note:  The elemental and poison attacks should be managed using the 
2914  * function "set_ele_attack", in spell2.c.  This provides for timeouts and
2915  * prevents the player from getting more than one at a time.
2916  */
2917 #define ATTACK_CONFUSE          0x00000001
2918 #define ATTACK_XXX1             0x00000002
2919 #define ATTACK_XXX2             0x00000004
2920 #define ATTACK_XXX3             0x00000008
2921 #define ATTACK_ACID             0x00000010
2922 #define ATTACK_ELEC             0x00000020
2923 #define ATTACK_FIRE             0x00000040
2924 #define ATTACK_COLD             0x00000080
2925 #define ATTACK_POIS             0x00000100
2926 #define ATTACK_HOLY             0x00000200
2927 #define ATTACK_SUIKEN           0x00000400
2928
2929
2930 #define DEFENSE_ACID            0x00000001
2931 #define DEFENSE_ELEC            0x00000002
2932 #define DEFENSE_FIRE            0x00000004
2933 #define DEFENSE_COLD            0x00000008
2934 #define DEFENSE_POIS            0x00000010
2935 #define KAMAE_GENBU             0x00000020
2936 #define KAMAE_BYAKKO            0x00000040
2937 #define KAMAE_SEIRYU            0x00000080
2938 #define KAMAE_SUZAKU            0x00000100
2939 #define KATA_IAI                0x00000200
2940 #define KATA_FUUJIN             0x00000400
2941 #define KATA_KOUKIJIN           0x00000800
2942 #define KATA_MUSOU              0x00001000
2943 #define NINJA_KAWARIMI          0x00002000
2944 #define NINJA_S_STEALTH         0x00004000
2945
2946 #define MAX_KAMAE 4
2947 #define KAMAE_MASK (KAMAE_GENBU | KAMAE_BYAKKO | KAMAE_SEIRYU | KAMAE_SUZAKU)
2948
2949 #define MAX_KATA 4
2950 #define KATA_MASK (KATA_IAI | KATA_FUUJIN | KATA_KOUKIJIN | KATA_MUSOU)
2951
2952
2953 #define ACTION_NONE     0
2954 #define ACTION_SEARCH   1
2955 #define ACTION_REST     2
2956 #define ACTION_LEARN    3
2957 #define ACTION_FISH     4
2958 #define ACTION_KAMAE    5
2959 #define ACTION_KATA     6
2960 #define ACTION_SING     7
2961 #define ACTION_HAYAGAKE 8
2962 #define ACTION_SPELL    9
2963
2964
2965 /* Empty hand status */
2966 #define EMPTY_HAND_NONE 0x0000 /* Both hands are used */
2967 #define EMPTY_HAND_LARM 0x0001 /* Left hand is empty */
2968 #define EMPTY_HAND_RARM 0x0002 /* Right hand is empty */
2969
2970 /*** General index values ***/
2971
2972
2973 /*
2974  * Legal restrictions for "summon_specific()"
2975  */
2976 #define SUMMON_ANT                  11
2977 #define SUMMON_SPIDER               12
2978 #define SUMMON_HOUND                13
2979 #define SUMMON_HYDRA                14
2980 #define SUMMON_ANGEL                15
2981 #define SUMMON_DEMON                16
2982 #define SUMMON_UNDEAD               17
2983 #define SUMMON_DRAGON               18
2984 #define SUMMON_HI_UNDEAD            21
2985 #define SUMMON_HI_DRAGON            22
2986 #define SUMMON_HI_DEMON             23
2987 #define SUMMON_AMBERITES            31
2988 #define SUMMON_UNIQUE               32
2989 #define SUMMON_BIZARRE1             33
2990 #define SUMMON_BIZARRE2             34
2991 #define SUMMON_BIZARRE3             35
2992 #define SUMMON_BIZARRE4             36
2993 #define SUMMON_BIZARRE5             37
2994 #define SUMMON_BIZARRE6             38
2995 #define SUMMON_CYBER                39
2996 #define SUMMON_KIN                  40
2997 #define SUMMON_DAWN                 41
2998 #define SUMMON_ANIMAL               42
2999 #define SUMMON_ANIMAL_RANGER        43
3000 /*#define SUMMON_HI_UNDEAD_NO_UNIQUES 44*/
3001 /*#define SUMMON_HI_DRAGON_NO_UNIQUES 45*/
3002 /*#define SUMMON_NO_UNIQUES           46*/
3003 #define SUMMON_PHANTOM              47
3004 /*#define SUMMON_ELEMENTAL_NO_UNIQUES 48*/
3005 #define SUMMON_BLUE_HORROR          49
3006 #define SUMMON_LIVING               50
3007 #define SUMMON_HI_DRAGON_LIVING     51
3008 #define SUMMON_GOLEM                52
3009 #define SUMMON_ELEMENTAL            53
3010 #define SUMMON_VORTEX               54
3011 #define SUMMON_HYBRID               55
3012 #define SUMMON_BIRD                 56
3013 /*#define SUMMON_AQUATIC_NO_UNIQUES   57*/
3014 #define SUMMON_KAMIKAZE             58
3015 #define SUMMON_KAMIKAZE_LIVING      59
3016 #define SUMMON_MANES                60
3017 #define SUMMON_LOUSE                61
3018 #define SUMMON_GUARDIANS            62
3019 #define SUMMON_KNIGHTS              63
3020 #define SUMMON_EAGLES               64
3021 #define SUMMON_PIRANHAS             65
3022 #define SUMMON_ARMAGE_GOOD          66
3023 #define SUMMON_ARMAGE_EVIL          67
3024
3025
3026 /*
3027  * Spell types used by project(), and related functions.
3028  */
3029 #define GF_ELEC         1
3030 #define GF_POIS         2
3031 #define GF_ACID         3
3032 #define GF_COLD         4
3033 #define GF_FIRE         5
3034 #define GF_PSY_SPEAR    9
3035 #define GF_MISSILE      10
3036 #define GF_ARROW        11
3037 #define GF_PLASMA       12
3038 /* Replaced with GF_HOLY_FIRE and GF_HELL_FIRE */
3039 /* #define GF_HOLY_ORB     13 */
3040 #define GF_WATER        14
3041 #define GF_LITE         15
3042 #define GF_DARK         16
3043 #define GF_LITE_WEAK    17
3044 #define GF_DARK_WEAK    18
3045 #define GF_SHARDS       20
3046 #define GF_SOUND        21
3047 #define GF_CONFUSION    22
3048 #define GF_FORCE        23
3049 #define GF_INERTIA      24
3050 #define GF_MANA         26
3051 #define GF_METEOR       27
3052 #define GF_ICE          28
3053 #define GF_CHAOS        30
3054 #define GF_NETHER       31
3055 #define GF_DISENCHANT   32
3056 #define GF_NEXUS        33
3057 #define GF_TIME         34
3058 #define GF_GRAVITY      35
3059 #define GF_KILL_WALL    40
3060 #define GF_KILL_DOOR    41
3061 #define GF_KILL_TRAP    42
3062 #define GF_MAKE_WALL    45
3063 #define GF_MAKE_DOOR    46
3064 #define GF_MAKE_TRAP    47
3065 #define GF_MAKE_TREE    48
3066 #define GF_OLD_CLONE    51
3067 #define GF_OLD_POLY             52
3068 #define GF_OLD_HEAL             53
3069 #define GF_OLD_SPEED    54
3070 #define GF_OLD_SLOW             55
3071 #define GF_OLD_CONF             56
3072 #define GF_OLD_SLEEP    57
3073 #define GF_OLD_DRAIN    58
3074 #define GF_AWAY_UNDEAD  61
3075 #define GF_AWAY_EVIL    62
3076 #define GF_AWAY_ALL     63
3077 #define GF_TURN_UNDEAD  64
3078 #define GF_TURN_EVIL    65
3079 #define GF_TURN_ALL     66
3080 #define GF_DISP_UNDEAD  67
3081 #define GF_DISP_EVIL    68
3082 #define GF_DISP_ALL 69
3083 #define GF_DISP_DEMON   70      /* New types for Zangband begin here... */
3084 #define GF_DISP_LIVING  71
3085 #define GF_ROCKET       72
3086 #define GF_NUKE         73
3087 #define GF_MAKE_GLYPH   74
3088 #define GF_STASIS       75
3089 #define GF_STONE_WALL   76
3090 #define GF_DEATH_RAY    77
3091 #define GF_STUN         78
3092 #define GF_HOLY_FIRE    79
3093 #define GF_HELL_FIRE    80
3094 #define GF_DISINTEGRATE 81
3095 #define GF_CHARM        82
3096 #define GF_CONTROL_UNDEAD   83
3097 #define GF_CONTROL_ANIMAL   84
3098 #define GF_PSI         85
3099 #define GF_PSI_DRAIN   86
3100 #define GF_TELEKINESIS  87
3101 #define GF_JAM_DOOR     88
3102 #define GF_DOMINATION   89
3103 #define GF_DISP_GOOD    90
3104 #define GF_DRAIN_MANA   91
3105 #define GF_MIND_BLAST   92
3106 #define GF_BRAIN_SMASH  93
3107 #define GF_CAUSE_1      94
3108 #define GF_CAUSE_2      95
3109 #define GF_CAUSE_3      96
3110 #define GF_CAUSE_4      97
3111 #define GF_HAND_DOOM    98
3112 #define GF_CAPTURE      99
3113 #define GF_ANIM_DEAD   100
3114 #define GF_CONTROL_LIVING   101
3115 #define GF_IDENTIFY    102
3116 #define GF_ATTACK      103
3117 #define GF_ENGETSU     104
3118 #define GF_GENOCIDE    105
3119 #define GF_PHOTO       106
3120 #define GF_CONTROL_DEMON   107
3121 #define GF_LAVA_FLOW   108
3122 #define GF_BLOOD_CURSE 109
3123 #define GF_SEEKER 110
3124 #define GF_SUPER_RAY 111
3125 #define GF_STAR_HEAL 112
3126 #define GF_WATER_FLOW   113
3127 #define GF_CRUSADE     114
3128 #define GF_STASIS_EVIL 115
3129 #define GF_WOUNDS      116
3130
3131 #define MAX_GF                          117
3132
3133 /*
3134  * Some things which induce learning
3135  */
3136 #define DRS_ACID         1
3137 #define DRS_ELEC         2
3138 #define DRS_FIRE         3
3139 #define DRS_COLD         4
3140 #define DRS_POIS         5
3141 #define DRS_NETH         6
3142 #define DRS_LITE         7
3143 #define DRS_DARK         8
3144 #define DRS_FEAR         9
3145 #define DRS_CONF        10
3146 #define DRS_CHAOS       11
3147 #define DRS_DISEN       12
3148 #define DRS_BLIND       13
3149 #define DRS_NEXUS       14
3150 #define DRS_SOUND       15
3151 #define DRS_SHARD       16
3152 #define DRS_FREE        30
3153 #define DRS_MANA        31
3154 #define DRS_REFLECT     32
3155
3156
3157
3158 #define DAMAGE_FORCE    1
3159 #define DAMAGE_GENO     2
3160 #define DAMAGE_LOSELIFE 3
3161 #define DAMAGE_ATTACK   4
3162 #define DAMAGE_NOESCAPE 5
3163 #define DAMAGE_USELIFE  6
3164
3165
3166 /*
3167  * Game generated inscription indices. These are stored in the object,
3168  * and are used to index the string array from tables.c.
3169  */
3170
3171 #define FEEL_NONE              0
3172 #define FEEL_BROKEN            1
3173 #define FEEL_TERRIBLE          2
3174 #define FEEL_WORTHLESS         3
3175 #define FEEL_CURSED            4
3176 #define FEEL_UNCURSED          5
3177 #define FEEL_AVERAGE           6
3178 #define FEEL_GOOD              7
3179 #define FEEL_EXCELLENT         8
3180 #define FEEL_SPECIAL           9
3181
3182 #define FEEL_MAX               9
3183
3184 /*
3185  * Hack -- special "xtra" object powers
3186  */
3187
3188 /* Sustain one stat */
3189 #define EGO_XTRA_SUSTAIN        1
3190
3191 /* High resist */
3192 #define EGO_XTRA_POWER          2
3193
3194 /* Special ability */
3195 #define EGO_XTRA_ABILITY        3
3196
3197 /*** Object flag values ***/
3198
3199
3200 /*
3201  * Chest trap flags (see "tables.c")
3202  */
3203 #define CHEST_LOSE_STR          0x0001
3204 #define CHEST_LOSE_CON          0x0002
3205 #define CHEST_POISON            0x0004
3206 #define CHEST_PARALYZE          0x0008
3207 #define CHEST_EXPLODE           0x0010
3208 #define CHEST_SUMMON            0x0020
3209 #define CHEST_SCATTER           0x0040
3210 #define CHEST_E_SUMMON          0x0080
3211 #define CHEST_BIRD_STORM        0x0100
3212 #define CHEST_H_SUMMON          0x0200
3213 #define CHEST_RUNES_OF_EVIL     0x0400
3214 #define CHEST_ALARM             0x0800
3215
3216
3217 /*
3218  * Special Object Flags
3219  */
3220 #define IDENT_SENSE     0x01    /* Item has been "sensed" */
3221 #define IDENT_FIXED     0x02    /* Item has been "haggled" */
3222 #define IDENT_EMPTY     0x04    /* Item charges are known */
3223 #define IDENT_KNOWN     0x08    /* Item abilities are known */
3224 #define IDENT_STORE     0x10    /* Item is storebought !!!! */
3225 #define IDENT_MENTAL    0x20    /* Item information is known */
3226 #if 0
3227 #define IDENT_CURSED    0x40    /* Item is temporarily cursed */
3228 #endif
3229 #define IDENT_BROKEN    0x80    /* Item is permanently worthless */
3230
3231
3232 /* 
3233  * How object is marked (flags in object_type.mark)
3234  * OM_FOUND --- original boolean flag
3235  * OM_NOMSG --- temporary flag to suppress messages which were
3236  *              already printed in autopick_pickup_items().
3237  */
3238 #define OM_FOUND        0x01    /* original boolean flag */
3239 #define OM_NOMSG        0x02    /* temporary flag to suppress messages */
3240 #define OM_NO_QUERY     0x04    /* Query for auto-pick was already answered as 'No' */
3241 #define OM_AUTODESTROY  0x08    /* Destroy later to avoid illegal inventry shift */
3242 #define OM_TOUCHED      0x10    /* Object was touched by player */
3243
3244
3245 /*
3246  * Special Monster Flags (all temporary)
3247  */
3248 #define MFLAG_VIEW      0x01    /* Monster is in line of sight */
3249 #define MFLAG_TEMP      0x02    /* Monster is marked for project_hack() */
3250 #define MFLAG_XXX2      0x04    /* (unused) */
3251 #define MFLAG_XXX3      0x08    /* (unused) */
3252 #define MFLAG_BORN      0x10    /* Monster is still being born */
3253 #define MFLAG_NICE      0x20    /* Monster is still being nice */
3254
3255 #define MFLAG2_KAGE      0x01    /* Monster is kage */
3256 #define MFLAG2_NOPET     0x02    /* Cannot make monster pet */
3257 #define MFLAG2_NOGENO    0x04    /* Cannot genocide */
3258 #define MFLAG2_CHAMELEON 0x08    /* Monster is chameleon */
3259 #define MFLAG2_NOFLOW    0x10    /* Monster is in no_flow_by_smell mode */
3260 #define MFLAG2_SHOW      0x20    /* Monster is recently memorized */
3261 #define MFLAG2_MARK      0x40    /* Monster is currently memorized */
3262
3263
3264 /*
3265  * Object flags
3266  *
3267  * Old variables for object flags such as flags1, flags2, and flags3
3268  * are obsolated.  Now single array flgs[TR_FLAG_SIZE] contains all
3269  * object flags.  And each flag is refered by single index number
3270  * instead of a bit mask.
3271  *
3272  * Therefore it's very easy to add a lot of new flags; no one need to
3273  * worry about in which variable a new flag should be put, nor to
3274  * modify a huge number of files all over the source directory at once
3275  * to add new flag variables such as flags4, flags5, etc...
3276  *
3277  * All management of flags is now treated using a set of macros
3278  * instead of bit operations.
3279  * Note: These macros are using division, modulo, and bit shift
3280  * operations, and it seems that these operations are rather slower
3281  * than original bit operation.  But since index numbers are almost
3282  * always given as constant, such slow operations are performed in the
3283  * compile time.  So there is no problem on the speed.
3284  *
3285  * Exceptions of new flag management is a set of flags to control
3286  * object generation and the curse flags.  These are not yet rewritten
3287  * in new index form; maybe these have no merit of rewriting.
3288  */
3289
3290 #define have_flag(ARRAY, INDEX) !!((ARRAY)[(INDEX)/32] & (1L << ((INDEX)%32)))
3291 #define add_flag(ARRAY, INDEX) ((ARRAY)[(INDEX)/32] |= (1L << ((INDEX)%32)))
3292 #define remove_flag(ARRAY, INDEX) ((ARRAY)[(INDEX)/32] &= ~(1L << ((INDEX)%32)))
3293 #define is_pval_flag(INDEX) ((TR_STR <= (INDEX) && (INDEX) <= TR_MAGIC_MASTERY) || (TR_STEALTH <= (INDEX) && (INDEX) <= TR_BLOWS))
3294 #define have_pval_flags(ARRAY) !!((ARRAY)[0] & (0x00003f7f))
3295
3296
3297 #define TR_STR                 0      /* STR += "pval" */
3298 #define TR_INT                 1      /* INT += "pval" */
3299 #define TR_WIS                 2      /* WIS += "pval" */
3300 #define TR_DEX                 3      /* DEX += "pval" */
3301 #define TR_CON                 4      /* CON += "pval" */
3302 #define TR_CHR                 5      /* CHR += "pval" */
3303 #define TR_MAGIC_MASTERY       6      /* Later */
3304 #define TR_FORCE_WEAPON        7      /* Later */
3305 #define TR_STEALTH             8      /* Stealth += "pval" */
3306 #define TR_SEARCH              9      /* Search += "pval" */
3307 #define TR_INFRA               10     /* Infra += "pval" */
3308 #define TR_TUNNEL              11     /* Tunnel += "pval" */
3309 #define TR_SPEED               12     /* Speed += "pval" */
3310 #define TR_BLOWS               13     /* Blows += "pval" */
3311 #define TR_CHAOTIC             14
3312 #define TR_VAMPIRIC            15
3313 #define TR_SLAY_ANIMAL         16
3314 #define TR_SLAY_EVIL           17
3315 #define TR_SLAY_UNDEAD         18
3316 #define TR_SLAY_DEMON          19
3317 #define TR_SLAY_ORC            20
3318 #define TR_SLAY_TROLL          21
3319 #define TR_SLAY_GIANT          22
3320 #define TR_SLAY_DRAGON         23
3321 #define TR_KILL_DRAGON         24     /* Execute Dragon */
3322 #define TR_VORPAL              25     /* Later */
3323 #define TR_IMPACT              26     /* Cause Earthquakes */
3324 #define TR_BRAND_POIS          27
3325 #define TR_BRAND_ACID          28
3326 #define TR_BRAND_ELEC          29
3327 #define TR_BRAND_FIRE          30
3328 #define TR_BRAND_COLD          31
3329
3330 #define TR_SUST_STR            32
3331 #define TR_SUST_INT            33
3332 #define TR_SUST_WIS            34
3333 #define TR_SUST_DEX            35
3334 #define TR_SUST_CON            36
3335 #define TR_SUST_CHR            37
3336 #define TR_RIDING              38
3337 #define TR_EASY_SPELL          39
3338 #define TR_IM_ACID             40
3339 #define TR_IM_ELEC             41
3340 #define TR_IM_FIRE             42
3341 #define TR_IM_COLD             43
3342 #define TR_THROW               44     /* Later */
3343 #define TR_REFLECT             45     /* Reflect 'bolts' */
3344 #define TR_FREE_ACT            46     /* Free Action */
3345 #define TR_HOLD_LIFE           47     /* Hold Life */
3346 #define TR_RES_ACID            48
3347 #define TR_RES_ELEC            49
3348 #define TR_RES_FIRE            50
3349 #define TR_RES_COLD            51
3350 #define TR_RES_POIS            52
3351 #define TR_RES_FEAR            53     /* Added for Zangband */
3352 #define TR_RES_LITE            54
3353 #define TR_RES_DARK            55
3354 #define TR_RES_BLIND           56
3355 #define TR_RES_CONF            57
3356 #define TR_RES_SOUND           58
3357 #define TR_RES_SHARDS          59
3358 #define TR_RES_NETHER          60
3359 #define TR_RES_NEXUS           61
3360 #define TR_RES_CHAOS           62
3361 #define TR_RES_DISEN           63
3362
3363 #define TR_SH_FIRE             64     /* Immolation (Fire) */
3364 #define TR_SH_ELEC             65     /* Electric Sheath */
3365 #define TR_SLAY_HUMAN          66     /* Slay human */
3366 #define TR_SH_COLD             67     /* cold aura */
3367 #define TR_NO_TELE             68     /* Anti-teleportation */
3368 #define TR_NO_MAGIC            69     /* Anti-magic */
3369 #define TR_DEC_MANA            70     /* ??? */
3370 #define TR_TY_CURSE            71     /* The Ancient Curse */
3371 #define TR_WARNING             72     /* Warning */
3372 #define TR_HIDE_TYPE           73     /* Hide "pval" description */
3373 #define TR_SHOW_MODS           74     /* Always show Tohit/Todam */
3374 #define TR_SLAY_GOOD           75
3375 #define TR_LEVITATION             76     /* Feather Falling */
3376 #define TR_LITE                77     /* Permanent Light */
3377 #define TR_SEE_INVIS           78     /* See Invisible */
3378 #define TR_TELEPATHY           79     /* Telepathy */
3379 #define TR_SLOW_DIGEST         80     /* Item slows down digestion */
3380 #define TR_REGEN               81     /* Item induces regeneration */
3381 #define TR_XTRA_MIGHT          82     /* Bows get extra multiplier */
3382 #define TR_XTRA_SHOTS          83     /* Bows get extra shots */
3383 #define TR_IGNORE_ACID         84     /* Item ignores Acid Damage */
3384 #define TR_IGNORE_ELEC         85     /* Item ignores Elec Damage */
3385 #define TR_IGNORE_FIRE         86     /* Item ignores Fire Damage */
3386 #define TR_IGNORE_COLD         87     /* Item ignores Cold Damage */
3387 #define TR_ACTIVATE            88     /* Item can be activated */
3388 #define TR_DRAIN_EXP           89     /* Item drains Experience */
3389 #define TR_TELEPORT            90     /* Item teleports player */
3390 #define TR_AGGRAVATE           91     /* Item aggravates monsters */
3391 #define TR_BLESSED             92     /* Item is Blessed */
3392 #define TR_ES_ATTACK           93     /* Fake flag for Smith */
3393 #define TR_ES_AC               94     /* Fake flag for Smith */
3394 #define TR_KILL_GOOD           95
3395
3396 #define TR_KILL_ANIMAL         96
3397 #define TR_KILL_EVIL           97
3398 #define TR_KILL_UNDEAD         98
3399 #define TR_KILL_DEMON          99
3400 #define TR_KILL_ORC            100
3401 #define TR_KILL_TROLL          101
3402 #define TR_KILL_GIANT          102
3403 #define TR_KILL_HUMAN          103
3404 #define TR_ESP_ANIMAL          104
3405 #define TR_ESP_UNDEAD          105
3406 #define TR_ESP_DEMON           106
3407 #define TR_ESP_ORC             107
3408 #define TR_ESP_TROLL           108
3409 #define TR_ESP_GIANT           109
3410 #define TR_ESP_DRAGON          110
3411 #define TR_ESP_HUMAN           111
3412 #define TR_ESP_EVIL            112
3413 #define TR_ESP_GOOD            113
3414 #define TR_ESP_NONLIVING       114
3415 #define TR_ESP_UNIQUE          115
3416 #define TR_FULL_NAME           116
3417 #define TR_FIXED_FLAVOR        117
3418 #define TR_ADD_L_CURSE         118
3419 #define TR_ADD_H_CURSE         119
3420 #define TR_DRAIN_HP            120
3421 #define TR_DRAIN_MANA          121
3422
3423 #define TR_FLAG_MAX            122
3424 #define TR_FLAG_SIZE           4
3425
3426
3427 #define TRG_INSTA_ART           0x00000001L     /* Item must be an artifact */
3428 #define TRG_QUESTITEM           0x00000002L     /* quest level item -KMW- */
3429 #define TRG_XTRA_POWER          0x00000004L     /* Extra power */
3430 #define TRG_ONE_SUSTAIN         0x00000008L     /* One sustain */
3431 #define TRG_XTRA_RES_OR_POWER   0x00000010L     /* Extra resistance or power */
3432 #define TRG_XTRA_H_RES          0x00000020L     /* Extra high resistance */
3433 #define TRG_XTRA_E_RES          0x00000040L     /* Extra element resistance */
3434 #define TRG_XTRA_L_RES          0x00000080L     /* Extra lordly resistance */
3435 #define TRG_XTRA_D_RES          0x00000100L     /* Extra dragon resistance */
3436 #define TRG_XTRA_RES            0x00000200L     /* Extra resistance */
3437 #define TRG_CURSED              0x00000400L     /* Item is Cursed */
3438 #define TRG_HEAVY_CURSE         0x00000800L     /* Item is Heavily Cursed */
3439 #define TRG_PERMA_CURSE         0x00001000L     /* Item is Perma Cursed */
3440 #define TRG_RANDOM_CURSE0       0x00002000L     /* Item is Random Cursed */
3441 #define TRG_RANDOM_CURSE1       0x00004000L     /* Item is Random Cursed */
3442 #define TRG_RANDOM_CURSE2       0x00008000L     /* Item is Random Cursed */
3443 #define TRG_XTRA_DICE           0x00010000L     /* Extra dice */
3444 #define TRG_POWERFUL            0x00020000L     /* Item has good value even if Cursed */
3445
3446
3447 #define MAX_CURSE 17
3448
3449 #define TRC_CURSED              0x00000001L
3450 #define TRC_HEAVY_CURSE         0x00000002L
3451 #define TRC_PERMA_CURSE         0x00000004L
3452 #define TRC_XXX1                0x00000008L
3453 #define TRC_TY_CURSE            0x00000010L
3454 #define TRC_AGGRAVATE           0x00000020L
3455 #define TRC_DRAIN_EXP           0x00000040L
3456 #define TRC_SLOW_REGEN          0x00000080L
3457 #define TRC_ADD_L_CURSE         0x00000100L
3458 #define TRC_ADD_H_CURSE         0x00000200L
3459 #define TRC_CALL_ANIMAL         0x00000400L
3460 #define TRC_CALL_DEMON          0x00000800L
3461 #define TRC_CALL_DRAGON         0x00001000L
3462 #define TRC_COWARDICE           0x00002000L
3463 #define TRC_TELEPORT            0x00004000L
3464 #define TRC_LOW_MELEE           0x00008000L
3465 #define TRC_LOW_AC              0x00010000L
3466 #define TRC_LOW_MAGIC           0x00020000L
3467 #define TRC_FAST_DIGEST         0x00040000L
3468 #define TRC_DRAIN_HP            0x00080000L
3469 #define TRC_DRAIN_MANA          0x00100000L
3470
3471 #define TRC_TELEPORT_SELF       0x00000001L
3472 #define TRC_CHAINSWORD          0x00000002L
3473
3474 #define TRC_SPECIAL_MASK \
3475         (TRC_TY_CURSE | TRC_AGGRAVATE)
3476
3477 #define TRC_HEAVY_MASK   \
3478         (TRC_TY_CURSE | TRC_AGGRAVATE | TRC_DRAIN_EXP | TRC_ADD_H_CURSE | \
3479          TRC_CALL_DEMON | TRC_CALL_DRAGON | TRC_TELEPORT)
3480
3481 #define TRC_P_FLAG_MASK  \
3482         (TRC_TELEPORT_SELF | TRC_CHAINSWORD | \
3483          TRC_TY_CURSE | TRC_DRAIN_EXP | TRC_ADD_L_CURSE | TRC_ADD_H_CURSE | \
3484          TRC_CALL_ANIMAL | TRC_CALL_DEMON | TRC_CALL_DRAGON | TRC_COWARDICE | \
3485          TRC_TELEPORT | TRC_DRAIN_HP | TRC_DRAIN_MANA)
3486
3487
3488
3489 /*
3490  * Bit flags for apply_magic() (etc)
3491  */
3492 #define AM_NO_FIXED_ART 0x00000001 /* Don't allow roll for fixed artifacts */
3493 #define AM_GOOD         0x00000002 /* Generate good items */
3494 #define AM_GREAT        0x00000004 /* Generate great items */
3495 #define AM_SPECIAL      0x00000008 /* Generate artifacts (for debug mode only) */
3496 #define AM_CURSED       0x00000010 /* Generate cursed/worthless items */
3497
3498
3499 /*** Monster blow constants ***/
3500
3501
3502 /*
3503  * New monster blow methods
3504  */
3505 #define RBM_HIT          1
3506 #define RBM_TOUCH        2
3507 #define RBM_PUNCH        3
3508 #define RBM_KICK         4
3509 #define RBM_CLAW         5
3510 #define RBM_BITE         6
3511 #define RBM_STING        7
3512 #define RBM_SLASH        8
3513 #define RBM_BUTT         9
3514 #define RBM_CRUSH       10
3515 #define RBM_ENGULF      11
3516 #define RBM_CHARGE      12
3517 #define RBM_CRAWL       13
3518 #define RBM_DROOL       14
3519 #define RBM_SPIT        15
3520 #define RBM_EXPLODE     16
3521 #define RBM_GAZE        17
3522 #define RBM_WAIL        18
3523 #define RBM_SPORE       19
3524 #define RBM_XXX4        20
3525 #define RBM_BEG         21
3526 #define RBM_INSULT      22
3527 #define RBM_MOAN        23
3528 #define RBM_SHOW        24
3529 #define RBM_SHOOT       25
3530
3531
3532 /*
3533  * New monster blow effects
3534  */
3535 #define RBE_HURT         1
3536 #define RBE_POISON       2
3537 #define RBE_UN_BONUS     3
3538 #define RBE_UN_POWER     4
3539 #define RBE_EAT_GOLD     5
3540 #define RBE_EAT_ITEM     6
3541 #define RBE_EAT_FOOD     7
3542 #define RBE_EAT_LITE     8
3543 #define RBE_ACID         9
3544 #define RBE_ELEC        10
3545 #define RBE_FIRE        11
3546 #define RBE_COLD        12
3547 #define RBE_BLIND       13
3548 #define RBE_CONFUSE     14
3549 #define RBE_TERRIFY     15
3550 #define RBE_PARALYZE    16
3551 #define RBE_LOSE_STR    17
3552 #define RBE_LOSE_INT    18
3553 #define RBE_LOSE_WIS    19
3554 #define RBE_LOSE_DEX    20
3555 #define RBE_LOSE_CON    21
3556 #define RBE_LOSE_CHR    22
3557 #define RBE_LOSE_ALL    23
3558 #define RBE_SHATTER     24
3559 #define RBE_EXP_10      25
3560 #define RBE_EXP_20      26
3561 #define RBE_EXP_40      27
3562 #define RBE_EXP_80      28
3563 #define RBE_DISEASE     29
3564 #define RBE_TIME        30
3565 #define RBE_EXP_VAMP    31
3566 #define RBE_DR_MANA     32
3567 #define RBE_SUPERHURT   33
3568 #define RBE_INERTIA     34
3569 #define RBE_STUN        35
3570
3571
3572 /*** Monster flag values (hard-coded) ***/
3573
3574
3575 /*
3576  * New monster race bit flags
3577  */
3578 #define RF1_UNIQUE              0x00000001  /* Unique Monster */
3579 #define RF1_QUESTOR             0x00000002  /* Quest Monster */
3580 #define RF1_MALE                0x00000004  /* Male gender */
3581 #define RF1_FEMALE              0x00000008  /* Female gender */
3582 #define RF1_CHAR_CLEAR          0x00000010  /* Absorbs symbol */
3583 #define RF1_SHAPECHANGER        0x00000020  /* TY: shapechanger */
3584 #define RF1_ATTR_CLEAR          0x00000040  /* Absorbs color */
3585 #define RF1_ATTR_MULTI          0x00000080  /* Changes color */
3586 #define RF1_FORCE_DEPTH         0x00000100  /* Start at "correct" depth */
3587 #define RF1_FORCE_MAXHP         0x00000200  /* Start with max hitpoints */
3588 #define RF1_FORCE_SLEEP         0x00000400  /* Start out sleeping */
3589 #define RF1_FORCE_EXTRA         0x00000800  /* Start out something */
3590 #define RF1_ATTR_SEMIRAND       0x00001000  /* Color is determined semi-randomly */
3591 #define RF1_FRIENDS             0x00002000  /* Arrive with some friends */
3592 #define RF1_ESCORT              0x00004000  /* Arrive with an escort */
3593 #define RF1_ESCORTS             0x00008000  /* Arrive with some escorts */
3594 #define RF1_NEVER_BLOW          0x00010000  /* Never make physical blow */
3595 #define RF1_NEVER_MOVE          0x00020000  /* Never make physical move */
3596 #define RF1_RAND_25             0x00040000  /* Moves randomly (25%) */
3597 #define RF1_RAND_50             0x00080000  /* Moves randomly (50%) */
3598 #define RF1_ONLY_GOLD           0x00100000  /* Drop only gold */
3599 #define RF1_ONLY_ITEM           0x00200000  /* Drop only items */
3600 #define RF1_DROP_60             0x00400000  /* Drop an item/gold (60%) */
3601 #define RF1_DROP_90             0x00800000  /* Drop an item/gold (90%) */
3602 #define RF1_DROP_1D2            0x01000000  /* Drop 1d2 items/gold */
3603 #define RF1_DROP_2D2            0x02000000  /* Drop 2d2 items/gold */
3604 #define RF1_DROP_3D2            0x04000000  /* Drop 3d2 items/gold */
3605 #define RF1_DROP_4D2            0x08000000  /* Drop 4d2 items/gold */
3606 #define RF1_DROP_GOOD           0x10000000  /* Drop good items */
3607 #define RF1_DROP_GREAT          0x20000000  /* Drop great items */
3608 #define RF1_XXX2                0x40000000  /* XXX */
3609 #define RF1_XXX3                0x80000000  /* XXX */
3610
3611 /*
3612  * New monster race bit flags
3613  */
3614 #define RF2_STUPID          0x00000001  /* Monster is stupid */
3615 #define RF2_SMART           0x00000002  /* Monster is smart */
3616 #define RF2_CAN_SPEAK       0x00000004  /* TY: can speak */
3617 #define RF2_REFLECTING      0x00000008  /* Reflects bolts */
3618 #define RF2_INVISIBLE       0x00000010  /* Monster avoids vision */
3619 #define RF2_COLD_BLOOD      0x00000020  /* Monster avoids infra */
3620 #define RF2_EMPTY_MIND      0x00000040  /* Monster avoids telepathy */
3621 #define RF2_WEIRD_MIND      0x00000080  /* Monster avoids telepathy? */
3622 #define RF2_MULTIPLY        0x00000100  /* Monster reproduces */
3623 #define RF2_REGENERATE      0x00000200  /* Monster regenerates */
3624 #define RF2_CHAR_MULTI      0x00000400  /* (Not implemented) */
3625 #define RF2_ATTR_ANY        0x00000800  /* TY: Attr_any */
3626 #define RF2_POWERFUL        0x00001000  /* Monster has strong breath */
3627 #define RF2_ELDRITCH_HORROR 0x00002000  /* Sanity-blasting horror    */
3628 #define RF2_AURA_FIRE       0x00004000  /* Burns in melee */
3629 #define RF2_AURA_ELEC       0x00008000  /* Shocks in melee */
3630 #define RF2_OPEN_DOOR       0x00010000  /* Monster can open doors */
3631 #define RF2_BASH_DOOR       0x00020000  /* Monster can bash doors */
3632 #define RF2_PASS_WALL       0x00040000  /* Monster can pass walls */
3633 #define RF2_KILL_WALL       0x00080000  /* Monster can destroy walls */
3634 #define RF2_MOVE_BODY       0x00100000  /* Monster can move monsters */
3635 #define RF2_KILL_BODY       0x00200000  /* Monster can kill monsters */
3636 #define RF2_TAKE_ITEM       0x00400000  /* Monster can pick up items */
3637 #define RF2_KILL_ITEM       0x00800000  /* Monster can crush items */
3638 #define RF2_XXX1            0x01000000
3639 #define RF2_XXX2            0x02000000
3640 #define RF2_XXX3            0x04000000
3641 #define RF2_XXX4            0x08000000
3642 #define RF2_XXX5            0x10000000
3643 #define RF2_XXX6            0x20000000
3644 #define RF2_HUMAN           0x40000000  /* Human */
3645 #define RF2_QUANTUM         0x80000000  /* Monster has quantum behavior */
3646
3647 /*
3648  * New monster race bit flags
3649  */
3650 #define RF3_ORC             0x00000001  /* Orc */
3651 #define RF3_TROLL           0x00000002  /* Troll */
3652 #define RF3_GIANT           0x00000004  /* Giant */
3653 #define RF3_DRAGON          0x00000008  /* Dragon */
3654 #define RF3_DEMON           0x00000010  /* Demon */
3655 #define RF3_UNDEAD          0x00000020  /* Undead */
3656 #define RF3_EVIL            0x00000040  /* Evil */
3657 #define RF3_ANIMAL          0x00000080  /* Animal */
3658 #define RF3_AMBERITE        0x00000100  /* TY: Amberite */
3659 #define RF3_GOOD            0x00000200  /* Good */
3660 #define RF3_AURA_COLD       0x00000400  /* Freezes in melee */
3661 #define RF3_NONLIVING       0x00000800  /* TY: Non-Living (?) */
3662 #define RF3_HURT_LITE       0x00001000  /* Hurt by lite */
3663 #define RF3_HURT_ROCK       0x00002000  /* Hurt by rock remover */
3664 #define RF3_HURT_FIRE       0x00004000  /* Hurt badly by fire */
3665 #define RF3_HURT_COLD       0x00008000  /* Hurt badly by cold */
3666 #define RF3_XXX16           0x00010000
3667 #define RF3_XXX17           0x00020000
3668 #define RF3_XXX18           0x00040000
3669 #define RF3_XXX19           0x00080000
3670 #define RF3_XXX20           0x00100000
3671 #define RF3_XXX21           0x00200000
3672 #define RF3_XXX22           0x00400000
3673 #define RF3_XXX23           0x00800000
3674 #define RF3_XXX24           0x01000000
3675 #define RF3_XXX25           0x02000000
3676 #define RF3_XXX26           0x04000000
3677 #define RF3_XXX27           0x08000000
3678 #define RF3_NO_FEAR         0x10000000  /* Cannot be scared */
3679 #define RF3_NO_STUN         0x20000000  /* Cannot be stunned */
3680 #define RF3_NO_CONF         0x40000000  /* Cannot be confused and resist confusion */
3681 #define RF3_NO_SLEEP        0x80000000  /* Cannot be slept */
3682
3683 /*
3684  * New monster race bit flags
3685  */
3686 #define RF4_SHRIEK          0x00000001  /* Shriek for help */
3687 #define RF4_XXX1            0x00000002  /* XXX */
3688 #define RF4_DISPEL          0x00000004  /* Dispel magic */
3689 #define RF4_ROCKET          0x00000008  /* TY: Rocket */
3690 #define RF4_SHOOT           0x00000010  /* Fire missiles */
3691 #define RF4_XXX2            0x00000020
3692 #define RF4_XXX3            0x00000040
3693 #define RF4_XXX4            0x00000080
3694 #define RF4_BR_ACID         0x00000100  /* Breathe Acid */
3695 #define RF4_BR_ELEC         0x00000200  /* Breathe Elec */
3696 #define RF4_BR_FIRE         0x00000400  /* Breathe Fire */
3697 #define RF4_BR_COLD         0x00000800  /* Breathe Cold */
3698 #define RF4_BR_POIS         0x00001000  /* Breathe Poison */
3699 #define RF4_BR_NETH         0x00002000  /* Breathe Nether */
3700 #define RF4_BR_LITE         0x00004000  /* Breathe Lite */
3701 #define RF4_BR_DARK         0x00008000  /* Breathe Dark */
3702 #define RF4_BR_CONF         0x00010000  /* Breathe Confusion */
3703 #define RF4_BR_SOUN         0x00020000  /* Breathe Sound */
3704 #define RF4_BR_CHAO         0x00040000  /* Breathe Chaos */
3705 #define RF4_BR_DISE         0x00080000  /* Breathe Disenchant */
3706 #define RF4_BR_NEXU         0x00100000  /* Breathe Nexus */
3707 #define RF4_BR_TIME         0x00200000  /* Breathe Time */
3708 #define RF4_BR_INER         0x00400000  /* Breathe Inertia */
3709 #define RF4_BR_GRAV         0x00800000  /* Breathe Gravity */
3710 #define RF4_BR_SHAR         0x01000000  /* Breathe Shards */
3711 #define RF4_BR_PLAS         0x02000000  /* Breathe Plasma */
3712 #define RF4_BR_WALL         0x04000000  /* Breathe Force */
3713 #define RF4_BR_MANA         0x08000000  /* Breathe Mana */
3714 #define RF4_BA_NUKE         0x10000000  /* TY: Nuke Ball */
3715 #define RF4_BR_NUKE         0x20000000  /* TY: Toxic Breath */
3716 #define RF4_BA_CHAO         0x40000000  /* TY: Logrus Ball */
3717 #define RF4_BR_DISI         0x80000000  /* Breathe Disintegration */
3718
3719 /*
3720  * New monster race bit flags
3721  */
3722 #define RF5_BA_ACID         0x00000001  /* Acid Ball */
3723 #define RF5_BA_ELEC         0x00000002  /* Elec Ball */
3724 #define RF5_BA_FIRE         0x00000004  /* Fire Ball */
3725 #define RF5_BA_COLD         0x00000008  /* Cold Ball */
3726 #define RF5_BA_POIS         0x00000010  /* Poison Ball */
3727 #define RF5_BA_NETH         0x00000020  /* Nether Ball */
3728 #define RF5_BA_WATE         0x00000040  /* Water Ball */
3729 #define RF5_BA_MANA         0x00000080  /* Mana Storm */
3730 #define RF5_BA_DARK         0x00000100  /* Darkness Storm */
3731 #define RF5_DRAIN_MANA      0x00000200  /* Drain Mana */
3732 #define RF5_MIND_BLAST      0x00000400  /* Blast Mind */
3733 #define RF5_BRAIN_SMASH     0x00000800  /* Smash Brain */
3734 #define RF5_CAUSE_1         0x00001000  /* Cause Light Wound */
3735 #define RF5_CAUSE_2         0x00002000  /* Cause Serious Wound */
3736 #define RF5_CAUSE_3         0x00004000  /* Cause Critical Wound */
3737 #define RF5_CAUSE_4         0x00008000  /* Cause Mortal Wound */
3738 #define RF5_BO_ACID         0x00010000  /* Acid Bolt */
3739 #define RF5_BO_ELEC         0x00020000  /* Elec Bolt (unused) */
3740 #define RF5_BO_FIRE         0x00040000  /* Fire Bolt */
3741 #define RF5_BO_COLD         0x00080000  /* Cold Bolt */
3742 #define RF5_BA_LITE         0x00100000  /* StarBurst */
3743 #define RF5_BO_NETH         0x00200000  /* Nether Bolt */
3744 #define RF5_BO_WATE         0x00400000  /* Water Bolt */
3745 #define RF5_BO_MANA         0x00800000  /* Mana Bolt */
3746 #define RF5_BO_PLAS         0x01000000  /* Plasma Bolt */
3747 #define RF5_BO_ICEE         0x02000000  /* Ice Bolt */
3748 #define RF5_MISSILE         0x04000000  /* Magic Missile */
3749 #define RF5_SCARE           0x08000000  /* Frighten Player */
3750 #define RF5_BLIND           0x10000000  /* Blind Player */
3751 #define RF5_CONF            0x20000000  /* Confuse Player */
3752 #define RF5_SLOW            0x40000000  /* Slow Player */
3753 #define RF5_HOLD            0x80000000  /* Paralyze Player */
3754
3755 /*
3756  * New monster race bit flags
3757  */
3758 #define RF6_HASTE           0x00000001  /* Speed self */
3759 #define RF6_HAND_DOOM       0x00000002  /* Hand of Doom */
3760 #define RF6_HEAL            0x00000004  /* Heal self */
3761 #define RF6_INVULNER        0x00000008  /* INVULNERABILITY! */
3762 #define RF6_BLINK           0x00000010  /* Teleport Short */
3763 #define RF6_TPORT           0x00000020  /* Teleport Long */
3764 #define RF6_WORLD           0x00000040  /* world */
3765 #define RF6_SPECIAL         0x00000080  /* Special Attack */
3766 #define RF6_TELE_TO         0x00000100  /* Move player to monster */
3767 #define RF6_TELE_AWAY       0x00000200  /* Move player far away */
3768 #define RF6_TELE_LEVEL      0x00000400  /* Move player vertically */
3769 #define RF6_PSY_SPEAR       0x00000800  /* Psyco-spear */
3770 #define RF6_DARKNESS        0x00001000  /* Create Darkness */
3771 #define RF6_TRAPS           0x00002000  /* Create Traps */
3772 #define RF6_FORGET          0x00004000  /* Cause amnesia */
3773 #define RF6_RAISE_DEAD      0x00008000  /* Raise Dead */
3774 #define RF6_S_KIN           0x00010000  /* Summon "kin" */
3775 #define RF6_S_CYBER         0x00020000  /* Summon Cyberdemons! */
3776 #define RF6_S_MONSTER       0x00040000  /* Summon Monster */
3777 #define RF6_S_MONSTERS      0x00080000  /* Summon Monsters */
3778 #define RF6_S_ANT           0x00100000  /* Summon Ants */
3779 #define RF6_S_SPIDER        0x00200000  /* Summon Spiders */
3780 #define RF6_S_HOUND         0x00400000  /* Summon Hounds */
3781 #define RF6_S_HYDRA         0x00800000  /* Summon Hydras */
3782 #define RF6_S_ANGEL         0x01000000  /* Summon Angel */
3783 #define RF6_S_DEMON         0x02000000  /* Summon Demon */
3784 #define RF6_S_UNDEAD        0x04000000  /* Summon Undead */
3785 #define RF6_S_DRAGON        0x08000000  /* Summon Dragon */
3786 #define RF6_S_HI_UNDEAD     0x10000000  /* Summon Greater Undead */
3787 #define RF6_S_HI_DRAGON     0x20000000  /* Summon Ancient Dragon */
3788 #define RF6_S_AMBERITES     0x40000000  /* Summon Amberites */
3789 #define RF6_S_UNIQUE        0x80000000  /* Summon Unique Monster */
3790
3791 /*
3792  * New monster race bit flags
3793  */
3794 #define RF7_AQUATIC             0x00000001  /* Aquatic monster */
3795 #define RF7_CAN_SWIM            0x00000002  /* Monster can swim */
3796 #define RF7_CAN_FLY             0x00000004  /* Monster can fly */
3797 #define RF7_FRIENDLY            0x00000008  /* Monster is friendly */
3798 #define RF7_NAZGUL              0x00000010  /* Is a "Nazgul" unique */
3799 #define RF7_UNIQUE2             0x00000020  /* Fake unique */
3800 #define RF7_RIDING              0x00000040  /* Good for riding */
3801 #define RF7_KAGE                0x00000080  /* Is kage */
3802 #define RF7_HAS_LITE_1          0x00000100  /* Monster carries light */
3803 #define RF7_SELF_LITE_1         0x00000200  /* Monster lights itself */
3804 #define RF7_HAS_LITE_2          0x00000400  /* Monster carries light */
3805 #define RF7_SELF_LITE_2         0x00000800  /* Monster lights itself */
3806 #define RF7_GUARDIAN            0x00001000  /* Guardian of a dungeon */
3807 #define RF7_CHAMELEON           0x00002000  /* Chameleon can change */
3808 #define RF7_XXXX4XXX            0x00004000  /* Now Empty */
3809 #define RF7_TANUKI              0x00008000  /* Tanuki disguise */
3810 #define RF7_HAS_DARK_1          0x00010000  /* Monster carries darkness */
3811 #define RF7_SELF_DARK_1         0x00020000  /* Monster darkens itself */
3812 #define RF7_HAS_DARK_2          0x00040000  /* Monster carries darkness */
3813 #define RF7_SELF_DARK_2         0x00080000  /* Monster darkens itself */
3814
3815 /*
3816  * Monster race flags
3817  */
3818 #define RF8_WILD_ONLY           0x00000001
3819 #define RF8_WILD_TOWN           0x00000002
3820 #define RF8_XXX8X02             0x00000004
3821 #define RF8_WILD_SHORE          0x00000008
3822 #define RF8_WILD_OCEAN          0x00000010
3823 #define RF8_WILD_WASTE          0x00000020
3824 #define RF8_WILD_WOOD           0x00000040
3825 #define RF8_WILD_VOLCANO        0x00000080
3826 #define RF8_XXX8X08             0x00000100
3827 #define RF8_WILD_MOUNTAIN       0x00000200
3828 #define RF8_WILD_GRASS          0x00000400
3829 #define RF8_WILD_ALL            0x80000000
3830
3831 /*
3832  * Monster drop info
3833  */
3834 #define RF9_DROP_CORPSE         0x00000001
3835 #define RF9_DROP_SKELETON       0x00000002
3836 #define RF9_EAT_BLIND           0x00000004
3837 #define RF9_EAT_CONF            0x00000008
3838 #define RF9_EAT_MANA            0x00000010
3839 #define RF9_EAT_NEXUS           0x00000020
3840 #define RF9_EAT_SLEEP           0x00000040
3841 #define RF9_EAT_BERSERKER       0x00000080
3842 #define RF9_EAT_ACIDIC          0x00000100
3843 #define RF9_EAT_SPEED           0x00000200
3844 #define RF9_EAT_CURE            0x00000400
3845 #define RF9_EAT_FIRE_RES        0x00000800
3846 #define RF9_EAT_COLD_RES        0x00001000
3847 #define RF9_EAT_ACID_RES        0x00002000
3848 #define RF9_EAT_ELEC_RES        0x00004000
3849 #define RF9_EAT_POIS_RES        0x00008000
3850 #define RF9_EAT_INSANITY        0x00010000
3851 #define RF9_EAT_DRAIN_EXP       0x00020000
3852 #define RF9_EAT_POISONOUS       0x00040000
3853 #define RF9_EAT_GIVE_STR        0x00080000
3854 #define RF9_EAT_GIVE_INT        0x00100000
3855 #define RF9_EAT_GIVE_WIS        0x00200000
3856 #define RF9_EAT_GIVE_DEX        0x00400000
3857 #define RF9_EAT_GIVE_CON        0x00800000
3858 #define RF9_EAT_GIVE_CHR        0x01000000
3859 #define RF9_EAT_LOSE_STR        0x02000000
3860 #define RF9_EAT_LOSE_INT        0x04000000
3861 #define RF9_EAT_LOSE_WIS        0x08000000
3862 #define RF9_EAT_LOSE_DEX        0x01000000
3863 #define RF9_EAT_LOSE_CON        0x20000000
3864 #define RF9_EAT_LOSE_CHR        0x40000000
3865 #define RF9_EAT_DRAIN_MANA      0x80000000
3866
3867 /*
3868  * Monster bit flags of racial resistances
3869  * Note: Resist confusion was merged to RFR_NO_CONF
3870  */
3871 #define RFR_IM_ACID         0x00000001  /* Resist acid */
3872 #define RFR_IM_ELEC         0x00000002  /* Resist elec */
3873 #define RFR_IM_FIRE         0x00000004  /* Resist fire */
3874 #define RFR_IM_COLD         0x00000008  /* Resist cold */
3875 #define RFR_IM_POIS         0x00000010  /* Resist poison */
3876 #define RFR_RES_LITE        0x00000020  /* Resist lite */
3877 #define RFR_RES_DARK        0x00000040  /* Resist dark */
3878 #define RFR_RES_NETH        0x00000080  /* Resist nether */
3879 #define RFR_RES_WATE        0x00000100  /* Resist water */
3880 #define RFR_RES_PLAS        0x00000200  /* Resist plasma */
3881 #define RFR_RES_SHAR        0x00000400  /* Resist shards */
3882 #define RFR_RES_SOUN        0x00000800  /* Resist sound */
3883 #define RFR_RES_CHAO        0x00001000  /* Resist chaos */
3884 #define RFR_RES_NEXU        0x00002000  /* Resist nexus */
3885 #define RFR_RES_DISE        0x00004000  /* Resist disenchantment */
3886 #define RFR_RES_WALL        0x00008000  /* Resist force */
3887 #define RFR_RES_INER        0x00010000  /* Resist inertia */
3888 #define RFR_RES_TIME        0x00020000  /* Resist time */
3889 #define RFR_RES_GRAV        0x00040000  /* Resist gravity */
3890 #define RFR_RES_ALL         0x00080000  /* Resist all */
3891 #define RFR_RES_TELE        0x00100000  /* Resist teleportation */
3892 #define RFR_XXX21           0x00200000
3893 #define RFR_XXX22           0x00400000
3894 #define RFR_XXX23           0x00800000
3895 #define RFR_XXX24           0x01000000
3896 #define RFR_XXX25           0x02000000
3897 #define RFR_XXX26           0x04000000
3898 #define RFR_XXX27           0x08000000
3899 #define RFR_XXX28           0x10000000
3900 #define RFR_XXX29           0x20000000
3901 #define RFR_XXX30           0x40000000
3902 #define RFR_XXX31           0x80000000
3903
3904
3905 /*
3906  * Hack -- choose "intelligent" spells when desperate
3907  * Including "summon" spells
3908  */
3909 #define RF4_INT_MASK \
3910         (RF4_SUMMON_MASK | RF4_DISPEL)
3911
3912 #define RF5_INT_MASK \
3913         (RF5_SUMMON_MASK | \
3914          RF5_HOLD | RF5_SLOW | RF5_CONF | RF5_BLIND | RF5_SCARE)
3915
3916 #define RF6_INT_MASK \
3917         (RF6_SUMMON_MASK | \
3918          RF6_BLINK | RF6_TPORT | RF6_TELE_LEVEL | RF6_TELE_AWAY | \
3919          RF6_HEAL | RF6_INVULNER | RF6_HASTE | RF6_TRAPS)
3920
3921 /*
3922  * Hack -- spells that cannot be used while player riding on the monster
3923  */
3924 #define RF4_RIDING_MASK \
3925         (RF4_SHRIEK)
3926
3927 #define RF5_RIDING_MASK 0UL
3928
3929 #define RF6_RIDING_MASK \
3930         (RF6_BLINK | RF6_TPORT | RF6_TRAPS | RF6_DARKNESS | RF6_SPECIAL)
3931
3932 /*
3933  * Hack -- "bolt" spells that may hurt fellow monsters
3934  * Currently "bolt" spells are included in "attack"
3935  */
3936 #define RF4_BOLT_MASK \
3937         (RF4_ROCKET | RF4_SHOOT)
3938
3939 #define RF5_BOLT_MASK \
3940         (RF5_BO_ACID | RF5_BO_ELEC | RF5_BO_FIRE | RF5_BO_COLD | \
3941          RF5_BO_NETH | RF5_BO_WATE | RF5_BO_MANA | RF5_BO_PLAS | \
3942          RF5_BO_ICEE | RF5_MISSILE)
3943
3944 #define RF6_BOLT_MASK 0UL
3945
3946 /*
3947  * Hack -- "beam" spells that may hurt fellow monsters
3948  * Currently "beam" spells are included in "attack"
3949  */
3950 #define RF4_BEAM_MASK 0UL
3951
3952 #define RF5_BEAM_MASK 0UL
3953
3954 #define RF6_BEAM_MASK (RF6_PSY_SPEAR)
3955
3956 /*
3957  * Hack -- "ball" spells that may hurt friends
3958  * Including "radius 4 ball" and "breath" spells
3959  * Currently "ball" spells are included in "attack"
3960  */
3961 #define RF4_BALL_MASK \
3962         (RF4_BIG_BALL_MASK | RF4_BREATH_MASK | \
3963          RF4_ROCKET | RF4_BA_NUKE)
3964
3965 #define RF5_BALL_MASK \
3966         (RF5_BIG_BALL_MASK | RF5_BREATH_MASK | \
3967          RF5_BA_ACID | RF5_BA_ELEC | RF5_BA_FIRE | RF5_BA_COLD | \
3968          RF5_BA_POIS | RF5_BA_NETH)
3969
3970 #define RF6_BALL_MASK \
3971         (RF6_BIG_BALL_MASK | RF6_BREATH_MASK)
3972
3973 /*
3974  * Hack -- "ball" spells with radius 4 that may hurt friends
3975  * Currently "radius 4 ball" spells are included in "ball"
3976  */
3977 #define RF4_BIG_BALL_MASK \
3978         (RF4_BA_CHAO)
3979
3980 #define RF5_BIG_BALL_MASK \
3981         (RF5_BA_LITE | RF5_BA_DARK | RF5_BA_WATE | RF5_BA_MANA)
3982
3983 #define RF6_BIG_BALL_MASK 0UL
3984
3985 /*
3986  * Hack -- "breath" spells that may hurt friends
3987  * Currently "breath" spells are included in "ball" and "non-magic"
3988  */
3989 #define RF4_BREATH_MASK \
3990         (RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | \
3991          RF4_BR_POIS | RF4_BR_NETH | RF4_BR_LITE | RF4_BR_DARK | \
3992          RF4_BR_CONF | RF4_BR_SOUN | RF4_BR_CHAO | RF4_BR_DISE | \
3993          RF4_BR_NEXU | RF4_BR_SHAR | RF4_BR_TIME | RF4_BR_INER | \
3994          RF4_BR_GRAV | RF4_BR_PLAS | RF4_BR_WALL | RF4_BR_MANA | \
3995          RF4_BR_NUKE | RF4_BR_DISI)
3996
3997 #define RF5_BREATH_MASK 0UL
3998
3999 #define RF6_BREATH_MASK 0UL
4000
4001 /*
4002  * Hack -- "summon" spells
4003  * Currently "summon" spells are included in "intelligent" and "indirect"
4004  */
4005 #define RF4_SUMMON_MASK 0UL
4006
4007 #define RF5_SUMMON_MASK 0UL
4008
4009 #define RF6_SUMMON_MASK \
4010         (RF6_S_KIN | RF6_S_CYBER | RF6_S_MONSTER | RF6_S_MONSTERS | RF6_S_ANT | \
4011          RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | RF6_S_ANGEL | RF6_S_DEMON | \
4012          RF6_S_UNDEAD | RF6_S_DRAGON | RF6_S_HI_UNDEAD | RF6_S_HI_DRAGON | \
4013          RF6_S_AMBERITES | RF6_S_UNIQUE)
4014
4015 /*
4016  * Hack -- "attack" spells
4017  * Including "bolt", "beam" and "ball" spells
4018  */
4019 #define RF4_ATTACK_MASK \
4020         (RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_DISPEL)
4021
4022 #define RF5_ATTACK_MASK \
4023         (RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | \
4024          RF5_DRAIN_MANA | RF5_MIND_BLAST | RF5_BRAIN_SMASH | \
4025          RF5_CAUSE_1 | RF5_CAUSE_2 | RF5_CAUSE_3 | RF5_CAUSE_4 | \
4026          RF5_SCARE | RF5_BLIND | RF5_CONF | RF5_SLOW | RF5_HOLD)
4027
4028 #define RF6_ATTACK_MASK \
4029         (RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | \
4030          RF6_HAND_DOOM | RF6_TELE_TO | RF6_TELE_AWAY | RF6_TELE_LEVEL | \
4031          RF6_DARKNESS | RF6_TRAPS | RF6_FORGET)
4032
4033 /*
4034  * Hack -- "indirect" spells
4035  * Including "summon" spells
4036  */
4037 #define RF4_INDIRECT_MASK \
4038         (RF4_SUMMON_MASK | RF4_SHRIEK)
4039
4040 #define RF5_INDIRECT_MASK \
4041         (RF5_SUMMON_MASK)
4042
4043 #define RF6_INDIRECT_MASK \
4044         (RF6_SUMMON_MASK | \
4045          RF6_HASTE | RF6_HEAL | RF6_INVULNER | RF6_BLINK | RF6_WORLD | \
4046          RF6_TPORT | RF6_RAISE_DEAD)
4047
4048 /*
4049  * Hack -- "non-magic" spells
4050  * Including "breath" spells
4051  */
4052 #define RF4_NOMAGIC_MASK \
4053         (RF4_BREATH_MASK | RF4_SHRIEK | RF4_ROCKET | RF4_SHOOT)
4054
4055 #define RF5_NOMAGIC_MASK \
4056         (RF5_BREATH_MASK)
4057
4058 #define RF6_NOMAGIC_MASK \
4059         (RF6_BREATH_MASK | RF6_SPECIAL)
4060
4061 /*
4062  * Hack -- "torch" masks
4063  */
4064 #define RF7_LITE_MASK \
4065         (RF7_HAS_LITE_1 | RF7_SELF_LITE_1 | RF7_HAS_LITE_2 | RF7_SELF_LITE_2)
4066
4067 #define RF7_DARK_MASK \
4068         (RF7_HAS_DARK_1 | RF7_SELF_DARK_1 | RF7_HAS_DARK_2 | RF7_SELF_DARK_2)
4069
4070 #define RF7_HAS_LD_MASK \
4071         (RF7_HAS_LITE_1 | RF7_HAS_LITE_2 | RF7_HAS_DARK_1 | RF7_HAS_DARK_2)
4072
4073 #define RF7_SELF_LD_MASK \
4074         (RF7_SELF_LITE_1 | RF7_SELF_LITE_2 | RF7_SELF_DARK_1 | RF7_SELF_DARK_2)
4075
4076 /*
4077  * Hack -- effective elemental and poison immunity mask
4078  */
4079 #define RFR_EFF_IM_ACID_MASK  (RFR_IM_ACID | RFR_RES_ALL)
4080 #define RFR_EFF_IM_ELEC_MASK  (RFR_IM_ELEC | RFR_RES_ALL)
4081 #define RFR_EFF_IM_FIRE_MASK  (RFR_IM_FIRE | RFR_RES_ALL)
4082 #define RFR_EFF_IM_COLD_MASK  (RFR_IM_COLD | RFR_RES_ALL)
4083 #define RFR_EFF_IM_POIS_MASK  (RFR_IM_POIS | RFR_RES_ALL)
4084 #define RFR_EFF_RES_SHAR_MASK (RFR_RES_SHAR | RFR_RES_ALL)
4085 #define RFR_EFF_RES_CHAO_MASK (RFR_RES_CHAO | RFR_RES_ALL)
4086 #define RFR_EFF_RES_NEXU_MASK (RFR_RES_NEXU | RFR_RES_ALL)
4087
4088
4089 #define MR1_SINKA 0x01
4090
4091
4092 #define is_friendly(A) \
4093          (bool)(((A)->smart & SM_FRIENDLY) ? TRUE : FALSE)
4094
4095 #define is_friendly_idx(IDX) \
4096          (bool)((IDX) > 0 && is_friendly(&m_list[(IDX)]))
4097
4098 #define is_pet(A) \
4099          (bool)(((A)->smart & SM_PET) ? TRUE : FALSE)
4100
4101 #define is_hostile(A) \
4102          (bool)((is_friendly(A) || is_pet(A)) ? FALSE : TRUE)
4103
4104 /* Hack -- Determine monster race appearance index is same as race index */
4105 #define is_original_ap(A) \
4106          (bool)(((A)->ap_r_idx == (A)->r_idx) ? TRUE : FALSE)
4107
4108 #define is_original_ap_and_seen(A) \
4109          (bool)((A)->ml && !p_ptr->image && ((A)->ap_r_idx == (A)->r_idx))
4110
4111 /*
4112  * Is the monster seen by the player?
4113  */
4114 #define is_seen(A) \
4115         ((bool)((A)->ml && (!ignore_unview || p_ptr->inside_battle || \
4116          (player_can_see_bold((A)->fy, (A)->fx) && projectable(py, px, (A)->fy, (A)->fx)))))
4117
4118
4119 /*** Option Definitions ***/
4120
4121
4122 #define OPT_PAGE_INPUT          1
4123 #define OPT_PAGE_MAPSCREEN      2
4124 #define OPT_PAGE_TEXT           3
4125 #define OPT_PAGE_GAMEPLAY       4
4126 #define OPT_PAGE_DISTURBANCE    5
4127 #define OPT_PAGE_BIRTH          6
4128 #define OPT_PAGE_AUTODESTROY    7
4129 #define OPT_PAGE_PLAYRECORD    10
4130
4131 #define OPT_PAGE_JAPANESE_ONLY 99
4132
4133
4134 /*** Macro Definitions ***/
4135
4136
4137 /*
4138  * Hack -- The main "screen"
4139  */
4140 #define term_screen     (angband_term[0])
4141
4142
4143 /*
4144  * Determine if a given inventory item is "aware"
4145  */
4146 #define object_is_aware(T) \
4147     (k_info[(T)->k_idx].aware)
4148
4149 /*
4150  * Determine if a given inventory item is "tried"
4151  */
4152 #define object_is_tried(T) \
4153     (k_info[(T)->k_idx].tried)
4154
4155
4156 /*
4157  * Determine if a given inventory item is "known"
4158  * Test One -- Check for special "known" tag
4159  * Test Two -- Check for "Easy Know" + "Aware"
4160  */
4161 #define object_is_known(T) \
4162     (((T)->ident & (IDENT_KNOWN)) || \
4163      (k_info[(T)->k_idx].easy_know && k_info[(T)->k_idx].aware))
4164
4165
4166 /*
4167  * Return the "attr" for a given item.
4168  * Use "flavor" if available.
4169  * Default to user definitions.
4170  */
4171 #define object_attr(T) \
4172         ((k_info[(T)->k_idx].flavor) ? \
4173          (k_info[k_info[(T)->k_idx].flavor].x_attr) : \
4174          ((!(T)->k_idx || ((T)->tval != TV_CORPSE) || ((T)->sval != SV_CORPSE) || \
4175            (k_info[(T)->k_idx].x_attr != TERM_DARK)) ? \
4176           (k_info[(T)->k_idx].x_attr) : (r_info[(T)->pval].x_attr)))
4177
4178 /*
4179  * Return the "char" for a given item.
4180  * Use "flavor" if available.
4181  * Default to user definitions.
4182  */
4183 #define object_char(T) \
4184         ((k_info[(T)->k_idx].flavor) ? \
4185          (k_info[k_info[(T)->k_idx].flavor].x_char) : \
4186          (k_info[(T)->k_idx].x_char))
4187
4188
4189 /*
4190  * Artifacts use the "name1" field
4191  */
4192 #define object_is_fixed_artifact(T) \
4193         ((T)->name1 ? TRUE : FALSE)
4194
4195 /*
4196  * Ego-Items use the "name2" field
4197  */
4198 #define object_is_ego(T) \
4199         ((T)->name2 ? TRUE : FALSE)
4200
4201
4202 /*
4203  * Broken items.
4204  */
4205 #define object_is_broken(T) \
4206         ((T)->ident & (IDENT_BROKEN))
4207
4208 /*
4209  * Cursed items.
4210  */
4211 #define object_is_cursed(T) \
4212         ((T)->curse_flags)
4213
4214
4215 /*
4216  * Convert an "attr"/"char" pair into a "pict" (P)
4217  */
4218 #define PICT(A,C) \
4219         ((((u16b)(A)) << 8) | ((byte)(C)))
4220
4221 /*
4222  * Convert a "pict" (P) into an "attr" (A)
4223  */
4224 #define PICT_A(P) \
4225         ((byte)((P) >> 8))
4226
4227 /*
4228  * Convert a "pict" (P) into an "char" (C)
4229  */
4230 #define PICT_C(P) \
4231         ((char)((byte)(P)))
4232
4233
4234 /*
4235  * Convert a "location" (Y,X) into a "grid" (G)
4236  */
4237 #define GRID(Y,X) \
4238         (256 * (Y) + (X))
4239
4240 /*
4241  * Convert a "grid" (G) into a "location" (Y)
4242  */
4243 #define GRID_Y(G) \
4244         ((int)((G) / 256U))
4245
4246 /*
4247  * Convert a "grid" (G) into a "location" (X)
4248  */
4249 #define GRID_X(G) \
4250         ((int)((G) % 256U))
4251
4252
4253 /*
4254  * Determines if a map location is fully inside the outer walls
4255  */
4256 #define in_bounds(Y,X) \
4257    (((Y) > 0) && ((X) > 0) && ((Y) < cur_hgt-1) && ((X) < cur_wid-1))
4258
4259 /*
4260  * Determines if a map location is on or inside the outer walls
4261  */
4262 #define in_bounds2(Y,X) \
4263    (((Y) >= 0) && ((X) >= 0) && ((Y) < cur_hgt) && ((X) < cur_wid))
4264
4265 /*
4266  * Determines if a map location is on or inside the outer walls
4267  * (unsigned version)
4268  */
4269 #define in_bounds2u(Y,X) \
4270    (((Y) < cur_hgt) && ((X) < cur_wid))
4271
4272 /*
4273  * Determines if a map location is currently "on screen" -RAK-
4274  * Note that "panel_contains(Y,X)" always implies "in_bounds2(Y,X)".
4275  */
4276 #define panel_contains(Y,X) \
4277   (((Y) >= panel_row_min) && ((Y) <= panel_row_max) && \
4278    ((X) >= panel_col_min) && ((X) <= panel_col_max))
4279
4280
4281 /*
4282  * Determine if player is on this grid
4283  */
4284 #define player_bold(Y,X) \
4285         (((Y) == py) && ((X) == px))
4286
4287
4288 /*
4289  * Grid based version of "player_bold()"
4290  */
4291 #define player_grid(C) \
4292         ((C) == &cave[py][px])
4293
4294
4295 #define cave_have_flag_bold(Y,X,INDEX) \
4296         (have_flag(f_info[cave[(Y)][(X)].feat].flags, (INDEX)))
4297
4298
4299 #define cave_have_flag_grid(C,INDEX) \
4300         (have_flag(f_info[(C)->feat].flags, (INDEX)))
4301
4302
4303 /*
4304  * Determine if a "feature" supports "los"
4305  */
4306 #define feat_supports_los(F) \
4307         (have_flag(f_info[(F)].flags, FF_LOS))
4308
4309
4310 /*
4311  * Determine if a "legal" grid supports "los"
4312  */
4313 #define cave_los_bold(Y,X) \
4314         (feat_supports_los(cave[(Y)][(X)].feat))
4315
4316 #define cave_los_grid(C) \
4317         (feat_supports_los((C)->feat))
4318
4319
4320 /*
4321  * Determine if a "legal" grid is a "clean" floor grid
4322  * Determine if terrain-change spells are allowed in a grid.
4323  *
4324  * Line 1 -- forbid non-floors
4325  * Line 2 -- forbid object terrains
4326  * Line 3 -- forbid normal objects
4327  */
4328 #define cave_clean_bold(Y,X) \
4329         (cave_have_flag_bold((Y), (X), FF_FLOOR) && \
4330          !(cave[Y][X].info & CAVE_OBJECT) && \
4331           (cave[Y][X].o_idx == 0))
4332
4333
4334 /*
4335  * Determine if an object can be dropped on a "legal" grid
4336  *
4337  * Line 1 -- forbid non-drops
4338  * Line 2 -- forbid object terrains
4339  */
4340 #define cave_drop_bold(Y,X) \
4341         (cave_have_flag_bold((Y), (X), FF_DROP) && \
4342          !(cave[Y][X].info & CAVE_OBJECT))
4343
4344
4345 /*
4346  * Determine if a "legal" grid is an "empty" floor grid
4347  * Determine if monsters are allowed to move into a grid
4348  *
4349  * Line 1 -- forbid non-placement grids
4350  * Line 2 -- forbid normal monsters
4351  * Line 3 -- forbid the player
4352  */
4353 #define cave_empty_bold(Y,X) \
4354         (cave_have_flag_bold((Y), (X), FF_PLACE) && \
4355          !(cave[Y][X].m_idx) && \
4356          !player_bold(Y,X))
4357
4358
4359 /*
4360  * Determine if a "legal" grid is an "empty" floor grid
4361  * Determine if monster generation is allowed in a grid
4362  *
4363  * Line 1 -- forbid non-empty grids
4364  * Line 2 -- forbid trees while dungeon generation
4365  */
4366 #define cave_empty_bold2(Y,X) \
4367         (cave_empty_bold(Y,X) && \
4368          (character_dungeon || !cave_have_flag_bold((Y), (X), FF_TREE)))
4369
4370
4371 /*
4372  * Determine if a "legal" grid is an "naked" floor grid
4373  *
4374  * Line 1 -- forbid non-clean gird
4375  * Line 2 -- forbid monsters
4376  * Line 3 -- forbid the player
4377  */
4378 #define cave_naked_bold(Y,X) \
4379         (cave_clean_bold(Y,X) && \
4380          !(cave[Y][X].m_idx) && \
4381          !player_bold(Y,X))
4382
4383
4384 /*
4385  * Determine if a "legal" grid is "permanent"
4386  *
4387  * Line 1 -- permanent flag
4388  */
4389 #define cave_perma_bold(Y,X) \
4390         (cave_have_flag_bold((Y), (X), FF_PERMANENT))
4391
4392
4393 /*
4394  * Grid based version of "cave_empty_bold()"
4395  */
4396 #define cave_empty_grid(C) \
4397         (cave_have_flag_grid((C), FF_PLACE) && \
4398          !((C)->m_idx) && \
4399          !player_grid(C))
4400
4401
4402 /*
4403  * Grid based version of "cave_perma_bold()"
4404  */
4405 #define cave_perma_grid(C) \
4406         (cave_have_flag_grid((C), FF_PERMANENT))
4407
4408
4409 #define pattern_tile(Y,X) \
4410         (cave_have_flag_bold((Y), (X), FF_PATTERN))
4411
4412 /*
4413  * Does the grid stop disintegration?
4414  */
4415 #define cave_stop_disintegration(Y,X) \
4416         (!cave_have_flag_bold((Y), (X), FF_PROJECT) && \
4417          (!cave_have_flag_bold((Y), (X), FF_HURT_DISI) || \
4418           cave_have_flag_bold((Y), (X), FF_PERMANENT)))
4419
4420
4421 /*
4422  * Determine if a "legal" grid is within "los" of the player
4423  *
4424  * Note the use of comparison to zero to force a "boolean" result
4425  */
4426 #define player_has_los_grid(C) \
4427     (((C)->info & (CAVE_VIEW)) != 0)
4428
4429 /*
4430  * Determine if a "legal" grid is within "los" of the player
4431  *
4432  * Note the use of comparison to zero to force a "boolean" result
4433  */
4434 #define player_has_los_bold(Y,X) \
4435     (((cave[Y][X].info & (CAVE_VIEW)) != 0) || p_ptr->inside_battle)
4436
4437
4438 /*
4439  * Determine if a "feature" is "permanent wall"
4440  */
4441 #define permanent_wall(F) \
4442         (have_flag((F)->flags, FF_WALL) && \
4443          have_flag((F)->flags, FF_PERMANENT))
4444
4445 /*
4446  * Get feature mimic from f_info[] (applying "mimic" field)
4447  */
4448 #define get_feat_mimic(C) \
4449         (f_info[(C)->mimic ? (C)->mimic : (C)->feat].mimic)
4450
4451 /*
4452  * Hack -- Prepare to use the "Secure" routines
4453  */
4454 #if defined(SET_UID) && defined(SECURE)
4455 extern int PlayerUID;
4456 # define getuid() PlayerUID
4457 # define geteuid() PlayerUID
4458 #endif
4459
4460
4461
4462 /*** Color constants ***/
4463
4464
4465 /*
4466  * Angband "attributes" (with symbols, and base (R,G,B) codes)
4467  *
4468  * The "(R,G,B)" codes are given in "fourths" of the "maximal" value,
4469  * and should "gamma corrected" on most (non-Macintosh) machines.
4470  */
4471 #define TERM_DARK                0  /* 'd' */   /* 0,0,0 */
4472 #define TERM_WHITE               1  /* 'w' */   /* 4,4,4 */
4473 #define TERM_SLATE               2  /* 's' */   /* 2,2,2 */
4474 #define TERM_ORANGE              3  /* 'o' */   /* 4,2,0 */
4475 #define TERM_RED                 4  /* 'r' */   /* 3,0,0 */
4476 #define TERM_GREEN               5  /* 'g' */   /* 0,2,1 */
4477 #define TERM_BLUE                6  /* 'b' */   /* 0,0,4 */
4478 #define TERM_UMBER               7  /* 'u' */   /* 2,1,0 */
4479 #define TERM_L_DARK              8  /* 'D' */   /* 1,1,1 */
4480 #define TERM_L_WHITE             9  /* 'W' */   /* 3,3,3 */
4481 #define TERM_VIOLET             10  /* 'v' */   /* 4,0,4 */
4482 #define TERM_YELLOW             11  /* 'y' */   /* 4,4,0 */
4483 #define TERM_L_RED              12  /* 'R' */   /* 4,0,0 */
4484 #define TERM_L_GREEN            13  /* 'G' */   /* 0,4,0 */
4485 #define TERM_L_BLUE             14  /* 'B' */   /* 0,4,4 */
4486 #define TERM_L_UMBER            15  /* 'U' */   /* 3,2,1 */
4487
4488
4489 /*
4490  * Not using graphical tiles for this feature?
4491  */
4492 #define is_ascii_graphics(A) (!((A) & 0x80))
4493
4494
4495 /*** Sound constants ***/
4496
4497
4498 /*
4499  * Mega-Hack -- some primitive sound support (see "main-win.c")
4500  *
4501  * Some "sound" constants for "Term_xtra(TERM_XTRA_SOUND, val)"
4502  */
4503 #define SOUND_HIT        1
4504 #define SOUND_MISS       2
4505 #define SOUND_FLEE       3
4506 #define SOUND_DROP       4
4507 #define SOUND_KILL       5
4508 #define SOUND_LEVEL      6
4509 #define SOUND_DEATH      7
4510 #define SOUND_STUDY      8
4511 #define SOUND_TELEPORT   9
4512 #define SOUND_SHOOT     10
4513 #define SOUND_QUAFF     11
4514 #define SOUND_ZAP       12
4515 #define SOUND_WALK      13
4516 #define SOUND_TPOTHER   14
4517 #define SOUND_HITWALL   15
4518 #define SOUND_EAT       16
4519 #define SOUND_STORE1    17
4520 #define SOUND_STORE2    18
4521 #define SOUND_STORE3    19
4522 #define SOUND_STORE4    20
4523 #define SOUND_DIG       21
4524 #define SOUND_OPENDOOR  22
4525 #define SOUND_SHUTDOOR  23
4526 #define SOUND_TPLEVEL   24
4527 #define SOUND_SCROLL    25
4528 #define SOUND_BUY           26
4529 #define SOUND_SELL          27
4530 #define SOUND_WARN          28
4531 #define SOUND_ROCKET    29 /* Somebody's shooting rockets */
4532 #define SOUND_N_KILL    30 /* The player kills a non-living/undead monster */
4533 #define SOUND_U_KILL    31 /* The player kills a unique */
4534 #define SOUND_QUEST     32 /* The player has just completed a quest */
4535 #define SOUND_HEAL      33 /* The player was healed a little bit */
4536 #define SOUND_X_HEAL    34 /* The player was healed full health */
4537 #define SOUND_BITE      35 /* A monster bites you */
4538 #define SOUND_CLAW      36 /* A monster claws you */
4539 #define SOUND_M_SPELL   37 /* A monster casts a miscellaneous spell */
4540 #define SOUND_SUMMON    38 /* A monster casts a summoning spell  */
4541 #define SOUND_BREATH    39 /* A monster breathes */
4542 #define SOUND_BALL      40 /* A monster casts a ball / bolt spell */
4543 #define SOUND_M_HEAL    41 /* A monster heals itself somehow */
4544 #define SOUND_ATK_SPELL 42 /* A monster casts a misc. offensive spell */
4545 #define SOUND_EVIL      43 /* Something nasty has just happened! */
4546 #define SOUND_TOUCH     44 /* A monster touches you */
4547 #define SOUND_STING     45 /* A monster stings you */
4548 #define SOUND_CRUSH     46 /* A monster crushes / envelopes you */
4549 #define SOUND_SLIME     47 /* A monster drools/spits/etc on you */
4550 #define SOUND_WAIL      48 /* A monster wails */
4551 #define SOUND_WINNER    49 /* Just won the game! */
4552 #define SOUND_FIRE      50 /* An item was burned  */
4553 #define SOUND_ACID      51 /* An item was destroyed by acid */
4554 #define SOUND_ELEC      52 /* An item was destroyed by electricity */
4555 #define SOUND_COLD      53 /* An item was shattered */
4556 #define SOUND_ILLEGAL   54 /* Illegal command attempted */
4557 #define SOUND_FAIL      55 /* Fail to get a spell off / activate an item */
4558 #define SOUND_WAKEUP    56 /* A monster wakes up */
4559 #define SOUND_INVULN    57 /* Invulnerability! */
4560 #define SOUND_FALL      58 /* Falling through a trapdoor... */
4561 #define SOUND_PAIN      59 /* A monster is in pain! */
4562 #define SOUND_DESTITEM  60 /* An item was destroyed by misc. means */
4563 #define SOUND_MOAN      61 /* A monster makes a moan/beg/insult attack */
4564 #define SOUND_SHOW      62 /* A monster makes a "show" attack */
4565 #define SOUND_UNUSED    63 /* (no sound for gaze attacks) */
4566 #define SOUND_EXPLODE   64 /* Something (or somebody) explodes */
4567 #define SOUND_GLASS     65 /* A glass feature was crashed */
4568
4569 /*
4570  * Mega-Hack -- maximum known sounds
4571  */
4572 #define SOUND_MAX 66
4573
4574 #define MAX_VIRTUE 18
4575
4576 #define V_COMPASSION        1
4577 #define V_HONOUR            2
4578 #define V_JUSTICE           3
4579 #define V_SACRIFICE         4
4580 #define V_KNOWLEDGE         5
4581 #define V_FAITH             6
4582 #define V_ENLIGHTEN         7
4583 #define V_ENCHANT           8
4584 #define V_CHANCE            9
4585 #define V_NATURE           10
4586 #define V_HARMONY          11
4587 #define V_VITALITY         12
4588 #define V_UNLIFE           13
4589 #define V_PATIENCE         14
4590 #define V_TEMPERANCE       15
4591 #define V_DILIGENCE        16
4592 #define V_VALOUR           17
4593 #define V_INDIVIDUALISM    18
4594
4595
4596 /*** Hack ***/
4597
4598
4599 /*
4600  * Hack -- attempt to reduce various values
4601  */
4602 #ifdef ANGBAND_LITE
4603 # undef MACRO_MAX
4604 # define MACRO_MAX      128
4605 # undef QUARK_MAX
4606 # define QUARK_MAX      128
4607 # undef MESSAGE_MAX
4608 # define MESSAGE_MAX    128
4609 # undef MESSAGE_BUF
4610 # define MESSAGE_BUF    4096
4611 #endif
4612
4613
4614 /*
4615  * Buildings actions
4616  */
4617 #define BACT_NOTHING                 0
4618 #define BACT_RESEARCH_ITEM           1
4619 #define BACT_TOWN_HISTORY            2
4620 #define BACT_RACE_LEGENDS            3
4621 #define BACT_GREET_KING              4
4622 #define BACT_KING_LEGENDS            5
4623 #define BACT_QUEST                   6
4624 #define BACT_XXX_UNUSED              7
4625 #define BACT_POSTER                  8
4626 #define BACT_ARENA_RULES             9
4627 #define BACT_ARENA                  10
4628 #define BACT_ARENA_LEGENDS          11
4629 #define BACT_IN_BETWEEN             12
4630 #define BACT_GAMBLE_RULES           13
4631 #define BACT_CRAPS                  14
4632 #define BACT_SPIN_WHEEL             15
4633 #define BACT_DICE_SLOTS             16
4634 #define BACT_REST                   17
4635 #define BACT_FOOD                   18
4636 #define BACT_RUMORS                 19
4637 #define BACT_RESEARCH_MONSTER       20
4638 #define BACT_COMPARE_WEAPONS        21
4639 #define BACT_LEGENDS                22
4640 #define BACT_ENCHANT_WEAPON         23
4641 #define BACT_ENCHANT_ARMOR          24
4642 #define BACT_RECHARGE               25
4643 #define BACT_IDENTS                 26
4644 #define BACT_LEARN                  27
4645 #define BACT_HEALING                28
4646 #define BACT_RESTORE                29
4647 #define BACT_ENCHANT_ARROWS         30
4648 #define BACT_ENCHANT_BOW            31
4649 #define BACT_GREET                  32
4650 #define BACT_RECALL                 33
4651 #define BACT_TELEPORT_LEVEL         34
4652 #define BACT_LOSE_MUTATION          35
4653 #define BACT_BATTLE                 36
4654 #define BACT_TSUCHINOKO             37
4655 #define BACT_TARGET                 38
4656 #define BACT_KUBI                   39
4657 #define BACT_KANKIN                 40
4658 #define BACT_HEIKOUKA               41
4659 #define BACT_TELE_TOWN              42
4660 #define BACT_POKER                  43
4661 #define BACT_IDENT_ONE              44
4662 #define BACT_RECHARGE_ALL           45
4663 #define BACT_EVAL_AC                    46
4664 #define BACT_BROKEN_WEAPON          47
4665 #define MAX_BACT                    48
4666
4667 /*
4668  * Quest status
4669  */
4670 #define QUEST_STATUS_UNTAKEN              0
4671 #define QUEST_STATUS_TAKEN                1
4672 #define QUEST_STATUS_COMPLETED            2
4673 #define QUEST_STATUS_REWARDED             3
4674 #define QUEST_STATUS_FINISHED             4
4675 #define QUEST_STATUS_FAILED               5
4676 #define QUEST_STATUS_FAILED_DONE          6
4677 #define QUEST_STATUS_STAGE_COMPLETED      7
4678
4679 /*
4680  * Quest type
4681  */
4682 #define QUEST_TYPE_KILL_LEVEL                1
4683 #define QUEST_TYPE_KILL_ANY_LEVEL            2
4684 #define QUEST_TYPE_FIND_ARTIFACT             3
4685 #define QUEST_TYPE_FIND_EXIT                 4
4686 #define QUEST_TYPE_KILL_NUMBER               5
4687 #define QUEST_TYPE_KILL_ALL                  6
4688 #define QUEST_TYPE_RANDOM                    7
4689 #define QUEST_TYPE_TOWER                     8
4690
4691 /*
4692  * Initialization flags
4693  */
4694 #define INIT_NAME_ONLY          0x01
4695 #define INIT_SHOW_TEXT          0x02
4696 #define INIT_ASSIGN             0x04
4697 #define INIT_CREATE_DUNGEON     0x08
4698 #define INIT_ONLY_FEATURES      0x10
4699 #define INIT_ONLY_BUILDINGS     0x20
4700
4701 /*
4702  * Quest flags
4703  */
4704 #define QUEST_FLAG_SILENT  0x01 /* no messages fro completion */
4705 #define QUEST_FLAG_PRESET  0x02 /* quest is outside the main dungeon */
4706 #define QUEST_FLAG_ONCE    0x04 /* quest is marked finished after leaving */
4707 #define QUEST_FLAG_TOWER   0x08 /* Tower quest is special */
4708
4709 /*
4710  * Available graphic modes
4711  */
4712 #define GRAPHICS_NONE       0
4713 #define GRAPHICS_ORIGINAL   1
4714 #define GRAPHICS_ADAM_BOLT  2
4715
4716 /*
4717  * Modes for the random name generator
4718  */
4719 #define NAME_DWARF  1
4720 #define NAME_ELF    2
4721 #define NAME_GNOME  3
4722 #define NAME_HOBBIT 4
4723 #define NAME_HUMAN  5
4724 #define NAME_ORC    6
4725
4726 #ifdef JP
4727 #define JVERB_AND 1
4728 #define JVERB_TO  2
4729 #define JVERB_OR  3
4730 #endif
4731
4732 /*
4733  * Modes for the tokenizer
4734  */
4735 #define TOKENIZE_CHECKQUOTE 0x01  /* Special handling of single quotes */
4736
4737 /*
4738  * Parse errors
4739  */
4740 #define PARSE_ERROR_GENERIC                  1
4741 #define PARSE_ERROR_ABSOLETE_FILE            2
4742 #define PARSE_ERROR_MISSING_RECORD_HEADER    3
4743 #define PARSE_ERROR_NON_SEQUENTIAL_RECORDS   4
4744 #define PARSE_ERROR_INVALID_FLAG             5
4745 #define PARSE_ERROR_UNDEFINED_DIRECTIVE      6
4746 #define PARSE_ERROR_OUT_OF_MEMORY            7
4747 #define PARSE_ERROR_OUT_OF_BOUNDS            8
4748 #define PARSE_ERROR_TOO_FEW_ARGUMENTS        9
4749 #define PARSE_ERROR_UNDEFINED_TERRAIN_TAG   10
4750 #define PARSE_ERROR_MAX                     11
4751
4752 #define GINOU_SUDE       0
4753 #define GINOU_NITOURYU   1
4754 #define GINOU_RIDING      2
4755
4756 /* Proficiency level */
4757 #define EXP_LEVEL_UNSKILLED 0
4758 #define EXP_LEVEL_BEGINNER  1
4759 #define EXP_LEVEL_SKILLED   2
4760 #define EXP_LEVEL_EXPERT    3
4761 #define EXP_LEVEL_MASTER    4
4762
4763 /* Proficiency of weapons and misc. skills (except riding) */
4764 #define WEAPON_EXP_UNSKILLED     0
4765 #define WEAPON_EXP_BEGINNER   4000
4766 #define WEAPON_EXP_SKILLED    6000
4767 #define WEAPON_EXP_EXPERT     7000
4768 #define WEAPON_EXP_MASTER     8000
4769
4770 /* Proficiency of riding */
4771 #define RIDING_EXP_UNSKILLED     0
4772 #define RIDING_EXP_BEGINNER    500
4773 #define RIDING_EXP_SKILLED    2000
4774 #define RIDING_EXP_EXPERT     5000
4775 #define RIDING_EXP_MASTER     8000
4776
4777 /* Proficiency of spells */
4778 #define SPELL_EXP_UNSKILLED      0
4779 #define SPELL_EXP_BEGINNER     900
4780 #define SPELL_EXP_SKILLED     1200
4781 #define SPELL_EXP_EXPERT      1400
4782 #define SPELL_EXP_MASTER      1600
4783
4784 #define NO_TOWN 6
4785 #define SECRET_TOWN 5
4786
4787 #define NIKKI_HIGAWARI     0
4788 #define NIKKI_BUNSHOU      1
4789 #define NIKKI_ART          2
4790 #define NIKKI_UNIQUE       3
4791 #define NIKKI_FIX_QUEST_C  4
4792 #define NIKKI_FIX_QUEST_F  5
4793 #define NIKKI_RAND_QUEST_C 6
4794 #define NIKKI_RAND_QUEST_F 7
4795 #define NIKKI_MAXDEAPTH    8
4796 #define NIKKI_TRUMP        9
4797 #define NIKKI_STAIR       10
4798 #define NIKKI_RECALL      11
4799 #define NIKKI_TO_QUEST    12
4800 #define NIKKI_TELE_LEV    13
4801 #define NIKKI_BUY         14
4802 #define NIKKI_SELL        15
4803 #define NIKKI_ARENA       16
4804 #define NIKKI_HANMEI      17
4805 #define NIKKI_LEVELUP     18
4806 #define NIKKI_GAMESTART   19
4807 #define NIKKI_WIZ_TELE    20
4808 #define NIKKI_NAMED_PET   21
4809 #define NIKKI_PAT_TELE    22
4810
4811 #define RECORD_NAMED_PET_NAME        0
4812 #define RECORD_NAMED_PET_UNNAME      1
4813 #define RECORD_NAMED_PET_DISMISS     2
4814 #define RECORD_NAMED_PET_DEATH       3
4815 #define RECORD_NAMED_PET_MOVED       4
4816 #define RECORD_NAMED_PET_LOST_SIGHT  5
4817 #define RECORD_NAMED_PET_DESTROY     6
4818 #define RECORD_NAMED_PET_EARTHQUAKE  7
4819 #define RECORD_NAMED_PET_GENOCIDE    8
4820 #define RECORD_NAMED_PET_WIZ_ZAP     9
4821 #define RECORD_NAMED_PET_TELE_LEVEL  10
4822 #define RECORD_NAMED_PET_BLAST       11
4823 #define RECORD_NAMED_PET_HEAL_LEPER  12
4824 #define RECORD_NAMED_PET_COMPACT     13
4825 #define RECORD_NAMED_PET_LOSE_PARENT 14
4826
4827 #define MAX_MANE 16
4828 #define MAX_MONSPELLS 96
4829 #define MONSPELL_TYPE_BOLT 1
4830 #define MONSPELL_TYPE_BALL 2
4831 #define MONSPELL_TYPE_BREATH 3
4832 #define MONSPELL_TYPE_SUMMON 4
4833 #define MONSPELL_TYPE_OTHER 5
4834
4835 #define EATER_EXT 36
4836 #define EATER_CHARGE 0x10000L
4837 #define EATER_ROD_CHARGE 0x10L
4838
4839 #define MAX_KUBI 20
4840
4841 #define DETECT_RAD_DEFAULT 30
4842 #define DETECT_RAD_MAP     30
4843 #define DETECT_RAD_ALL     255
4844
4845 /* Monster Spells */
4846 #define MS_SHRIEK         0
4847 #define MS_XXX1           1
4848 #define MS_DISPEL         2
4849 #define MS_ROCKET         3
4850 #define MS_SHOOT          4
4851 #define MS_XXX2           5
4852 #define MS_XXX3           6
4853 #define MS_XXX4           7
4854 #define MS_BR_ACID        8
4855 #define MS_BR_ELEC        9
4856 #define MS_BR_FIRE        10
4857 #define MS_BR_COLD        11
4858 #define MS_BR_POIS        12
4859 #define MS_BR_NETHER      13
4860 #define MS_BR_LITE        14
4861 #define MS_BR_DARK        15
4862 #define MS_BR_CONF        16
4863 #define MS_BR_SOUND       17
4864 #define MS_BR_CHAOS       18
4865 #define MS_BR_DISEN       19
4866 #define MS_BR_NEXUS       20
4867 #define MS_BR_TIME        21
4868 #define MS_BR_INERTIA     22
4869 #define MS_BR_GRAVITY     23
4870 #define MS_BR_SHARDS      24
4871 #define MS_BR_PLASMA      25
4872 #define MS_BR_FORCE       26
4873 #define MS_BR_MANA        27
4874 #define MS_BALL_NUKE      28
4875 #define MS_BR_NUKE        29
4876 #define MS_BALL_CHAOS     30
4877 #define MS_BR_DISI        31
4878 #define MS_BALL_ACID      32
4879 #define MS_BALL_ELEC      33
4880 #define MS_BALL_FIRE      34
4881 #define MS_BALL_COLD      35
4882 #define MS_BALL_POIS      36
4883 #define MS_BALL_NETHER    37
4884 #define MS_BALL_WATER     38
4885 #define MS_BALL_MANA      39
4886 #define MS_BALL_DARK      40
4887 #define MS_DRAIN_MANA     41
4888 #define MS_MIND_BLAST     42
4889 #define MS_BRAIN_SMASH    43
4890 #define MS_CAUSE_1        44
4891 #define MS_CAUSE_2        45
4892 #define MS_CAUSE_3        46
4893 #define MS_CAUSE_4        47
4894 #define MS_BOLT_ACID      48
4895 #define MS_BOLT_ELEC      49
4896 #define MS_BOLT_FIRE      50
4897 #define MS_BOLT_COLD      51
4898 #define MS_STARBURST      52
4899 #define MS_BOLT_NETHER    53
4900 #define MS_BOLT_WATER     54
4901 #define MS_BOLT_MANA      55
4902 #define MS_BOLT_PLASMA    56
4903 #define MS_BOLT_ICE       57
4904 #define MS_MAGIC_MISSILE  58
4905 #define MS_SCARE          59
4906 #define MS_BLIND          60
4907 #define MS_CONF           61
4908 #define MS_SLOW           62
4909 #define MS_SLEEP          63
4910 #define MS_SPEED          64
4911 #define MS_HAND_DOOM      65
4912 #define MS_HEAL           66
4913 #define MS_INVULNER       67
4914 #define MS_BLINK          68
4915 #define MS_TELEPORT       69
4916 #define MS_WORLD          70
4917 #define MS_SPECIAL        71
4918 #define MS_TELE_TO        72
4919 #define MS_TELE_AWAY      73
4920 #define MS_TELE_LEVEL     74
4921 #define MS_PSY_SPEAR      75
4922 #define MS_DARKNESS       76
4923 #define MS_MAKE_TRAP      77
4924 #define MS_FORGET         78
4925 #define MS_RAISE_DEAD     79
4926 #define MS_S_KIN          80
4927 #define MS_S_CYBER        81
4928 #define MS_S_MONSTER      82
4929 #define MS_S_MONSTERS     83
4930 #define MS_S_ANT          84
4931 #define MS_S_SPIDER       85
4932 #define MS_S_HOUND        86
4933 #define MS_S_HYDRA        87
4934 #define MS_S_ANGEL        88
4935 #define MS_S_DEMON        89
4936 #define MS_S_UNDEAD       90
4937 #define MS_S_DRAGON       91
4938 #define MS_S_HI_UNDEAD    92
4939 #define MS_S_HI_DRAGON    93
4940 #define MS_S_AMBERITE     94
4941 #define MS_S_UNIQUE       95
4942
4943
4944 #define MON_BEGGAR        12
4945 #define MON_LEPER         13
4946 #define MON_BLACK_MARKET  14
4947 #define MON_LION_HEART    19
4948 #define MON_GHB           39
4949 #define MON_NOV_PRIEST    45
4950 #define MON_GRIP          53
4951 #define MON_WOLF          54
4952 #define MON_FANG          55
4953 #define MON_LOUSE         69
4954 #define MON_PIRANHA       70
4955 #define MON_COPPER_COINS  85
4956 #define MON_NOV_PALADIN   97
4957 #define MON_GREEN_G       100
4958 #define MON_NOV_PRIEST_G  109
4959 #define MON_SILVER_COINS  117
4960 #define MON_D_ELF         122
4961 #define MON_MANES         128
4962 #define MON_LOST_SOUL     133
4963 #define MON_ROBIN_HOOD    138
4964 #define MON_NOV_PALADIN_G 147
4965 #define MON_PHANTOM_W     152
4966 #define MON_WOUNDED_BEAR  159
4967 #define MON_D_ELF_MAGE    178
4968 #define MON_D_ELF_WARRIOR 182
4969 #define MON_BLUE_HORROR   189
4970 #define MON_GOLD_COINS    195
4971 #define MON_VORPAL_BUNNY  205
4972 #define MON_MASTER_YEEK   224
4973 #define MON_PRIEST        225
4974 #define MON_D_ELF_PRIEST  226
4975 #define MON_TIGER         230
4976 #define MON_MITHRIL_COINS 239
4977 #define MON_DRUID         241
4978 #define MON_PINK_HORROR   242
4979 #define MON_HILL_GIANT    255
4980 #define MON_WERERAT       270
4981 #define MON_UMBER_HULK    283
4982 #define MON_ORC_CAPTAIN   285
4983 #define MON_BERSERKER     293
4984 #define MON_IMP           296
4985 #define MON_SHAGRAT       314
4986 #define MON_GORBAG        315
4987 #define MON_STONE_GIANT   321
4988 #define MON_LIZARD_KING   332
4989 #define MON_WYVERN        334
4990 #define MON_SABRE_TIGER   339
4991 #define MON_D_ELF_LORD    348
4992 #define MON_FIRE_VOR      354
4993 #define MON_WATER_VOR     355
4994 #define MON_ARCH_VILE     357
4995 #define MON_COLD_VOR      358
4996 #define MON_ENERGY_VOR    359
4997 #define MON_IRON_GOLEM    367
4998 #define MON_JADE_MONK     370
4999 #define MON_D_ELF_WARLOCK 375
5000 #define MON_HAGEN         383
5001 #define MON_MENELDOR      384
5002 #define MON_PHANTOM_B     385
5003 #define MON_C_CRAWLER     395
5004 #define MON_XICLOTLAN     396
5005 #define MON_D_ELF_DRUID   400
5006 #define MON_TROLL_PRIEST  403
5007 #define MON_GWAIHIR       410
5008 #define MON_ANGEL         417
5009 #define MON_ADAMANT_COINS 423
5010 #define MON_COLBRAN       435
5011 #define MON_SPIRIT_NAGA   436
5012 #define MON_GACHAPIN      441
5013 #define MON_BASILISK      453
5014 #define MON_ARCHANGEL     456
5015 #define MON_MITHRIL_GOLEM 464
5016 #define MON_THORONDOR     468
5017 #define MON_SHADOW_DRAKE  471
5018 #define MON_GHOST         477
5019 #define MON_OGRE_SHAMAN   479
5020 #define MON_GHOUL_KING    483
5021 #define MON_NINJA         485
5022 #define MON_BICLOPS       490
5023 #define MON_IVORY_MONK    492
5024 #define MON_LOG_MASTER    498
5025 #define MON_ETHER_DRAKE   504
5026 #define MON_GOEMON        505
5027 #define MON_CHERUB        511
5028 #define MON_WATER_ELEM    512
5029 #define MON_JURT          517
5030 #define MON_LICH          518
5031 #define MON_BLOODLETTER   523
5032 #define MON_HALFLING_S    539
5033 #define MON_GRAV_HOUND    540
5034 #define MON_REVENANT      555
5035 #define MON_RAAL          557
5036 #define MON_COLOSSUS      558
5037 #define MON_NIGHTBLADE    564
5038 #define MON_ELDER_THING   569
5039 #define MON_CRYPT_THING   577
5040 #define MON_NEXUS_VOR     587
5041 #define MON_PLASMA_VOR    588
5042 #define MON_TIME_VOR      589
5043 #define MON_M_MH_DRAGON   593
5044 #define MON_MANDOR        598
5045 #define MON_SHIM_VOR      600
5046 #define MON_SERAPH        605
5047 #define MON_BARON_HELL    609
5048 #define MON_KAVLAX        616
5049 #define MON_ETTIN         621
5050 #define MON_VAMPIRE_LORD  623
5051 #define MON_JUBJUB        640
5052 #define MON_G_C_DRAKE     646
5053 #define MON_CLUB_DEMON    648
5054 #define MON_F_ANGEL       652
5055 #define MON_D_ELF_SORC    657
5056 #define MON_MASTER_LICH   658
5057 #define MON_RINALDO       660
5058 #define MON_ARCHON        661
5059 #define MON_UND_BEHOLDER  664
5060 #define MON_IRON_LICH     666
5061 #define MON_JACK_SHADOWS  670
5062 #define MON_LLOIGOR       682
5063 #define MON_DREADMASTER   690
5064 #define MON_DROLEM        691
5065 #define MON_DAWN          693
5066 #define MON_NAZGUL        696
5067 #define MON_SMAUG         697
5068 #define MON_STORMBRINGER  698
5069 #define MON_ULTRA_PALADIN 699
5070 #define MON_G_TITAN       702
5071 #define MON_S_TYRANNO     705
5072 #define MON_FAFNER        712
5073 #define MON_G_BALROG      720
5074 #define MON_TIME_HOUND    725
5075 #define MON_PLASMA_HOUND  726
5076 #define MON_BULLGATES     732
5077 #define MON_SANTACLAUS    733
5078 #define MON_LORD_CHAOS    737
5079 #define MON_TINDALOS      739
5080 #define MON_DEMILICH      742
5081 #define MON_NIGHTCRAWLER  744
5082 #define MON_CHAOS_VOR     751
5083 #define MON_AETHER_VOR    752
5084 #define MON_FUNDIN        762
5085 #define MON_DWORKIN       763
5086 #define MON_NIGHTWALKER   768
5087 #define MON_RAPHAEL       769
5088 #define MON_SARUMAN       771
5089 #define MON_GANDALF       772
5090 #define MON_BRAND         773
5091 #define MON_SHADOWLORD    774
5092 #define MON_ARCHLICH      776
5093 #define MON_JABBERWOCK    778
5094 #define MON_CHAOS_HOUND   779
5095 #define MON_ULT_BEHOLDER  781
5096 #define MON_SHAMBLER      786
5097 #define MON_BLEYS         789
5098 #define MON_FIONA         791
5099 #define MON_SKY_DRAKE     793
5100 #define MON_JULIAN        794
5101 #define MON_BLACK_REAVER  798
5102 #define MON_CAINE         799
5103 #define MON_GERARD        807
5104 #define MON_UNGOLIANT     808
5105 #define MON_ATLACH_NACHA  809
5106 #define MON_Y_GOLONAC     810
5107 #define MON_AETHER_HOUND  811
5108 #define MON_WARP_DEMON    812
5109 #define MON_ERIC          813
5110 #define MON_UNMAKER       815
5111 #define MON_CYBER         816
5112 #define MON_KLING         819
5113 #define MON_CORWIN        820
5114 #define MON_ANGMAR        825
5115 #define MON_CANTORAS      830
5116 #define MON_GODZILLA      832
5117 #define MON_SPAWN_CTH     836
5118 #define MON_SURTUR        837
5119 #define MON_TARRASQUE     838
5120 #define MON_LUNGORTHIN    839
5121 #define MON_CYBER_KING    843
5122 #define MON_WYRM_POWER    847
5123 #define MON_NODENS        849
5124 #define MON_JORMUNGAND    854
5125 #define MON_DESTROYER     855
5126 #define MON_GOTHMOG       856
5127 #define MON_G_CTHULHU     857
5128 #define MON_SAURON        858
5129 #define MON_UNICORN_ORD   859
5130 #define MON_OBERON        860
5131 #define MON_MORGOTH       861
5132 #define MON_SERPENT       862
5133 #define MON_ONE_RING      864
5134 #define MON_CAAWS         866
5135 #define MON_CULVERIN      867
5136 #define MON_EBONY_MONK    870
5137 #define MON_HAGURE        871
5138 #define MON_OROCHI        872
5139 #define MON_ECHIZEN       873
5140 #define MON_SPECT_WYRM    874
5141 #define MON_DIO           878
5142 #define MON_OHMU          879
5143 #define MON_WONG          880
5144 #define MON_ZOMBI_SERPENT 883
5145 #define MON_D_ELF_SHADE   886
5146 #define MON_MANA_HOUND    887
5147 #define MON_VENOM_WYRM    890
5148 #define MON_TROLL_KING    894
5149 #define MON_BAZOOKER      896
5150 #define MON_SHARD_VOR     897
5151 #define MON_ELF_LORD      900
5152 #define MON_MASTER_MYS    916
5153 #define MON_G_MASTER_MYS  917
5154 #define MON_IE            921
5155 #define MON_TSUCHINOKO    926
5156 #define MON_GCWADL        929
5157 #define MON_LOCKE_CLONE   930
5158 #define MON_CALDARM       931
5159 #define MON_BANORLUPART   932
5160 #define MON_BANOR         933
5161 #define MON_LUPART        934
5162 #define MON_KENSHIROU     936
5163 #define MON_W_KNIGHT      938
5164 #define MON_PLANETAR      942
5165 #define MON_SOLAR         943
5166 #define MON_BIKETAL       945
5167 #define MON_RICH          948
5168 #define MON_IKETA         949
5169 #define MON_B_DEATH_SWORD 953
5170 #define MON_YASE_HORSE    955
5171 #define MON_HORSE         956
5172 #define MON_BOTEI         963
5173 #define MON_KAGE          964
5174 #define MON_JAIAN         967
5175 #define MON_BELD          973
5176 #define MON_THAT_BAT      975
5177 #define MON_SHUTEN        979
5178 #define MON_FENGHUANG     988
5179 #define MON_KIRIN         989
5180 #define MON_BAHAMUT       1000
5181 #define MON_SUKE          1001
5182 #define MON_KAKU          1002
5183 #define MON_GHOST_Q       1003
5184 #define MON_PIP           1004
5185 #define MON_A_GOLD        1010
5186 #define MON_A_SILVER      1011
5187 #define MON_ROLENTO       1013
5188 #define MON_RAOU          1018
5189 #define MON_SHURYUUDAN    1023
5190 #define MON_WAHHA         1031
5191 #define MON_DEBBY         1032
5192 #define MON_KNI_TEMPLAR   1037
5193 #define MON_PALADIN       1038
5194 #define MON_CHAMELEON     1040
5195 #define MON_CHAMELEON_K   1041
5196 #define MON_TOPAZ_MONK    1047
5197 #define MON_M_MINDCRAFTER 1056
5198 #define MON_ELDER_VAMPIRE 1058
5199 #define MON_NOBORTA       1059
5200 #define MON_MORI_TROLL    1060
5201 #define MON_BARNEY        1061
5202 #define MON_GROO          1062
5203 #define MON_LOUSY         1063
5204 #define MON_WYRM_SPACE    1064
5205 #define MON_JIZOTAKO      1065
5206 #define MON_TANUKI        1067
5207 #define MON_HATOPOPPO     1083
5208 #define MON_KOGAN         1096
5209
5210 /* Maximum "Nazguls" number */
5211 #define MAX_NAZGUL_NUM 5
5212
5213 #define DO_AUTOPICK       0x01
5214 #define DO_AUTODESTROY    0x02
5215 #define DO_DISPLAY        0x04
5216 #define DONT_AUTOPICK     0x08
5217 #define ITEM_DISPLAY      0x10
5218 #define DO_QUERY_AUTOPICK 0x20
5219
5220
5221 #define MAGIC_GLOVE_REDUCE_MANA 0x0001
5222 #define MAGIC_FAIL_5PERCENT     0x0002
5223 #define MAGIC_GAIN_EXP          0x0004
5224
5225 #define VIRTUE_LARGE 1
5226 #define VIRTUE_SMALL 2
5227
5228 #define SPELL_DD_S 27
5229 #define SPELL_DD_T 13
5230 #define SPELL_SW   22
5231 #define SPELL_KABE 20
5232
5233 #define KNOW_STAT   0x01
5234 #define KNOW_HPRATE 0x02
5235
5236 /*
5237  * Music songs
5238  */
5239 #define MUSIC_NONE              0
5240 #define MUSIC_SLOW              1
5241 #define MUSIC_BLESS             2
5242 #define MUSIC_STUN              3
5243 #define MUSIC_L_LIFE            4
5244 #define MUSIC_FEAR              5
5245 #define MUSIC_HERO              6
5246 #define MUSIC_MIND              7
5247 #define MUSIC_STEALTH           8
5248 #define MUSIC_ID                9
5249 #define MUSIC_CONF              10
5250 #define MUSIC_SOUND             11
5251 #define MUSIC_CHARM             12
5252 #define MUSIC_WALL              13
5253 #define MUSIC_RESIST            14
5254 #define MUSIC_SPEED             15
5255 #define MUSIC_DISPEL            16
5256 #define MUSIC_SARUMAN           17
5257 #define MUSIC_QUAKE             18
5258 #define MUSIC_STASIS            19
5259 #define MUSIC_SHERO             20
5260 #define MUSIC_H_LIFE            21
5261 #define MUSIC_INVULN            22
5262 #define MUSIC_PSI               23
5263
5264 #define MUSIC_DETECT            101
5265
5266 #define music_singing(X) ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] == (X)))
5267 #define music_singing_any() ((p_ptr->pclass == CLASS_BARD) && p_ptr->magic_num1[0])
5268
5269 #define HISSATSU_NONE   0
5270 #define HISSATSU_2      1
5271 #define HISSATSU_3WAY   2
5272 #define HISSATSU_SUTEMI 3
5273 #define HISSATSU_FIRE   4
5274 #define HISSATSU_COLD   5
5275 #define HISSATSU_POISON 6
5276 #define HISSATSU_ELEC   7
5277 #define HISSATSU_NYUSIN 8
5278 #define HISSATSU_FUKI   9
5279 #define HISSATSU_MAJIN  10
5280 #define HISSATSU_BOOMER 11
5281 #define HISSATSU_DRAIN  12
5282 #define HISSATSU_SEKIRYUKA 13
5283 #define HISSATSU_OTAKEBI 14
5284 #define HISSATSU_SHOUGE 15
5285 #define HISSATSU_CONF   16
5286 #define HISSATSU_ISSEN  17
5287 #define HISSATSU_KYUSHO 18
5288 #define HISSATSU_KONSIN 19
5289 #define HISSATSU_HYAKU  20
5290 #define HISSATSU_MINEUCHI 21
5291 #define HISSATSU_MEKIKI 22
5292 #define HISSATSU_ZANMA  23
5293 #define HISSATSU_UNDEAD 24
5294 #define HISSATSU_HAGAN  25
5295 #define HISSATSU_QUAKE  26
5296 #define HISSATSU_COUNTER 27
5297 #define HISSATSU_HARAI  28
5298 #define HISSATSU_3DAN   29
5299 #define HISSATSU_100NIN 30
5300
5301 #define HISSATSU_IAI    100
5302
5303 /*
5304  *  Special essence id for Weapon smith
5305  */
5306 #define MIN_SPECIAL_ESSENCE 200
5307
5308 #define ESSENCE_ATTACK        (MIN_SPECIAL_ESSENCE + 0)
5309 #define ESSENCE_AC            (MIN_SPECIAL_ESSENCE + 1)
5310 #define ESSENCE_TMP_RES_ACID  (MIN_SPECIAL_ESSENCE + 2)
5311 #define ESSENCE_TMP_RES_ELEC  (MIN_SPECIAL_ESSENCE + 3)
5312 #define ESSENCE_TMP_RES_FIRE  (MIN_SPECIAL_ESSENCE + 4)
5313 #define ESSENCE_TMP_RES_COLD  (MIN_SPECIAL_ESSENCE + 5)
5314 #define ESSENCE_SH_FIRE       (MIN_SPECIAL_ESSENCE + 6)
5315 #define ESSENCE_SH_ELEC       (MIN_SPECIAL_ESSENCE + 7)
5316 #define ESSENCE_SH_COLD       (MIN_SPECIAL_ESSENCE + 8)
5317 #define ESSENCE_RESISTANCE    (MIN_SPECIAL_ESSENCE + 9)
5318 #define ESSENCE_SUSTAIN       (MIN_SPECIAL_ESSENCE + 10)
5319 #define ESSENCE_SLAY_GLOVE    (MIN_SPECIAL_ESSENCE + 11)
5320
5321
5322 #define DUNGEON_MODE_NONE       0
5323 #define DUNGEON_MODE_AND        1
5324 #define DUNGEON_MODE_NAND       2
5325 #define DUNGEON_MODE_OR         3
5326 #define DUNGEON_MODE_NOR        4
5327
5328 /*** Dungeon type flags -- DG ***/
5329 #define DF1_WINNER              0x00000001L
5330 #define DF1_MAZE                0x00000002L
5331 #define DF1_SMALLEST            0x00000004L
5332 #define DF1_BEGINNER            0x00000008L
5333 #define DF1_BIG                 0x00000010L
5334 #define DF1_NO_DOORS            0x00000020L
5335 #define DF1_WATER_RIVER         0x00000040L
5336 #define DF1_LAVA_RIVER          0x00000080L
5337 #define DF1_CURTAIN             0x00000100L
5338 #define DF1_GLASS_DOOR          0x00000200L
5339 #define DF1_CAVE                0x00000400L
5340 #define DF1_CAVERN              0x00000800L
5341 #define DF1_ARCADE              0x00001000L
5342 #define DF1_XXX13               0x00002000L
5343 #define DF1_XXX14               0x00004000L
5344 #define DF1_XXX15               0x00008000L
5345 #define DF1_FORGET              0x00010000L
5346 #define DF1_LAKE_WATER          0x00020000L
5347 #define DF1_LAKE_LAVA           0x00040000L
5348 #define DF1_LAKE_RUBBLE         0x00080000L
5349 #define DF1_LAKE_TREE           0x00100000L
5350 #define DF1_NO_VAULT            0x00200000L
5351 #define DF1_ARENA               0x00400000L
5352 #define DF1_DESTROY             0x00800000L
5353 #define DF1_GLASS_ROOM          0x01000000L
5354 #define DF1_NO_CAVE             0x02000000L
5355 #define DF1_NO_MAGIC            0x04000000L
5356 #define DF1_NO_MELEE            0x08000000L
5357 #define DF1_CHAMELEON           0x10000000L
5358 #define DF1_DARKNESS            0x20000000L
5359 #define DF1_XXX30               0x40000000L
5360 #define DF1_XXX31               0x80000000L
5361
5362 #define DF1_LAKE_MASK (DF1_LAKE_WATER | DF1_LAKE_LAVA | DF1_LAKE_RUBBLE | DF1_LAKE_TREE)
5363
5364 #define DUNGEON_ANGBAND  1
5365 #define DUNGEON_GALGALS  2
5366 #define DUNGEON_ORC      3
5367 #define DUNGEON_MAZE     4
5368 #define DUNGEON_DRAGON   5
5369 #define DUNGEON_GRAVE    6
5370 #define DUNGEON_WOOD     7
5371 #define DUNGEON_VOLCANO  8
5372 #define DUNGEON_HELL     9
5373 #define DUNGEON_HEAVEN   10
5374 #define DUNGEON_OCEAN    11
5375 #define DUNGEON_CASTLE   12
5376 #define DUNGEON_CTH      13
5377 #define DUNGEON_MOUNTAIN 14
5378 #define DUNGEON_GOLD     15
5379 #define DUNGEON_NO_MAGIC 16
5380 #define DUNGEON_NO_MELEE 17
5381 #define DUNGEON_CHAMELEON 18
5382 #define DUNGEON_DARKNESS 19
5383
5384
5385 #define DUNGEON_FEAT_PROB_NUM 3
5386
5387
5388 /*
5389  * Flags for change floor mode
5390  */
5391 #define CFM_UP           0x0001  /* Move up */
5392 #define CFM_DOWN         0x0002  /* Move down */
5393 #define CFM_LONG_STAIRS  0x0004  /* Randomly occurred long stairs/shaft */
5394 #define CFM_XXX          0x0008  /* XXX */
5395 #define CFM_SHAFT        0x0010  /* Shaft */
5396 #define CFM_RAND_PLACE   0x0020  /* Arrive at random grid */
5397 #define CFM_RAND_CONNECT 0x0040  /* Connect with random stairs */
5398 #define CFM_SAVE_FLOORS  0x0080  /* Save floors */
5399 #define CFM_NO_RETURN    0x0100  /* Flee from random quest etc... */
5400 #define CFM_FIRST_FLOOR  0x0200  /* Create exit from the dungeon */
5401
5402
5403 /*
5404  * Flags for save/load temporal saved floor file
5405  */
5406 #define SLF_SECOND       0x0001  /* Called from another save/load function */
5407 #define SLF_NO_KILL      0x0002  /* Don't kill temporal files */
5408
5409
5410 /*
5411  * Flags for wr_item()/rd_item()
5412  */
5413 #define SAVE_ITEM_PVAL         0x00000001
5414 #define SAVE_ITEM_DISCOUNT     0x00000002
5415 #define SAVE_ITEM_NUMBER       0x00000004
5416 #define SAVE_ITEM_NAME1        0x00000008
5417 #define SAVE_ITEM_NAME2        0x00000010
5418 #define SAVE_ITEM_TIMEOUT      0x00000020
5419 #define SAVE_ITEM_TO_H         0x00000040
5420 #define SAVE_ITEM_TO_D         0x00000080
5421 #define SAVE_ITEM_TO_A         0x00000100
5422 #define SAVE_ITEM_AC           0x00000200
5423 #define SAVE_ITEM_DD           0x00000400
5424 #define SAVE_ITEM_DS           0x00000800
5425 #define SAVE_ITEM_IDENT        0x00001000
5426 #define SAVE_ITEM_MARKED       0x00002000
5427 #define SAVE_ITEM_ART_FLAGS0   0x00004000
5428 #define SAVE_ITEM_ART_FLAGS1   0x00008000
5429 #define SAVE_ITEM_ART_FLAGS2   0x00010000
5430 #define SAVE_ITEM_ART_FLAGS3   0x00020000
5431 #define SAVE_ITEM_CURSE_FLAGS  0x00040000
5432 #define SAVE_ITEM_HELD_M_IDX   0x00080000
5433 #define SAVE_ITEM_XTRA1        0x00100000
5434 #define SAVE_ITEM_XTRA2        0x00200000
5435 #define SAVE_ITEM_XTRA3        0x00400000
5436 #define SAVE_ITEM_XTRA4        0x00800000
5437 #define SAVE_ITEM_XTRA5        0x01000000
5438 #define SAVE_ITEM_FEELING      0x02000000
5439 #define SAVE_ITEM_INSCRIPTION  0x04000000
5440 #define SAVE_ITEM_ART_NAME     0x08000000
5441
5442
5443 /*
5444  * Flags for wr_monster()/rd_monster()
5445  */
5446 #define SAVE_MON_AP_R_IDX     0x00000001
5447 #define SAVE_MON_SUB_ALIGN    0x00000002
5448 #define SAVE_MON_CSLEEP       0x00000004
5449 #define SAVE_MON_FAST         0x00000008
5450 #define SAVE_MON_SLOW         0x00000010
5451 #define SAVE_MON_STUNNED      0x00000020
5452 #define SAVE_MON_CONFUSED     0x00000040
5453 #define SAVE_MON_MONFEAR      0x00000080
5454 #define SAVE_MON_TARGET_Y     0x00000100
5455 #define SAVE_MON_TARGET_X     0x00000200
5456 #define SAVE_MON_INVULNER     0x00000400
5457 #define SAVE_MON_SMART        0x00000800
5458 #define SAVE_MON_EXP          0x00001000
5459 #define SAVE_MON_MFLAG2       0x00002000
5460 #define SAVE_MON_NICKNAME     0x00004000
5461 #define SAVE_MON_PARENT       0x00008000
5462
5463
5464 /*
5465  * Constant for kinds of mimic
5466  */
5467 #define MIMIC_NONE       0
5468 #define MIMIC_DEMON      1
5469 #define MIMIC_DEMON_LORD 2
5470 #define MIMIC_VAMPIRE    3
5471
5472
5473 #define MIMIC_FLAGS choice
5474 #define MIMIC_IS_NONLIVING 0x00000001
5475 #define MIMIC_IS_DEMON     0x00000002
5476 #define MIMIC_IS_UNDEAD    0x00000004
5477
5478
5479 #define prace_is_(A) (!p_ptr->mimic_form && (p_ptr->prace == A))
5480
5481 /* Sub-alignment flags for neutral monsters */
5482 #define SUB_ALIGN_NEUTRAL 0x0000
5483 #define SUB_ALIGN_EVIL    0x0001
5484 #define SUB_ALIGN_GOOD    0x0002
5485
5486 /* Temporary flags macro */
5487 #define IS_FAST() (p_ptr->fast || music_singing(MUSIC_SPEED) || music_singing(MUSIC_SHERO))
5488 #define IS_INVULN() (p_ptr->invuln || music_singing(MUSIC_INVULN))
5489 #define IS_HERO() (p_ptr->hero || music_singing(MUSIC_HERO) || music_singing(MUSIC_SHERO))
5490 #define IS_BLESSED() (p_ptr->blessed || music_singing(MUSIC_BLESS) || hex_spelling(HEX_BLESS))
5491 #define IS_OPPOSE_ACID() (p_ptr->oppose_acid || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
5492 #define IS_OPPOSE_ELEC() (p_ptr->oppose_elec || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
5493 #define IS_OPPOSE_FIRE() (p_ptr->oppose_fire || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
5494 #define IS_OPPOSE_COLD() (p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
5495 #define IS_OPPOSE_POIS() (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
5496 #define IS_TIM_ESP() (p_ptr->tim_esp || music_singing(MUSIC_MIND) || (p_ptr->concent >= CONCENT_TELE_THRESHOLD))
5497 #define IS_TIM_STEALTH() (p_ptr->tim_stealth || music_singing(MUSIC_STEALTH))
5498
5499 /* Multishadow effects is determined by turn */
5500 #define CHECK_MULTISHADOW() (p_ptr->multishadow && (turn & 1))
5501
5502 /* Is "teleport level" ineffective to this target? */
5503 #define TELE_LEVEL_IS_INEFF(TARGET) \
5504         (p_ptr->inside_arena || p_ptr->inside_battle || \
5505          (p_ptr->inside_quest && !random_quest_number(dun_level)) || \
5506          (((TARGET) <= 0) && (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth)) && \
5507           (dun_level >= 1) && ironman_downward))
5508
5509
5510 /*
5511  * Max numbers of macro trigger names
5512  */
5513 #define MAX_MACRO_MOD 12
5514 #define MAX_MACRO_TRIG 200
5515
5516 /* Max size of screen dump buffer */
5517 #define SCREEN_BUF_SIZE 65536
5518
5519
5520 /*
5521  * Special key code used for inkey_special()
5522  */
5523 #define SKEY_MOD_MASK     0x0f00
5524 #define SKEY_MOD_SHIFT    0x0100
5525 #define SKEY_MOD_CONTROL  0x0200
5526
5527 #define SKEY_MASK         0xf000
5528 #define SKEY_DOWN         0xf001
5529 #define SKEY_LEFT         0xf002
5530 #define SKEY_RIGHT        0xf003
5531 #define SKEY_UP           0xf004
5532 #define SKEY_PGUP         0xf005
5533 #define SKEY_PGDOWN       0xf006
5534 #define SKEY_TOP          0xf007
5535 #define SKEY_BOTTOM       0xf008
5536
5537 /*
5538  * Bit flags for move_player_effect()
5539  */
5540 #define MPE_STAYING       0x00000001
5541 #define MPE_FORGET_FLOW   0x00000002
5542 #define MPE_HANDLE_STUFF  0x00000004
5543 #define MPE_ENERGY_USE    0x00000008
5544 #define MPE_DONT_PICKUP   0x00000010
5545 #define MPE_DO_PICKUP     0x00000020
5546 #define MPE_BREAK_TRAP    0x00000040
5547 #define MPE_DONT_SWAP_MON 0x00000080
5548
5549
5550 #define MTIMED_CSLEEP   0 /* Monster is sleeping */
5551 #define MTIMED_FAST     1 /* Monster is temporarily fast */
5552 #define MTIMED_SLOW     2 /* Monster is temporarily slow */
5553 #define MTIMED_STUNNED  3 /* Monster is stunned */
5554 #define MTIMED_CONFUSED 4 /* Monster is confused */
5555 #define MTIMED_MONFEAR  5 /* Monster is afraid */
5556 #define MTIMED_INVULNER 6 /* Monster is temporarily invulnerable */
5557
5558 #define MAX_MTIMED      7
5559
5560 #define MON_CSLEEP(M_PTR)   ((M_PTR)->mtimed[MTIMED_CSLEEP])
5561 #define MON_FAST(M_PTR)     ((M_PTR)->mtimed[MTIMED_FAST])
5562 #define MON_SLOW(M_PTR)     ((M_PTR)->mtimed[MTIMED_SLOW])
5563 #define MON_STUNNED(M_PTR)  ((M_PTR)->mtimed[MTIMED_STUNNED])
5564 #define MON_CONFUSED(M_PTR) ((M_PTR)->mtimed[MTIMED_CONFUSED])
5565 #define MON_MONFEAR(M_PTR)  ((M_PTR)->mtimed[MTIMED_MONFEAR])
5566 #define MON_INVULNER(M_PTR) ((M_PTR)->mtimed[MTIMED_INVULNER])
5567
5568 /*
5569  * Bit flags for screen_object()
5570  */
5571 #define SCROBJ_FAKE_OBJECT  0x00000001
5572 #define SCROBJ_FORCE_DETAIL 0x00000002
5573
5574 /*
5575  * For travel command (auto run)
5576  */
5577 #define TRAVEL
5578
5579 /* Sniper */
5580 #define SP_NONE          0
5581 #define SP_LITE          1
5582 #define SP_AWAY          2
5583 #define SP_FIRE          3
5584 #define SP_KILL_WALL     4
5585 #define SP_COLD          5
5586 #define SP_KILL_TRAP     6
5587 #define SP_ELEC          7
5588 #define SP_PIERCE        8
5589 #define SP_RUSH          9
5590 #define SP_DOUBLE        10
5591 #define SP_EXPLODE       11
5592 #define SP_EVILNESS      12
5593 #define SP_HOLYNESS      13
5594 #define SP_FINAL         14
5595 #define SP_NEEDLE        15
5596
5597 #define CONCENT_RADAR_THRESHOLD 2
5598 #define CONCENT_TELE_THRESHOLD  5
5599
5600 /* Hex */
5601 #define hex_spelling_any() \
5602         ((p_ptr->realm1 == REALM_HEX) && (p_ptr->magic_num1[0]))
5603 #define hex_spelling(X) \
5604         ((p_ptr->realm1 == REALM_HEX) && (p_ptr->magic_num1[0] & (1L << (X))))
5605 /* 1st book */
5606 #define HEX_BLESS             0
5607 #define HEX_CURE_LIGHT        1
5608 #define HEX_DEMON_AURA        2
5609 #define HEX_STINKING_MIST     3
5610 #define HEX_XTRA_MIGHT        4
5611 #define HEX_CURSE_WEAPON      5
5612 #define HEX_DETECT_EVIL       6
5613 #define HEX_PATIENCE          7
5614 /* 2nd book */
5615 #define HEX_ICE_ARMOR         8
5616 #define HEX_CURE_SERIOUS      9
5617 #define HEX_INHAIL           10
5618 #define HEX_VAMP_MIST        11
5619 #define HEX_RUNESWORD        12
5620 #define HEX_CONFUSION        13
5621 #define HEX_BUILDING         14
5622 #define HEX_ANTI_TELE        15
5623 /* 3rd book */
5624 #define HEX_SHOCK_CLOAK      16
5625 #define HEX_CURE_CRITICAL    17
5626 #define HEX_RECHARGE         18
5627 #define HEX_RAISE_DEAD       19
5628 #define HEX_CURSE_ARMOUR     20
5629 #define HEX_SHADOW_CLOAK     21
5630 #define HEX_PAIN_TO_MANA     22
5631 #define HEX_EYE_FOR_EYE      23
5632 /* 4th book */
5633 #define HEX_ANTI_MULTI       24
5634 #define HEX_RESTORE          25
5635 #define HEX_DRAIN_CURSE      26
5636 #define HEX_VAMP_BLADE       27
5637 #define HEX_STUN_MONSTERS    28
5638 #define HEX_SHADOW_MOVE      29
5639 #define HEX_ANTI_MAGIC       30
5640 #define HEX_REVENGE          31
5641
5642 /*
5643   Language selection macro
5644 */
5645 #ifdef JP
5646 #define _(JAPANESE,ENGLISH) (JAPANESE)
5647 #else
5648 #define _(JAPANESE,ENGLISH) (ENGLISH)
5649 #endif