1 /* $Id$ */
2 /* File: defines.h */
3 
4 /* Purpose: global constants and macro definitions */
5 
6 
7 /*
8  * Do not edit this file unless you know *exactly* what you are doing.
9  *
10  * Some of the values in this file were chosen to preserve game balance,
11  * while others are hard-coded based on the format of old save-files, the
12  * definition of arrays in various places, mathematical properties, fast
13  * computation, storage limits, or the format of external text files.
14  *
15  * Changing some of these values will induce crashes or memory errors or
16  * savefile mis-reads.  Most of the comments in this file are meant as
17  * reminders, not complete descriptions, and even a complete knowledge
18  * of the source may not be sufficient to fully understand the effects
19  * of changing certain definitions.
20  *
21  * Lastly, note that the code does not always use the symbolic constants
22  * below, and sometimes uses various hard-coded values that may not even
23  * be defined in this file, but which may be related to definitions here.
24  * This is of course bad programming practice, but nobody is perfect...
25  *
26  * For example, there are MANY things that depend on the screen being
27  * 80x24, with the top line used for messages, the bottom line being
28  * used for status, and exactly 22 lines used to show the dungeon.
29  * Just because your screen can hold 46 lines does not mean that the
30  * game will work if you try to use 44 lines to show the dungeon.
31  *
32  * You have been warned.
33  *
34  * Edit: Added arbitrary screen sizes; for now just implemented up to 44 map
35  *       lines aka 46 main window lines. (v4.4.9.1.0.2) - C. Blue
36  */
37 
38 
39 
40 /* MAJOR/MINOR/PATCH version should be 0-15. */
41 #define VERSION_MAJOR		4
42 #define VERSION_MINOR		6
43 #define VERSION_PATCH		0
44 #define VERSION_EXTRA		0
45 #define VERSION_BRANCH		0
46 #define VERSION_BUILD		0
47 
48 /* MAJOR/MINOR/PATCH version that counts as 'latest' (should be 0-15).
49    If a player is online with a version > this && <= current version (VERSION_)
50    it will be assumed that he's using a 'test client' and be marked in @ list
51    with a 'T' marker which is visible only to admins.*/
52 #define VERSION_MAJOR_LATEST	4
53 #define VERSION_MINOR_LATEST	6
54 #define VERSION_PATCH_LATEST	0
55 #define VERSION_EXTRA_LATEST	0
56 #define VERSION_BRANCH_LATEST	0
57 #define VERSION_BUILD_LATEST	0
58 
59 /* maximum MAJOR/MINOR/PATCH version that counts as 'outdated' (should be 0-15). */
60 #define VERSION_MAJOR_OUTDATED	4
61 #define VERSION_MINOR_OUTDATED	5
62 #define VERSION_PATCH_OUTDATED	9
63 #define VERSION_EXTRA_OUTDATED	0
64 #define VERSION_BRANCH_OUTDATED	0
65 #define VERSION_BUILD_OUTDATED	1 /* should always be 1 to invalidate previous 'test' versions */
66 
67 /* Server release version tag (such as "a", "b" etc):
68    Minimum client version tag required to "play 100%". */
69 #define SERVER_VERSION_TAG	""
70 
71 
72 /* Client-side only: Client release version tag
73    (such as "a", "b" etc) used in window title and file dumps */
74 #define CLIENT_VERSION_TAG	""
75 
76 /* Minimum client version required to be allowed to log in */
77 #define MIN_VERSION_MAJOR	4
78 #define MIN_VERSION_MINOR	4
79 #define MIN_VERSION_PATCH	1
80 #define MIN_VERSION_EXTRA	0
81 
82 /* Maximum client version allowed to log in */
83 #define MAX_VERSION_MAJOR	4
84 #define MAX_VERSION_MINOR	15
85 #define MAX_VERSION_PATCH	15
86 #define MAX_VERSION_EXTRA	INT_MAX
87 
88 
89 /* For savefile purpose only */
90 #define SF_VERSION_MAJOR	4
91 #define SF_VERSION_MINOR	5
92 #define SF_VERSION_PATCH	33
93 #define SF_VERSION_EXTRA	0
94 
95 /* For quests savefile purpose only */
96 #define QUEST_SF_VERSION_MAJOR	1
97 #define QUEST_SF_VERSION_MINOR	0
98 #define QUEST_SF_VERSION_PATCH	1
99 #define QUEST_SF_VERSION_EXTRA	0
100 
101 
102 /* version_os constants, set by gcc flags - C. Blue */
103 #define OS_UNKNOWN	0
104 #define OS_WIN32	1
105 #define OS_GCU		2
106 #define OS_X11		3
107 #define OS_GCU_X11	4
108 #define OS_OSX		5
109 
110 /* Set new VERSION_OS (after 4.4.8.1.0.0) for client - C. Blue */
111 #ifdef CLIENT_SIDE
112  #ifdef WIN32
113   #define VERSION_OS		OS_WIN32
114  #elif defined(OSX)
115   #define VERSION_OS		OS_OSX
116  #elif defined(USE_X11) && defined(USE_GCU)
117   #define VERSION_OS		OS_GCU_X11
118  #elif defined(USE_GCU)
119   #define VERSION_OS		OS_GCU
120  #elif defined(USE_X11)
121   #define VERSION_OS		OS_X11
122  #else
123   #define VERSION_OS		OS_UNKNOWN
124  #endif
125 #endif
126 
127 
128 
129 /*
130  * Base version strings of TomeNET (see version_build)
131  */
132 #define TOMENET_VERSION_SHORT		"TomeNET"
133 
134 /*
135  * This value is a single 16-bit number holding the version info
136  */
137 
138 #define MY_VERSION (VERSION_MAJOR << 12 | VERSION_MINOR << 8 | VERSION_PATCH \
139 	<< 4 | VERSION_EXTRA)
140 
141 
142 
143 /* Main server flags */
144 #define SFLG0_NORMAL	0x00000000
145 #define SFLG0_RPG	0x00000001
146 #define SFLG0_FUN	0x00000002
147 #define SFLG0_PARTY	0x00000004
148 #define SFLG0_ARCADE	0x00000008
149 #define SFLG0_TEST	0x00000010
150 #define SFLG0_RPG_ADMIN	0x00000020
151 #define SFLG0_DED_IDDC	0x00000040
152 #define SFLG0_DED_PVP	0x00000080
153 #define SFLG0_NO_PK	0x00000100
154 
155 #define SFLG1_NORMAL	0x00000000
156 #define SFLG1_PARTY	0x00000001
157 #define SFLG1_BIG_MAP	0x00000002
158 #define SFLG1_NEW_SHIELDS_NO_AC	0x00000004
159 
160 
161 
162 /* Determine fundamental server type (Normal, RPG, Arcade, Fun flagged). */
163 #include "defines-local.h"
164 
165 /* Add feature enabling/disabling definitions - C. Blue */
166 #include "defines-features.h"
167 
168 /* Add colour schemes - C. Blue */
169 #include "colours.h"
170 
171 
172 
173 /* Characters disallowed in save files */
174 #define SF_BAD_CHARS ":!?\\/()\"@. _"
175 
176 /* Keys are safe from monsters? (taking/killing/stealing) */
177 //#define MON_IGNORE_KEYS
178 
179 #ifdef MONSTER_ASTAR
180  #define ASTAR_MAX_NODES 1000		/* max size of open/closed pathfinding table in an A* instance */
181  #define ASTAR_MAX_INSTANCES 20		/* how many spawned monsters can use A* at once */
182 #endif
183 
184 /* for MONSTER_FLOW_BY_SOUND */
185 /* Range limit? */
186 #define MONSTER_FLOW_BY_SOUND_DEPTH	64
187 /* Time limit? */
188 #define MONSTER_FLOW_BY_SOUND_TIME	50
189 
190 /* for MONSTER_FLOW_BY_SMELL */
191 /* Range limit? */
192 #define MONSTER_FLOW_BY_SMELL_DEPTH	200
193 /* Time limit? */
194 #define MONSTER_FLOW_BY_SMELL_TIME	50
195 /* Scent radius surrounding a player. Note: not implemented yet, but it doesn't bring additional cost, so adding it. - C. Blue */
196 #define MONSTER_FLOW_BY_SMELL_RADIUS	2
197 
198 /* for MONSTER_FLOW_BY_ESP */
199 /* Total flow depth? Might be superfluous, just flood whole level, and let sound/smell take care of the rest.. - C. Blue */
200 #define MONSTER_FLOW_DEPTH	32
201 
202 
203 /* The four seasons - C. Blue */
204 #define SEASON_SPRING 0
205 #define SEASON_SUMMER 1
206 #define SEASON_AUTUMN 2
207 #define SEASON_WINTER 3
208 
209 
210 /* Client-side: Maximum amount of terminal windows the client may have. */
211 #define ANGBAND_TERM_MAX 8
212 
213 
214 /* Define this to make 'exp ratio' determine exp-gain instead of exp-to-adv:
215    (has no effect if KINGCAP_EXP is defined) */
216 #define ALT_EXPRATIO
217 
218 
219 /* Startup equipment treatment: [3]
220    0 = like any item
221    1 = level 0 (unusable by others), can be sold by anyone, not throwable/droppable till charlevel cfg.newbies_cannot_drop
222    2 = level 0 (unusable by others), can be sold by yourself only, dropped items turn {+,0} before charlevel cfg.newbies_cannot_drop
223    3 = level 0 (unusable by others), can't be sold at all, dropped items turn {+,0} before charlevel cfg.newbies_cannot_drop
224    Note: 2 and 3 imply that all level 0 items in the game can only be sold by their owners. */
225 #define STARTEQ_TREATMENT 3
226 
227 
228 
229 /* Maximum number of different characters one player account may hold - C. Blue */
230 #define MAX_CHARS_PER_ACCOUNT	8
231 #define MAX_DED_IDDC_CHARS	2	/* additional iddc-only characters (needs ALLOW_DED_IDDC_MODE) */
232 #define MAX_DED_PVP_CHARS	1	/* additional pvp-only characters (needs ALLOW_DED_PVP_MODE) */
233 
234 
235 /* What kind of character creation method does the server use? - C. Blue
236    currently (since 4.2.0):     0 = traditional random rolling (1 try)
237                         	1 = player can set his stats manually */
238 /* I'm using 0x02 for sending the server version - mikaelh */
239 #define CHAR_CREATION_FLAGS	1
240 
241 
242 /* Does drinking from fountains bear the possibility of conjuring a guardian monster? */
243 #define FOUNTAIN_GUARDS 10	/* chance of appearing */
244 
245 
246 /*
247  * Define the maximum number of characters to use in many things
248  */
249 #define MAX_CHARS	80	/* typically 1 line */
250 #define MAX_CHARS_WIDE	160	/* typically a line with possibly colour codes */
251 
252 /* max length of item names including inscription */
253 #define ONAME_LEN	160
254 
255 /* max length of monster names (with pronominum etc) */
256 #define MNAME_LEN	80
257 
258 /* max length of character/party/guild names + 1 */
259 #define NAME_LEN	20
260 /* max length of login info + 1 */
261 #define ACCOUNTNAME_LEN		16
262 #define PASSWORD_LEN		16
263 #define REALNAME_LEN		20 /* realname is replaced by "PLAYER" anyway */
264 #define HOSTNAME_LEN		20
265 #define CHARACTERNAME_LEN	16
266 
267 /*
268  * Maximum message length
269  */
270 #define MSG_LEN 256
271 
272 /*
273  * Define the maximum size of temporary file-name length.
274  */
275 #define MAX_TMP_PATH_LEN	256
276 
277 /*
278  * The maximum number of player ID's / accounts
279  */
280 #define MAX_ID 65536
281 #define MAX_ACCOUNTS	8192
282 
283 /* For storing event rewards for to-be-created characters of an account */
284 #define MAX_CONTENDER_BUFFERS 128
285 #define MAX_ACHIEVEMENT_BUFFERS 128
286 
287 /* For temporarily reserving character names for an account */
288 #define MAX_RESERVED_NAMES 128
289 
290 
291 /*
292  * This is very important...
293  *
294  * This is the number of "frames" to produce per second.  It determines
295  * the speed of the game.
296  */
297 /*#define FPS 60 */
298 #define FPS (cfg.fps)
299 
300 
301 /* Characters and accounts do never expire? (Enable this in your LAN for example) */
302 //#define PLAYERS_NEVER_EXPIRE
303 
304 /* Number of days after which an account without any characters on it will expire. */
305 #ifdef RPG_SERVER
306  #define ACCOUNT_EXPIRY_DAYS 184
307 #else
308  #define ACCOUNT_EXPIRY_DAYS 62
309 #endif
310 
311 /* Number of days after which an unused character will expire. */
312 #define CHARACTER_EXPIRY_DAYS 184
313 
314 
315 /* maximum respawn time for uniques.... from japanese patch */
316 #define COME_BACK_TIME_MAX 600
317 
318 
319 /* For flash player option, cfg.fps/n, for teleport [6] */
320 #define FLASH_SELF_DIV 4
321 /* For flash player option, cfg.fps/n, for floor change [4] */
322 #define FLASH_SELF_DIV2 3
323 
324 
325 /* Time to be idle for auto-afk to kick in, in seconds [60] */
326 #define AUTO_AFK_TIMER 60
327 
328 /* Time to be idle and starving for auto-kick to kick in, in seconds [30] */
329 #define STARVE_KICK_TIMER 30
330 
331 
332 /* Do artifacts time out after a while to prevent hoarding?
333    (Fluent artifact reset system vs static reset schedules) - C. Blue */
334 #define FLUENT_ARTIFACT_RESETS
335 /* Warn a player if an artifact is about to timeout [4 hours] */
336 #define FLUENT_ARTIFACT_WARNING	(60 * 4)
337 /* Default time in weeks until a true artifact times out.
338    Gets doubled for winner-arts and doubled on rpg-server (cumulative). */
339 #define FLUENT_ARTIFACT_WEEKS 5
340 
341 
342 /* Can staticed levels no longer get their static-timeout 'reset' by someone
343    logging on on them and leaving again? */
344 #define NO_STATIC_TIMER_RESET
345 /* Allow exception for someone dying there when it's already stale, if his
346    level is at least 1/4 of the depth and >= cfg.newbies_cannot_drop? */
347 #define STATIC_TIMER_RESETS_ON_DEATH
348 /* Sauron's floor in Mt Doom has a shorter static timer */
349 #define SAURON_FLOOR_FAST_UNSTAT
350 
351 
352 /*
353  * The types of communication that we send to the metaserver
354  */
355 #define META_START	0x01
356 #define META_DIE	0x02
357 #define META_UPDATE	0x04
358 
359 
360 /* Traditional hard-coded number of grids used to display the dungeon,
361    had to be multiples of 11 and 33 respectively.
362    Only kept now for setting default values - C. Blue */
363 #define SCREEN_HGT	22
364 #define SCREEN_WID	66
365 
366 /* New for BIG_MAP feature: Minimum and maximum screen size - C. Blue */
367 #define MIN_SCREEN_WID	SCREEN_WID
368 #define MIN_SCREEN_HGT	SCREEN_HGT
369 #ifndef ARCADE_SERVER
370  #define MAX_SCREEN_WID	SCREEN_WID
371 #else
372  #define MAX_SCREEN_WID (SCREEN_WID * 3)
373 #endif
374 #define MAX_SCREEN_HGT	(SCREEN_HGT * 2)
375 
376 /* (BIG_MAP) Padding of on-screen map, because of chat line, status bars, etc */
377 #define SCREEN_PAD_LEFT		13
378 #define SCREEN_PAD_RIGHT	1
379 #define SCREEN_PAD_TOP		1
380 #define SCREEN_PAD_BOTTOM	1
381 #define SCREEN_PAD_X		(SCREEN_PAD_LEFT + SCREEN_PAD_RIGHT)
382 #define SCREEN_PAD_Y		(SCREEN_PAD_TOP + SCREEN_PAD_BOTTOM)
383 
384 /* (BIG_MAP) Maximum possible main window size */
385 #define MAX_WINDOW_WID	(MAX_SCREEN_WID + SCREEN_PAD_LEFT + SCREEN_PAD_RIGHT)
386 #define MAX_WINDOW_HGT	(MAX_SCREEN_HGT + SCREEN_PAD_TOP + SCREEN_PAD_BOTTOM)
387 
388 #ifdef CLIENT_SIDE
389  /* For resizing the main window while client runs */
390  #define CL_WINDOW_WID	(screen_wid + SCREEN_PAD_LEFT + SCREEN_PAD_RIGHT)
391  #define CL_WINDOW_HGT	(screen_hgt + SCREEN_PAD_TOP + SCREEN_PAD_BOTTOM)
392 #else
393  /* For handling client functions depending on BIG_MAP */
394  #define CL_WINDOW_WID	(Players[Ind]->screen_wid + SCREEN_PAD_LEFT + SCREEN_PAD_RIGHT)
395  #define CL_WINDOW_HGT	(Players[Ind]->screen_hgt + SCREEN_PAD_TOP + SCREEN_PAD_BOTTOM)
396 #endif
397 
398 /*
399  * Maximum dungeon height in grids, must be a multiple of SCREEN_HGT,
400  * probably hard-coded to SCREEN_HGT * 3.
401  */
402 #define MAX_HGT		66
403 
404 /*
405  * Maximum dungeon width in grids, must be a multiple of SCREEN_WID,
406  * probably hard-coded to SCREEN_WID * 3.
407  */
408 #define MAX_WID		198
409 
410 /* Used only in object3.c / trap effects (ToME) */
411 #if ((MAX_HGT / SCREEN_HGT) < (MAX_WID / SCREEN_WID))
412  #define RATIO (MAX_WID / SCREEN_WID)
413 #else
414  #define RATIO (MAX_HGT / SCREEN_HGT)
415 #endif
416 
417 /* for consistent setting of max_panel_rows/cols: */
418 #ifndef BIG_MAP /* old -> rounding issues */
419  #define MAX_PANEL_ROWS_L	(((l_ptr->hgt + p_ptr->screen_hgt / 2) / p_ptr->screen_hgt) * 2 - 2)
420  #define MAX_PANEL_COLS_L	(((l_ptr->wid + p_ptr->screen_wid / 2) / p_ptr->screen_wid) * 2 - 2)
421  #define MAX_PANEL_ROWS		((MAX_HGT / p_ptr->screen_hgt) * 2 - 2)
422  #define MAX_PANEL_COLS		((MAX_WID / p_ptr->screen_wid) * 2 - 2)
423 
424  /* stuff that depends on normal-sized panels, for various effects such as magic mapping */
425  #define MAX_TRADPANEL_ROWS_L	MAX_PANEL_ROWS_L
426  #define MAX_TRADPANEL_COLS_L	MAX_PANEL_COLS_L
427  #define MAX_TRADPANEL_ROWS	MAX_PANEL_ROWS
428  #define MAX_TRADPANEL_COLS	MAX_PANEL_COLS
429 
430  #define TRADPANEL_ROW_MIN	(p_ptr->panel_row_min)
431  #define TRADPANEL_ROW_MAX	(p_ptr->panel_row_max)
432  #define TRADPANEL_COL_MIN	(p_ptr->panel_col_min)
433  #define TRADPANEL_COL_MAX	(p_ptr->panel_col_max)
434 #else /* allow larger main screen than 80x24 - C. Blue */
435  #define MAX_PANEL_ROWS_L	((int)((l_ptr->hgt + p_ptr->screen_hgt / 2 - 1) / (p_ptr->screen_hgt / 2)) - 2)
436  #define MAX_PANEL_COLS_L	((int)((l_ptr->wid + p_ptr->screen_wid / 2 - 1) / (p_ptr->screen_wid / 2)) - 2)
437  #define MAX_PANEL_ROWS		((int)((MAX_HGT + p_ptr->screen_hgt / 2 - 1) / (p_ptr->screen_hgt / 2)) - 2)
438  #define MAX_PANEL_COLS		((int)((MAX_WID + p_ptr->screen_wid / 2 - 1) / (p_ptr->screen_wid / 2)) - 2)
439 
440  /* 'traditional' panel variables used for various effects such as magic mapping (working on 66x22) */
441  #define MAX_TRADPANEL_ROWS_L	(((l_ptr->hgt + SCREEN_HGT / 2) / SCREEN_HGT) * 2 - 2)
442  #define MAX_TRADPANEL_COLS_L	(((l_ptr->wid + SCREEN_WID / 2) / SCREEN_WID) * 2 - 2)
443  #define MAX_TRADPANEL_ROWS	((MAX_HGT / SCREEN_HGT) * 2 - 2)
444  #define MAX_TRADPANEL_COLS	((MAX_WID / SCREEN_WID) * 2 - 2)
445 
446  #if 1
447   /* use traditional panel sizes and map around the one we'd be within (better) */
448   #define TRADPANEL_ROW_MIN	(p_ptr->tradpanel_row_min)
449   #define TRADPANEL_ROW_MAX	(p_ptr->tradpanel_row_max)
450   #define TRADPANEL_COL_MIN	(p_ptr->tradpanel_col_min)
451   #define TRADPANEL_COL_MAX	(p_ptr->tradpanel_col_max)
452  #else /* centers magic mapping on current huge panel (quick and easy) */
453   /* this causes a problem when player is close to an edge of a level! */
454   #define TRADPANEL_ROW_MIN	(p_ptr->panel_row_min + p_ptr->screen_hgt / 2 - SCREEN_HGT / 2)
455   #define TRADPANEL_ROW_MAX	(p_ptr->panel_row_max - p_ptr->screen_hgt / 2 + SCREEN_HGT / 2)
456   #define TRADPANEL_COL_MIN	(p_ptr->panel_col_min + p_ptr->screen_wid / 2 - SCREEN_WID / 2)
457   #define TRADPANEL_COL_MAX	(p_ptr->panel_col_max - p_ptr->screen_wid / 2 + SCREEN_WID / 2)
458  #endif
459 #endif
460 
461 #ifdef CLIENT_SIDE
462  /* For client-side BIG_MAP handling */
463  #define HGT_PLUS	(screen_hgt - SCREEN_HGT)
464  #define WID_PLUS	(screen_wid - SCREEN_WID)
465 #else
466  /* For handling client functions depending on BIG_MAP */
467  #define HGT_PLUS	(Players[Ind]->screen_hgt - SCREEN_HGT)
468  #define WID_PLUS	(Players[Ind]->screen_wid - SCREEN_WID)
469 #endif
470 
471 
472 /*
473  * Hack -- This is used to make sure that every player that has a structure
474  * dedicated to them is actually connected
475  */
476 #define NOT_CONNECTED	(-1)
477 
478 
479 /*
480  * Maximum number of players playing at once.
481  *
482  * This limit has never been stretched, and it would be interesting to see
483  * what happens when 100 or so players play at once.
484  */
485 #define MAX_PLAYERS	1000
486 
487 #ifdef PLAYER_STORES
488 /* How many of them can at once visit different player stores? */
489  #define MAX_VISITED_PLAYER_STORES	(MAX_PLAYERS / 20)
490 #endif
491 
492 /*
493  * Maximum number of player "race" types (see "table.c", etc)
494  */
495 #ifdef ENABLE_MAIA
496  #ifdef ENABLE_KOBOLD
497   #define MAX_RACE	18
498  #else
499   #define MAX_RACE	17
500  #endif
501 #else
502  #ifdef ENABLE_KOBOLD
503   #define MAX_RACE	17
504  #else
505   #define MAX_RACE	16
506  #endif
507 #endif
508 
509 
510 /*
511  * Maximum number of player "class" types (see "table.c", etc)
512  */
513 #define MAX_CLASS	13
514 
515 
516 /*
517  * Maximum number of character traits. Originally added for Draconians - C. Blue
518  */
519 #define MAX_TRAIT	32	/* 0 = N/A; 13 dragon flavours; 2 Maiar flavours; ... */
520 
521 
522 /*
523  * Maximum NPC robots to allow.
524  */
525 #define MAX_NPCS	16	/* Allow more perhaps, or make it expandable... */
526 
527 /*
528  * Maximum number of parties to allow.  If, while trying to create a new
529  * party, you get a "No empty party slot" or somesuch message, increase
530  * this number.  However, you should NEVER decrease this number after a
531  * server has been run, or all sorts of bad things could happen.
532  */
533 #define MAX_PARTIES	512
534 #define MAX_GUILDS	32	/* test value */
535 
536 /* Price to create a guild */
537 #define GUILD_PRICE	2000000
538 
539 /*
540  * Maximum number of houses available.
541  */
542 #define MAX_HOUSES	65536	/* temp value... */
543 #define HOUSE_KEY	0
544 #define HOUSE_PASS	1
545 
546 #define FILL_BUILD		0
547 #define FILL_CLEAR		1
548 #define FILL_MAKEHOUSE		2
549 #define FILL_PLAYER		3
550 #define FILL_OBJECT		4
551 #define FILL_GUILD		5
552 #ifdef HOUSE_PAINTING
553  #define FILL_UNPAINT		6
554 #endif
555 #define FILL_GUILD_SUS		7	/* for leaderless guild handling: no item/gold pickup possible */
556 #define FILL_GUILD_SUS_UNDO	8
557 #define FILL_SFX_KNOCK		9
558 
559 /*
560  * Number of entries in the player name hash table.
561  * This must be a power of 2!
562  */
563 #define NUM_HASH_ENTRIES	256
564 
565 
566 /* Turn currently invalid items into seals? Otherwise they are simply deleted. */
567 #define SEAL_INVALID_OBJECTS
568 
569 
570 /* Pre-set owner for DROP_CHOSEN items, so you can't cheeze them to someone else
571    by ground-IDing them, then have someone else to pick them up! (especially for Nazgul rings) */
572 #define PRE_OWN_DROP_CHOSEN
573 
574 
575 /*
576  * Maximum array bounds for template based arrays
577  */
578 /*
579  * TODO: make them redefinable w/o client update
580  */
581 
582 #define MAX_F_IDX	256	/* Max size for "f_info[]" */
583 #define MAX_K_IDX	1280	/* Max size for "k_info[]" */
584 #define MAX_A_IDX	512	/* Max size for "a_info[]" */
585 #define MAX_E_IDX	384	/* Max size for "e_info[]" */
586 #define MAX_R_IDX	1280	/* Max size for "r_info[]" */
587 #define MAX_V_IDX 	256	/* Max size for "v_info[]" */
588 #define MAX_RE_IDX	128	/* Max size for "re_info[]" */
589 #define MAX_T_IDX	256	/* Max size for "t_info[]" */
590 #define MAX_OW_IDX	128	/* Max size for "ow_info[]" */
591 #define MAX_ST_IDX	128	/* Max size for "st_info[]" */
592 #define MAX_BA_IDX	96	/* Max size for "ba_info[]" */
593 #define MAX_D_IDX	64	/* Max size for "d_info[]" */
594 #define MAX_Q_IDX	100	/* Max size for "q_info[]" */
595 
596 /* for compatibility with 4.5.8.1- clients: */
597 #define MAX_F_IDX_COMPAT	256
598 #define MAX_K_IDX_COMPAT	1024
599 #define MAX_A_IDX_COMPAT	512
600 #define MAX_E_IDX_COMPAT	256
601 #define MAX_R_IDX_COMPAT	1152
602 #define MAX_V_IDX_COMPAT 	256
603 #define MAX_RE_IDX_COMPAT	128
604 #define MAX_T_IDX_COMPAT	256
605 #define MAX_OW_IDX_COMPAT	96
606 #define MAX_ST_IDX_COMPAT	96
607 #define MAX_BA_IDX_COMPAT	96
608 #define MAX_D_IDX_COMPAT	64
609 #define MAX_Q_IDX_COMPAT	100
610 
611 /* Max ego base type restrictions */
612 #define MAX_EGO_BASETYPES	10
613 
614 /* Client-side unique list */
615 #define MAX_UNIQUES		300
616 
617 
618 
619 /*
620  * Maximum array bounds for entity list arrays
621  */
622 /*
623  * 32768 is way too large; 4096 monsters/objs are enough to weigh
624  * your latest comp down(even w/o AI code)!
625  */
626 #define MAX_O_IDX	32768	/* Max size for "o_list[]" */
627 #define MAX_M_IDX 	32768	/* Max size for "m_list[]" */
628 
629 
630 /* Maximum number of extermination orders for 'xorder' type (OLD, unused) */
631 #define MAX_XO_IDX		4
632 /* Maximum number of extermination orders for 'xorder_type' type (NEW, used instead) */
633 #define MAX_XORDERS		20
634 /* Duration until extermination order expires */
635 #define MAX_XORDER_TURNS	(DAY * 2)
636 
637 /* Maximum number of concurrent quests (quest_info type) */
638 #define MAX_CONCURRENT_QUESTS 5
639 
640 /*
641  * Maximum number of high scores in the high score file
642  */
643 #define MAX_HISCORES	100
644 
645 
646 /*
647  * Maximum dungeon level.  The player can never reach this level
648  * in the dungeon, and this value is used for various calculations
649  * involving object and monster creation.  It must be at least 100.
650  * Setting it below 128 may prevent the creation of some objects.
651  */
652 #define MAX_WILD_X	64
653 #define MAX_WILD_Y	64
654 #define MAX_WILD	(MAX_WILD_X*MAX_WILD_Y)
655 #define MAX_WILD_8	((MAX_WILD_X*MAX_WILD_Y)/8)
656 #define MAX_DEPTH_OBJ	128 /* must be <= 128 */
657 #define MAX_DEPTH	255 /* should be <= 255? (Valinor at 200 is deepest level) */
658 
659 /* The 'generally acknowledged' max radius for a town's housing zone.
660    This is not so much used to create wilderness than to check stuff - don't touch! */
661 #define MAX_TOWNAREA	3
662 
663 /*
664  * Maximum size of the "lite" array (see "cave.c")
665  * Note that the "lite radius" will NEVER exceed 5, and even if the "lite"
666  * was rectangular, we would never require more than 128 entries in the array.
667  */
668 #define LITE_MAX 529 /* 529 = ((10+1 safety) radius + 1 centre) 128 */
669 #define LITE_CAP 10 /* just a limiter */
670 
671 /* Maximum number of notes that the server will store */
672 #define MAX_NOTES 200
673 //#define MAX_PARTYNOTES 30
674 #define MAX_PARTYNOTES MAX_PARTIES
675 //#define MAX_GUILDNOTES 10
676 #define MAX_GUILDNOTES MAX_GUILDS
677 #define MAX_ADMINNOTES 20
678 
679 /* Number of text lines for the in-game BBS */
680 #define BBS_LINES 15
681 
682 /*
683  * Maximum size of the "view" array (see "cave.c")
684  * Note that the "view radius" will NEVER exceed 20, and even if the "view"
685  * was octagonal, we would never require more than 1520 entries in the array.
686  */
687 #define VIEW_MAX 1536
688 
689 /*
690  * Maximum size of the "temp" array (see "cave.c")
691  * We must be as large as "VIEW_MAX" and "LITE_MAX" for proper functioning
692  * of "update_view()" and "update_lite()".  We must also be as large as the
693  * largest illuminatable room, but no room is larger than 800 grids.  We
694  * must also be large enough to allow "good enough" use as a circular queue,
695  * to calculate monster flow, but note that the flow code is "paranoid".
696  */
697 #define TEMP_MAX 1536
698 
699 
700 /*
701  * OPTION: Maximum number of macros (see "io.c")
702  * Default: assume at most 512 macros are used
703  */
704 #define MACRO_MAX	512
705 
706 /*
707  * OPTION: Maximum number of "quarks" (see "io.c")
708  * Default: assume at most 512 different inscriptions are used
709  */
710 #define QUARK_MAX	8192 /* 4096 still wasn't enough - mikaelh */
711 
712 /*
713  * OPTION: Maximum number of messages to remember (see "io.c")
714  * Default: assume maximal memorization of 2048 total messages
715  * Doubled to 4096 - mikaelh
716  */
717 #define MESSAGE_MAX	4096
718 
719 /*
720  * OPTION: Maximum space for the message text buffer (see "io.c")
721  * Default: assume that each of the 2048 messages is repeated an
722  * average of three times, and has an average length of 48
723  * Doubled to 65536 - mikaelh
724  */
725 #define MESSAGE_BUF	65536
726 
727 
728 /*
729  * Maximum value storable in a "byte" (hard-coded)
730  */
731 #define MAX_UCHAR	255
732 
733 /*
734  * Maximum value storable in a "s16b" (hard-coded)
735  */
736 #define MAX_SHORT	32767
737 
738 /*
739  * Maximum path length
740  */
741 #define MAX_PATH_LENGTH	128
742 
743 /* Maximum level difference for party members,
744    and (+1 tolerance here) for supporting fellow players (depending on HENC_STRICTNESS) */
745 #define MAX_PARTY_LEVEL_DIFF 7
746 
747 /* Maximum level difference for winner-party members,
748    and (+1 tolerance here) for supporting fellow players (depending on HENC_STRICTNESS) */
749 #define MAX_KING_PARTY_LEVEL_DIFF 11
750 
751 /* Max amount of swear words */
752 #define MAX_SWEAR 100
753 
754 /* Max amount of legal words that override swear words */
755 #define MAX_NONSWEAR 200
756 
757 /* only imprison within town area? Otherwise it can be exploited for world travel. */
758 #define JAIL_TOWN_AREA
759 
760 /* does the Jailer remove WoR scrolls and discharge WoR rods? */
761 //#define JAILER_KILLS_WOR
762 
763 
764 /* Maximum armour class value that yields in a reduction of damage.
765    Note: The chance to get hit still goes down further above this value.
766    Also search code for CAP_ITEM_BONI to find +hit/+dam/+ac cappings. */
767 #ifdef ENABLE_NEW_MELEE
768  #if 0
769   #define AC_CAP	250
770   #define AC_CAP_DIV	350
771  #else
772   #ifndef TO_AC_CAP_30
773    #define AC_CAP	200
774    #define AC_CAP_DIV	300
775   #else
776     /* for now the same - could reduce cap to 175 or even 150 */
777    #define AC_CAP	200
778    #define AC_CAP_DIV	300
779   #endif
780  #endif
781 #else
782  #define AC_CAP		150
783  #define AC_CAP_DIV	250
784 #endif
785 
786 /* Limit value for Anti-magic fields (AM cap)
787    Should range from 75..80%, maybe make skill & DS percentage
788    multiply instead of sum up. - C. Blue */
789 #define ANTIMAGIC_CAP		75
790 
791 /* Limit effectiveness of interception/martial arts,
792    Should range from 75%..80%. - C. Blue */
793 #define INTERCEPT_CAP		80
794 
795 /* upper limit of dodging chance.       [90] */
796 #define DODGE_MAX_CHANCE 	80
797 
798 
799 /* Total size of internal IDDC depth table */
800 #define IDDC_HIGHSCORE_SIZE 50
801 /* The first n entries that are actually displayed */
802 #define IDDC_HIGHSCORE_DISPLAYED 10
803 /* A character who makes it through IDDC is always placed 1st? */
804 #define IDDC_THROUGH_IS_FIRST
805 /* A character of same account and class will replace a worse entry of himself on the score board, or get discarded */
806 #define IDDC_RESTRICT_ACC_CLASS
807 
808 /* EXPERIMENTAL:
809   Allow incompatible char modes (everlasting vs non-everlasting) to interact
810    (form party, trade items) while inside the Ironman Deep Dive Challenge? */
811 #define IRONDEEPDIVE_ALLOW_INCOMPAT
812 
813 /* Special anti-cheeze hack: Disallow carrying items from town to IDDC and
814    giving them to another character inside IDDC, for the first n floors. */
815 #define IDDC_NO_TRADE_CHEEZE 5
816 
817 /* Give a crazy form learning boost inside Ironman Deep Dive Challenge? [9] */
818 #define IDDC_MIMICRY_BOOST 9
819 
820 /* Make true artifacts pass their rarity roll more easily in IDDC? */
821 #define IDDC_EASY_TRUE_ARTIFACTS
822 
823 /* Show character icon with coloured '@' or 'b' in top score table
824    of the Ironman Deep Dive Challenge? */
825 #define IDDC_HISCORE_SHOWS_ICON
826 
827 /* Maximum amount of gold that can be farmed from townies before you get 1 XP
828    from it. This is an anti-cheeze for Highlander Tournament and Ironman Deep
829    Dive Challenge. (-1 = no limit) [300] */
830 #define EVENT_TOWNIE_GOLD_LIMIT 300
831 
832 /* New, added for the implementation of FINAL_GUARDIAN (finally) - C. Blue
833    Does the player have to actually explore a dungeon to get his recall depth set for it?
834    (If not then he can just get his recall depth from another dungeon and use it here.)
835    NOTE: Make sure 0,0 holds no 'normal' dungeon (only special-sector highlander etc). */
836 #define SEPARATE_RECALL_DEPTHS
837 
838 /* Dungeons have minimum player level requirements to enter? */
839 //#define OBEY_DUNGEON_LEVEL_REQUIREMENTS
840 
841 /* Levels that Morgoth spawns on will not allow *destruction* nor any use of
842    genocide spells. This can also prevent too trivial loot retrieval in
843    case of unexpected deathhh - C. Blue */
844 #define MORGOTH_DANGEROUS_LEVEL
845 
846 /* If Morgoth is generated within a vault at the time the
847    dungeon level is generated, set it to NO_TELE.
848    (overridden by MORGOTH_NO_TELE_VAULTS, see below) - C. Blue */
849 //#define MORGOTH_NO_TELE_VAULT
850 
851 /* If Morgoth is generated on a dungeon level at the time the
852    dungeon level is generated, set all vaults on it to NO_TELE.
853    Also prevent Morgoth from spawning 'live' (meaning later on,
854    after the level had already been generated) which would
855    undermine the NO_TELE vault concept (or require more code :) - C. Blue */
856 #define MORGOTH_NO_TELE_VAULTS
857 
858 /* All player deaths that occur on a level Morgoth is currently on
859    are no-ghost deaths, resulting in total termination of the character!
860    This was added after some complaints arrived that the atmosphere was taken out of
861    the game by mostly everlasting players who made killing him kind of a routine. - C. Blue */
862 #define MORGOTH_GHOST_DEATH_LEVEL
863 
864 /* Both of the above lead to preventing live spawns of Morgoth, other than during
865    generation of the dungeon level. (for technical reasons) */
866 #ifdef MORGOTH_NO_TELE_VAULTS
867  #define MORGOTH_NO_LIVE_SPAWN
868 #endif
869 #ifdef MORGOTH_GHOST_DEATH_LEVEL
870  #define MORGOTH_NO_LIVE_SPAWN
871 #endif
872 
873 
874 /* Make Sauron more dangerous for AM or Intercepters,
875    by giving him AI_ANNOY vs melee targets. */
876 #define SAURON_ANTI_MELEE
877 
878 /* Make Sauron more dangerous for Glyphers
879    by giving him faster cast rate while blocked by glyphs. */
880 #define SAURON_ANTI_GLYPH
881 
882 /* Set Sauron's boost factor (1/n chance to cast spells) [67,75] */
883 #define SAURON_SPELL_BOOST	67
884 
885 
886 /* Disallow instant resurrection in the Nether Realm */
887 #define INSTANT_RES_EXCEPTION
888 
889 
890 /* Auto-retaliation: */
891 /* No class restriction; limit to non-escape mechanisms. */
892 #define AUTO_RET_NEW
893 /* Enable use of /autoret or /ar command to specify auto-retaliation.
894    This is especially to enable mimics to use their powers in auto-retaliation,
895    if this option is enabled, they will be unable to use @OM inscription for that instead. */
896 #define AUTO_RET_CMD
897 
898 
899 /* Does a projection 'explode' ON a wall grid it hits, or BEFORE the wall grid?
900    Exploding before it means that players standing in walls will only take 50%
901    damage from it, while exploding on the wall grid means normal 100% damage.
902    Should be on when PY_PROJ_WALL is on. */
903 #define PROJ_ON_WALL
904 
905 /* Allow players to target monsters in walls, for fairness (monsters can usually
906    target players in walls just fine). Should be on when PROJ_ON_WALL is on and
907    must be on if PROJ_MON_ON_WALL is on. */
908 #define PY_PROJ_WALL
909 
910 /* Allow monsters on wall grids which are _target_ (aka the epicenter x,y grid)
911    of a projection to get hit by it. Otherwise, monsters on wall grids are always
912    protected from balls/breaths by default. Must be on if PY_PROJ_WALL is on. */
913 #define PROJ_MON_ON_WALL
914 
915 /* Allow players to fire ammo at monsters standing on walls.
916    Also used for throwing. */
917 #define PY_FIRE_ON_WALL
918 
919 /* Allow monsters to cast bolt spells at players standing on a wall/mountain/tree grid?
920    Note: Shooting arrows/bolts/shots/missiles is casting bolt spells too. */
921 #define MON_BOLT_ON_WALL
922 
923 
924 /* Reduce the effect of aggravating equipment on the player
925    and especially fellow players? - C. Blue */
926 #define REDUCED_AGGRAVATION
927 
928 /* How do polymorph rings work? - C. Blue    [1]
929    0 = wear ring to keep the form, ring has timeout until it desintegrates
930    1 = ring gets destroyed on activation and effect is timed */
931 #define POLY_RING_METHOD 1
932 
933 /* SLAY and KILL (ie *SLAY*) multiplier */
934 #if 0 /* from old times when 2-handed weapons had very low dice */
935  #define FACTOR_MULT 1	/* multiplier for actual FACTOR_ values, for finer resolution */
936  #define FACTOR_HURT 2	/* slay animal/evil */
937  #define FACTOR_SLAY 3
938  #define FACTOR_KILL 5
939  #define FACTOR_BRAND_RES 2
940  #define FACTOR_BRAND 3
941  #define FACTOR_BRAND_SUSC 6
942 #else /* adjusted for modern weapon dice to prevent insane output */
943  #define FACTOR_MULT 10	/* multiplier for actual FACTOR_ values, for finer resolution */
944  #define FACTOR_HURT 15	/* slay animal/evil */
945  #define FACTOR_SLAY 20
946  #define FACTOR_KILL 30
947  #define FACTOR_BRAND_RES 15
948  #define FACTOR_BRAND 20
949  #define FACTOR_BRAND_SUSC 40
950 #endif
951 /* Apply flat brand/slay +todam bonus too (for low-dice weapons)? - C. Blue */
952 #define FLAT_HURT_BONUS		3
953 #define FLAT_BRAND_BONUS	4	/* same for susceptible monsters, none for resisting monsters */
954 #define FLAT_SLAY_BONUS		4
955 #define FLAT_KILL_BONUS		5
956 
957 
958 /* Approximate cap of a monster's average raw melee damage output per turn
959    (before AC of the target is even incorporated)	[700] */
960 #define AVG_MELEE_CAP		700
961 /* Non-magical ranged monsters' damage cap */
962 #define RANGED_CAP		500	/* UNUSED currently */
963 /* Generic magical damage cap (BEFORE susceptibilities, for those it may still be doubled) */
964 #define MAGICAL_CAP		1600
965 
966 
967 /* Divide stack size of ethereal ammunition by this to make it rarer */
968 #define ETHEREAL_AMMO_REDUCTION 2
969 
970 
971 /* Various melee/ranged combat settings for cmd1.c and cmd2.c mostly */
972 
973 #define MAX_VAMPIRIC_DRAIN 50   /* was 25 - note: this counts per turn, not per blow */
974 #define NON_WEAPON_VAMPIRIC_CHANCE 50 /* was 67 - chance to drain if VAMPIRIC is given be a non-weapon item */
975 
976 #define MAX_VAMPIRIC_DRAIN_RANGED 10    /* was 25 - note: this counts per shot, not per turn */
977 #define NON_WEAPON_VAMPIRIC_CHANCE_RANGED 33 /* chance to drain if VAMPIRIC is given be a non-weapon/non-ammo item */
978 
979 /* max range of arrows in do_cmd_fire.
980  * the aim is to prevent 'out-of-range attack' abuse.
981  * [MAX_RANGE] */
982 /* commented out due to monster AI improvements.
983  * activate it if STUPID_MONSTER_SPELLS is defined!
984  */
985 #define ARROW_DIST_LIMIT MAX_RANGE
986 
987 
988 /* Reduce damage in PvP by this factor */
989 #define PVP_MELEE_DAM_REDUCTION 3
990 /* Reduce damage in PvP by this factor */
991 #define PVP_SHOOT_DAM_REDUCTION 5 /* [3] */
992 /* Reduce damage in PvP by this factor */
993 #define PVP_THROW_DAM_REDUCTION 3
994 /* divide magical damage by this in PvP */
995 #define PVP_SPELL_DAM_REDUCTION 5
996 
997 /* Adam's experimental spell damage reduction for PvP (disables PVP_SPELL_DAM_REDUCTION if enabled) */
998 //#define EXPERIMENTAL_PVP_SPELL_DAM
999 
1000 /* Increase mana-regeneration rate in PvP? */
1001 #define PVP_MANA_REGEN_BOOST 3
1002 
1003 /* Reduce AC used for testing the hit chance in PvP?
1004    Intended to counter heavy royal armour, which would otherwise be near impossible to beat. */
1005 #define PVP_AC_REDUCTION
1006 
1007 /* Does backstabbing bypass damage reduction from AC? (somewhat experimental, needs play-testing) */
1008 #define PVP_BACKSTAB_PIERCES
1009 
1010 /* Reduction of vampirism in PvP (melee and ranged) */
1011 //unused atm #define PVP_VAMPIRISM_REDUCTION 3
1012 
1013 /* Should other hostile players in line of sight cause a player to abort running?
1014    PvP mode chars cannot run with this on, which might be bad if a ranged char has
1015    phase door on auto-retaliation, while the other char is melee. Disabling it for now. */
1016 //#define HOSTILITY_ABORTS_RUNNING
1017 
1018 /* Number of turns you cannot use /pvp to exit the pvp arena, recall, or teleport, after
1019    getting hit or after entering the pvp arena. - C. Blue */
1020 #define PVP_COOLDOWN_TELEPORT 30
1021 
1022 
1023 /* Not allowed to steal while in town? */
1024 #define TOWN_NO_STEALING
1025 
1026 /* Not allowed to steal on protected floor grids (Inns)? */
1027 #define PROTECTED_NO_STEALING
1028 
1029 
1030 /*
1031  * Allow wraith-formed player to pass through permawalls on the surface.
1032  */
1033 /*
1034  * TODO: wraithes should only pass townwalls of her/his own house
1035  */
1036 #define WRAITH_THROUGH_TOWNWALL
1037 
1038 /* when do rogues learn cloaking mode? */
1039 #define LEARN_CLOAKING_LEVEL 15
1040 
1041 /* Should a mind-link also display shops and shop actions to the secondary player? */
1042 //#define MINDLINK_STORE
1043 
1044 /* At which % should a char turn into a number? (10 = always, -1 = never) default: [6] */
1045 #define TURN_CHAR_INTO_NUMBER 7
1046 
1047 
1048 /* for PvP mode: */
1049 #define MIN_PVP_LEVEL	10
1050 #define MID_PVP_LEVEL	20
1051 #define MAX_PVP_LEVEL	30
1052 
1053 
1054 /*
1055  * Party commands
1056  */
1057 #define PARTY_CREATE		1
1058 #define PARTY_ADD		2
1059 #define PARTY_DELETE		3
1060 #define PARTY_REMOVE_ME		4
1061 #define PARTY_HOSTILE		5
1062 #define PARTY_PEACE		6
1063 #define PARTY_CREATE_IRONTEAM	7
1064 
1065 /*
1066  * Party modes
1067  */
1068 #define PA_NORMAL	0
1069 #define PA_IRONTEAM	1
1070 
1071 /*
1072  * Guild commands
1073  */
1074 #define GUILD_CREATE	1
1075 #define GUILD_ADD	2
1076 #define GUILD_DELETE	3
1077 #define GUILD_REMOVE_ME	4
1078 
1079 /*
1080  * Dungeon master commands
1081  */
1082 #define	MASTER_NULL	0
1083 #define	MASTER_LEVEL	1
1084 #define MASTER_BUILD	2
1085 #define	MASTER_SUMMON	3
1086 #define MASTER_GENERATE	4
1087 #define MASTER_PLAYER	5
1088 #define	MASTER_SCRIPTL  6
1089 #define	MASTER_SCRIPTB  7
1090 #define	MASTER_SCRIPTE  8
1091 #define	MASTER_SCRIPTS  9
1092 
1093 #define	MASTER_SUMMON_SPEFIC	0
1094 #define	MASTER_SUMMON_
1095 
1096 #define	MASTER_SCRIPTB_W	'w'
1097 #define	MASTER_SCRIPTB_A	'a'
1098 
1099 
1100 /* Dungeon indices (d_ptr->type) hardcoded from d_info.txt file: */
1101 #define DI_MT_DOOM		5
1102 #define DI_NETHER_REALM		6
1103 #define DI_HALLS_OF_MANDOS	8
1104 #define DI_PATHS_DEAD		16
1105 #define DI_SANDWORM_LAIR	27
1106 #define DI_VALINOR		31
1107 #define DI_CLOUD_PLANES		32
1108 
1109 /* Monster indices (r_idx) hardcoded from r_info.txt file.
1110    (Note -- the following code parts still use hard-coded numbers:
1111    taunt_monsters(), calc_body_bonus(), fountain_guard(), and mimic form handling:
1112    (mimic_shaman_E, mimic_druid, mimic_vampire, check_experience(), do_cmd_check_extra_info()).) */
1113 #define RI_UFTHAK		260
1114 #define RI_DOOR_MIMIC		311
1115 #define RI_VAMPIRE_BAT		391
1116 #define RI_BLOODLETTER		523
1117 #define RI_SANTA1		733	/* terror santa from hell */
1118 #define RI_DOL_GULDUR		819	/* 'easy' version of sauron */
1119 #define RI_OREMORJ		843	/* note: jokeangband */
1120 #define RI_SAURON		860
1121 #define RI_MORGOTH		862
1122 #define RI_TIK_SRVZLLAT		1032
1123 #define RI_LIVING_LIGHTNING	1147
1124 #define RI_HELLRAISER		1067
1125 #define RI_NETHER_GUARD		1068
1126 #define RI_DOR			1085
1127 #define RI_PUMPKIN1		1086
1128 #define RI_PUMPKIN2		1087
1129 #define RI_PUMPKIN3		1088
1130 #define RI_ZU_AON		1097
1131 #define RI_OROME		1098
1132 #define RI_BRIGHTLANCE		1100
1133 #define RI_TARGET_DUMMY1	1101	/* normal version */
1134 #define RI_SANTA2		1102	/* normal version */
1135 #define RI_CANDLEBEARER		1104	/* ENABLE_MAIA */
1136 #define RI_DARKLING		1105	/* ENABLE_MAIA */
1137 #define RI_BAD_LUCK_BAT		1114
1138 #define RI_TARGET_DUMMY2	1126	/* snow-covered version */
1139 #define RI_PANDA		1135
1140 #define RI_TARGET_DUMMYA1	1144	/* normal armoured version */
1141 #define RI_TARGET_DUMMYA2	1145	/* snow-covered armoured version */
1142 #define RI_HORNED_REAPER_GE	1146	/* low-power Horned Reaper for 'Dungeon Keeper' event */
1143 
1144 #define RI_ARCADE_START		1115	/* first arcade-specific monster; TODO: add ARCADE flag instead */
1145 #define RI_ARCADE_END		1124	/* last arcade-specific monster; TODO: add ARCADE flag instead */
1146 
1147 /* Monster ego power indices */
1148 #define RE_MASTER_THIEF		33	/* CHAR_CLEAR+ATTR_CLEAR */
1149 #define RE_SHADOWED		45	/* CHAR_CLEAR+ATTR_CLEAR */
1150 
1151 /* Summoning/spawning override flags for checks in monster placement routines */
1152 #define SO_NONE			0x0000	/* apply all checks (default) */
1153 #define SO_ALL			0xFFFF	/* ignore ALL checks (admin summmoning) */
1154 
1155 #define SO_PROTECTED		0x0001	/* ignore PROTECTED grids (Inn) */
1156 #define SO_HOUSE		0x0002	/* ignore CAVE_ICKY grids on surface around towns (houses) */
1157 #define SO_FORCE_DEPTH		0x0004	/* ignore FORCE_DEPTH check (monlev vs dunlev) */
1158 #define SO_GRID_EMPTY		0x0008	/* ignore check for 'empty' or 'mountain' (if monster can pass mountains) grid */
1159 
1160 #define SO_GRID_TERRAIN		0x0010	/* ignore check for terrain the monster can pass. NOTE: currently these two SO_GRID_.. are checked inconsistently -> fix! */
1161 #define SO_GRID_GLYPH		0x0020	/* ignore check for glyphed grid */
1162 #define SO_TT_RPG		0x0040	/* RPG server rules: Don't spawn any monsters in training tower */
1163 #define SO_EVENTS		0x0080	/* ignore check preventing disturbing live spawns during events. Note: wild_add_monster() has own check. */
1164 
1165 #define SO_PRE_STAIRS		0x0100	/* ignore safety check preventing monster packs occupying staircase grids, pushing off the player when he enters the level */
1166 #define SO_BOSS_LEVELS		0x0200	/* ignore checks which manage special levels (containing bosses) */
1167 #define SO_BOSS_MONSTERS	0x0400	/* ignore checks which restrict boss/special/unique monster appearances (nether realm monsters too) */
1168 #define SO_SURFACE		0x0800	/* ignore checks which restrict certain monster spawns on the world surface (breeders, uniques) */
1169 
1170 #define SO_IDDC			0x1000	/* legalize uncheezable summoning in ironman deep dive challenge. Note: clone/clone_summoning imply this flag! */
1171 #define SO_PLAYER_SUMMON	0x2000	/* player deliberately summoned -> do not reduce monster starting energy helpfully */
1172 
1173 
1174 /*
1175  * Methods of leaving a level
1176  */
1177 #define LEVEL_UP		0
1178 #define LEVEL_DOWN		1
1179 #define LEVEL_RAND		2
1180 #define LEVEL_GHOST		3
1181 #define	LEVEL_OUTSIDE   	4
1182 #define LEVEL_OUTSIDE_RAND 	5
1183 #define LEVEL_HOUSE 		6
1184 #define LEVEL_RECALL_UP 	7
1185 #define LEVEL_RECALL_DOWN 	8
1186 #define LEVEL_PROB_TRAVEL	9
1187 #define LEVEL_TO_TEMPLE		10
1188 
1189 /*
1190  * Pkill flags
1191  */
1192 #define PK_RULES_TRAD		0
1193 #define PK_RULES_DECLARE	1
1194 #define PK_RULES_NEVER		2
1195 
1196 #define PKILL_SET	1	/* On/off */
1197 /* KURZEL_PK -- We now just use a single (PK) flag (above) now. */
1198 #define PKILL_KILLABLE	2	/* Can be killed */
1199 #define PKILL_KILLER	4	/* Can kill */
1200 
1201 #define BUMP_OPEN_DOOR	0x01
1202 #define BUMP_OPEN_HOUSE	0x02
1203 #define BUMP_OPEN_TRAP	0x04
1204 
1205 /*
1206  * The types of special file perusal.
1207  */
1208 #define SPECIAL_FILE_NONE	0
1209 #define SPECIAL_FILE_UNIQUE	1
1210 #define SPECIAL_FILE_ARTIFACT	2
1211 #define SPECIAL_FILE_PLAYER	3
1212 #define SPECIAL_FILE_OTHER	4	/* actually, this can handle everything */
1213 #define SPECIAL_FILE_SCORES	5
1214 #define SPECIAL_FILE_HELP	6
1215 #define SPECIAL_FILE_PLAYER_EQUIP	7
1216 #define SPECIAL_FILE_LOG		8
1217 #define SPECIAL_FILE_RFE		9
1218 #define SPECIAL_FILE_SERVER_SETTING	10
1219 #define SPECIAL_FILE_MONSTER	11
1220 #define SPECIAL_FILE_OBJECT	12
1221 #define SPECIAL_FILE_HOUSE	13
1222 #define SPECIAL_FILE_TRAP	14
1223 #define SPECIAL_FILE_RECALL	15
1224 #define SPECIAL_FILE_MOTD2	16
1225 
1226 
1227 /*
1228  * The commands that can be given to the new console
1229  */
1230 #define CONSOLE_STATUS			  10
1231 #define CONSOLE_PLAYER_INFO		  11
1232 #define CONSOLE_ARTIFACT_LIST		  12
1233 #define CONSOLE_UNIQUE_LIST		  13
1234 #define CONSOLE_CHANGE_ARTIFACT		  14
1235 #define CONSOLE_CHANGE_UNIQUE		  15
1236 #define CONSOLE_SHUTDOWN		  16
1237 #define CONSOLE_MESSAGE			  17
1238 #define CONSOLE_KICK_PLAYER		  18
1239 #define CONSOLE_RELOAD_SERVER_PREFERENCES 19
1240 
1241 /*
1242  * The replies that the new console can send
1243  */
1244 #define CONSOLE_DENIED		100
1245 
1246 /*
1247  * Store constants
1248  */
1249 /* Total number of base stores (see "store.c", etc). Note: MAX_ST_IDX is total # of stores. */
1250 #define MAX_BASE_STORES	10		/* default stores that appear in every town */
1251 /* Total number of owners per store (see "store.c", etc) */
1252 #define MAX_STORE_OWNERS	6	/* Max size for st_ptr->owners[] */
1253 
1254 #define STORE_INVEN_MAX	120		/* Max number of discrete objs in inven [48] */
1255 #define STORE_CHOICES	56 /*34*/	/* Number of items to choose stock from */
1256 #define STORE_OBJ_LEVEL	5		/* Magic Level for normal stores */
1257 #define STORE_TURNOVER_DIV 3		/* Normal shop turnover, per day (stock_size / this = randint(amount of items to turnover)) */
1258 #if 0
1259 #define STORE_MIN_KEEP	10		/* Min slots to "always" keep full */
1260 #define STORE_MAX_KEEP	42		/* Max slots to "always" keep full */
1261 #else /* 0 */
1262 #define STORE_MIN_KEEP	6		/* Min slots to "always" keep full */
1263 #define STORE_MAX_KEEP	24		/* Max slots to "always" keep full */
1264 #endif /* 0 */
1265 #define STORE_SHUFFLE	20		/* 1/Chance (per day) of an owner changing */
1266 #define STORE_TURNOUT	60		/* Max turns a player may stay in a store if crowded */
1267 #define STORE_TURNS	(cfg.store_turns)	/* Number of turns between turnovers */
1268 
1269 #define STORE_PURSE_BOOST	10	/* Multiplier for max_cost (15) */
1270 
1271 #if 0
1272 #define STORE_TURNS	200		/* Number of turns between turnovers */
1273 #define STORE_SHUFFLE	25		/* 1/Chance (per day) of an owner changing */
1274 #define STORE_TURNS	500		/* Number of turns between turnovers */
1275 #endif
1276 
1277 /* Stores/buildings defines */
1278 #define STORE_HATED     0
1279 #define STORE_LIKED     1
1280 #define STORE_NORMAL    2
1281 
1282 #define STORE_MAX_ACTION	6
1283 
1284 /* Store flags */
1285 #define SF1_DEPEND_LEVEL        0x00000001L	/* Item kind levels depend on dungeon level */
1286 #define SF1_SHALLOW_LEVEL       0x00000002L	/* Add a little to minimum item level */
1287 #define SF1_MEDIUM_LEVEL        0x00000004L	/* Add to minimum item level */
1288 #define SF1_DEEP_LEVEL          0x00000008L	/* Add much to minimum item level */
1289 #define SF1_RARE                0x00000010L
1290 #define SF1_VERY_RARE           0x00000020L
1291 //#define SF1_COMMON              0x00000040L	/* Currently no effect */
1292 #define SF1_FLAT_BASE		0x00000040L	/* a) prevent rare base item types, b) give all base item types same probability */
1293 #define SF1_ALL_ITEM            0x00000080L	/* Works as the BM */
1294 #define SF1_RANDOM              0x00000100L	/* Sets level to 0 for apply_magic() if it isn't increased by ..._LEVEL store flags anyway. */
1295 #define SF1_FORCE_LEVEL         0x00000200L	/* Prevent items of much lower kind level than store level. Applies to T-256 wildcard only. */
1296 #define SF1_MUSEUM              0x00000400L
1297 #define SF1_NO_DISCOUNT		0x00000800L	/* no discount at all */
1298 #define SF1_NO_DISCOUNT2	0x00001000L	/* no 50%/75%/90% off */
1299 #define SF1_EGO     	      	0x00002000L	/* often has ego items (should go with SF1_GOOD and SF1_GREAT) */
1300 #define SF1_RARE_EGO            0x00004000L	/* reroll on cheap ego items (value<25000) at 67% probability */
1301 #define SF1_PRICE1     	      	0x00008000L	/* prices * 1.5 */
1302 #define SF1_PRICE2     	      	0x00010000L	/* double prices */
1303 #define SF1_PRICE4            	0x00020000L	/* prices * 4 */
1304 #define SF1_PRICE16            	0x00040000L	/* prices * 16 */
1305 #define SF1_GOOD     	      	0x00080000L	/* apply_magic good */
1306 #define SF1_GREAT            	0x00100000L	/* apply_magic great */
1307 #define SF1_PRICY_ITEMS1     	0x00200000L	/* items are worth 1000+ */
1308 #define SF1_PRICY_ITEMS2      	0x00400000L	/* items are worth 5000+ */
1309 #define SF1_PRICY_ITEMS3      	0x00800000L	/* items are worth 10000+ */
1310 #define SF1_PRICY_ITEMS4      	0x01000000L	/* items are worth 20000+ */
1311 #define SF1_HARD_STEAL 	      	0x02000000L	/* hard to steal from this shop */
1312 #define SF1_VHARD_STEAL	      	0x04000000L	/* very hard to steal from this shop */
1313 #define SF1_SPECIAL		0x08000000L	/* Store doesn't have an inventory but prints arbitrary text to screen instead */
1314 #define SF1_BUY67		0x10000000L	/* Shop buys for 67% of value */
1315 #define SF1_NO_DISCOUNT1	0x20000000L	/* no 20+% discounts */
1316 //flag hole:
1317 #define SF1_XXXXXXXXXXXX	0x40000000L	/*  */
1318 #define SF1_ZEROLEVEL		0x80000000L	/* all items are level 0 and can't be traded */
1319 
1320 /* This seems to be bad, but backported once anyway;
1321  * consider removing them later */
1322 #define STORE_GENERAL	0
1323 #define STORE_ARMOURY	1
1324 #define STORE_WEAPON	2
1325 #define STORE_TEMPLE	3
1326 #define STORE_ALCHEMIST	4
1327 #define STORE_MAGIC	5
1328 #define STORE_BLACK	6
1329 #define STORE_HOME	7
1330 #define STORE_BOOK	8
1331 //#define STORE_PET	9
1332 #define STORE_RUNE	9
1333 #define STORE_MAYOR	10
1334 #define STORE_INN	11
1335 #define STORE_CASINO	15
1336 #define STORE_JEWELX	42
1337 #define STORE_SHOESX	45
1338 #define STORE_LIBRARY	46		/* unused */
1339 #define STORE_FORBIDDENLIBRARY	47	/* unused */
1340 #define STORE_BLACKX	48
1341 #define STORE_MINING	59
1342 #define STORE_BLACKS	60
1343 #define STORE_BTSUPPLY	61
1344 #define STORE_HERBALIST 62
1345 #define STORE_STRADER	63	/* for ironman dungeons / RPG_SERVER settings */
1346 
1347 /* The specialist shops - the_sandman */
1348 #define STORE_SPEC_AXE		38
1349 #define STORE_SPEC_BLUNT	39
1350 #define STORE_SPEC_POLE		40
1351 #define STORE_SPEC_SWORD	41
1352 #define STORE_DEEPSUPPLY	51
1353 #define STORE_SPEC_SCROLL	52
1354 #define STORE_SPEC_POTION	53
1355 #define STORE_SPEC_ARCHER	55
1356 #define STORE_MERCHANTS_GUILD	56
1357 #define STORE_MATHOM_HOUSE	57
1358 #define STORE_SPEC_CLOSECOMBAT	64
1359 #define STORE_HIDDENLIBRARY	65
1360 //player store template is	66
1361 #define STORE_POTION_IDDC	67
1362 #define STORE_DUNGEON_INN	68
1363 
1364 /* Dungeon store clones of the normal town stores */
1365 #define STORE_GENERAL_DUN	70
1366 #define STORE_ARMOURY_DUN	71
1367 #define STORE_WEAPON_DUN	72
1368 #define STORE_TEMPLE_DUN	73
1369 #define STORE_ALCHEMIST_DUN	74
1370 #define STORE_MAGIC_DUN		75
1371 #define STORE_BLACK_DUN		76
1372 #define STORE_HOME_DUN		77
1373 #define STORE_BOOK_DUN		78
1374 //#define STORE_PET_DUN		79
1375 #define STORE_RUNE_DUN		79
1376 
1377 /* special 'stores' (hacks for build_store()) */
1378 #define STORE_FEAT_MORE	100	/* staircase down */
1379 #define STORE_FEAT_LESS	101	/* staircase up */
1380 #define STORE_HOUSE	102	/* trad/list/appartment */
1381 #define STORE_DOORWAY	103	/* 'destroyed house' */
1382 #define STORE_FOREST	104
1383 #define STORE_POND	105
1384 #define STORE_AUCTION	106	/* deprecated (not 'new' code, would need re-integration first) */
1385 #define STORE_NINE	107	/* unknown, but supposed to have been a '9' and much bigger */
1386 
1387 
1388 /*
1389  * Misc constants
1390  */
1391 #define SERVER_SAVE	500		/* How often to save the server state (100) */
1392 #if 0
1393  #define TOWN_DAWN	10000		/* Number of turns from dawn to dawn XXX */
1394  #define TOWN_DAWN	(DAY / 2)	/* Number of turns from dawn to dawn XXX */
1395 #endif /* 0 */
1396 #define GROW_TREE	5000		/* How often to grow a new tree in town */
1397 #define BREAK_GLYPH	350		/* Rune of protection resistance */
1398 #define BTH_PLUS_ADJ	3		/* Adjust BTH per plus-to-hit */
1399 #define MON_MULT_ADJ	8		/* High value slows multiplication */
1400 #define MON_SUMMON_ADJ	2		/* Adjust level of summoned creatures */
1401 #define MON_DRAIN_LIFE	2		/* Percent of player exp drained per hit */
1402 #define USE_DEVICE	3		/* x> Harder devices x< Easier devices */
1403 /* Enable to prevent cursed diggers/tools to be created. - C. Blue
1404    Note: For tools that do not have (+hit) or (+dam) values, this might
1405    slightly increase amount of tools generated in stores since they will
1406    be generated fine even if they'd otherwise have come out as 'cursed'. */
1407 //#define PREVENT_CURSED_TOOLS
1408 /* If enabled, ATTR_BNW is calculated 'manually' on server-side same as
1409    breath-based flickering. This makes the BNW flickering much slower, which
1410    might or might not look better than the client-side fast flickering of
1411    dungeon wizards. Added ATTR_BNW and all this for silyl Panda Bear. - C. Blue
1412    NOTE: ATTR_BNW Stacks with ATTR_BASE. If SLOW_ATTR_BNW is NOT defined, then
1413    ATTR_BNW even cannot be used without ATTR_BASE if client is <= v447, because
1414    sole ATTR_BNW will also return TERM_DARK otherwise, which looks pretty bad. */
1415 #define SLOW_ATTR_BNW
1416 
1417 
1418 /*
1419  * There is a 1/20 (5%) chance of inflating the requested object_level
1420  * during the creation of an object (see "get_obj_num()" in "object.c").
1421  * Lower values yield better objects more often.
1422  */
1423 #define GREAT_OBJ	20
1424 
1425 /*
1426  * There is a 1/50 (2%) chance of inflating the requested monster_level
1427  * during the creation of a monsters (see "get_mon_num()" in "monster.c").
1428  * Lower values yield harder monsters more often.
1429  */
1430 #define NASTY_MON	50		/* 1/chance of inflated monster level */
1431 
1432 
1433 
1434 /*
1435  * Refueling constants
1436  */
1437 #define FUEL_TORCH	5000	/* Maximum amount of fuel in a torch */
1438 #define FUEL_LAMP	15000   /* Maximum amount of fuel in a lantern */
1439 
1440 
1441 /*
1442  * More maximum values
1443  */
1444 #define MAX_SIGHT	20	/* Maximum view distance */
1445 #define MAX_RANGE	18	/* Maximum range (spells, etc) */
1446 
1447 
1448 
1449 /*
1450  * There is a 1/160 chance per round of creating a new monster
1451  */
1452 #define MAX_M_ALLOC_CHANCE	160
1453 
1454 /*
1455  * Normal levels get at least 14 monsters
1456  */
1457 #define MIN_M_ALLOC_LEVEL	14
1458 
1459 /*
1460  * The town starts out with 4 residents during the day
1461  */
1462 #define MIN_M_ALLOC_TD		4
1463 
1464 /*
1465  * The town starts out with 8 residents during the night
1466  */
1467 #define MIN_M_ALLOC_TN		8
1468 
1469 
1470 /*
1471  * Misc constants ( see bst(), do_cmd_time() )
1472  */
1473 #define DAY			(10 * 384 * cfg.fps)	/* Number of turns per day (192) times cfg.fps */
1474 #define HOUR                    (DAY / 24)              /* Number of turns per hour */
1475 #define MINUTE                  (HOUR / 60)             /* Number of turns per minute */
1476 #define YEAR                    (DAY * 365)             /* Number of turns per year */
1477 
1478 #define SUNRISE			6			/* Sunrise */
1479 #define NIGHTFALL		20			/* Nightfall */
1480 
1481 /* Macros for determing if it is night or day */
1482 
1483 #if 0
1484  #define	IS_DAY	 ((turn % (10L * TOWN_DAWN)) <= (10L * TOWN_DAWN / 2))
1485  #define	IS_NIGHT ((turn % (10L * TOWN_DAWN)) > (10L * TOWN_DAWN / 2))
1486 #else	/* 0 */
1487  #define	IS_NIGHT_RAW	((bst(HOUR, turn) < SUNRISE) || (bst(HOUR, turn) >= NIGHTFALL))
1488  /* Certain events keep the world dark - Halloween and fireworks during season_new_years_eve: */
1489  #define	IS_NIGHT	(IS_NIGHT_RAW || season_halloween || fireworks)
1490  #define	IS_DAY		(!IS_NIGHT)
1491 #endif	/* 0 */
1492 /* For new quests */
1493  #define	IS_MORNING	((bst(HOUR, turn) >= SUNRISE) && (bst(HOUR, turn) < 9))
1494  #define	IS_FORENOON	((bst(HOUR, turn) >= 9) && (bst(HOUR, turn) < 12))
1495  #define	IS_NOON		((bst(HOUR, turn) >= 12) && (bst(HOUR, turn) < 14))
1496  #define	IS_AFTERNOON	((bst(HOUR, turn) >= 14) && (bst(HOUR, turn) < 19))
1497  #define	IS_EVENING	((bst(HOUR, turn) >= 19) && (bst(HOUR, turn) <= 23))
1498  #define	IS_MIDNIGHT	((bst(HOUR, turn) >= 0) && (bst(HOUR, turn) < 1))
1499  #define	IS_DEEPNIGHT	((bst(HOUR, turn) >= 1) && (bst(HOUR, turn) < SUNRISE))
1500 
1501 
1502 /* More time macros */
1503 
1504 #define START_YEAR              2890                    /* Bilbo birthday year */
1505 #define START_DAY               265			/* Bilbo birthday (22. Sept.) */
1506 
1507 
1508 /*
1509  * A monster can only "multiply" (reproduce) if there are fewer than 100
1510  * monsters on the level capable of such spontaneous reproduction.  This
1511  * is a hack which prevents the "m_list[]" array from exploding due to
1512  * reproducing monsters.  Messy, but necessary.
1513  */
1514 #define MAX_REPRO	100
1515 
1516 
1517 /*
1518  * Player constants
1519  */
1520 #define PY_MAX_EXP	999999999L	/* Maximum exp */
1521 //#define PY_MAX_EXP	4899999996L	/* Maximum exp */
1522 //#define PY_MAX_EXP	3899999997L	/* Maximum exp */
1523 #define PY_MAX_GOLD	999999999L	/* Maximum gold: 999 M  --  no effect currently */
1524 #define PY_MAX_PLAYER_LEVEL	99	/* Maximum level attainable by a player (non-admin) */
1525 #define PY_MAX_LEVEL		100	/* Maximum level allowed technically */
1526 
1527 /*
1528  * Player "food" crucial values
1529  */
1530 #define PY_FOOD_MAX	15000	/* Food value (Bloated) */
1531 #define PY_FOOD_FULL	10000	/* Food value (Normal) */
1532 #define PY_FOOD_ALERT	3000	/* Food value (Hungry) was 2000 */
1533 #define PY_FOOD_WEAK	2000	/* Food value (Weak) was 1000 */
1534 #define PY_FOOD_FAINT	1000	/* Food value (Fainting) was 500 */
1535 #define PY_FOOD_STARVE	200	/* Food value (Starving) was 100 */
1536 
1537 /*
1538  * Player regeneration constants
1539  */
1540 #define PY_REGEN_NORMAL		197		/* Regen factor*2^16 when full */
1541 #define PY_REGEN_WEAK		98		/* Regen factor*2^16 when weak */
1542 #define PY_REGEN_FAINT		33		/* Regen factor*2^16 when fainting */
1543 //#define PY_REGEN_HPBASE		1442		/* Min amount hp regen*2^16 */  <- doesn't counter single life drain.
1544 //#define PY_REGEN_HPBASE		1642		/* Min amount hp regen*2^16 */  <- works well, a bit stronger regen rate.
1545 #define PY_REGEN_HPBASE		1542		/* Min amount hp regen*2^16 */
1546 //#define PY_REGEN_HPBASE		1492		/* Min amount hp regen*2^16 */  <- works negatively at ~<=215 HP, positively at ~>=260 HP
1547 #define PY_REGEN_MNBASE		524		/* Min amount mana regen*2^16 */
1548 
1549 
1550 
1551 /*** Option Definitions ***/
1552 #define OPT_MAX		154	/* 6+1 pages a 22 options */
1553 #define OPT_MAX_COMPAT	128	/* 64; 96 */
1554 #define OPT_MAX_OLD	96	/* for clients <= 4.5.5 */
1555 
1556 
1557 /*
1558  * Maximum number of "normal" pack slots, and the index of the "overflow"
1559  * slot, which can hold an item, but only temporarily, since it causes the
1560  * pack to "overflow", dropping the "last" item onto the ground.  Since this
1561  * value is used as an actual slot, it must be less than "INVEN_WIELD" (below).
1562  * Note that "INVEN_PACK" is probably hard-coded by its use in savefiles, and
1563  * by the fact that the screen can only show 23 items plus a one-line prompt.
1564  */
1565 #define INVEN_PACK		23
1566 
1567 /*
1568  * Body parts
1569  */
1570 #define BODY_WEAPON     0
1571 #define BODY_TORSO      1
1572 #define BODY_ARMS       2
1573 #define BODY_FINGER     3
1574 #define BODY_HEAD       4
1575 #define BODY_LEGS       5
1576 #define BODY_MAX        6
1577 
1578 /*
1579  * Indexes used for various "equipment" slots (hard-coded by savefiles, etc).
1580  */
1581 #define INVEN_WIELD	24
1582 #define INVEN_ARM	25
1583 #define INVEN_BOW	26
1584 #define INVEN_LEFT	27
1585 #define INVEN_RIGHT	28
1586 #define INVEN_NECK	29
1587 #define INVEN_LITE	30
1588 #define INVEN_BODY	31
1589 #define INVEN_OUTER	32
1590 #define INVEN_HEAD	33
1591 #define INVEN_HANDS	34
1592 #define INVEN_FEET	35
1593 
1594 #define INVEN_AMMO      36 /* 1 quiver -- TORSO */
1595 #define INVEN_TOOL      37 /* 1 tool -- ARMS */
1596 
1597 #if 0	/* ToME ones - later, later :) */
1598 #define INVEN_WIELD     24 /* 3 weapons -- WEAPONS */
1599 #define INVEN_BOW       27 /* 1 bow -- WEAPON */
1600 #define INVEN_RING      28 /* 6 rings -- FINGER */
1601 #define INVEN_NECK      34 /* 2 amulets -- HEAD */
1602 #define INVEN_LITE      36 /* 1 lite -- TORSO */
1603 #define INVEN_BODY      37 /* 1 body -- TORSO */
1604 #define INVEN_OUTER     38 /* 1 cloak -- TORSO */
1605 #define INVEN_ARM       39 /* 3 arms -- ARMS */
1606 #define INVEN_HEAD      42 /* 2 heads -- HEAD */
1607 #define INVEN_HANDS     44 /* 3 hands -- ARMS */
1608 #define INVEN_FEET      47 /* 2 feets -- LEGS */
1609 #define INVEN_CARRY     49 /* 1 carried monster -- TORSO */
1610 #define INVEN_AMMO      50 /* 1 quiver -- TORSO */
1611 #define INVEN_TOOL      51 /* 1 tool -- ARMS */
1612 #endif	/* 0 */
1613 
1614 
1615 /*
1616  * Total number of inventory slots (hard-coded).
1617  */
1618 #define INVEN_TOTAL	38	/* since they start at 0, max slot index is INVEN_TOTAL - 1 (!) */
1619 /* Number of equipment slots, INVEN_TOTAL ... INVEN_TOTAL + INVEN_EQ - 1 */
1620 #define INVEN_EQ        (INVEN_TOTAL - INVEN_WIELD)
1621 
1622 
1623 /*
1624  * A "stack" of items is limited to less than 100 items (hard-coded).
1625  */
1626 #define MAX_STACK_SIZE			100
1627 
1628 /* Different items stacking may at most pile up to this many items (0 = no limit) */
1629 //#define MAX_ITEMS_STACKING		10
1630 
1631 
1632 
1633 /*
1634  * Indexes of the various "stats" (hard-coded by savefiles, etc).
1635  */
1636 #define A_STR	0
1637 #define A_INT	1
1638 #define A_WIS	2
1639 #define A_DEX	3
1640 #define A_CON	4
1641 #define A_CHR	5
1642 
1643 /*
1644  * Player race constants (hard-coded by save-files, arrays, etc)
1645  */
1646 #define RACE_HUMAN	0
1647 #define RACE_HALF_ELF	1
1648 #define RACE_ELF	2
1649 #define RACE_HOBBIT	3
1650 #define RACE_GNOME	4
1651 #define RACE_DWARF	5
1652 #define RACE_HALF_ORC	6
1653 #define RACE_HALF_TROLL	7
1654 #define RACE_DUNADAN	8
1655 #define RACE_HIGH_ELF	9
1656 #define RACE_YEEK	10
1657 #define RACE_GOBLIN	11
1658 #define RACE_ENT	12
1659 #define RACE_DRACONIAN	13
1660 #ifdef ENABLE_KOBOLD
1661  #define RACE_KOBOLD	14
1662  #define RACE_DARK_ELF	15
1663  #define RACE_VAMPIRE	16
1664  //#ifdef ENABLE_MAIA
1665  #define RACE_MAIA	17
1666  //#endif
1667 #else
1668  #define RACE_DARK_ELF	14
1669  #define RACE_VAMPIRE	15
1670  //#ifdef ENABLE_MAIA
1671  #define RACE_MAIA	16
1672  //#endif
1673 #endif
1674 /* (or simply replace all those defines with p_info.txt) */
1675 
1676 /*
1677  * Player class constants (hard-coded by save-files, arrays, etc)
1678  */
1679 #define CLASS_WARRIOR		0
1680 #define CLASS_MAGE		1
1681 #define CLASS_PRIEST		2
1682 #define CLASS_ROGUE		3
1683 #define CLASS_MIMIC		4
1684 #define CLASS_ARCHER		5
1685 #define CLASS_PALADIN		6
1686 #define CLASS_RANGER		7
1687 #define CLASS_ADVENTURER	8
1688 //#define CLASS_BARD		9
1689 #define CLASS_DRUID		9
1690 #define CLASS_SHAMAN		10
1691 #define CLASS_RUNEMASTER	11
1692 #define CLASS_MINDCRAFTER	12
1693 
1694 /*
1695  * Races' class flags, which races allow which classes for choice
1696  * (must be same order as according CLASS_.. constants!)
1697  */
1698 #define CF_NONE	0x0000
1699 #define CF_ALL	0xFFFF
1700 
1701 #define CFW	0x0001	/* Warrior */
1702 #define CFI	0x0002	/* Istar */
1703 #define CFP	0x0004	/* Priest */
1704 #define CFR	0x0008	/* Rogue */
1705 
1706 #define CFM	0x0010	/* Mimic */
1707 #define CFA	0x0020	/* Archer */
1708 #define CFL	0x0040	/* Paladin */
1709 #define CFN	0x0080	/* Ranger */
1710 
1711 #define CFX	0x0100	/* Adventurer */
1712 #define CFD	0x0200	/* Druid */
1713 #define CFS	0x0400	/* Shaman */
1714 #define CFU	0x0800	/* Runemaster */
1715 
1716 #define CFC	0x1000	/* Mindcrafter */
1717 
1718 /*
1719  * Traits' class flags, which traits are allowed for which race for choice
1720  */
1721 #define RF_NONE	0x000000
1722 #define RF_ALL	0xFFFFFF
1723 
1724 #define RFU	0x000001	/* Human */
1725 #define RFL	0x000002	/* Half-Elf */
1726 #define RFE	0x000004	/* Elf */
1727 #define RFH	0x000008	/* Hobbit */
1728 
1729 #define RFG	0x000010	/* Gnome */
1730 #define RFD	0x000020	/* Dwarf */
1731 #define RFO	0x000040	/* Half-Orc */
1732 #define RFT	0x000080	/* Half-Troll */
1733 
1734 #define RFA	0x000100	/* Dunadan */
1735 #define RFF	0x000200	/* High-Elf */
1736 #define RFY	0x000400	/* Yeek */
1737 #define RFI	0x000800	/* Goblin */
1738 
1739 #define RFN	0x001000	/* Ent */
1740 #define RFC	0x002000	/* Draconian */
1741 #define RFK	0x004000	/* Dark-Elf */
1742 #define RFV	0x008000	/* Vampire */
1743 
1744 #define RFM	0x010000	/* Maia */
1745 #define RFB	0x020000	/* Kobold */
1746 
1747 
1748 /*
1749  * The traits
1750  */
1751 #define TRAIT_NONE		0	/* N/A */
1752 
1753 #define TRAIT_BLUE		1	/* Draconians */
1754 #define TRAIT_WHITE		2
1755 #define TRAIT_RED		3
1756 #define TRAIT_BLACK		4
1757 #define TRAIT_GREEN		5
1758 #define TRAIT_MULTI		6
1759 #define TRAIT_BRONZE		7
1760 #define TRAIT_SILVER		8
1761 #define TRAIT_GOLD		9
1762 #define TRAIT_LAW		10
1763 #define TRAIT_CHAOS		11
1764 #define TRAIT_BALANCE		12
1765 #define TRAIT_POWER		13
1766 
1767 #define TRAIT_ENLIGHTENED	14	/* Maiar */
1768 #define TRAIT_CORRUPTED		15
1769 
1770 
1771 /*
1772  * Define the realms
1773  */
1774 #define REALM_MAGERY            0
1775 #define REALM_PRAYER            1
1776 #define REALM_SORCERY           2
1777 #define REALM_FIGHTING          3
1778 #define REALM_SHADOW            4
1779 #define REALM_HUNT              5
1780 #define REALM_PSI               6
1781 #define REALM_GHOST             7
1782 #define MAX_REALM               8
1783 
1784 /* hack needed in Handle_direction */
1785 #define REALM_MIMIC		200
1786 #define REALM_SCHOOL		201
1787 
1788 /*** Screen Locations ***/
1789 
1790 /*
1791  * Some screen locations for various display routines
1792  * Currently, row 8 and 15 are the only "blank" rows.
1793  * That leaves a "border" around the "stat" values.
1794  */
1795 
1796 /* DEG PARTY Client defines */
1797 #define CLIENT_PARTY_ROWHP      8
1798 #define CLIENT_PARTY_COLHP      0
1799 
1800 #define CLIENT_PARTY_ROWSP      9
1801 #define CLIENT_PARTY_COLSP      0
1802 
1803 #define CLIENT_PARTY_ROWMBR     11
1804 #define CLIENT_PARTY_COLMBR     0
1805 
1806 #define ROW_RACE		1
1807 #define COL_RACE		0	/* <race name> */
1808 
1809 #define ROW_CLASS		2
1810 #define COL_CLASS		0	/* <class name> */
1811 
1812 #define ROW_TITLE		3
1813 #define COL_TITLE		0	/* <title> or <mode> */
1814 
1815 #define ROW_LEVEL		4
1816 #define COL_LEVEL		0	/* "LEVEL xxxxxx" */
1817 
1818 #define ROW_EXP			5
1819 #define COL_EXP			0	/* "EXP xxxxxxxx" */
1820 
1821 #define ROW_GOLD		6
1822 #define COL_GOLD		0	/* "AU xxxxxxxxx" */
1823 
1824 #define ROW_STAT		9
1825 #define COL_STAT		0	/* "xxx   xxxxxx" */
1826 
1827 #define ROW_AC			16
1828 #define COL_AC			0	/* "Cur AC xxxxx" */
1829 
1830 #define CONDENSED_HP_SP		/* reduce HP and SP to 1 line each, instead of 1 line for max and 1 line for cur values? */
1831 
1832 #ifndef CONDENSED_HP_SP
1833  #define ROW_MAXHP		16
1834  #define COL_MAXHP		0	/* "Max HP xxxxx" */
1835 
1836  #define ROW_CURHP		17
1837  #define COL_CURHP		0	/* "Cur HP xxxxx" */
1838 
1839  #define ROW_MAXSP		18
1840  #define COL_MAXSP		0	/* "Max SP xxxxx" */
1841 
1842  #define ROW_CURSP		19
1843  #define COL_CURSP		0	/* "Cur SP xxxxx" */
1844 
1845  #define ROW_EXSTA              -1      /* extra status, requires CONDENSED_HP_SP ! */
1846  #define COL_EXSTA		-1
1847 #else
1848  #define ROW_MAXHP		17
1849  #define COL_MAXHP		8	/* "Max HP xxxxx" */
1850 
1851  #define ROW_CURHP		17
1852  #define COL_CURHP		3	/* "Cur HP xxxxx" */
1853 
1854  #define ROW_MAXSP		18
1855  #define COL_MAXSP		8	/* "Max SP xxxxx" */
1856 
1857  #define ROW_CURSP		18
1858  #define COL_CURSP		3	/* "Cur SP xxxxx" */
1859 
1860  #define ROW_MAXST		19	/* current stamina */
1861  #define COL_MAXST		8
1862 
1863  #define ROW_CURST		19	/* current stamina */
1864  #define COL_CURST		3
1865 
1866  #define ROW_EXSTA              20      /* extra status, requires CONDENSED_HP_SP ! */
1867  #define COL_EXSTA		0
1868 #endif
1869 
1870 
1871 #define ROW_SANITY		15	/* "Sanity  100%" */
1872 #define COL_SANITY		0
1873 
1874 #if 1
1875 #define ROW_INFO		21
1876 #define COL_INFO		0	/* "xxxxxxxxxxxx" */
1877 #endif	/* if 1 */
1878 
1879 /* begin of 'bottom-aligned' status info, for large map size support - C. Blue */
1880 
1881 #define ROW_CUT			(22 + HGT_PLUS)
1882 #define COL_CUT			0	/* <cut> */
1883 
1884 #define ROW_STUN		(23 + HGT_PLUS)
1885 #define COL_STUN		38	/* <stun> */
1886 
1887 #define ROW_HUNGRY		(23 + HGT_PLUS)
1888 #define COL_HUNGRY		0	/* "Weak" / "Hungry" / "Full" / "Gorged" */
1889 
1890 #define ROW_BLIND		(23 + HGT_PLUS)
1891 #define COL_BLIND		7	/* "Blind" */
1892 
1893 #define ROW_CONFUSED		(23 + HGT_PLUS)
1894 #define COL_CONFUSED		13	/* "Confused" */
1895 
1896 #define ROW_AFRAID		(23 + HGT_PLUS)
1897 #define COL_AFRAID		22	/* "Afraid" */
1898 
1899 #define ROW_POISONED		(23 + HGT_PLUS)
1900 #define COL_POISONED		29	/* "Poisoned" */
1901 
1902 #define ROW_STATE		(23 + HGT_PLUS)
1903 #define COL_STATE		38	/* <state> */
1904 
1905 #define ROW_SPEED		(23 + HGT_PLUS)
1906 #define COL_SPEED		50	/* "Slow (-NN)" or "Fast (+NN)" */
1907 
1908 #define ROW_STUDY		(23 + HGT_PLUS)
1909 #define COL_STUDY		62	/* "Study" */
1910 #define ROW_BPR			(23 + HGT_PLUS)
1911 #define COL_BPR			61	/* Blows/Round */
1912 
1913 #define ROW_DEPTH		(23 + HGT_PLUS)
1914 #define COL_DEPTH		69	/* "Lev NNN" / "NNNN ft" */
1915 
1916 /* non-bottom-aligned stuff again */
1917 
1918 #define ROW_XYPOS		21
1919 #define COL_XYPOS		0
1920 
1921 #define ROW_AFK                 21
1922 #define COL_AFK                 7       /* "AFK" */
1923 
1924 #define ROW_CUMBER              7
1925 #define COL_CUMBER              0       /* encumberment icons bar */
1926 
1927 #define ROW_LAG                 8
1928 #define COL_LAG                 0       /* mini lag-o-meter */
1929 
1930 /*** Terrain Feature Indexes (see "lib/edit/f_info.txt") ***/
1931 
1932 /* Nothing */
1933 #define FEAT_NONE               0x00
1934 
1935 /* Basic features */
1936 #define FEAT_FLOOR              0x01
1937 #define FEAT_FOUNTAIN           0x02
1938 #define FEAT_GLYPH              0x03
1939 #define FEAT_OPEN               0x04
1940 #define FEAT_BROKEN             0x05
1941 #define FEAT_LESS               0x06
1942 #define FEAT_MORE               0x07
1943 
1944 /* Quest features -KMW- */
1945 #define FEAT_QUEST_ENTER        0x08
1946 #define FEAT_QUEST_EXIT         0x09
1947 #define FEAT_QUEST_DOWN         0x0A
1948 #define FEAT_QUEST_UP           0x0B
1949 
1950 /* Shafts -GSN- */
1951 #define FEAT_SHAFT_DOWN         0x0D
1952 #define FEAT_SHAFT_UP           0x0E
1953 
1954 #define FEAT_EMPTY_FOUNTAIN     0x0F
1955 #define FEAT_WEB		0x10
1956 #define FEAT_TRAP               0x11
1957 
1958 /* Features 0x12 - 0x1F -- unused */
1959 /* Resurrected ones from Mangband/TomeNET */
1960 #define FEAT_CROP		0x12
1961 #define FEAT_LOOSE_DIRT		0x13
1962 #define FEAT_HOME_OPEN		0x14
1963 #define FEAT_SIGN		0x15
1964 #define FEAT_PERM_CLEAR		0x16
1965 #define FEAT_LOGS		0x17
1966 #define FEAT_DRAWBRIDGE		0x18
1967 #define FEAT_HOME		0x19
1968 #define FEAT_WALL_HOUSE		0x1A	/* permanent wall for player houses */
1969 
1970 /* Backward compatibility Hack */
1971 #define FEAT_HOME_HEAD	0x19
1972 #define FEAT_HOME_TAIL	0x19
1973 
1974 /* New features, filling up the gaps in f_info */
1975 #define FEAT_FOUNTAIN_BLOOD	0x1B	/* for Vampires */
1976 
1977 /* Like house wall, but for upper storeys, not illuminated by lamp light therefore */
1978 #define FEAT_WALL_HOUSEUPPER	0x1C
1979 
1980 /* Doors */
1981 #define FEAT_DOOR_HEAD          0x20
1982 #define FEAT_DOOR_TAIL          0x2F
1983 
1984 /* Extra */
1985 #define FEAT_SECRET             0x30
1986 #define FEAT_RUBBLE             0x31
1987 
1988 /* Seams */
1989 #define FEAT_MAGMA              0x32
1990 #define FEAT_QUARTZ             0x33
1991 #define FEAT_MAGMA_H            0x34	/* hidden treasure -- not generated atm */
1992 #define FEAT_QUARTZ_H           0x35	/* hidden treasure -- not generated atm */
1993 #define FEAT_MAGMA_K            0x36	/* known treasure */
1994 #define FEAT_QUARTZ_K           0x37	/* known treasure */
1995 
1996 /* Walls */
1997 #define FEAT_WALL_EXTRA         0x38
1998 #define FEAT_WALL_INNER         0x39
1999 #define FEAT_WALL_OUTER         0x3A
2000 #define FEAT_WALL_SOLID         0x3B
2001 #define FEAT_PERM_EXTRA         0x3C	/* shop/house walls */
2002 #define FEAT_PERM_INNER         0x3D	/* inner vault walls (also used for Dungeon Keeper) */
2003 #define FEAT_PERM_OUTER         0x3E	/* outer vault walls */
2004 #define FEAT_PERM_SOLID         0x3F	/* dungeon border */
2005 /* note: also check add_outer_wall() about FEAT_PERM_OUTER and FEAT_PERM_EXTRA */
2006 
2007 /* Explosive rune */
2008 #define FEAT_RUNE		0x40
2009 
2010 /* Pattern */
2011 #define FEAT_PATTERN_START      0x41
2012 #define FEAT_PATTERN_1          0x42
2013 #define FEAT_PATTERN_2          0x43
2014 #define FEAT_PATTERN_3          0x44
2015 #define FEAT_PATTERN_4          0x45
2016 #define FEAT_PATTERN_END        0x46
2017 #define FEAT_PATTERN_OLD        0x47
2018 #define FEAT_PATTERN_XTRA1      0x48
2019 #define FEAT_PATTERN_XTRA2      0x49
2020 
2021 /* Shops */
2022 #define FEAT_SHOP               0x4A
2023 
2024 /* Permanent walls for quests */
2025 #define FEAT_QUEST1             0x4B
2026 #define FEAT_QUEST2             0x4C
2027 #define FEAT_QUEST3             0x4D
2028 #define FEAT_QUEST4             0x4E
2029 
2030 /* Permanent clear wall to fill up unused map areas (new for better visuals, especially w/ BIG_MAP) */
2031 #define FEAT_PERM_FILL		0x4F
2032 
2033 /* Permanent wall for Nether Realm/other dungeons (just for the visuals) */
2034 #define FEAT_PERM_SPIRIT	0x50
2035 #define FEAT_PERM_MOUNTAIN	0x51
2036 
2037 #define FEAT_FLOOR_CLOUD	0x52
2038 
2039 /* Additional terrains */
2040 #define FEAT_SNOW               0x53
2041 #define FEAT_SHAL_WATER         0x54
2042 #define FEAT_DEEP_LAVA          0x55
2043 #define FEAT_SHAL_LAVA          0x56
2044 #define FEAT_DARK_PIT           0x57
2045 #define FEAT_DIRT               0x58
2046 #define FEAT_GRASS              0x59
2047 #define FEAT_ICE                0x5A
2048 #define FEAT_SAND               0x5B
2049 #define FEAT_DEAD_TREE          0x5C
2050 #define FEAT_ASH                0x5D
2051 #define FEAT_MUD                0x5E
2052 #define FEAT_ICE_WALL           0x5F
2053 #define FEAT_TREE               0x60
2054 #define FEAT_MOUNTAIN           0x61
2055 #define FEAT_SANDWALL           0x62
2056 #define FEAT_SANDWALL_H         0x63	/* hidden treasure -- not generated atm */
2057 #define FEAT_SANDWALL_K         0x64	/* known treasure */
2058 #define FEAT_HIGH_MOUNTAIN	0x65
2059 #define FEAT_NETHER_MIST	0x66
2060 #define FEAT_GLIT_WATER         0x67	/* For Valinor */
2061 #define FEAT_HIGH_MOUNT_SOLID	0x68	/* For Valinor */
2062 #define FEAT_BETWEEN_TEMP	0x69	/* Just a marker for divine_gateway() */
2063 #define FEAT_ABYSS		0x6A
2064 #define FEAT_CLOUDYSKY		0x6B
2065 #define FEAT_ABYSS_BOUNDARY	0x6C
2066 #define FEAT_VOLCANIC		0x6D
2067 
2068 /* Features 0x6C - 0x9F -- unused */
2069 
2070 #define FEAT_BETWEEN            0xA0 /* 160 */
2071 
2072 /* Altars */
2073 #define FEAT_ALTAR_HEAD         0xA1 /* 161 */
2074 #define FEAT_ALTAR_TAIL         0xAB /* 171 */
2075 
2076 #define FEAT_MARKER             0xAC /* 172 */
2077 /* Feature 0xAD -- Underground Tunnel */
2078 #define FEAT_TAINTED_WATER      0xAE /* 174 */
2079 #define FEAT_MON_TRAP           0xAF /* 175 */
2080 #define FEAT_BEACON		0xB0 /* 176, formerly FEAT_BETWEEN2, finally in use: for Dungeon Keeper event */
2081 #define FEAT_LAVA_WALL		0xB1 /* 177 */
2082 #define FEAT_GREAT_FIRE         0xB2 /* 178 */
2083 #define FEAT_WAY_MORE           0xB3 /* 179 */
2084 #define FEAT_WAY_LESS           0xB4 /* 180 */
2085 /* Feature 0xB5 -- field */
2086 #define FEAT_EKKAIA             0xB6 /* 182 */
2087 
2088 /* Features 0xB7 - 0xBA -- unused */
2089 
2090 #define FEAT_DEEP_WATER         0xBB /* 187 */
2091 #define FEAT_GLASS_WALL         0xBC /* 188 */
2092 #define FEAT_ILLUS_WALL         0xBD /* 189 */
2093 /* Feature 0xBE -- grass roof */
2094 /* Feature 0xBF -- grass roof top */
2095 /* Feature 0xC0 -- grass roof chimney */
2096 /* Feature 0xC1 -- brick roof */
2097 /* Feature 0xC2 -- brick roof top */
2098 /* Feature 0xC3 -- brick roof chimney */
2099 /* Feature 0xC4 -- window */
2100 /* Feature 0xC5 -- small window */
2101 /* Feature 0xC6 -- rain barrel */
2102 #define FEAT_FLOWER             0xC7 /* 199 */
2103 /* Feature 0xC8 -- cobblestone road */
2104 /* Feature 0xC9 -- cobblestone with outlet */
2105 #define FEAT_IVY		0xCA /* 202 */
2106 #define FEAT_TOWN               0xCB /* 203 */
2107 /* Feature 0xCC -- Underground Tunnel */
2108 #define FEAT_FIRE               0xCD /* 205 */
2109 /* Feature 0xCE -- pile of rubble (permanent) */
2110 #define FEAT_ROCKY		0xCF /*207 */
2111 /* Features 0xCF - 0xFF */
2112 #define FEAT_AGOAL		208
2113 #define FEAT_BGOAL		209
2114 //
2115 #define FEAT_DECO_WATER		211
2116 #define FEAT_BUSH		219
2117 //
2118 #define FEAT_SEALED_DOOR	224	/* for pvp-arena, like Andur suggested */
2119 #define FEAT_UNSEALED_DOOR	225
2120 #define FEAT_ESCAPE_DOOR	230	/* for quests - it's a one-way door!  */
2121 
2122 /* number of connected void gates or something? */
2123 #define MAX_BETWEEN_EXITS       2
2124 
2125 /* former Dirty Hack (XXX this can overlook spiked door!) */
2126 #define is_door(feat) (f_info[feat].flags1 & FF1_DOOR)
2127 
2128 #define is_stair(feat) \
2129 	((feat) == FEAT_MORE || (feat) == FEAT_LESS || (feat) == FEAT_WAY_MORE || (feat) == FEAT_WAY_LESS || \
2130 	(feat) == FEAT_BETWEEN || (feat) == FEAT_BEACON)
2131 
2132 #define is_always_passable(feat) \
2133 	(is_door(feat) || is_stair(feat) || \
2134 	(feat) == FEAT_FOUNTAIN || (feat) == FEAT_EMPTY_FOUNTAIN || (feat) == FEAT_FOUNTAIN_BLOOD)
2135 
2136 
2137 /*
2138  * Number of effects
2139  */
2140 #define MAX_EFFECTS             256	/* 256, 128 */
2141 #define MAX_EFFECTS_PLAYER      256	/* 128, 32 */
2142 #define EFF_WAVE                0x00000001      /* A circle whose radius increase */
2143 #define EFF_LAST                0x00000002      /* The wave lasts */
2144 #define EFF_STORM               0x00000004      /* The area follows the player */
2145 #define EFF_WALL		0x00000008	/* A cloud shaped like a beam */
2146 #define EFF_CROSSHAIR_A		0x00000010
2147 #define EFF_CROSSHAIR_B		0x00000020
2148 #define EFF_CROSSHAIR_C		0x00000040
2149 #define EFF_LIGHTNING1		0x01000000	/* For Nether Realm finishing */
2150 #define EFF_LIGHTNING2		0x02000000	/* For Nether Realm finishing */
2151 #define EFF_LIGHTNING3		0x04000000	/* For Nether Realm finishing */
2152 #define EFF_RAINING		0x08000000	/* New ideas for pushing the edge of Rogue-like gaming ^^ */
2153 #define EFF_FIREWORKS1		0x10000000	/* For NEW_YEARS_EVE =) - C. Blue*/
2154 #define EFF_FIREWORKS2		0x20000000	/* For new year's eve too. */
2155 #define EFF_FIREWORKS3		0x40000000	/* For new year's eve too. */
2156 #define EFF_SNOWING		0x80000000	/* For WINTER_SEASON */
2157 
2158 
2159 /*** Artifact indexes (see "lib/edit/a_info.txt") ***/
2160 
2161 
2162 /* Randarts */
2163 #define ART_RANDART		999
2164 
2165 /* Lites */
2166 #define ART_GALADRIEL		1
2167 #define ART_ELENDIL		2
2168 #define ART_THRAIN		3
2169 #define ART_PALANTIR		202
2170 #define ART_UNDEATH		200
2171 #define ART_STONE_LORE		15
2172 #define ART_PALANTIR_ITHIL	208
2173 
2174 /* Amulets */
2175 #define ART_CARLAMMAS		4
2176 #define ART_INGWE		5
2177 #define ART_DWARVES		6
2178 #define ART_ANCHOR		14
2179 #define ART_ELESSAR		206
2180 #define ART_EVENSTAR		207
2181 
2182 /* Rings */
2183 #define ART_FLAR		7
2184 #define ART_BARAHIR		8
2185 #define ART_TULKAS		9
2186 #define ART_NARYA		10
2187 #define ART_NENYA		11
2188 #define ART_VILYA		12
2189 #define ART_POWER		13
2190 #define ART_PHASING		203
2191 /* 14 used by the anchor of space-time */
2192 /* 15 used by the stone of lore */
2193 
2194 /* Dragon Scale */
2195 #define ART_RAZORBACK		16
2196 #define ART_BLADETURNER		17
2197 #define ART_MEDIATOR		166
2198 
2199 /* Hard Armour */
2200 #define ART_HIMRING		167
2201 #define ART_SOULKEEPER		19
2202 #define ART_ISILDUR		20
2203 #define ART_ROHIRRIM		21
2204 #define ART_BELEGENNON		22
2205 #define ART_CELEBORN		23
2206 #define ART_ARVEDUI		24
2207 #define ART_CASPANION		25
2208 
2209 /* DragonRider flying suit */
2210 #define ART_MARDRA		26
2211 #define ART_TRON		27
2212 
2213 /* Soft Armour */
2214 #define ART_THALKETTOTH		28
2215 
2216 /* Shields */
2217 #define ART_THORIN		30
2218 #define ART_CELEGORM		31
2219 #define ART_ANARION		32
2220 #define ART_GILGALAD		169
2221 #define ART_HARADRIM		176
2222 
2223 /* Helms and Crowns */
2224 #define ART_MORGOTH		34
2225 #define ART_BERUTHIEL		35
2226 #define ART_THRANDUIL		36
2227 #define ART_THENGEL		37
2228 #define ART_HAMMERHAND		38
2229 #define ART_DOR			39
2230 #define ART_HOLHENNETH		40
2231 #define ART_GORLIM		41
2232 #define ART_GONDOR		42
2233 #define ART_NUMENOR		43
2234 #define ART_KNOWLEDGE		160
2235 #define ART_LEBOHAUM		165
2236 #define ART_CELEBRIMBOR		170
2237 
2238 /* Cloaks */
2239 #define ART_COLLUIN		44
2240 #define ART_HOLCOLLETH		45
2241 #define ART_THINGOL		46
2242 #define ART_THORONGIL		47
2243 #define ART_COLANNON		48
2244 #define ART_LUTHIEN		49
2245 #define ART_TUOR		50
2246 #define ART_OCEANSOUL		217
2247 
2248 /* Gloves */
2249 #define ART_CAMBELEG		52
2250 #define ART_CAMMITHRIM		53
2251 #define ART_PAURHACH		54
2252 #define ART_PAURNIMMEN		55
2253 #define ART_PAURAEGEN		56
2254 #define ART_PAURNEN		57
2255 #define ART_CAMLOST		58
2256 #define ART_FINGOLFIN		59
2257 #define ART_EOL			178
2258 
2259 /* Boots */
2260 #define ART_FEANOR		60
2261 #define ART_DAL			61
2262 #define ART_THROR		62
2263 
2264 /* Swords */
2265 #define ART_NARSIL		164
2266 #define ART_MAEDHROS		64
2267 #define ART_ANGRIST		65
2268 #define ART_NARTHANC		66
2269 #define ART_NIMTHANC		67
2270 #define ART_DETHANC		68
2271 #define ART_RILIA		69
2272 #define ART_BELANGIL		70
2273 #define ART_CALRIS		71
2274 #define ART_ARUNRUTH		72
2275 #define ART_GLAMDRING		73
2276 #define ART_AEGLIN		74
2277 #define ART_ORCRIST		75
2278 #define ART_GURTHANG		76
2279 #define ART_ZARCUTHRA		77
2280 #define ART_MORMEGIL		78
2281 #define ART_GONDRICAM		79
2282 #define ART_CRISDURIAN		80
2283 #define ART_AGLARANG		81
2284 #define ART_RINGIL		82
2285 #define ART_ANDURIL		83
2286 #define ART_ANGUIREL		84
2287 #define ART_ELVAGIL		85
2288 #define ART_FORASGIL		86
2289 #define ART_CARETH		87
2290 #define ART_STING		88
2291 #define ART_HARADEKKET		89
2292 #define ART_GILETTAR		90
2293 #define ART_DOOMCALLER		91
2294 #define ART_VORPAL_BLADE	92
2295 #define ART_ERU			147
2296 
2297 /* Polearms */
2298 #define ART_THEODEN		93
2299 #define ART_PAIN		94
2300 #define ART_OSONDIR		95
2301 #define ART_TIL			96
2302 #define ART_AEGLOS		97
2303 #define ART_OROME		98
2304 #define ART_NIMLOTH		99
2305 #define ART_EORLINGAS		100
2306 #define ART_DURIN		101
2307 #define ART_EONWE		102
2308 #define ART_BALLI		103
2309 #define ART_LOTHARANG		104
2310 #define ART_MUNDWINE		105
2311 #define ART_BARUKKHELED		106
2312 #define ART_WRATH		107
2313 #define ART_ULMO		108
2314 #define ART_AVAVIR		109
2315 #define ART_FUNDIN		175
2316 
2317 /* The sword of the Dawn */
2318 #define ART_DAWN		110
2319 
2320 /* Blunt */
2321 #define ART_MELKOR		18
2322 #define ART_HURIN		33
2323 #define ART_GROND		111
2324 #define ART_TOTILA		112
2325 #define ART_THUNDERFIST		113
2326 #define ART_BLOODSPIKE		114
2327 #define ART_FIRESTAR		115
2328 #define ART_TARATOL		116
2329 #define ART_AULE		117
2330 #define ART_NAR			118
2331 #define ART_ERIRIL		119
2332 #define ART_OLORIN		120
2333 #define ART_DEATHWREAKER	121
2334 #define ART_TURMIL		122
2335 #define ART_GOTHMOG		123
2336 #define ART_AXE_GOTHMOG		145
2337 #define ART_SKULLCLEAVER	177
2338 
2339 #define ART_NAIN		174
2340 
2341 /* Bows */
2342 #define ART_BELTHRONDING	124
2343 #define ART_BARD		125
2344 #define ART_CUBRAGOL		126
2345 #define ART_UMBAR		171
2346 
2347 /* Mage Staffs */
2348 #define ART_GANDALF		127
2349 
2350 /* Boomerangs */
2351 #define ART_BEOR		128
2352 #define ART_GLIMDRIR		129
2353 
2354 /* Musical Instrument */
2355 #define ART_ROBINTON		137
2356 #define ART_PIEMUR		138
2357 #define ART_MENOLLY		139
2358 #define ART_DRUEDAIN		141
2359 #define ART_ROHAN		142
2360 #define ART_HELM		143
2361 #define ART_BOROMIR		144
2362 
2363 /* Diggers */
2364 #define ART_EREBOR		140
2365 
2366 #define ART_ORCHAST		156
2367 #define ART_NIGHT		157
2368 #define ART_NATUREBANE		158
2369 
2370 /* ToME-NET additions */
2371 #define ART_GIVEROFSLEEP	209
2372 #define ART_MOLTOR		210 /* was ETERNALPEACE */
2373 #define ART_METHODIQUE		211
2374 #define ART_SCHMERZGLAUBE	212
2375 #define ART_DOUBLEZEE		213
2376 #define ART_BILBO		214
2377 #define ART_HALFLINGS		215
2378 #define ART_DWARVEN_ALE		216
2379 
2380 /* C. Blue (arts > 216) */
2381 #define ART_OCEAN_SOUL		217
2382 #define ART_CLOAK_DM		218
2383 #define ART_IRONFOOT		219
2384 #define ART_HELM_DURIN		220
2385 #define ART_MOONSTONE		221
2386 #define ART_RIPPER		222
2387 #define ART_REAVER		223
2388 #define ART_GUARDIAN		224
2389 #define ART_ABYSS		225
2390 #define ART_FORGOTTEN		226
2391 #define ART_BLACKORE		227
2392 #define ART_THUNDERBOLT		228
2393 #define ART_ZODIA		229
2394 #define ART_GOBLINS		230
2395 #define ART_DOMINATION		231
2396 #define ART_SOULCURE		232
2397 #define ART_AMUGROM		233
2398 #define ART_WRATHVERGE		234
2399 #define ART_ARTERYCUTTER	235
2400 #define ART_HELLFIRE		236
2401 #define ART_COBALTFOCUS		237
2402 #define ART_SKYWALKER		238
2403 #define ART_SUNSPIRE		239
2404 #define ART_STORMSPIRE		240
2405 #define ART_BLOODSCOURGE	241
2406 #define ART_QUIETUS		242
2407 #define ART_ICONOFLIFE		243
2408 #define ART_SPIRITSHARD		244
2409 #define ART_RIPSAW		245
2410 #define ART_NIGHTCLAW		246
2411 #define ART_MISERICORDIA	247
2412 #define ART_HOPEDAWN		248
2413 #define ART_IMPALER		249
2414 #define ART_KRONOS		250
2415 #define ART_TARNKAPPE		251
2416 #define ART_AMBER		252
2417 #define ART_SLEEPING		253
2418 #define ART_STORMSHIELD		254
2419 #define ART_PIETY		255
2420 #define ART_WINDS		256
2421 #define ART_FIONA		257
2422 #define ART_SCARLETORDER	258
2423 #define ART_THINKINGCAP		259
2424 #define ART_MIRROROFGLORY	260
2425 #define ART_GOGGLES_DM		261
2426 #define ART_ARS_NUMENIS		262
2427 #define ART_SOULCALLER		263
2428 #define ART_VERIDIS_QUO		264
2429 #define ART_SCYTHE_DM		265
2430 #define ART_BOOTS_MOLTOR	266
2431 #define ART_DAILIR		267
2432 #define ART_PIERCER		268
2433 #define ART_URUKHAI		269
2434 #define ART_DREADNOUGHT		272
2435 #define ART_HAVOC		274
2436 /* #define ART_ANGTIRCALAD	*/
2437 
2438 
2439 /*** Ego-Item indices (see "lib/edit/e_info.txt") ***/
2440 
2441 #define EGO_MANA		1
2442 #define EGO_MSTAFF_POWER	2
2443 #define EGO_MANA_POWER		3
2444 #define EGO_MSTAFF_SPELL	4
2445 #define EGO_RESIST_ACID		5
2446 #define EGO_RESIST_ELEC         6
2447 #define EGO_RESIST_FIRE         7
2448 #define EGO_RESIST_COLD         8
2449 #define EGO_RESISTANCE          9
2450 #define EGO_ELVENKIND           10
2451 #define EGO_PERMANENCE		11
2452 #define EGO_LEPROUS		12
2453 #define EGO_IMMUNE		13
2454 #define EGO_DEFENCE		14
2455 #define EGO_JUMP                15
2456 #define EGO_ENDURE_ACID         16
2457 #define EGO_ENDURE_ELEC         17
2458 #define EGO_ENDURE_FIRE         18
2459 #define EGO_ENDURE_COLD         19
2460 #define EGO_ENDURANCE		20
2461 #define EGO_REFLECT		21
2462 #define EGO_ELECTRIC		22
2463 #define EGO_NOLDOR              23
2464 #define EGO_INTELLIGENCE	24
2465 #define EGO_WISDOM		25
2466 #define EGO_BEAUTY		26
2467 #define EGO_MAGI                27
2468 #define EGO_MIGHT		28
2469 #define EGO_LORDLINESS		29
2470 #define EGO_SEEING		30
2471 #define EGO_INFRAVISION		31
2472 #define EGO_LITE                32
2473 #define EGO_TELEPATHY		33
2474 #define EGO_REGENERATION	34
2475 #define EGO_TELEPORTATION       35
2476 #define EGO_STUPIDITY		36
2477 #define EGO_NAIVETY		37
2478 #define EGO_UGLINESS		38
2479 #define EGO_SICKLINESS		39
2480 #define EGO_DWARVEN		40
2481 #define EGO_PROTECTION          41
2482 #define EGO_STEALTH             42
2483 #define EGO_AMAN		43
2484 #define EGO_AURA_FIRE           44
2485 #define EGO_ENVELOPING		45
2486 #define EGO_VULNERABILITY	46
2487 #define EGO_IRRITATION		47
2488 #define EGO_AURA_ELEC           48
2489 #define EGO_FREE_ACTION         49
2490 #define EGO_SLAYING             50
2491 #define EGO_AGILITY		51
2492 #define EGO_POWER		52
2493 #define EGO_PEACE		53
2494 #define EGO_CHARMING		54
2495 #define EGO_WEAKNESS		55
2496 #define EGO_CLUMSINESS		56
2497 #define EGO_SLOW_DESCENT	57
2498 #define EGO_QUIET               58
2499 #define EGO_MOTION              59
2500 #define EGO_SPEED               60
2501 #define EGO_DWARVISHENDU	61
2502 #define EGO_NOISE		62
2503 #define EGO_SLOWNESS		63
2504 #define EGO_ANNOYANCE		64
2505 #define EGO_HA			65
2506 #define EGO_DF			66
2507 #define EGO_BLESS_BLADE		67
2508 #define EGO_LIFE		68
2509 #define EGO_WEST		69
2510 #define EGO_ATTACKS		70
2511 #define EGO_SLAYING_WEAPON	71
2512 #define EGO_SPINNING		72
2513 #define EGO_BRAND_ACID		73
2514 #define EGO_BRAND_ELEC		74
2515 #define EGO_BRAND_FIRE		75
2516 #define EGO_BRAND_COLD		76
2517 #define EGO_BRAND_POIS		77
2518 #define EGO_CHAOTIC		78
2519 #define EGO_EARTHQUAKES		80
2520 #define EGO_SLAY_ANIMAL		81
2521 #define EGO_SLAY_EVIL		82
2522 #define EGO_SLAY_UNDEAD		83
2523 #define EGO_SLAY_DEMON		84
2524 #define EGO_SLAY_ORC		85
2525 #define EGO_SLAY_TROLL		86
2526 #define EGO_SLAY_GIANT		87
2527 #define EGO_SLAY_DRAGON		88
2528 #define EGO_KILL_ANIMAL		89
2529 #define EGO_KILL_EVIL		90
2530 #define EGO_KILL_UNDEAD		91
2531 #define EGO_KILL_DEMON		92
2532 #define EGO_KILL_ORC		93
2533 #define EGO_KILL_TROLL		94
2534 #define EGO_KILL_GIANT		95
2535 #define EGO_KILL_DRAGON		96
2536 #define EGO_VAMPIRIC		97
2537 #define EGO_STAR_DF		98
2538 #define EGO_DRAGON		99
2539 #define EGO_GONDOLIN		100
2540 #define EGO_DIGGING		101
2541 #define EGO_SPECTRAL            102
2542 #define EGO_MORGUL		103
2543 #define EGO_NOTHINGNESS		104
2544 #define EGO_ACCURACY		105
2545 #define EGO_VELOCITY		106
2546 #define EGO_EXTRA_MIGHT		107
2547 #define EGO_EXTRA_SHOTS		108
2548 #define EGO_LORIEN              109
2549 #define EGO_HARADRIM		110
2550 #define EGO_BUCKLAND		111
2551 #define EGO_HURT_ANIMAL		112
2552 #define EGO_HURT_EVIL		113
2553 #define EGO_HURT_UNDEAD		114
2554 #define EGO_POISONOUS		115
2555 #define EGO_ACIDIC		116
2556 #define EGO_ELEMENTAL		117
2557 #define EGO_HURT_DEMON		118
2558 #define EGO_HURT_DRAGON		119
2559 #define EGO_HURT_ALL		120
2560 #define EGO_LIGHTNING_BOLT      121
2561 #define EGO_FLAME               122
2562 #define EGO_FROST               123
2563 #define EGO_WOUNDING		124
2564 #define EGO_BACKBITING		125
2565 #define EGO_SHATTERED           126
2566 #define EGO_BLASTED             127
2567 #define EGO_MUSIC_ELDAR		128
2568 #define EGO_MUSIC_POWER		129
2569 #define EGO_INST_DRAGONKIND     130
2570 #define EGO_GNOMISH		131
2571 #define EGO_DWARVISH		132
2572 #define EGO_RQUICKNESS		133
2573 #define EGO_RCHARGING		134
2574 #define EGO_RISTARI		135
2575 
2576 #define EGO_LBOLDNESS		137
2577 
2578 #define EGO_LBRIGHTNESS		139
2579 #define EGO_LSTAR_BRIGHTNESS	140
2580 #define EGO_ENCHANTED		141
2581 #define EGO_LINFRAVISION	142
2582 #define EGO_LETERNAL_EYE	143
2583 
2584 #define EGO_LFADING		145
2585 #define EGO_DWARVEN_ARMOR	146
2586 #define EGO_INDESTRUCTIBLE	147
2587 #define EGO_CURSED		148
2588 #define EGO_FIREPROOF_BOOK	149
2589 #define EGO_PLENTY		150
2590 #define EGO_TXMIGHT		151
2591 #define EGO_TXSHOTS		152
2592 #define EGO_TAUTO		153
2593 #define EGO_TFULLAUTO		154
2594 #define EGO_TWELLHIDDEN		155
2595 #define EGO_TCOMPLICATED	156
2596 #define EGO_TOBVIOUS		157
2597 #define EGO_TDRAGON		158
2598 #define EGO_TDEMON		159
2599 #define EGO_TANIMAL		160
2600 #define EGO_TUNDEAD		161
2601 #define EGO_TEVIL		162
2602 #define EGO_LITE_MAGI           163
2603 #define EGO_VULNERABILITY2	164
2604 #define EGO_VULNERABILITY3	165
2605 #define EGO_PRESERVATION	166
2606 #define EGO_SERENITY		167
2607 #define EGO_NIGHT_DAY		168
2608 #define EGO_CLOAK_MAGI		169
2609 #define EGO_CLOAK_INVIS		170
2610 #define EGO_CLOAK_BAT		171
2611 #define EGO_THIEVERY		172
2612 #define EGO_COMBAT		173
2613 #define EGO_STABILITY		174
2614 #define EGO_ELVENKIND2		175
2615 #define EGO_FURY		176
2616 #define EGO_PLENTY2		177
2617 
2618 #define EGO_RSIMPLICITY		179
2619 /* megahack */
2620 #define EGO_CLOAK_LORDLY_RES	180
2621 #define EGO_CLOAK_TELERI	181
2622 #define EGO_MIRKWOOD		182
2623 #define EGO_NUMENOR             183
2624 #define EGO_AVARI		184
2625 #define EGO_ISTARI		185
2626 #define EGO_OFTHEMAGI		186
2627 #define EGO_STORMBRINGER	187
2628 #define EGO_BUDWEISER		188
2629 #define EGO_HEINEKEN		189
2630 #define EGO_MISTRUST		190
2631 #define EGO_INSULATION		191
2632 #define EGO_CONCENTRATION	192
2633 #define EGO_BRILLIANCE		193
2634 #define EGO_LIMMUNITY		194
2635 #define EGO_LPERPETUITY		195
2636 #define EGO_LPRESENTIMENT	196
2637 #define EGO_ESP			197	/* amulet of telepathic awareness, formerly ESP */
2638 #define EGO_GUINNESS		198
2639 #define EGO_PERFECTION		199
2640 #define EGO_MOONWOOD		200
2641 #define EGO_DRAGONBONE		201
2642 #define EGO_IMBUED		202
2643 #define EGO_TRANSFORMATION	203
2644 #define EGO_ETHEREAL		204
2645 #define EGO_LEVITATION		205
2646 #define EGO_HEAVY_IMMUNITY	206
2647 #define EGO_HEAVY_SUSTENANCE	207
2648 #define EGO_HEAVY_PRESERVANCE	208
2649 #define EGO_HEAVY_SWIFTNESS	209
2650 #define EGO_HEAVY_POWER		210
2651 #define EGO_HEAVY_TELEPATHY	211
2652 #define EGO_HEAVY_HELLFORGED	212
2653 #define EGO_AURA_COLD		213
2654 
2655 #define EGO_HEAVY_RUNED		215
2656 #define EGO_WATERPROOF_BOOK	216
2657 
2658 #define EGO_WATERPROOF		219
2659 #define EGO_FIREPROOF		220
2660 #define EGO_AURA_ELEC2		221
2661 #define EGO_AURA_COLD2		222
2662 #define EGO_AURA_FIRE2		223
2663 
2664 #define EGO_ROBE_MAGI		224
2665 #define EGO_FROCK_PIETY		225
2666 #define EGO_MARTIAL		226
2667 
2668 #define EGO_TEMPORARY		227
2669 
2670 
2671 /*** Object "tval" and "sval" codes ***/
2672 
2673 
2674 /*
2675  * The values for the "tval" field of various objects.
2676  *
2677  * This value is the primary means by which items are sorted in the
2678  * player inventory, followed by "sval" and "cost".
2679  *
2680  * Note that a "BOW" with tval = 19 and sval S = 10*N+P takes a missile
2681  * weapon with tval = 16+N, and does (xP) damage when so combined.  This
2682  * fact is not actually used in the source, but it kind of interesting.
2683  *
2684  * Note that as of 2.7.8, the "item flags" apply to all items, though
2685  * only armor and weapons and a few other items use any of these flags.
2686  */
2687 
2688 /* ToME ones */
2689 #define TV_SKELETON      1      /* Skeletons ('s') */
2690 #define TV_BOTTLE        2      /* Empty bottles ('!') */
2691 #define TV_FIRESTONE     3      /* For DragonRiders */
2692 #define TV_BATERIE       4      /* For the Alchemists */
2693 #define TV_SPIKE         5      /* Spikes ('~') */
2694 #define TV_MSTAFF        6      /* Mage Staffs */
2695 #define TV_CHEST         7      /* Chests ('~') */
2696 #define TV_PARCHMENT     8      /* Parchments from Kamband */
2697 #define TV_CORPSE        9      /* Monster corpses */
2698 #define TV_EGG          10      /* Monster Eggs */
2699 #define TV_JUNK         11      /* Sticks, Pottery, etc ('~') */
2700 #define TV_TOOL         12      /* Tools */
2701 #define TV_GAME		13	/* Heavy ball and chess pieces - can only be generated by admins */
2702 #define TV_INSTRUMENT   14      /* Musical instruments */
2703 #define TV_BOOMERANG    15      /* Boomerangs */
2704 #define TV_SHOT         16      /* Ammo for slings */
2705 #define TV_ARROW        17      /* Ammo for bows */
2706 #define TV_BOLT         18      /* Ammo for x-bows */
2707 #define TV_BOW          19      /* Slings/Bows/Xbows */
2708 #define TV_DIGGING      20      /* Shovels/Picks */
2709 #define TV_BLUNT        21      /* Priest Weapons */
2710 #define TV_POLEARM      22      /* Pikes/Glaives/Spears/etc. */
2711 #define TV_SWORD        23      /* Edged Weapons */
2712 #define TV_AXE          24      /* Axes/Cleavers */
2713 #define TV_BOOTS        30      /* Boots */
2714 #define TV_GLOVES       31      /* Gloves */
2715 #define TV_HELM         32      /* Helms */
2716 #define TV_CROWN        33      /* Crowns */
2717 #define TV_SHIELD       34      /* Shields */
2718 #define TV_CLOAK        35      /* Cloaks */
2719 #define TV_SOFT_ARMOR   36      /* Soft Armor */
2720 #define TV_HARD_ARMOR   37      /* Hard Armor */
2721 #define TV_DRAG_ARMOR   38      /* Dragon Scale Mail */
2722 #define TV_LITE         39      /* Lites (including Specials) */
2723 #define TV_AMULET       40      /* Amulets (including Specials) */
2724 #define TV_RING         45      /* Rings (including Specials) */
2725 #define TV_TRAPKIT      46      /* Trapkits */
2726 #define TV_TOTEM        54      /* Summoner totems */
2727 #define TV_STAFF        55
2728 #define TV_WAND         65
2729 #define TV_ROD          66
2730 #define TV_ROD_MAIN     67
2731 #define TV_SCROLL       70
2732 #define TV_POTION       71
2733 #define TV_POTION2      72      /* Second set of potion */
2734 #define TV_FLASK        77
2735 #define TV_FOOD         80
2736 #define TV_HYPNOS       99      /* To wield monsters !:) */
2737 #define TV_GOLD         100     /* Gold can only be picked up by players(?) */
2738 #define TV_RANDART      102     /* Random Artifacts */
2739 
2740 /* Runecraft */
2741 #define TV_RUNE         107
2742 
2743 //gemstones
2744 #define TV_GEM		106
2745 
2746 
2747 #define TV_BOOK         111
2748 #if 0   /* (reserved) we'll use TomeNET books :) */
2749 #define TV_SYMBIOTIC_BOOK 112
2750 #define TV_MUSIC_BOOK   113
2751 #define TV_DRUID_BOOK   114
2752 #define TV_DAEMON_BOOK  115
2753 
2754 #endif  /* 0 */
2755 
2756 /* pernM ones (resurrected) */
2757 #define TV_KEY		51      /* Keys (';') */
2758 #define TV_GOLEM        52       /* Golem parts */
2759 
2760 #define TV_PSI_BOOK 	89
2761 #define TV_MAGIC_BOOK   90
2762 #define TV_PRAYER_BOOK  91
2763 #define TV_SORCERY_BOOK 92
2764 #define TV_FIGHT_BOOK 	93
2765 #define TV_SHADOW_BOOK 	94
2766 #define TV_HUNT_BOOK 	95
2767 
2768 /* unused */
2769 #define is_realm_book(o_ptr) \
2770 	(89 <= (o_ptr)->tval && (o_ptr)->tval <= 95)
2771 
2772 /* special items */
2773 #define TV_SPECIAL	127
2774 
2775 /* Maximum "tval" */
2776 #define TV_MAX		127
2777 
2778 
2779 /* some masks (originally just is_armour for XBM control) - C. Blue */
2780 #define is_ammo(tval)	(((tval) == TV_SHOT) || ((tval) == TV_ARROW) || ((tval) == TV_BOLT))
2781 #define is_weapon(tval)	(((tval) == TV_SWORD) || ((tval) == TV_BLUNT) || ((tval) == TV_AXE) || ((tval) == TV_POLEARM))
2782 #define is_rare_weapon(tval,sval) ( \
2783 	(((tval) == TV_SWORD) && ((sval) >= SV_BLADE_OF_CHAOS)) || /* blade of chaos, dark sword, bluesteel, shadow */ \
2784 	(((tval) == TV_BLUNT) && ((sval) == SV_MACE_OF_DISRUPTION || (sval) == SV_DEMON_HAMMER || (sval) == SV_SCOURGE_OF_REPENTANCE)) || \
2785 	(((tval) == TV_AXE) && ((sval) == SV_THUNDER_AXE)) || \
2786 	(((tval) == TV_POLEARM) && (sval) == SV_SCYTHE_OF_SLICING) )
2787 #define is_magic_device(tval)	(((tval) == TV_WAND) || ((tval) == TV_STAFF) || ((tval) == TV_ROD))
2788 #define is_rare_magic_device(tval,sval) ( \
2789 	((tval) == TV_WAND && ((sval) == SV_WAND_ANNIHILATION || (sval) == SV_WAND_ROCKETS || (sval) == SV_WAND_WALL_CREATION || (sval) == SV_WAND_TELEPORT_TO)) || \
2790 	/* allowing +perception+, healing, magi/power/holiness */ \
2791 	((tval) == TV_STAFF && ((sval) == SV_STAFF_EARTHQUAKES || (sval) == SV_STAFF_DESTRUCTION || (sval) == SV_STAFF_SPEED || (sval) == SV_STAFF_GENOCIDE)) || \
2792 	/* not allowing Speed/Healing so people aren't "forced" to train MD */ \
2793 	((tval) == TV_ROD && ((sval) == SV_ROD_HAVOC || (sval) == SV_ROD_IDENTIFY || \
2794 	    (sval) == SV_ROD_MAPPING || (sval) == SV_ROD_CURING || (sval) == SV_ROD_RESTORATION \
2795 	    || (sval) == SV_ROD_SPEED || (sval) == SV_ROD_HEALING)) )
2796 #define is_armour(tval)	\
2797 	(((tval) == TV_BOOTS) || ((tval) == TV_GLOVES) || \
2798 	((tval) == TV_HELM) || ((tval) == TV_CROWN) || \
2799 	((tval) == TV_SHIELD) || ((tval) == TV_CLOAK) || \
2800 	((tval) == TV_SOFT_ARMOR) || ((tval) == TV_HARD_ARMOR) || \
2801 	((tval) == TV_DRAG_ARMOR))
2802 #define is_rare_armour(tval,sval) ( \
2803 	(((tval) == TV_HELM) && ((sval) == SV_DRAGON_HELM || (sval) == SV_MITHRIL_HELM || (sval) == SV_ADAMANTITE_HELM)) || \
2804 	((tval) == TV_CROWN) || /* for telepathy crowns in Ironman dungeon stores (IDDC -2k especially) */ \
2805 	(((tval) == TV_SHIELD) && (((sval) == SV_ORCISH_SHIELD) || ((sval) == SV_DRAGON_SHIELD) || ((sval) == SV_SHIELD_OF_DEFLECTION) \
2806 	    || ((sval) == SV_MITHRIL_ANCILE) || ((sval) == SV_ADAMANTITE_AEGIS))) || \
2807 	(((tval) == TV_GLOVES) && ((sval) == SV_SET_OF_ELVEN_GLOVES)) || \
2808 	(((tval) == TV_CLOAK) && ((sval) == SV_KOLLA)) || \
2809 	(((tval) == TV_HARD_ARMOR) && (sval) >= SV_MITHRIL_CHAIN_MAIL) || \
2810 	((tval) == TV_DRAG_ARMOR) )
2811 /* doesn't include WINNERS_ONLY armour: */
2812 //	(((tval) == TV_HARD_ARMOR) && (((sval) == SV_MITHRIL_CHAIN_MAIL) || ((sval) == SV_MITHRIL_PLATE_MAIL) || ((sval) == SV_ADAMANTITE_PLATE_MAIL))) ||
2813 #define is_top_armour(tval,sval) \
2814 	(((tval) == TV_DRAG_ARMOR) && \
2815 	((sval) == SV_DRAGON_POWER || (sval) == SV_DRAGON_SKY || \
2816 	(sval) == SV_DRAGON_DEATH || (sval) == SV_DRAGON_SHINING || \
2817 	(sval) == SV_DRAGON_MULTIHUED || (sval) == SV_DRAGON_BALANCE))
2818 	/* ...and possibly all winners_only armour */
2819 #define is_common_armour(tval,sval) \
2820 	(is_armour(tval) && !is_rare_armour(tval,sval))
2821 #define sv_dsm_low(sv) \
2822         (sv == SV_DRAGON_BLUE || sv == SV_DRAGON_WHITE || sv == SV_DRAGON_BLACK || \
2823 	sv == SV_DRAGON_RED || sv == SV_DRAGON_GREEN)
2824 #define sv_dsm_mid(sv) \
2825         (sv == SV_DRAGON_BRONZE || sv == SV_DRAGON_SILVER || sv == SV_DRAGON_GOLD || \
2826 	sv == SV_DRAGON_PSEUDO)
2827 /* for determining sound effects for wear/wield command: */
2828 #define is_textile_armour(tval,sval) \
2829 	(((tval) == TV_BOOTS && (sval) != SV_PAIR_OF_METAL_SHOD_BOOTS && (sval) != SV_PAIR_OF_WITAN_BOOTS) || \
2830 	((tval) == TV_GLOVES && (sval) != SV_SET_OF_GAUNTLETS && (sval) != SV_SET_OF_CESTI) || \
2831 	(tval) == TV_SOFT_ARMOR || (tval) == TV_CLOAK || \
2832 	((tval) == TV_HELM && ((sval) == SV_CLOTH_CAP || (sval) == SV_HARD_LEATHER_CAP || (sval) == SV_GOGGLES_DM)) || \
2833 	((tval) == TV_SHIELD && ((sval) == SV_SMALL_LEATHER_SHIELD || (sval) == SV_LARGE_LEATHER_SHIELD)))
2834 #define is_cheap_misc(tval) \
2835 	(is_ammo(tval) || (tval) == TV_FIRESTONE || (tval) == TV_SPIKE || (tval) == TV_JUNK)
2836 #define is_ranged_weapon(tval) \
2837 	((tval) == TV_BOW || (tval) == TV_BOOMERANG)
2838 #define is_ranged_item(Ind, o_ptr) \
2839 	(is_ranged_weapon((o_ptr)->tval) || \
2840 	is_ammo((o_ptr)->tval) || \
2841 	(o_ptr)->tval == TV_BOOK || \
2842 	(o_ptr)->tval == TV_WAND || \
2843 	((o_ptr)->tval == TV_ROD && rod_requires_direction(Ind, o_ptr)))
2844 #define is_firearm_trapkit(sval) \
2845 	((sval) == SV_TRAPKIT_SLING || (sval) == SV_TRAPKIT_BOW || (sval) == SV_TRAPKIT_XBOW)
2846 #ifndef NEW_SHIELDS_NO_AC
2847 /* Note: This doesn't check artifact_p() or TR5_NO_ENCHANT, but only the base item type. */
2848 #define is_enchantable(o_ptr) \
2849 	(is_weapon((o_ptr)->tval) || is_ranged_weapon((o_ptr)->tval) || is_ammo((o_ptr)->tval) || \
2850 	(o_ptr)->tval == TV_MSTAFF || \
2851 	((o_ptr)->tval == TV_TRAPKIT && is_firearm_trapkit((o_ptr)->sval)) || \
2852 	is_armour((o_ptr)->tval) || (o_ptr)->tval == TV_DIGGING)
2853 #else
2854 /* Note: This doesn't check artifact_p() or TR5_NO_ENCHANT, but only the base item type. */
2855 #define is_enchantable(o_ptr) \
2856 	((is_weapon((o_ptr)->tval) || is_ranged_weapon((o_ptr)->tval) || is_ammo((o_ptr)->tval) || \
2857 	(o_ptr)->tval == TV_MSTAFF || \
2858 	((o_ptr)->tval == TV_TRAPKIT && is_firearm_trapkit((o_ptr)->sval)) || \
2859 	is_armour((o_ptr)->tval) || (o_ptr)->tval == TV_DIGGING) \
2860 	&& (o_ptr->tval != TV_SHIELD))
2861 #endif
2862 /* more possibilities: is_potion, is_rune, is_jewelry, is_rare_armour(tval,sval) */
2863 
2864 
2865 /* Ones borrowed from PernAngband.<---->- Jir - */
2866 /*
2867  * Max sizes of the following arrays
2868  */
2869 #define MAX_ROCKS      62       /* Used with rings (min 58) */
2870 #define MAX_AMULETS    43       /* Used with amulets (min 30) */
2871 #define MAX_WOODS      36       /* Used with staffs (min 32) */
2872 #define MAX_METALS     39       /* Used with wands/rods (min 32/30) */
2873 #ifndef EXPAND_TV_POTION
2874  #define MAX_COLORS     65       /* Used with potions (min 62) */
2875 #else
2876  #define MAX_COLORS     66       /* Used with potions (min 62) */
2877 #endif
2878 #define STATIC_COLORS	6	/* The first n colour flavours, which aren't randomised */
2879 #define MAX_SHROOM     20       /* Used with mushrooms (min 20) */
2880 #define MAX_TITLES     72       /* Used with scrolls (min 55) */
2881 #define MAX_SYLLABLES 164       /* Used with scrolls (see below) */
2882 
2883 
2884 /* sval for TV_BOTTLE */
2885 #define SV_EMPTY_BOTTLE		1
2886 
2887 /* svals for TV_KEY */
2888 #define SV_HOUSE_KEY		1
2889 #define SV_GUILD_KEY		2
2890 
2891 /* Sval for golems */
2892 #define SV_GOLEM_WOOD           0
2893 #define SV_GOLEM_COPPER         1
2894 #define SV_GOLEM_IRON           2
2895 #define SV_GOLEM_ALUM           3
2896 #define SV_GOLEM_SILVER         4
2897 #define SV_GOLEM_GOLD           5
2898 #define SV_GOLEM_MITHRIL        6
2899 #define SV_GOLEM_ADAM           7
2900 #define SV_GOLEM_LEG            8
2901 #define SV_GOLEM_ARM            9
2902 #define SV_GOLEM_ATTACK         200
2903 #define SV_GOLEM_FOLLOW         201
2904 #define SV_GOLEM_GUARD          202
2905 
2906 /* Sval for bones */
2907 #define SV_BROKEN_SKULL		1
2908 #define SV_BROKEN_BONE		2
2909 
2910 /* Svals for TV_GAME */
2911 #define SV_GAME_BALL		1
2912 #define SV_WHITE_PIECE		2
2913 #define SV_BLACK_PIECE		3
2914 #define SV_WHITE_PAWN		4
2915 #define SV_WHITE_KING		5
2916 #define SV_WHITE_QUEEN		6
2917 #define SV_WHITE_ROOK		7
2918 #define SV_WHITE_KNIGHT		8
2919 #define SV_WHITE_BISHOP		9
2920 #define SV_BLACK_PAWN		10
2921 #define SV_BLACK_KING		11
2922 #define SV_BLACK_QUEEN		12
2923 #define SV_BLACK_ROOK		13
2924 #define SV_BLACK_KNIGHT		14
2925 #define SV_BLACK_BISHOP		15
2926 
2927 
2928 /* items requiring hard-coded adjustments;
2929  * those items need some reworking. */
2930 /*
2931 #define SV_AMULET_DOOM			0
2932 #define SV_AMULET_THE_MAGI		8
2933 */
2934 #define SV_AMULET_TERKEN		30
2935 #define SV_AMULET_SPEED			31
2936 #define SV_AMULET_THE_MOON              33
2937 #define SV_AMULET_RAGE			34
2938 #define SV_AMULET_LIFE_SAVING		35
2939 #define SV_AMULET_MANA_CHARGING		36
2940 
2941 /*
2942  * Special "sval" limit -- first "normal" food
2943  */
2944 #define SV_FOOD_MIN_FOOD	20
2945 #define SV_FOOD_MAX_FOOD	49
2946 
2947 /*
2948  * Special "sval" limit -- first "aimed" rod
2949  */
2950 #define SV_ROD_MIN_DIRECTION	12
2951 
2952 /*
2953  * Special "sval" limit -- first "large" chest
2954  */
2955 #define SV_CHEST_RUINED		0
2956 #define SV_CHEST_SMALL_WOODEN	1
2957 #define SV_CHEST_SMALL_IRON	2
2958 #define SV_CHEST_SMALL_STEEL	3
2959 #define SV_CHEST_MIN_LARGE	4	/* marker */
2960 #define SV_CHEST_LARGE_WOODEN	5
2961 #define SV_CHEST_LARGE_IRON	6
2962 #define SV_CHEST_LARGE_STEEL	7
2963 
2964 /*
2965  * Special "sval" limit -- first "good" magic/prayer book
2966  */
2967 #define SV_BOOK_MIN_GOOD	4
2968 
2969 /*
2970  * Special "sval" limit -- last gold
2971  */
2972 #define SV_GOLD_MAX		18
2973 
2974 
2975 /* from ToMe */
2976 
2977 /* The "sval" codes for TV_TOOL */
2978 #define SV_TOOL_CLIMB			0
2979 #define SV_PORTABLE_HOLE		1
2980 #define SV_TOOL_PICKLOCK		2
2981 #define SV_TOOL_MONEY_BELT		3
2982 #define SV_TOOL_THEFT_PREVENTION	4
2983 #define SV_TOOL_TARPAULIN		5
2984 #define SV_TOOL_FLINT			6
2985 #define SV_TOOL_WRAPPING		7
2986 
2987 /* The "sval" codes for TV_MSTAFF */
2988 #define SV_MSTAFF 1
2989 
2990 /* The "sval" codes for TV_FIRESTONE */
2991 #define SV_FIRESTONE  3
2992 #define SV_FIRE_SMALL 6
2993 
2994 /* The "sval" codes for TV_SHOT/TV_ARROW/TV_BOLT */
2995 #define SV_AMMO_LIGHT		0	/* pebbles */
2996 #define SV_AMMO_NORMAL		1	/* shots, arrows, bolts */
2997 #define SV_AMMO_HEAVY		2	/* seeker arrows and bolts, mithril shots */
2998 /* (pernM ammo) */
2999 #define SV_AMMO_MAGIC		3	/* magic arrows, bolts, shots */
3000 #define SV_AMMO_SILVER		4	/* silver arrows and bolts */
3001 #define SV_AMMO_CHARRED		5	/* burnt ammo (used for flare missile skill) */
3002 
3003 /* The "sval" codes for TV_INSTRUMENT */
3004 #define SV_FLUTE                         1
3005 #define SV_BANJO                         2
3006 #define SV_LUTE                          3
3007 #define SV_MANDOLIN                      4
3008 #define SV_DRUM                          5
3009 #define SV_HARP                          6
3010 #define SV_HORN                          7
3011 
3012 /* The "sval" codes for TV_TRAPKIT */
3013 #define SV_TRAPKIT_SLING                 1
3014 #define SV_TRAPKIT_BOW                   2
3015 #define SV_TRAPKIT_XBOW                  3
3016 #define SV_TRAPKIT_POTION                4	/* 'Fumes Trap Kit' */
3017 #define SV_TRAPKIT_SCROLL_RUNE           5	/* 'Magic Trap Kit' */
3018 #define SV_TRAPKIT_DEVICE                6	/* 'Device Trap Kit' */
3019 
3020 /* The "sval" codes for TV_BOOMERANG */
3021 #define SV_BOOM_S_WOOD                   1      /* 1d4  */
3022 #define SV_BOOM_WOOD                     2      /* 1d9  */
3023 #define SV_BOOM_S_METAL                  3      /* 1d8  */
3024 #define SV_BOOM_METAL                    4      /* 2d4  */
3025 
3026 /* The "sval" codes for TV_BOW (note information in "sval") */
3027 #define SV_SLING                         2	/* (x2) */
3028 #define SV_SHORT_BOW                    12	/* (x2) */
3029 #define SV_LONG_BOW                     13	/* (x3) */
3030 #define SV_LIGHT_XBOW                   23	/* (x3) */
3031 #define SV_HEAVY_XBOW                   24	/* (x4) */
3032 
3033 /* The "sval" codes for TV_DIGGING */
3034 #define SV_SHOVEL                        1
3035 #define SV_GNOMISH_SHOVEL                2
3036 #define SV_DWARVEN_SHOVEL                3
3037 #define SV_PICK                          4
3038 #define SV_ORCISH_PICK                   5
3039 #define SV_DWARVEN_PICK                  6
3040 #define SV_MATTOCK                       7
3041 #define SV_PICK_MOLTOR			 8
3042 
3043 /* The "sval" values for TV_BLUNT */
3044 #define SV_CLUB                          1	/* 1d4  */
3045 #define SV_WHIP                          2	/* 1d6  */
3046 #define SV_QUARTERSTAFF                  3	/* 1d9  */
3047 #define SV_NUNCHAKU                      4	/* 2d3  */
3048 #define SV_MACE                          5	/* 2d4  */
3049 #define SV_BALL_AND_CHAIN                6	/* 2d4  */
3050 #define SV_WAR_MAUL			 8	/* 3d3  */
3051 #define SV_WAR_HAMMER			10	/* 2d5  */
3052 #define SV_THREE_PIECE_ROD              11	/* 3d3  */
3053 #define SV_MORNING_STAR                 12	/* 2d6  */
3054 #define SV_FLAIL                        13	/* 2d6  */
3055 #define SV_LEAD_FILLED_MACE             15	/* 3d4  */
3056 #define SV_TWO_HANDED_FLAIL             18	/* 3d6  */
3057 #define SV_GREAT_HAMMER                 19	/* 4d6  */
3058 #define SV_MACE_OF_DISRUPTION           20	/* 5d8  */
3059 #define SV_SCOURGE			21	/* 4d2  */
3060 #define SV_DEMON_HAMMER			22	/* 6d6  */
3061 #define SV_SCOURGE_OF_REPENTANCE	23	/* 4d3	*/
3062 #define SV_GROND                        50	/* 3d4  */
3063 
3064 /* The "sval" values for TV_AXE */
3065 #define SV_CLEAVER			 1	/* 1d5 */
3066 #define SV_DBITTED			 2	/* 2d4 */
3067 #define SV_TOMAHAWK			 3	/* 2d4 */
3068 #define SV_HATCHET			 5	/* 2d3 */
3069 #define SV_LIGHT_WAR_AXE		 8	/* 2d5 */
3070 #define SV_BEAKED_AXE                   10	/* 2d6 */
3071 #define SV_BROAD_AXE                    11	/* 2d6 */
3072 #define SV_BATTLE_AXE                   22	/* 2d8 */
3073 #define SV_GREAT_AXE                    25	/* 4d4 */
3074 #define SV_HEAVY_WAR_AXE                28	/* 3d8 */
3075 #define SV_SLAUGHTER_AXE                30      /* 5d7 */
3076 #define SV_THUNDER_AXE			33	/* 6d8 */
3077 
3078 /* The "sval" values for TV_POLEARM */
3079 #define SV_HUNTING_SPEAR		 1	/* 1d6 */
3080 #define SV_SPEAR                         2	/* 1d6 */
3081 #define SV_SICKLE                        3	/* 2d3 */
3082 #define SV_AWL_PIKE                      4	/* 1d8 */
3083 #define SV_TRIDENT                       5	/* 1d9 */
3084 #define SV_FAUCHARD                      6  /* 1d10 */
3085 #define SV_BROAD_SPEAR                   7	/* 1d9 */
3086 #define SV_PIKE                          8	/* 2d5 */
3087 #define SV_RHOMPHAIA                     9  	/* 2d4 */
3088 #define SV_GLAIVE                       13	/* 2d6 */
3089 #define SV_HALBERD                      15	/* 3d4 */
3090 #define SV_GUISARME                     16  /* 2d5 */
3091 #define SV_SCYTHE                       17	/* 5d3 */
3092 #define SV_LANCE                        20	/* 2d8 */
3093 #define SV_TRIFURCATE_SPEAR             26	/* 2d9 */
3094 #define SV_HEAVY_LANCE                  29  /* 4d8 */
3095 #define SV_SCYTHE_OF_SLICING            30	/* 8d4 */
3096 
3097 /* The "sval" codes for TV_SWORD */
3098 #define SV_BROKEN_DAGGER                 1  /* 1d1 */
3099 #define SV_BROKEN_SWORD                  2  /* 1d2 */
3100 #define SV_DAGGER                        4  /* 1d4 */
3101 #define SV_MAIN_GAUCHE                   5  /* 1d5 */
3102 #define SV_RAPIER                        7  /* 1d6 */
3103 #define SV_SMALL_SWORD                   8  /* 1d6 */
3104 #define SV_BASILLARD                     9  /* 1d8 */
3105 #define SV_SHORT_SWORD                  10  /* 1d7 */
3106 #define SV_SABRE                        11  /* 1d7 */
3107 #define SV_CUTLASS                      12  /* 1d7 */
3108 #define SV_TULWAR                       15  /* 2d4 */
3109 #define SV_BROAD_SWORD                  16  /* 2d5 */
3110 #define SV_LONG_SWORD                   17  /* 2d5 */
3111 #define SV_SCIMITAR                     18  /* 2d5 */
3112 #define SV_KATANA                       20  /* 3d4 */
3113 #define SV_BASTARD_SWORD                21  /* 3d4 */
3114 #define SV_GREAT_SCIMITAR               22  /* 4d5 */
3115 #define SV_CLAYMORE                     23  /* 2d8 */
3116 #define SV_ESPADON                      24  /* 2d9 */
3117 #define SV_TWO_HANDED_SWORD             25  /* 3d6 */
3118 #define SV_FLAMBERGE                    26  /* 3d7 */
3119 #define SV_EXECUTIONERS_SWORD           28  /* 4d5 */
3120 #define SV_ZWEIHANDER                   29  /* 4d6 */
3121 #define SV_BLADE_OF_CHAOS               30  /* 6d5 */
3122 #define SV_SHADOW_BLADE                 31  /* 4d4 */
3123 #define SV_BLUESTEEL_BLADE              32  /* 3d9 */
3124 #define SV_DARK_SWORD                   33  /* 3d7 */
3125 
3126 /* The "sval" codes for TV_SHIELD */
3127 #define SV_SMALL_LEATHER_SHIELD          2
3128 #define SV_SMALL_METAL_SHIELD            3
3129 #define SV_LARGE_LEATHER_SHIELD          4
3130 #define SV_LARGE_METAL_SHIELD            5
3131 #define SV_DRAGON_SHIELD                 6
3132 #define SV_ORCISH_SHIELD		 7
3133 #define SV_SHIELD_OF_DEFLECTION         10
3134 #define SV_MITHRIL_ANCILE		11
3135 #define SV_ADAMANTITE_AEGIS		12
3136 
3137 /* The "sval" codes for TV_HELM */
3138 #define SV_CLOTH_CAP			 1
3139 #define SV_HARD_LEATHER_CAP              2
3140 #define SV_METAL_CAP                     3
3141 #define SV_IRON_HELM                     5
3142 #define SV_STEEL_HELM                    6
3143 #define SV_DRAGON_HELM                   7
3144 #define SV_MITHRIL_HELM			10
3145 #define SV_ADAMANTITE_HELM		11
3146 #define SV_GOGGLES_DM			15 /* artifact goggles of the dungeon master */
3147 
3148 /* The "sval" codes for TV_CROWN */
3149 #define SV_IRON_CROWN                   10
3150 #define SV_GOLDEN_CROWN                 11
3151 #define SV_JEWELED_CROWN                12
3152 #define SV_MORGOTH                      50
3153 
3154 /* The "sval" codes for TV_BOOTS */
3155 #define SV_PAIR_OF_SOFT_LEATHER_BOOTS    2
3156 #define SV_PAIR_OF_HARD_LEATHER_BOOTS    3
3157 #define SV_PAIR_OF_METAL_SHOD_BOOTS      6
3158 #define SV_PAIR_OF_WITAN_BOOTS		 8
3159 #define SV_SMOKIN_BOOTS_MOLTOR		 9
3160 
3161 /* The "sval" codes for TV_CLOAK */
3162 #define SV_CLOAK                         1
3163 #define SV_ELVEN_CLOAK                   2
3164 #define SV_FUR_CLOAK                     3
3165 #define SV_SHADOW_CLOAK                  6
3166 #define SV_KOLLA			 7
3167 #define SV_SBSILK_CLOAK			 8
3168 
3169 /* The "sval" codes for TV_GLOVES */
3170 #define SV_SET_OF_LEATHER_GLOVES         1
3171 #define SV_SET_OF_GAUNTLETS              2
3172 #define SV_SET_OF_ELVEN_GLOVES		 4
3173 #define SV_SET_OF_CESTI                  5
3174 
3175 /* The "sval" codes for TV_SOFT_ARMOR */
3176 #define SV_FILTHY_RAG                    1
3177 #define SV_ROBE                          2
3178 #define SV_PAPER_ARMOR                   3  /* 4 */
3179 #define SV_SOFT_LEATHER_ARMOR            4
3180 #define SV_SOFT_STUDDED_LEATHER          5
3181 #define SV_HARD_LEATHER_ARMOR            6
3182 #define SV_HARD_STUDDED_LEATHER          7
3183 #define SV_RHINO_HIDE_ARMOR              8
3184 #define SV_CORD_ARMOR                    9  /*  6 */
3185 #define SV_PADDED_ARMOR                 10  /*  4 */
3186 #define SV_LEATHER_SCALE_MAIL           11
3187 #define SV_LEATHER_JACK                 12
3188 #define SV_WIRE_FLEECE			13
3189 #define SV_STONE_AND_HIDE_ARMOR         15  /* 15 */
3190 #define SV_DRAGONRIDER_SUIT             16
3191 #define SV_WYVERNHIDE_ARMOR             17
3192 #define SV_SHIRT             		18
3193 #define SV_FROCK			20
3194 #define SV_TUNIC			21
3195 #define SV_GOWN				22
3196 #define SV_LEATHER_FROCK		23
3197 #define SV_COSTUME			24 /* Halloween costume */
3198 
3199 /* The "sval" codes for TV_HARD_ARMOR */
3200 #define SV_RUSTY_CHAIN_MAIL              1  /* 14- */
3201 #define SV_RING_MAIL                     2  /* 12  */
3202 #define SV_METAL_SCALE_MAIL              3  /* 13  */
3203 #define SV_CHAIN_MAIL                    4  /* 14  */
3204 #define SV_DOUBLE_RING_MAIL              5  /* 15  */
3205 #define SV_AUGMENTED_CHAIN_MAIL          6  /* 16  */
3206 #define SV_DOUBLE_CHAIN_MAIL             7  /* 16  */
3207 #define SV_BAR_CHAIN_MAIL                8  /* 18  */
3208 #define SV_METAL_BRIGANDINE_ARMOUR       9  /* 19  */
3209 #define SV_SPLINT_MAIL                  10  /* 19  */
3210 #define SV_PARTIAL_PLATE_ARMOUR         12  /* 22  */
3211 #define SV_METAL_LAMELLAR_ARMOUR        13  /* 23  */
3212 #define SV_FULL_PLATE_ARMOUR            15  /* 25  */
3213 #define SV_RIBBED_PLATE_ARMOUR          18  /* 28  */
3214 #define SV_MITHRIL_CHAIN_MAIL           20  /* 28+ */
3215 #define SV_MITHRIL_PLATE_MAIL           25  /* 35+ */
3216 #define SV_ADAMANTITE_PLATE_MAIL        30  /* 40+ */
3217 
3218 /* The "sval" codes for TV_DRAG_ARMOR */
3219 #define SV_DRAGON_BLACK                  1
3220 #define SV_DRAGON_BLUE                   2
3221 #define SV_DRAGON_WHITE                  3
3222 #define SV_DRAGON_RED                    4
3223 #define SV_DRAGON_GREEN                  5
3224 #define SV_DRAGON_MULTIHUED              6
3225 #define SV_DRAGON_PSEUDO		 8
3226 #define SV_DRAGON_SHINING               10
3227 #define SV_DRAGON_LAW                   12
3228 #define SV_DRAGON_BRONZE                14
3229 #define SV_DRAGON_GOLD                  16
3230 #define SV_DRAGON_CHAOS                 18
3231 #define SV_DRAGON_BALANCE               20
3232 #define SV_DRAGON_POWER                 30
3233 #define SV_DRAGON_DEATH			40
3234 #define SV_DRAGON_CRYSTAL		41
3235 #define SV_DRAGON_DRACOLICH		42
3236 #define SV_DRAGON_DRACOLISK		43
3237 #define SV_DRAGON_SKY			44
3238 #define SV_DRAGON_SILVER                45
3239 
3240 /* The sval codes for TV_LITE */
3241 #define SV_LITE_TORCH                    0
3242 #define SV_LITE_LANTERN                  1
3243 #define SV_LITE_TORCH_EVER               2
3244 #define SV_LITE_DWARVEN                  3
3245 #define SV_LITE_FEANORIAN                4
3246 #define SV_LITE_GALADRIEL                100
3247 #define SV_LITE_ELENDIL                  101
3248 #define SV_LITE_THRAIN                   102
3249 #define SV_LITE_UNDEATH                  103
3250 #define SV_LITE_PALANTIR                 104
3251 #define SV_ANCHOR_SPACETIME              105
3252 #define SV_STONE_LORE                    106
3253 
3254 
3255 /* The "sval" codes for TV_AMULET */
3256 #define SV_AMULET_DOOM                   0
3257 #define SV_AMULET_TELEPORT               1
3258 #define SV_AMULET_ADORNMENT              2
3259 #define SV_AMULET_SLOW_DIGEST            3
3260 #define SV_AMULET_RESIST_ACID            4
3261 #define SV_AMULET_SEARCHING              5
3262 #define SV_AMULET_BRILLANCE              6
3263 #define SV_AMULET_CHARISMA               7
3264 #define SV_AMULET_THE_MAGI               8
3265 #define SV_AMULET_REFLECTION             9
3266 #define SV_AMULET_CARLAMMAS             10
3267 #define SV_AMULET_INGWE                 11
3268 #define SV_AMULET_DWARVES               12
3269 #define SV_AMULET_NO_MAGIC              13
3270 #define SV_AMULET_NO_TELE               14
3271 #define SV_AMULET_RESISTANCE            15
3272 #define SV_AMULET_NOTHING               16
3273 #define SV_AMULET_SERPENT               17
3274 #define SV_AMULET_TORIS_MEJISTOS        18
3275 #define SV_AMULET_ESP			22
3276 #define SV_AMULET_TRICKERY              23
3277 #define SV_AMULET_DEVOTION              25
3278 #define SV_AMULET_WEAPONMASTERY         24
3279 #define SV_AMULET_WISDOM                28
3280 #define SV_AMULET_INFRA                 26
3281 #define SV_AMULET_HIGHLANDS             32	/* for highlander games */
3282 #define SV_AMULET_INVINCIBILITY		37	/* for admins */
3283 #define SV_AMULET_GROM			38
3284 #define SV_AMULET_LUCK			39	/* Talisman */
3285 #define SV_AMULET_SSHARD		40	/* Spirit Shard (artifact) */
3286 #define SV_AMULET_INVULNERABILITY	41	/* for admins */
3287 #define SV_AMULET_HIGHLANDS2            42	/* for highlander games, with ESP */
3288 
3289 /* The sval codes for TV_RING */
3290 #define SV_RING_WOE                      0
3291 #define SV_RING_AGGRAVATION              1
3292 #define SV_RING_WEAKNESS                 2
3293 #define SV_RING_STUPIDITY                3
3294 #define SV_RING_TELEPORTATION            4
3295 #define SV_RING_SPECIAL                  5
3296 #define SV_RING_SLOW_DIGESTION           6
3297 #define SV_RING_FEATHER_FALL             7
3298 #define SV_RING_RESIST_FIRE              8
3299 #define SV_RING_RESIST_COLD              9
3300 #define SV_RING_SUSTAIN_MIGHT		10
3301 #define SV_RING_SUSTAIN_BRILLIANCE	11
3302 #define SV_RING_SUSTAIN_ABILITY		12
3303 #define SV_RING_SUSTAIN_READYWIT	13
3304 #define SV_RING_SUSTAIN_STEADINESS	14
3305 #define SV_RING_SUSTAIN_CUNNINGNESS	15
3306 #define SV_RING_PROTECTION              16
3307 #define SV_RING_ACID                    17
3308 #define SV_RING_FLAMES                  18
3309 #define SV_RING_ICE                     19
3310 #define SV_RING_RESIST_POIS             20
3311 #define SV_RING_FREE_ACTION             21
3312 #define SV_RING_SEE_INVIS               22
3313 #define SV_RING_SEARCHING               23
3314 #define SV_RING_MIGHT                   24
3315 #define SV_RING_READYWIT		25
3316 #define SV_RING_TOUGHNESS		26
3317 #define SV_RING_CUNNINGNESS             27
3318 #define SV_RING_ACCURACY                28
3319 #define SV_RING_DAMAGE                  29
3320 #define SV_RING_SLAYING                 30
3321 #define SV_RING_SPEED                   31
3322 #define SV_RING_BARAHIR                 32
3323 #define SV_RING_TULKAS                  33
3324 #define SV_RING_NARYA                   34
3325 #define SV_RING_NENYA                   35
3326 #define SV_RING_VILYA                   36
3327 #define SV_RING_POWER                   37
3328 #define SV_RING_RES_FEAR                38
3329 #define SV_RING_RES_LD                  39
3330 #define SV_RING_RES_NETHER              40
3331 #define SV_RING_RES_NEXUS               41
3332 #define SV_RING_RES_SOUND               42
3333 #define SV_RING_RES_CONFUSION           43
3334 #define SV_RING_RES_SHARDS              44
3335 #define SV_RING_RES_DISENCHANT          45
3336 #define SV_RING_RES_CHAOS               46
3337 #define SV_RING_RES_BLINDNESS           47
3338 #define SV_RING_LORDLY                  48
3339 #define SV_RING_ATTACKS                 49
3340 #define SV_RING_NOTHING                 50
3341 #define SV_RING_PRECONITION             51
3342 #define SV_RING_FLAR                    52
3343 #define SV_RING_INVIS                   53
3344 #define SV_RING_LEVITATION		54
3345 #define SV_RING_WRAITH                  55
3346 #define SV_RING_ELEC                    56
3347 /* 57 - DURIN (arts) */
3348 #define SV_RING_CRIT                    58
3349 /* ToME-NET additions */
3350 #define SV_RING_POLYMORPH		60
3351 #define SV_RING_STEALTH			61
3352 
3353 
3354 /* The "sval" codes for TV_STAFF */
3355 #define SV_STAFF_DARKNESS                0
3356 #define SV_STAFF_SLOWNESS                1
3357 #define SV_STAFF_HASTE_MONSTERS          2
3358 #define SV_STAFF_SUMMONING               3
3359 #define SV_STAFF_TELEPORTATION           4
3360 #define SV_STAFF_IDENTIFY                5
3361 #define SV_STAFF_REMOVE_CURSE            6
3362 #define SV_STAFF_STARLITE                7
3363 #define SV_STAFF_LITE                    8
3364 #define SV_STAFF_MAPPING                 9
3365 #define SV_STAFF_DETECT_GOLD            10
3366 #define SV_STAFF_DETECT_ITEM            11
3367 #define SV_STAFF_DETECT_TRAP            12
3368 #define SV_STAFF_DETECT_DOOR            13
3369 #define SV_STAFF_DETECT_INVIS           14
3370 #define SV_STAFF_DETECT_EVIL            15
3371 #define SV_STAFF_CURE_SERIOUS           16
3372 #define SV_STAFF_CURING                 17
3373 #define SV_STAFF_HEALING                18
3374 #define SV_STAFF_THE_MAGI               19
3375 #define SV_STAFF_SLEEP_MONSTERS         20
3376 #define SV_STAFF_SLOW_MONSTERS          21
3377 #define SV_STAFF_SPEED                  22
3378 #define SV_STAFF_PROBING                23
3379 #define SV_STAFF_DISPEL_EVIL            24
3380 #define SV_STAFF_POWER                  25
3381 #define SV_STAFF_HOLINESS               26
3382 #define SV_STAFF_GENOCIDE               27
3383 #define SV_STAFF_EARTHQUAKES            28
3384 #define SV_STAFF_DESTRUCTION            29
3385 #define SV_STAFF_NOTHING                30
3386 #define SV_STAFF_WISHING                31
3387 #define SV_STAFF_GANDALF                32	/* sorta hack? (tval=6) */
3388 #define SV_STAFF_STAR_IDENTIFY		33
3389 
3390 /* jk - the first valuable staff */
3391 #define SV_STAFF_NASTY_STAFF		4
3392 
3393 /* The "sval" codes for TV_WAND */
3394 #define SV_WAND_HEAL_MONSTER             0
3395 #define SV_WAND_HASTE_MONSTER            1
3396 #define SV_WAND_CLONE_MONSTER            2
3397 #define SV_WAND_TELEPORT_AWAY            3
3398 #define SV_WAND_DISARMING                4
3399 #define SV_WAND_TRAP_DOOR_DEST           5
3400 #define SV_WAND_STONE_TO_MUD             6
3401 #define SV_WAND_LITE                     7
3402 #define SV_WAND_SLEEP_MONSTER            8
3403 #define SV_WAND_SLOW_MONSTER             9
3404 #define SV_WAND_CONFUSE_MONSTER         10
3405 #define SV_WAND_FEAR_MONSTER            11
3406 #define SV_WAND_DRAIN_LIFE              12
3407 #define SV_WAND_POLYMORPH               13
3408 #define SV_WAND_STINKING_CLOUD          14
3409 #define SV_WAND_MAGIC_MISSILE           15
3410 #define SV_WAND_ACID_BOLT               16
3411 #define SV_WAND_CHARM_MONSTER           17
3412 #define SV_WAND_FIRE_BOLT               18
3413 #define SV_WAND_COLD_BOLT               19
3414 #define SV_WAND_ACID_BALL               20
3415 #define SV_WAND_ELEC_BALL               21
3416 #define SV_WAND_FIRE_BALL               22
3417 #define SV_WAND_COLD_BALL               23
3418 #define SV_WAND_WONDER                  24
3419 #define SV_WAND_ANNIHILATION            25
3420 #define SV_WAND_DRAGON_FIRE             26
3421 #define SV_WAND_DRAGON_COLD             27
3422 #define SV_WAND_DRAGON_BREATH           28
3423 #define SV_WAND_ROCKETS                 29
3424 #define SV_WAND_NOTHING                 30
3425 #define SV_WAND_WALL_CREATION           31
3426 #define SV_WAND_THRAIN                  32
3427 /* ToME-NET additions(?) */
3428 #define SV_WAND_ELEC_BOLT		33
3429 #define SV_WAND_TELEPORT_TO		34
3430 
3431 /* jk - the first valuable wand */
3432 #define SV_WAND_NASTY_WAND               3
3433 
3434 /* The "sval" codes for TV_ROD(Rod Tips) */
3435 #define SV_ROD_NOTHING                   0
3436 #define SV_ROD_DETECT_DOOR               1
3437 #define SV_ROD_IDENTIFY                  2
3438 #define SV_ROD_RECALL                    3
3439 #define SV_ROD_ILLUMINATION              4
3440 #define SV_ROD_MAPPING                   5
3441 #define SV_ROD_DETECTION                 6
3442 #define SV_ROD_PROBING                   7
3443 #define SV_ROD_CURING                    8
3444 #define SV_ROD_HEALING                   9
3445 #define SV_ROD_RESTORATION              10
3446 #define SV_ROD_SPEED                    11
3447 /* xxx (aimed) */
3448 #define SV_ROD_TELEPORT_AWAY            13
3449 #define SV_ROD_DISARMING                14
3450 #define SV_ROD_LITE                     15
3451 #define SV_ROD_SLEEP_MONSTER            16
3452 #define SV_ROD_SLOW_MONSTER             17
3453 #define SV_ROD_DRAIN_LIFE               18
3454 #define SV_ROD_POLYMORPH                19
3455 #define SV_ROD_ACID_BOLT                20
3456 #define SV_ROD_ELEC_BOLT                21
3457 #define SV_ROD_FIRE_BOLT                22
3458 #define SV_ROD_COLD_BOLT                23
3459 #define SV_ROD_ACID_BALL                24
3460 #define SV_ROD_ELEC_BALL                25
3461 #define SV_ROD_FIRE_BALL                26
3462 #define SV_ROD_COLD_BALL                27
3463 #define SV_ROD_HAVOC                    28
3464 #define SV_ROD_DETECT_TRAP              29
3465 #define SV_ROD_HOME                     30
3466 
3467 
3468 /* The "sval" codes for TV_ROD_MAIN(Rods) */
3469 /* Note that the sval is the max mana capacity of the rod */
3470 
3471 #define SV_ROD_WOODEN                   10
3472 #define SV_ROD_COPPER                   20
3473 #define SV_ROD_IRON                     50
3474 #define SV_ROD_ALUMINIUM                75
3475 #define SV_ROD_SILVER                   100
3476 #define SV_ROD_GOLDEN                   125
3477 #define SV_ROD_MITHRIL                  160
3478 #define SV_ROD_ADMANTITE                200
3479 
3480 
3481 /* The "sval" codes for TV_SCROLL */
3482 
3483 #define SV_SCROLL_DARKNESS               0
3484 #define SV_SCROLL_AGGRAVATE_MONSTER      1
3485 #define SV_SCROLL_CURSE_ARMOR            2
3486 #define SV_SCROLL_CURSE_WEAPON           3
3487 #define SV_SCROLL_SUMMON_MONSTER         4
3488 #define SV_SCROLL_SUMMON_UNDEAD          5
3489 #define SV_SCROLL_SUMMON_MINE            6
3490 #define SV_SCROLL_TRAP_CREATION          7
3491 #define SV_SCROLL_PHASE_DOOR             8
3492 #define SV_SCROLL_TELEPORT               9
3493 #define SV_SCROLL_TELEPORT_LEVEL        10
3494 #define SV_SCROLL_WORD_OF_RECALL        11
3495 #define SV_SCROLL_IDENTIFY              12
3496 #define SV_SCROLL_STAR_IDENTIFY         13
3497 #define SV_SCROLL_REMOVE_CURSE          14
3498 #define SV_SCROLL_STAR_REMOVE_CURSE     15
3499 #define SV_SCROLL_ENCHANT_ARMOR         16
3500 #define SV_SCROLL_ENCHANT_WEAPON_TO_HIT 17
3501 #define SV_SCROLL_ENCHANT_WEAPON_TO_DAM 18
3502 #define SV_SCROLL_ENCHANT_WEAPON_PVAL   19
3503 #define SV_SCROLL_STAR_ENCHANT_ARMOR    20
3504 #define SV_SCROLL_STAR_ENCHANT_WEAPON   21
3505 #define SV_SCROLL_RECHARGING            22
3506 #define SV_SCROLL_RESET_RECALL          23
3507 #define SV_SCROLL_LIGHT                 24
3508 #define SV_SCROLL_MAPPING               25
3509 #define SV_SCROLL_DETECT_GOLD           26
3510 #define SV_SCROLL_DETECT_ITEM           27
3511 #define SV_SCROLL_DETECT_TRAP           28
3512 #define SV_SCROLL_DETECT_DOOR           29
3513 #define SV_SCROLL_DETECT_INVIS          30
3514 #define SV_SCROLL_DIVINATION            31
3515 #define SV_SCROLL_SATISFY_HUNGER        32
3516 #define SV_SCROLL_BLESSING              33
3517 #define SV_SCROLL_HOLY_CHANT            34
3518 #define SV_SCROLL_HOLY_PRAYER           35
3519 #define SV_SCROLL_MONSTER_CONFUSION     36
3520 #define SV_SCROLL_PROTECTION_FROM_EVIL  37
3521 #define SV_SCROLL_RUNE_OF_PROTECTION    38
3522 #define SV_SCROLL_TRAP_DOOR_DESTRUCTION 39
3523 #define SV_SCROLL_DEINCARNATION         40
3524 #define SV_SCROLL_STAR_DESTRUCTION      41
3525 #define SV_SCROLL_DISPEL_UNDEAD         42
3526 #define SV_SCROLL_MASS_RESURECTION      43
3527 #define SV_SCROLL_GENOCIDE              44
3528 #define SV_SCROLL_OBLITERATION          45
3529 #define SV_SCROLL_ACQUIREMENT           46
3530 #define SV_SCROLL_STAR_ACQUIREMENT      47
3531 #define SV_SCROLL_FIRE                  48
3532 #define SV_SCROLL_ICE                   49
3533 #define SV_SCROLL_CHAOS                 50
3534 #define SV_SCROLL_RUMOR                 51
3535 /* #define SV_SCROLL_ARTIFACT              52 */
3536 #define SV_SCROLL_ARTIFACT_CREATION     52
3537 #define SV_SCROLL_NOTHING               53
3538 #define SV_SCROLL_SPELL                 54
3539 /* ToME-NET additions */
3540 #define SV_SCROLL_GOLEM                         55
3541 #define SV_SCROLL_LIFE				56
3542 #define SV_SCROLL_HOUSE				57
3543 #define SV_SCROLL_BLOOD_BOND			58
3544 #define SV_SCROLL_LOTTERY			59
3545 #define SV_SCROLL_ID_ALL			60
3546 #define SV_SCROLL_VERMIN_CONTROL		61
3547 #define SV_SCROLL_CANCELLATION			62
3548 #define SV_SCROLL_WILDERNESS_MAP		63
3549 /* more stuff - C. Blue */
3550 #define SV_SCROLL_CONJURE_MONSTER       	64
3551 #define SV_SCROLL_SLEEPING       		65
3552 /* DEG Stuff to make game more party friendly */
3553 #define SV_SCROLL_TELEPORT_TO_PARTY   		66
3554 #define SV_SCROLL_STAR_TELEPORT_TO_PARTY   	67
3555 #define SV_SCROLL_PARTY_RECALL   		68
3556 #define SV_SCROLL_EMERGENCY_RECALL   		69
3557 #define SV_SCROLL_EMERGENCY_PARTY_RECALL	70
3558 #define SV_SCROLL_CHEQUE			71 /* for player houses; read to redeem, easily. */
3559 
3560 
3561 /* The "sval" codes for TV_POTION */
3562 #define SV_POTION_WATER                  0
3563 #define SV_POTION_APPLE_JUICE            1
3564 #define SV_POTION_SLIME_MOLD             2
3565 #define SV_POTION_BLOOD                  3
3566 #define SV_POTION_SALT_WATER             5
3567 #define SV_POTION_POISON                 6
3568 #define SV_POTION_BLINDNESS              7
3569 #define SV_POTION_INVIS                  8
3570 #define SV_POTION_CONFUSION              9
3571 #define SV_POTION_SLOWNESS              10
3572 //#define SV_POTION_MUTATION		10
3573 /* used for EXPAND_TV_POTION		10 */
3574 #define SV_POTION_SLEEP                 11
3575 //#define SV_POTION_LEARNING		40 /* not used. see SV_POTION2_LEARNING instead */
3576 /* used for EXPAND_TV_POTION		12 */
3577 #define SV_POTION_LOSE_MEMORIES         12
3578 /* xxx -- used for EXPAND_TV_POTION	14 */
3579 #define SV_POTION_RUINATION             13
3580 #define SV_POTION_DEC_STR               14
3581 #define SV_POTION_DEC_INT               15
3582 #define SV_POTION_DEC_WIS               16
3583 #define SV_POTION_DEC_DEX               17
3584 #define SV_POTION_DEC_CON               18
3585 #define SV_POTION_DEC_CHR               19
3586 #define SV_POTION_DETONATIONS           20
3587 #define SV_POTION_DEATH                 21
3588 #define SV_POTION_STAR_RESTORE_MANA     22
3589 #define SV_POTION_RESTORE_MANA          23
3590 #define SV_POTION_INFRAVISION           24
3591 #define SV_POTION_DETECT_INVIS          25
3592 #define SV_POTION_SLOW_POISON           26
3593 #define SV_POTION_CURE_POISON           27
3594 #define SV_POTION_BOLDNESS              28
3595 #define SV_POTION_SPEED                 29
3596 #define SV_POTION_RESIST_HEAT           30
3597 #define SV_POTION_RESIST_COLD           31
3598 #define SV_POTION_HEROISM               32
3599 #define SV_POTION_BERSERK_STRENGTH      33
3600 #define SV_POTION_CURE_LIGHT            34
3601 #define SV_POTION_CURE_SERIOUS          35
3602 #define SV_POTION_CURE_CRITICAL         36
3603 #define SV_POTION_STAR_HEALING          37
3604 #define SV_POTION_HEALING               38
3605 #define SV_POTION_LIFE                  39
3606 #define SV_POTION_RESTORE_EXP           41
3607 #define SV_POTION_RES_STR               42
3608 #define SV_POTION_RES_INT               43
3609 #define SV_POTION_RES_WIS               44
3610 #define SV_POTION_RES_DEX               45
3611 #define SV_POTION_RES_CON               46
3612 #define SV_POTION_RES_CHR               47
3613 #define SV_POTION_INC_STR               48
3614 #define SV_POTION_INC_INT               49
3615 #define SV_POTION_INC_WIS               50
3616 #define SV_POTION_INC_DEX               51
3617 #define SV_POTION_INC_CON               52
3618 #define SV_POTION_INC_CHR               53
3619 /* xxx -- used for EXPAND_TV_POTION	54 */
3620 #define SV_POTION_INVULNERABILITY       54
3621 #define SV_POTION_AUGMENTATION          55
3622 #define SV_POTION_ENLIGHTENMENT         56
3623 #define SV_POTION_STAR_ENLIGHTENMENT    57
3624 #define SV_POTION_SELF_KNOWLEDGE        58
3625 #define SV_POTION_EXPERIENCE            59
3626 #define SV_POTION_RESISTANCE            60
3627 #define SV_POTION_CURING                61
3628 /*disabled: #define SV_POTION_NEW_LIFE  63
3629   used for EXPAND_TV_POTION		63 */
3630 
3631 #ifndef EXPAND_TV_POTION
3632  #define SV_POTION_LAST			64	/* used for handling fountains */
3633 #else
3634  #define SV_POTION_LAST			65	/* used for handling fountains */
3635 #endif
3636 
3637 /* for EXPAND_TV_POTION, always defined for conversion in load2.c: */
3638 #define SV_POTION_CHAUVE_SOURIS		4
3639 #define SV_POTION_LEARNING		40
3640 #define SV_POTION_CURE_LIGHT_SANITY	62
3641 #define SV_POTION_CURE_SERIOUS_SANITY	63
3642 #define SV_POTION_CURE_CRITICAL_SANITY	64
3643 #define SV_POTION_CURE_SANITY		65
3644 
3645 
3646 /*
3647  * NOTE: due to hard-coded flavor code, adding SV_POTION is bad idea.
3648  * Add it to SV_POTION2 instead.
3649  * (flavor variator is under construction.)		- Jir -
3650  */
3651 
3652 /* The "sval" codes for TV_POTION2 */
3653 #define SV_POTION2_MIMIC_ABOMINATION    1
3654 #define SV_POTION2_MIMIC_WOLF           2
3655 #define SV_POTION2_MIMIC_APE            3
3656 #define SV_POTION2_MIMIC_GOAT           4
3657 #define SV_POTION2_MIMIC_INSECT         5
3658 #define SV_POTION2_MIMIC_SPARROW        6
3659 #define SV_POTION2_MIMIC_STATUE         7
3660 #define SV_POTION2_MIMIC_VAMPIRE        8
3661 #define SV_POTION2_MIMIC_SPIDER         9
3662 #define SV_POTION2_MIMIC_MANA_BALL      10
3663 #define SV_POTION2_MIMIC_FIRE_CLOUD     11
3664 #define SV_POTION2_MIMIC_COLD_CLOUD     12
3665 #define SV_POTION2_MIMIC_CHAOS_CLOUD    13
3666 #define SV_POTION2_CURE_LIGHT_SANITY    14
3667 #define SV_POTION2_CURE_SERIOUS_SANITY  15
3668 #define SV_POTION2_CURE_CRITICAL_SANITY 16
3669 #define SV_POTION2_CURE_SANITY          17
3670 #define SV_POTION2_CURE_WATER           18
3671 
3672 #define SV_POTION2_CHAUVE_SOURIS	19
3673 #define SV_POTION2_LEARNING		20
3674 
3675 #define SV_POTION2_AMBER		21	/* artifact potion */
3676 
3677 #ifndef EXPAND_TV_POTION
3678  #define SV_POTION2_LAST                 21
3679 #else
3680  #define SV_POTION2_LAST                 0
3681 #endif
3682 
3683 /* sval for TV_FLASK */
3684 /* note: there is only 1 flask, ie flask of oil.
3685    this might be assumed in lots of places in the code.*/
3686 #define SV_FLASK_OIL			0
3687 
3688 /* The "sval" codes for TV_FOOD */
3689 #define SV_FOOD_POISON                   0
3690 #define SV_FOOD_BLINDNESS                1
3691 #define SV_FOOD_PARANOIA                 2
3692 #define SV_FOOD_CONFUSION                3
3693 #define SV_FOOD_HALLUCINATION            4
3694 #define SV_FOOD_PARALYSIS                5
3695 #define SV_FOOD_WEAKNESS                 6
3696 #define SV_FOOD_SICKNESS                 7
3697 #define SV_FOOD_STUPIDITY                8
3698 #define SV_FOOD_NAIVETY                  9
3699 #define SV_FOOD_UNHEALTH                10
3700 #define SV_FOOD_DISEASE                 11
3701 #define SV_FOOD_CURE_POISON             12
3702 #define SV_FOOD_CURE_BLINDNESS          13
3703 #define SV_FOOD_CURE_PARANOIA           14
3704 #define SV_FOOD_CURE_CONFUSION          15
3705 #define SV_FOOD_CURE_SERIOUS            16
3706 #define SV_FOOD_RESTORE_STR             17
3707 #define SV_FOOD_RESTORE_CON             18
3708 #define SV_FOOD_RESTORING               19
3709 /* many missing mushrooms */
3710 /* mangband-oriented wilderness crops */
3711 #define	SV_FOOD_POTATO			20
3712 #define SV_FOOD_HEAD_OF_CABBAGE		21
3713 #define SV_FOOD_CARROT			22
3714 #define SV_FOOD_BEET			23
3715 #define	SV_FOOD_SQUASH			24
3716 #define	SV_FOOD_EAR_OF_CORN		25
3717 /* normal foods again */
3718 #define SV_FOOD_BISCUIT                 32
3719 #define SV_FOOD_JERKY                   33
3720 #define SV_FOOD_RATION                  35
3721 #define SV_FOOD_SLIME_MOLD              36
3722 #define SV_FOOD_WAYBREAD                37
3723 #define SV_FOOD_PINT_OF_ALE             38
3724 #define SV_FOOD_PINT_OF_WINE            39
3725 #define SV_FOOD_ATHELAS                 40
3726 #define SV_FOOD_GREAT_HEALTH            41	/* annuled for now */
3727 #define SV_FOOD_FORTUNE_COOKIE          42
3728 /* Another block for mushrooms */
3729 #define SV_FOOD_UNMAGIC			50
3730 
3731 /* The "sval" codes for TV_BATERIE */
3732 #define SV_BATERIE_POISON    1
3733 #define SV_BATERIE_EXPLOSION 2
3734 #define SV_BATERIE_TELEPORT  3
3735 #define SV_BATERIE_COLD      4
3736 #define SV_BATERIE_FIRE      5
3737 #define SV_BATERIE_ACID      6
3738 #define SV_BATERIE_LIFE      7
3739 #define SV_BATERIE_CONFUSION 8
3740 #define SV_BATERIE_LITE      9
3741 #define SV_BATERIE_CHAOS     10
3742 #define SV_BATERIE_TIME      11
3743 #define SV_BATERIE_MAGIC     12
3744 #define SV_BATERIE_XTRA_LIFE 13
3745 #define SV_BATERIE_DARKNESS  14
3746 #define SV_BATERIE_KNOWLEDGE 15
3747 #define SV_BATERIE_FORCE     16
3748 #define SV_BATERIE_LIGHTNING 17
3749 #define SV_BATERIE_MANA      18
3750 
3751 /* The "sval" codes for TV_CORPSE */
3752 #define SV_CORPSE_CORPSE     1
3753 #define SV_CORPSE_SKELETON   2
3754 #define SV_CORPSE_HEAD       3
3755 #define SV_CORPSE_SKULL      4
3756 #define SV_CORPSE_MEAT       5
3757 
3758 /* The "sval" codes for TV_PARCHMENT */
3759 	/* Basic informational parchments */
3760 #define SV_PARCHMENT_NEWBIE	50
3761 #define SV_PARCHMENT_DEATH	51
3762 #define SV_PARCHMENT_NEWS	52
3763 
3764 	/* Deeds, given as a reward for certain events */
3765 #define SV_DEED_HIGHLANDER	60 /* for winner */
3766 #define SV_DEED2_HIGHLANDER	61 /* for participant */
3767 #define SV_DEED_PVP_MAX		62 /* reaching top level in pvp mode */
3768 #define SV_DEED_PVP_MID		63 /* reaching top level in pvp mode */
3769 #define SV_DEED_PVP_MASS	64 /* killing a lot of opponents in pvp mode */
3770 #define SV_DEED_PVP_START	65 /* birth item for pvp mode chars */
3771 #define SV_DEED_DUNGEONKEEPER	66 /* for winner */
3772 #define SV_DEED2_DUNGEONKEEPER	67 /* for participant */
3773 
3774 	/* Inheritances given as consolidation for deaths of high chars */
3775 #define SV_INHERIT_KNOW		70	/* flavour knowledge */
3776 #define SV_INHERIT_ATTR		71	/* boost/max 1+ attribute(s) */
3777 #define SV_INHERIT_GOLD		72	/* just gold */
3778 #define SV_INHERIT_ITEM		73	/* like highlander reward */
3779 #define SV_INHERIT_ART		74	/* artifact creation */
3780 
3781 /* for TV_BOOK */
3782 /* 0..49 are school tomes */
3783 #define SV_BOOK_COMBO		50 /* 50..99 are handbooks, 50 is beginner cantrips */
3784 #define SV_SPELLBOOK		255
3785 #define SV_CUSTOM_TOME_1	100 /* player-made personalized tomes */
3786 #define SV_CUSTOM_TOME_2	101
3787 #define SV_CUSTOM_TOME_3	102
3788 
3789 #define is_custom_tome(sval)	((sval) >= SV_CUSTOM_TOME_1 && (sval) <= SV_CUSTOM_TOME_3)
3790 
3791 /* For precious stones (TV_PRECIOUS_STONE) */
3792 /* order is from least rare to most rare (thanks, http://magmawiki.com/index.php/40d:Gem and some creative writing) */
3793 #define PRECIOUS_STONE_MAX_TIER1_START	1
3794 #define PRECIOUS_STONE_MAX_TIER1_END	3
3795 
3796 #define PRECIOUS_STONE_MAX_TIER2_START	11
3797 #define PRECIOUS_STONE_MAX_TIER2_END	18
3798 
3799 #define PRECIOUS_STONE_MAX_TIER3_START	21
3800 #define PRECIOUS_STONE_MAX_TIER3_END	28
3801 
3802 #define PRECIOUS_STONE_MAX_TIER4_START	31
3803 #define PRECIOUS_STONE_MAX_TIER4_END	32
3804 
3805 /* "cheap" tier; keep this to a minimum since we dont want lowbies to run around with too many stones */
3806 #define SV_PRECIOUS_STONE_JADE		1
3807 #define SV_PRECIOUS_STONE_CARNELIAN	2
3808 #define SV_PRECIOUS_STONE_OPAL		3
3809 
3810 /* "medium" tier */
3811 #define SV_PRECIOUS_STONE_MELANITE	11
3812 #define SV_PRECIOUS_STONE_TOURMALINE	12
3813 #define SV_PRECIOUS_STONE_AMETHYST	13
3814 #define SV_PRECIOUS_STONE_AQUAMARINE	14
3815 #define SV_PRECIOUS_STONE_MOONSTONE	15
3816 #define SV_PRECIOUS_STONE_CHRYSOBERYL 	16
3817 #define SV_PRECIOUS_STONE_TOPAZ		17
3818 #define SV_PRECIOUS_STONE_CATS_EYE	18
3819 
3820 /* "rare" tier */
3821 #define SV_PRECIOUS_STONE_RUBY	 		21
3822 #define SV_PRECIOUS_STONE_STAR_SAPPHIRE		22
3823 #define SV_PRECIOUS_STONE_INDIGO_TOURMALINE	23
3824 #define SV_PRECIOUS_STONE_FAINT_YELLOW_DIAMOND	24
3825 #define SV_PRECIOUS_STONE_DIAMOND		25
3826 #define SV_PRECIOUS_STONE_BLACK_DIAMOND		26
3827 #define SV_PRECIOUS_STONE_YELLOW_DIAMOND	27
3828 #define SV_PRECIOUS_STOE_TSAVORITE		28
3829 
3830 /* "unobtainium" tier (Thanks, Andur) */
3831 #define SV_PRECIOUS_STONE_QUASAR	31
3832 #define SV_PRECIOUS_STONE_ZUONIUM	32
3833 
3834 /* sub-section of "unobtainium": specific mobs drop this. take out of the group */
3835 #define SV_PRECIOUS_STONE_DORS_EYE	41 // Dor's Eye... Guess where it's going to be dropped by?
3836 
3837 /* svals for TV_SPECIAL */
3838 #define SV_SEAL			0	/* for invalid items */
3839 #define SV_CUSTOM_OBJECT	1	/* fun vanity objects, customizable by admins */
3840 #define SV_QUEST		2	/* a custom quest item (not to be confused with questors) */
3841 
3842 /*** General flag values ***/
3843 
3844 
3845 /*
3846  * Special cave grid flags
3847  */
3848 #define CAVE_MARK	0x00000001 	/* memorized feature */
3849 #define CAVE_GLOW	0x00000002 	/* self-illuminating */
3850 #define CAVE_ICKY	0x00000004 	/* part of a vault */
3851 #define CAVE_ROOM	0x00000008 	/* part of a room */
3852 
3853 #define CAVE_LITE	0x00000010 	/* lite flag  */
3854 #define CAVE_VIEW	0x00000020 	/* view flag */
3855 #define CAVE_TEMP	0x00000040 	/* temp flag */
3856 #define CAVE_XTRA	0x00000080 	/* misc flag */
3857 
3858 #define CAVE_NOPK	0x00000100	/* no pkill (arena?, tavern) */
3859 #define CAVE_STCK	0x00000200	/* sticky (no-tele vault), not icky (prison?) */
3860 #define CAVE_DARKEN	0x00000400	/* world surface at night - change colours to darker variants */
3861 #define CAVE_ICKY_PERMA	0x00000800 	/* part of a perma-walled vault */
3862 
3863 #define CAVE_PROT	0x00001000 	/* protected from monster-spawn + cannot be monster teleport destination */
3864 #define CAVE_NEST_PIT	0x00002000	/* grid is part of a monster nest and target for monster placement */
3865 #define CAVE_MAGELOCK	0x00004000	/* Anti-exploit: Remember magelocked doors so they don't give exp repeatedly */
3866 #define CAVE_JAIL	0x00008000	/* part of a jail: for special colour/lighting of jail walls */
3867 
3868 #define CAVE_LITE_VAMP	0x00010000	/* lite flag for RACE_VAMPIRE 'light' */
3869 #define CAVE_LITE_WHITE	0x00020000	/* lite flag for non-fiery light sources */
3870 #define CAVE_GUILD_SUS	0x00040000	/* floor of a suspended guild hall, due to the guild's leaderlessnes */
3871 #define CAVE_WATERY	0x00080000	/* For doors/stairs: Are they adjacent to water grids? */
3872 
3873 #define CAVE_SWITCH	0x00100000	/* Players can always switch position here, like on staircase grids (for grids around stores) */
3874 
3875 #if 0	/* for future expansion.. */
3876 /* To what extent shall we enlarge it?
3877  * we'll do 'smells of carrot' thingie? :) */
3878 #define CAVE_TRDT       0x0800    /* trap detected */
3879 #define CAVE_IDNT       0x1000    /* grid identified (fountains) */
3880 #define CAVE_SPEC       0x2000    /* special mark(quests) */
3881 #define CAVE_FREE       0x4000    /* no random generation on it */
3882 #define CAVE_DETECT     0x8000    /* Traps detected here */
3883 #define CAVE_PLIT       0x0    /* Player lit grid */
3884 #define CAVE_MLIT       0x0    /* Monster lit grid */
3885 #endif /* 0 */
3886 
3887 /*
3888  * Bit flags for the "project()" function
3889  *
3890  */
3891 #define PROJECT_JUMP	0x00000001	/* Jump directly to the target location (this is a hack) */
3892 #define PROJECT_BEAM	0x00000002	/* Work as a beam weapon (affect every grid passed through) */
3893 #define PROJECT_THRU	0x00000004	/* Continue "through" the target (used for "bolts"/"beams") */
3894 #define PROJECT_STOP	0x00000008	/* Stop as soon as we hit a monster (used for "bolts") */
3895 
3896 #define PROJECT_GRID	0x00000010	/* Affect each grid in the "blast area" in some way */
3897 #define PROJECT_ITEM	0x00000020	/* Affect each object in the "blast area" in some way */
3898 #define PROJECT_KILL	0x00000040	/* Affect each monster in the "blast area" in some way */
3899 #define PROJECT_HIDE	0x00000080	/* Hack -- disable "visual" feedback from projection */
3900 
3901 #define PROJECT_STAY    0x00000100	/* Create an 'effect' on the grid (cloud/wall/special fx) */
3902 #define PROJECT_SELF	0x00000200	/* Affect the projector too */
3903 #define PROJECT_DUMY	0x00000400	/* Don't affect anything or anybody (just visual fx, used for EFF_FIREWORKS etc.) */
3904 #define PROJECT_GRAV	0x00000800	/* Affected by gravity ie running along the ground. Example: Fire Wall. (Will hence stop at FEAT_DARK_PIT) */
3905 
3906 #define PROJECT_PLAY	0x00001000	/* Affect players too, including the projector. (for GF_HEALINGCLOUD) */
3907 #define PROJECT_NORF	0x00002000	/* cannot be deflected by REFLECT monster flag */
3908 #define PROJECT_FULL	0x00004000	/* Deal full damage over radius spread (May dehack many things with this! - Kurzel) */
3909 #define PROJECT_EVSG	0x00008000	/* 'Entity vs Grid': It's a bolt spell that can hit EITHER mon/py OR floor/item. */
3910 
3911 #define PROJECT_NODO	PROJECT_NORF	/* cannot be dodged (basically used in the same places as NORF) */
3912 #define PROJECT_LODF	0x00020000	/* can only partially be deflected by shield-blocking. */
3913 #define PROJECT_NODF	0x00040000	/* cannot be deflected by shield-blocking. */
3914 #define PROJECT_RNAF	0x00080000	/* has no adverse effects if resisted (added for time runecraft on high-elven characters) */
3915 
3916 /* ToME expansions */
3917 #if 0	/* soon */
3918 #define PROJECT_VIEWABLE	0x00000100   /* Affect monsters in LOS */
3919 #define PROJECT_METEOR_SHOWER	0x00000200   /* Affect random grids */
3920 #define PROJECT_BLAST		0x00000400   /* Like Mega_blast, but will only affect viewable grids */
3921 #define PROJECT_PANEL		0x00000800   /* Affect everything in the panel. */
3922 #define PROJECT_ALL		0x00001000   /* Affect every single grid. */
3923 #define PROJECT_WALL		0x00002000
3924 #define PROJECT_MANA_PATH	0x00004000   /* Follow a mana path. */
3925 #define PROJECT_ABSORB_MANA	0x00008000   /* The spell increase in power as it absord grid's mana. */
3926 #endif	/* 0 */
3927 
3928 
3929 /*
3930  * Bit flags for the "enchant()" function
3931  */
3932 #define ENCH_TOHIT	0x01
3933 #define ENCH_TODAM	0x02
3934 #define ENCH_TOAC	0x04
3935 #define ENCH_STOLEN	0x08
3936 
3937 
3938 /*
3939  * Some bit-flags for the "smart" field
3940  */
3941 #define SM_RES_ACID		0x00000001
3942 #define SM_RES_ELEC		0x00000002
3943 #define SM_RES_FIRE		0x00000004
3944 #define SM_RES_COLD		0x00000008
3945 #define SM_RES_POIS		0x00000010
3946 #define SM_RES_NETH		0x00000020
3947 #define SM_RES_LITE		0x00000040
3948 #define SM_RES_DARK		0x00000080
3949 #define SM_RES_FEAR		0x00000100
3950 #define SM_RES_CONF		0x00000200
3951 #define SM_RES_CHAOS		0x00000400
3952 #define SM_RES_DISEN		0x00000800
3953 #define SM_RES_BLIND		0x00001000
3954 #define SM_RES_NEXUS		0x00002000
3955 #define SM_RES_SOUND		0x00004000
3956 #define SM_RES_SHARD		0x00008000
3957 #define SM_OPP_ACID		0x00010000
3958 #define SM_OPP_ELEC		0x00020000
3959 #define SM_OPP_FIRE		0x00040000
3960 #define SM_OPP_COLD		0x00080000
3961 #define SM_OPP_POIS		0x00100000
3962 #define SM_OPP_XXX1		0x00200000
3963 #define SM_OPP_XXX2		0x00400000
3964 #define SM_OPP_XXX3		0x00800000
3965 #define SM_IMM_ACID		0x01000000
3966 #define SM_IMM_ELEC		0x02000000
3967 #define SM_IMM_FIRE		0x04000000
3968 #define SM_IMM_COLD		0x08000000
3969 #define SM_IMM_XXX5		0x10000000
3970 #define SM_IMM_XXX6		0x20000000
3971 #define SM_IMM_FREE		0x40000000
3972 #define SM_IMM_MANA		0x80000000
3973 
3974 
3975 /*
3976  * Bit flags for the "c_get_item" function
3977  */
3978 #define USE_EQUIP	0x01	/* Allow equip items */
3979 #define USE_INVEN	0x02	/* Allow inven items */
3980 #define USE_FLOOR	0x04	/* Allow floor items */
3981 #define USE_EXTRA	0x08	/* Allow extra items */
3982 #define INVEN_FIRST	0x10	/* Seach for inscription tag in inventory first */
3983 #define SPECIAL_REQ	0x20	/* Allow pressing '-' key to switch the request in a special way */
3984 
3985 /*
3986  * Bit flags for the "p_ptr->notice" variable
3987  */
3988 #define PN_COMBINE	0x00000001L	/* Combine the pack */
3989 #define PN_REORDER	0x00000002L	/* Reorder the pack */
3990 /* xxx (many) */
3991 
3992 
3993 /*
3994  * Bit flags for the "p_ptr->update" variable
3995  */
3996 #define PU_BONUS	0x00000001L	/* Calculate boni */
3997 #define PU_TORCH	0x00000002L	/* Calculate torch radius */
3998 #define PU_SKILL_INFO   0x00000004L	/* Update client skill info */
3999 #define PU_SANITY       0x00000008L     /* Calculate csane and msane */
4000 #define PU_HP		0x00000010L	/* Calculate chp and mhp */
4001 #define PU_MANA		0x00000020L	/* Calculate csp and msp */
4002 /* xxx */
4003 #define PU_SKILL_MOD    0x00000080L	/* Update client skill values/... */
4004 /* xxx (many) */
4005 /* xxx (many) */
4006 #define PU_UN_VIEW	0x00010000L	/* Forget view */
4007 #define PU_UN_LITE	0x00020000L	/* Forget lite */
4008 /* xxx (many) */
4009 #define PU_VIEW		0x00100000L	/* Update view */
4010 #define PU_LITE		0x00200000L	/* Update lite */
4011 /* xxx */
4012 #define PU_MONSTERS	0x01000000L	/* Update monsters */
4013 #define PU_DISTANCE	0x02000000L	/* Update distances */
4014 /* xxx */
4015 #define PU_FLOW		0x10000000L	/* Update flow */
4016 #define PU_MUSIC	0x40000000L	/* Update music */
4017 #define PU_LUA		0x80000000L	/* Update LUA scripts */
4018 /* xxx (many) */
4019 
4020 
4021 /*
4022  * Bit flags for the "p_ptr->redraw" variable
4023  */
4024 #define PR_MISC		0x00000001L	/* Display Race/Class/Trait */
4025 #define PR_TITLE	0x00000002L	/* Display Title */
4026 #define PR_LEV		0x00000004L	/* Display Level */
4027 #define PR_EXP		0x00000008L	/* Display Experience */
4028 #define PR_STATS	0x00000010L	/* Display Stats */
4029 #define PR_ARMOR	0x00000020L	/* Display Armor */
4030 #define PR_HP		0x00000040L	/* Display Hitpoints */
4031 #define PR_MANA		0x00000080L	/* Display Mana */
4032 #define PR_GOLD		0x00000100L	/* Display Gold */
4033 #define PR_DEPTH	0x00000200L	/* Display Depth */
4034 #define PR_HISTORY	0x00000400L	/* Display History */
4035 #define PR_HEALTH	0x00000800L	/* Display Health Bar */
4036 #define PR_CUT		0x00001000L	/* Display Extra (Cut) */
4037 #define PR_STUN		0x00002000L	/* Display Extra (Stun) */
4038 #define PR_HUNGER	0x00004000L	/* Display Extra (Hunger) */
4039 #define PR_VARIOUS	0x00008000L	/* Display Various info (age, etc.) */
4040 #define PR_BLIND	0x00010000L	/* Display Extra (Blind) */
4041 #define PR_CONFUSED	0x00020000L	/* Display Extra (Confused) */
4042 #define PR_AFRAID	0x00040000L	/* Display Extra (Afraid) */
4043 #define PR_POISONED	0x00080000L	/* Display Extra (Poisoned) */
4044 #define PR_STATE	0x00100000L	/* Display Extra (State) */
4045 #define PR_SPEED	0x00200000L	/* Display Extra (Speed) */
4046 #define PR_STUDY	0x00400000L	/* Display Extra (Study) */
4047 #define PR_PLUSSES	0x00800000L	/* Display Plusses to Hit/Damage */
4048 #define PR_EXTRA	0x01000000L	/* Display Extra Info */
4049 #define PR_BASIC	0x02000000L	/* Display Basic Info */
4050 #define PR_MAP		0x04000000L	/* Display Map */
4051 #define PR_WIPE		0x08000000L	/* Hack -- Total Redraw */
4052 #define PR_SKILLS	0x10000000L	/* Display Skills */
4053 #define PR_SANITY	0x20000000L     /* Display Sanity */
4054 #define PR_ENCUMBERMENT	0x40000000L	/* Display Encumberment status line */
4055 #define PR_STAMINA	0x80000000L	/* Display Stamina */
4056 
4057 #define PR_BPR		0x00400000L	/* Re-use (!) to display BpR */
4058 
4059 /*
4060  * Bit flags for the "p_ptr->window" variable (etc)
4061  */
4062 #if 0
4063 
4064 #define PW_INVEN	0x00000001L	/* Display inven/equip */
4065 #define PW_EQUIP	0x00000002L	/* Display equip/inven */
4066 /* xxx */
4067 #define PW_PLAYER	0x00000008L	/* Display character */
4068 #define PW_LAGOMETER	0x00000010L	/* Display the lag-o-meter */
4069 /* xxx */
4070 #define PW_MESSAGE	0x00000040L	/* Display messages */
4071 #define PW_OVERHEAD	0x00000080L	/* Display overhead view */
4072 #define PW_MONSTER	0x00000100L	/* Display monster recall */
4073 #define PW_OBJECT	0x00000200L	/* Display object recall */
4074 /* xxx */
4075 /* xxx */
4076 /* xxx */
4077 /* xxx */
4078 /* xxx */
4079 /* xxx */
4080 /* xxx */
4081 /* xxx */
4082 #define PW_CHAT		0x00040000L	/* Display chat messages */
4083 #define PW_MSGNOCHAT	0x00080000L	/* Display messages except chat */
4084 
4085 #else
4086 
4087 /* flags also used by the client as term window flags */
4088 #define PW_INVEN	0x00000001L	/* Display inven/equip */
4089 #define PW_EQUIP	0x00000002L	/* Display equip/inven */
4090 #define PW_PLAYER	0x00000004L	/* Display character */
4091 #define PW_MSGNOCHAT	0x00000008L	/* Display messages except chat */
4092 #define PW_MESSAGE	0x00000010L	/* Display messages */
4093 #define PW_CHAT		0x00000020L	/* Display chat messages */
4094 #define PW_MINIMAP	0x00000040L	/* Display minimap */
4095 #define PW_LAGOMETER	0x00000080L	/* Display the lag-o-meter */
4096 /* flags currently not used by the client */
4097 #define PW_OVERHEAD	0x00001000L	/* Display overhead view */
4098 #define PW_MONSTER	0x00002000L	/* Display monster recall */
4099 #define PW_OBJECT	0x00004000L	/* Display object recall */
4100 
4101 #endif
4102 
4103 /*** General index values ***/
4104 
4105 
4106 /*
4107  * Legal restrictions for "summon_specific()"
4108  */
4109 #define SUMMON_ALL			0	/* allows all, including uniques */
4110 #define SUMMON_ALL_U98			1	/* allows all, except uniques above race level 98 (No Sauron/NR uniques) */
4111 #define SUMMON_MONSTER			2	/* allows all, but disallows all uniques */
4112 /* the usual stuff */
4113 #define SUMMON_ANT			11
4114 #define SUMMON_SPIDER			12
4115 #define SUMMON_HOUND			13
4116 #define SUMMON_HYDRA			14
4117 #define SUMMON_ANGEL			15
4118 #define SUMMON_DEMON			16
4119 #define SUMMON_UNDEAD			17
4120 #define SUMMON_DRAGON			18
4121 #define SUMMON_HI_UNDEAD		21
4122 #define SUMMON_HI_DRAGON		22
4123 #define SUMMON_NAZGUL			31
4124 #define SUMMON_UNIQUE			32
4125 /* additions from ToME */
4126 #define SUMMON_BIZARRE1			33
4127 #define SUMMON_BIZARRE2			34
4128 #define SUMMON_BIZARRE3			35
4129 #define SUMMON_BIZARRE4			36
4130 #define SUMMON_BIZARRE5			37
4131 #define SUMMON_BIZARRE6			38
4132 #define SUMMON_HI_DEMON			39
4133 #define SUMMON_KIN			40
4134 #define SUMMON_DAWN			41
4135 #define SUMMON_ANIMAL			42
4136 #define SUMMON_ANIMAL_RANGER		43
4137 #define SUMMON_HI_UNDEAD_NO_UNIQUES	44
4138 #define SUMMON_HI_DRAGON_NO_UNIQUES	45
4139 #define SUMMON_NO_UNIQUES		46
4140 #define SUMMON_PHANTOM			47
4141 #define SUMMON_ELEMENTAL		48
4142 #define SUMMON_DRAGONRIDER		49
4143 #define SUMMON_BLUE_HORROR		50
4144 #define SUMMON_BUG			51
4145 #define SUMMON_RNG			52
4146 #define SUMMON_IMMOBILE			53
4147 #define SUMMON_HUMAN			54
4148 #define SUMMON_SHADOW			55
4149 #define SUMMON_GHOST			56
4150 #define SUMMON_QUYLTHULG		57
4151 #define SUMMON_LUA			58
4152 /* Again, TomeNET one(s)	- Jir - */
4153 #define SUMMON_VERMIN			59
4154 #define SUMMON_PATIENT			60
4155 /* New stuff (RF0_) - C. Blue */
4156 #define SUMMON_HI_MONSTER		61
4157 #define SUMMON_HI_UNIQUE		62
4158 #define SUMMON_SPOOK			63
4159 
4160 
4161 
4162 /*
4163  * Spell types used by project(), and related functions.
4164  */
4165 #define GF_ELEC			1
4166 #define GF_POIS			2
4167 #define GF_ACID			3
4168 #define GF_COLD			4
4169 #define GF_FIRE			5
4170 #define GF_MISSILE		10
4171 #define GF_ARROW		11
4172 #define GF_PLASMA		12
4173 #define GF_HOLY_ORB		13
4174 #define GF_WATER		14
4175 #define GF_LITE			15
4176 #define GF_DARK			16
4177 #define GF_LITE_WEAK		17
4178 #define GF_DARK_WEAK		18
4179 #define GF_SHARDS		20
4180 #define GF_SOUND		21
4181 #define GF_CONFUSION		22
4182 #define GF_FORCE		23
4183 #define GF_INERTIA		24
4184 #define GF_MANA			26
4185 #define GF_METEOR		27
4186 #define GF_ICE			28
4187 #define GF_CHAOS		30
4188 #define GF_NETHER		31
4189 #define GF_DISENCHANT		32
4190 #define GF_NEXUS		33
4191 #define GF_TIME			34
4192 #define GF_GRAVITY		35
4193 #define GF_KILL_WALL		40
4194 #define GF_KILL_DOOR		41
4195 #define GF_KILL_TRAP		42
4196 #define GF_MAKE_WALL		45
4197 #define GF_MAKE_DOOR		46
4198 #define GF_MAKE_TRAP		47
4199 #define GF_OLD_CLONE		51
4200 #define GF_OLD_POLY		52
4201 #define GF_OLD_HEAL		53
4202 #define GF_OLD_SPEED		54
4203 #define GF_OLD_SLOW		55
4204 #define GF_OLD_CONF		56
4205 #define GF_OLD_SLEEP		57
4206 #define GF_OLD_DRAIN		58
4207 #define GF_AWAY_UNDEAD		61
4208 #define GF_AWAY_EVIL		62
4209 #define GF_AWAY_ALL		63
4210 #define GF_TURN_UNDEAD		64
4211 #define GF_TURN_EVIL		65
4212 #define GF_TURN_ALL		66
4213 #define GF_DISP_UNDEAD		67
4214 #define GF_DISP_EVIL		68
4215 #define GF_DISP_ALL		69
4216 
4217 #define	GF_HEAL_PLAYER		70
4218 #define	GF_STONE_WALL		71
4219 #define	GF_EARTHQUAKE		72
4220 #define	GF_WRAITH_PLAYER	73
4221 #define	GF_SPEED_PLAYER		74
4222 #define	GF_SHIELD_PLAYER	75
4223 #define GF_RECALL_PLAYER	76
4224 #define GF_STUN			77
4225 #define GF_IDENTIFY		78
4226 #define GF_PSI			79
4227 #define GF_HOLY_FIRE		80
4228 #define GF_DISINTEGRATE		81
4229 #define GF_HELL_FIRE		82 /* was HOLY_ORB */
4230 #define GF_NETHER_WEAK		83 /* special version of GF_NETHER, solely for Vampires smashing Potions of Death */
4231 #define GF_REMCURSE_PLAYER	84
4232 #define GF_KILL_GLYPH		85
4233 
4234 #define GF_INFERNO		89 /* damage-wise like GF_ROCKET, but no special sfx and doesn't hurt terrain (could be changed, dunno) */
4235 #define GF_DETONATION		90 /* damage-wise like GF_ROCKET, but different sfx */
4236 #define GF_ROCKET		91
4237 
4238 /* for traps.h :) - C. Blue */
4239 #define GF_REMFEAR		92
4240 #define GF_HERO_MONSTER		93
4241 #define GF_LIFEHEAL		94
4242 #define GF_DEC_STR		95
4243 #define GF_DEC_DEX		96
4244 #define GF_DEC_CON		97
4245 #define GF_RES_STR		98
4246 #define GF_RES_DEX		99
4247 #define GF_RES_CON		100
4248 #define GF_INC_STR		101
4249 #define GF_INC_DEX		102
4250 #define GF_INC_CON		103
4251 #define GF_AUGMENTATION		104
4252 #define GF_RUINATION		105
4253 #define GF_EXP			106
4254 
4255 #define GF_NUKE			110
4256 #define GF_BLIND		111
4257 #define GF_HOLD			112	/* hold */
4258 #define GF_DOMINATE		113	/* dominate */
4259 #define GF_BLESS_PLAYER  	114
4260 #define GF_REMFEAR_PLAYER  	115
4261 #define GF_SATHUNGER_PLAYER  	116
4262 #define GF_RESFIRE_PLAYER  	117
4263 #define GF_RESCOLD_PLAYER  	118
4264 #define GF_CUREPOISON_PLAYER  	119
4265 #define GF_SEEINVIS_PLAYER  	120
4266 #define GF_SEEMAP_PLAYER  	121
4267 #define GF_CURECUT_PLAYER  	122
4268 #define GF_CURESTUN_PLAYER  	123
4269 #define GF_DETECTCREATURE_PLAYER	124
4270 #define GF_DETECTDOOR_PLAYER  	125
4271 #define GF_DETECTTRAP_PLAYER  	126
4272 #define GF_TELEPORTLVL_PLAYER  	127
4273 #define GF_RESPOIS_PLAYER  	128
4274 #define GF_RESELEC_PLAYER  	129
4275 #define GF_RESACID_PLAYER  	130
4276 #define GF_HPINCREASE_PLAYER  	131
4277 #define GF_HERO_PLAYER  	132
4278 #define GF_SHERO_PLAYER  	133
4279 
4280 #define GF_UNBREATH     	134
4281 #define GF_WAVE         	135
4282 
4283 #define GF_TELEPORT_PLAYER 	136	/* UNUSED actually: only s_convey used it once */
4284 
4285 #define GF_RESTORE_PLAYER 	137	/* C. Blue changes */
4286 #define GF_VAPOUR		138	/* This is same as GF_WATER, just looks differently */
4287 #define GF_CURE_PLAYER 		139
4288 #define GF_RESURRECT_PLAYER 	140
4289 #define GF_SANITY_PLAYER 	141
4290 #define GF_ZEAL_PLAYER 		142
4291 #define GF_DISP_DEMON   	143
4292 #define GF_SOULCURE_PLAYER	144
4293 #define GF_MINDBOOST_PLAYER	145
4294 #define GF_REMCONF_PLAYER	146
4295 #define GF_REMIMAGE_PLAYER	147
4296 #define GF_SLOWPOISON_PLAYER 	148
4297 #define GF_CURING 		149
4298 
4299 /* Zangband changes */
4300 #define GF_TELE_TO		150
4301 #define GF_HAND_DOOM		151
4302 #define GF_STASIS		152
4303 
4304 /* For the new priest spell I'm conjuring - the_sandman */
4305 #define GF_CURSE		153
4306 /* Here comes the druid items - the_sandman */
4307 #define GF_HEALINGCLOUD		154
4308 #define GF_WATERPOISON		155
4309 #define GF_ICEPOISON		156
4310 #define GF_EXTRA_STATS		157
4311 #define GF_EXTRA_SPR		158
4312 
4313 #define GF_PUSH 		159 /* Moltor */
4314 
4315 #define GF_SILENCE		160 /* for new mindcrafters */
4316 #define GF_CHARMIGNORE		161
4317 
4318 #define GF_THUNDER		189 /* To replace the hacky 'triple-bolt' of the thunderstorm spell */
4319 #define GF_ANNIHILATION		192 /* To differentiate drain effect from hacky non-drain effect for wands */
4320 
4321 /* For snowflakes on WINTER_SEASON. Could use 0 for type, but let's complete it. -C. Blue */
4322 #define GF_SNOWFLAKE		200
4323 /* For fireworks on NEW_YEARS_EVE - C. Blue */
4324 #define GF_FW_FIRE		201
4325 #define GF_FW_ELEC		202
4326 #define GF_FW_POIS		203
4327 #define GF_FW_LITE		204
4328 #define GF_FW_SHDI		205
4329 #define GF_FW_SHDM		206
4330 #define GF_FW_MULT		207
4331 /* well, let's try to bring weather and seasons? */
4332 #define GF_RAINDROP		208
4333 #define GF_LEAF			209 /* unused, just added here for inspiration - C. Blue */
4334 /* full-screen warnings or other important notifications that players oughtn't overlook - C. Blue */
4335 //ugly though, since they are wpos-bound -..
4336 // #define GF_TEXT_UPDATE	210 /* 'your game version is outdated..' */
4337 #define GF_SHOW_LIGHTNING	211
4338 
4339 #define GF_CROSSHAIR 		250 /* what's this for? appearently unused; moved it to 250 */
4340 
4341 
4342 #if 0	/* Let's implement one by one.. */
4343 #define GF_DISP_DEMON		70      /* New types for Zangband begin here... */
4344 #define GF_DISP_LIVING		71
4345 #define GF_NUKE			73
4346 #define GF_STASIS		75
4347 #define GF_STONE_WALL		76
4348 #define GF_DEATH_RAY		77
4349 #define GF_STUN			78
4350 #define GF_HOLY_FIRE		79
4351 #define GF_HELL_FIRE		80
4352 #define GF_DISINTEGRATE		81
4353 #define GF_CHARM		82
4354 #define GF_CONTROL_UNDEAD	83
4355 #define GF_CONTROL_ANIMAL	84
4356 #define GF_PSI			85
4357 #define GF_PSI_DRAIN		86
4358 #define GF_TELEKINESIS		87
4359 #define GF_JAM_DOOR		88
4360 #define GF_DOMINATION		89
4361 #define GF_DISP_GOOD		90
4362 #define GF_IDENTIFY		91
4363 #define GF_RAISE		92
4364 #define GF_STAR_IDENTIFY	93
4365 #define GF_DESTRUCTION		94
4366 #define GF_STUN_CONF		95
4367 #define GF_STUN_DAM		96
4368 #define GF_CONF_DAM		98
4369 #define GF_STAR_CHARM		99
4370 #define GF_IMPLOSION		100
4371 #define GF_LAVA_FLOW		101
4372 #define GF_FEAR			102
4373 #define GF_BETWEEN_GATE		103
4374 #define GF_WINDS_MANA		104
4375 #define GF_DEATH		105
4376 #define GF_CONTROL_DEMON	106
4377 #define GF_RAISE_DEMON		107
4378 #define GF_TRAP_DEMONSOUL	108
4379 #define GF_ATTACK		109
4380 /* Increased it (from 152) to 153 - the_sandman*/
4381 /* Increaing it again by ... 3-- to 156 :-) - the_sandman */
4382 #define MAX_GF			156	/* appearently unused, if 0'ed */
4383 #endif	/* 0 */
4384 
4385 /*
4386  * Some things which induce learning
4387  */
4388 #define DRS_ACID	1
4389 #define DRS_ELEC	2
4390 #define DRS_FIRE	3
4391 #define DRS_COLD	4
4392 #define DRS_POIS	5
4393 #define DRS_NETH	6
4394 #define DRS_LITE	7
4395 #define DRS_DARK	8
4396 #define DRS_FEAR	9
4397 #define DRS_CONF	10
4398 #define DRS_CHAOS	11
4399 #define DRS_DISEN	12
4400 #define DRS_BLIND	13
4401 #define DRS_NEXUS	14
4402 #define DRS_SOUND	15
4403 #define DRS_SHARD	16
4404 #define DRS_FREE	30
4405 #define DRS_MANA	31
4406 
4407 
4408 
4409 /*
4410  * Hack -- first "normal" artifact in the artifact list.  All of
4411  * the artifacts with indexes from 1 to 15 are "special" (lights,
4412  * rings, amulets), and the ones from 16 to 127 are "normal".
4413  */
4414 #define ART_MIN_NORMAL		16
4415 
4416 
4417 /*
4418  * Hack -- special "xtra" object powers
4419  */
4420 
4421 /* Sustain one stat */
4422 #define EGO_XTRA_SUSTAIN	1
4423 
4424 /* High resist */
4425 #define EGO_XTRA_POWER		2
4426 
4427 /* Special ability */
4428 #define EGO_XTRA_ABILITY	3
4429 
4430 
4431 
4432 
4433 
4434 /*** Object flag values ***/
4435 
4436 
4437 /*
4438  * Chest trap flags (see "tables.c")
4439  */
4440 #define CHEST_LOSE_STR		0x01
4441 #define CHEST_LOSE_CON		0x02
4442 #define CHEST_POISON		0x04
4443 #define CHEST_PARALYZE		0x08
4444 #define CHEST_EXPLODE		0x10
4445 #define CHEST_SUMMON		0x20
4446 
4447 
4448 
4449 /*
4450  * Special "Item Flags"
4451  */
4452 #define ID_SENSE	0x0001	/* Item has been "sensed" */
4453 #define ID_FIXED	0x0002	/* Item has been "haggled" */
4454 #define ID_EMPTY	0x0004	/* Item charges are known */
4455 #define ID_KNOWN	0x0008	/* Item abilities are known */
4456 #define ID_RUMOUR	0x0010	/* Item background is known */
4457 #define ID_MENTAL	0x0020	/* Item information is known (*ID*-ed) */
4458 #define ID_CURSED	0x0040	/* Item is temporarily cursed */
4459 #define ID_BROKEN	0x0080	/* Item is permanently worthless */
4460 #define ID_SENSED_ONCE	0x0100	/* Item was at least sensed once, maybe even IDed. (anti-exploit) */
4461 #define ID_SENSE_HEAVY	0x0200	/* Item was deeply pseudo-identified (felt_heavy) */
4462 
4463 
4464 
4465 /*
4466  * As of 2.7.8, the "object flags" are valid for all objects, and as
4467  * of 2.7.9, these flags are not actually stored with the object.
4468  *
4469  * Note that "flags1" contains all flags dependant on "pval" (including
4470  * stat boni, but NOT stat sustainers), plus all "extra attack damage"
4471  * flags (SLAY_XXX and BRAND_XXX).
4472  *
4473  * Note that "flags2" contains all "resistances" (including "Stat Sustainers",
4474  * actual immunities, and resistances).  Note that "Hold Life" is really an
4475  * "immunity" to ExpLoss, and "Free Action" is "immunity to paralysis".
4476  *
4477  * Note that "flags3" contains everything else -- including the three "CURSED"
4478  * flags, and the "BLESSED" flag, several "item display" parameters, some new
4479  * flags for powerful Bows, and flags which affect the player in a "general"
4480  * way (LITE, TELEPATHY, SEE_INVIS, SLOW_DIGEST, REGEN, FEATHER), including
4481  * all the "general" curses (TELEPORT, AGGRAVATE, EXP_DRAIN).  It also has
4482  * four new flags called "ITEM_IGNORE_XXX" which lets an item specify that
4483  * it can not be affected by various forms of destruction.  This is NOT as
4484  * powerful as actually granting resistance/immunity to the wearer.
4485  */
4486 
4487 #define TR1_STR			0x00000001L	/* STR += "pval" */
4488 #define TR1_INT			0x00000002L	/* INT += "pval" */
4489 #define TR1_WIS			0x00000004L	/* WIS += "pval" */
4490 #define TR1_DEX			0x00000008L	/* DEX += "pval" */
4491 #define TR1_CON				0x00000010L	/* CON += "pval" */
4492 #define TR1_CHR				0x00000020L	/* CHR += "pval" */
4493 #define TR1_MANA			0x00000040L	/* SP += "pval" * SP / 10 */
4494 /* #define TR1_SPELL_SPEED		0x00000080L */	/* Spell Speed += pval */
4495  #define TR1_SPELL			0x00000080L	/* Spell Speed += pval -- unused, remove me -- */
4496 #define TR1_STEALTH		0x00000100L	/* Stealth += "pval" */
4497 #define TR1_SEARCH		0x00000200L	/* Search += "pval" */
4498 #define TR1_INFRA		0x00000400L	/* Infra += "pval" */
4499 #define TR1_TUNNEL		0x00000800L	/* Tunnel += "pval" */
4500 #define TR1_SPEED			0x00001000L	/* Speed += "pval" */
4501 #define TR1_BLOWS			0x00002000L	/* Blows += "pval" */
4502 #define TR1_LIFE			0x00004000L	/* Later */
4503 #define TR1_VAMPIRIC			0x00008000L	/* XXX4 */
4504 #define TR1_SLAY_ANIMAL		0x00010000L
4505 #define TR1_SLAY_EVIL		0x00020000L
4506 #define TR1_SLAY_UNDEAD		0x00040000L
4507 #define TR1_SLAY_DEMON		0x00080000L
4508 #define TR1_SLAY_ORC			0x00100000L
4509 #define TR1_SLAY_TROLL			0x00200000L
4510 #define TR1_SLAY_GIANT			0x00400000L
4511 #define TR1_SLAY_DRAGON			0x00800000L
4512 #define TR1_KILL_DRAGON		0x01000000L	/* Execute Dragon */
4513 #define TR1_KILL_DEMON		0x02000000L     /* Execute Demon */
4514 #define TR1_KILL_UNDEAD		0x04000000L     /* Execute Undead */
4515 #define TR1_BRAND_POIS		0x08000000L	/* XXX6 */
4516 #define TR1_BRAND_ACID			0x10000000L
4517 #define TR1_BRAND_ELEC			0x20000000L
4518 #define TR1_BRAND_FIRE			0x40000000L
4519 #define TR1_BRAND_COLD			0x80000000L
4520 
4521 /* mask for all damage multipliers (brands & slays) */
4522 #define TR1_MULTMASK		(TR1_BRAND_FIRE | TR1_BRAND_COLD | TR1_BRAND_ELEC | TR1_BRAND_ACID | TR1_BRAND_POIS | \
4523 				TR1_SLAY_ANIMAL | TR1_SLAY_EVIL | TR1_SLAY_UNDEAD | TR1_SLAY_DEMON | TR1_SLAY_ORC | \
4524 				TR1_SLAY_TROLL | TR1_SLAY_GIANT | TR1_SLAY_DRAGON | \
4525 				TR1_KILL_DRAGON | TR1_KILL_DEMON | TR1_KILL_UNDEAD)
4526 
4527 /* ToME hack for trapkits */
4528 #define TRAP2_AUTOMATIC_5	0x00000001L     /* Trap automatically rearms itself, 1 in 5 failure */
4529 #define TRAP2_AUTOMATIC_99	0x00000002L     /* Trap automatically rearms itself */
4530 #define TRAP2_KILL_GHOST	0x00000004L     /* Trap also affects PASS_WALL creatures */
4531 #define TRAP2_TELEPORT_TO	0x00000008L     /* After everything else, teleport to player */
4532 #define TRAP2_ONLY_DRAGON		0x00000010L     /* Affect only dragons & other AFFECTed creatures */
4533 #define TRAP2_ONLY_DEMON		0x00000020L     /* Affect only demons & other AFFECTed creatures */
4534 #define TRAP2_ONLY_ANIMAL	0x00000100L     /* Affect only animals & other AFFECTed creatures */
4535 #define TRAP2_ONLY_UNDEAD	0x00000200L     /* Affect only undead & others */
4536 #define TRAP2_ONLY_EVIL		0x00000400L     /* Affect only evil creatures &c. */
4537 
4538 /* mask for monster-specific traps */
4539 #define TRAP2_ONLY_MASK		(TRAP2_ONLY_DRAGON | TRAP2_ONLY_DEMON | TRAP2_ONLY_ANIMAL | \
4540 				 TRAP2_ONLY_UNDEAD | TRAP2_ONLY_EVIL )
4541 
4542 #define TR2_SUST_STR		0x00000001L
4543 #define TR2_SUST_INT		0x00000002L
4544 #define TR2_SUST_WIS		0x00000004L
4545 #define TR2_SUST_DEX		0x00000008L
4546 #define TR2_SUST_CON			0x00000010L
4547 #define TR2_SUST_CHR			0x00000020L
4548  #define TR2_REDUC_FIRE			0x00000040L     /* Later */
4549  #define TR2_REDUC_COLD			0x00000080L     /* Later */
4550 #define TR2_IM_ACID		0x00000100L
4551 #define TR2_IM_ELEC		0x00000200L
4552 #define TR2_IM_FIRE		0x00000400L
4553 #define TR2_IM_COLD		0x00000800L
4554  #define TR2_REDUC_ELEC			0x00001000L     /* Later */
4555  #define TR2_REDUC_ACID			0x00002000L     /* Later */
4556 #define TR2_FREE_ACT			0x00004000L	/* Free Action */
4557 #define TR2_HOLD_LIFE	 		0x00008000L	/* Hold Life */
4558 #define TR2_RES_ACID		0x00010000L
4559 #define TR2_RES_ELEC		0x00020000L
4560 #define TR2_RES_FIRE		0x00040000L
4561 #define TR2_RES_COLD		0x00080000L
4562 #define TR2_RES_POIS			0x00100000L
4563 #define TR2_RES_FEAR			0x00200000L
4564 #define TR2_RES_LITE			0x00400000L
4565 #define TR2_RES_DARK			0x00800000L
4566 #define TR2_RES_BLIND		0x01000000L
4567 #define TR2_RES_CONF		0x02000000L
4568 #define TR2_RES_SOUND		0x04000000L
4569 #define TR2_RES_SHARDS		0x08000000L
4570 #define TR2_RES_NETHER			0x10000000L
4571 #define TR2_RES_NEXUS			0x20000000L
4572 #define TR2_RES_CHAOS			0x40000000L
4573 #define TR2_RES_DISEN			0x80000000L
4574 
4575 #if 0
4576 #define TR3_KNOWLEDGE			0x00000001L	/* Later */
4577 #define TR3_XXX2			0x00000002L	/* Later */
4578 #define TR3_XXX3			0x00000004L	/* Later */
4579 #define TR3_XXX4			0x00000008L	/* Later */
4580 #define TR3_XXX5			0x00000010L	/* Later */
4581 #define TR3_XXX6			0x00000020L	/* Later */
4582 #define TR3_XXX7			0x00000040L	/* Later */
4583 #define TR3_XXX8			0x00000080L	/* Later */
4584 #endif	/* 0 */
4585 /* Flags from ToME - Jir - */
4586 
4587 #define TR3_SH_FIRE		0x00000001L     /* Immolation (Fire) */
4588 #define TR3_SH_ELEC		0x00000002L     /* Electric Sheath */
4589 #define TR3_AUTO_CURSE		0x00000004L     /* The obj will recurse itself */
4590  #define TR3_DECAY		0x00000008L     /* Decay -- unused -- */
4591 #define TR3_NO_TELE			0x00000010L     /* Anti-teleportation */
4592 #define TR3_NO_MAGIC			0x00000020L     /* Anti-magic */
4593 #define TR3_WRAITH			0x00000040L     /* Wraithform */
4594 #define TR3_TY_CURSE			0x00000080L     /* The Ancient Curse */
4595 #define TR3_EASY_KNOW		0x00000100L	/* Aware -> Known */
4596 #define TR3_HIDE_TYPE		0x00000200L	/* Hide "pval" description */
4597 #define TR3_SHOW_MODS		0x00000400L	/* Always show Tohit/Todam */
4598 #define TR3_INSTA_ART		0x00000800L	/* Item must be a (true) artifact */
4599 #define TR3_FEATHER			0x00001000L	/* Feather Falling */
4600 #define TR3_LITE1			0x00002000L	/* Permanent Light */
4601 #define TR3_SEE_INVIS			0x00004000L	/* See Invisible */
4602  #define TR3_NO_NORM_ART		0x00008000L	/* ??? -- unused -- */
4603 #define TR3_SLOW_DIGEST		0x00010000L	/* Item slows down digestion */
4604 #define TR3_REGEN		0x00020000L	/* Item induces regeneration */
4605 #define TR3_XTRA_MIGHT		0x00040000L	/* Bows get extra multiplier */
4606 #define TR3_XTRA_SHOTS		0x00080000L	/* Bows get extra shots */
4607 #define TR3_IGNORE_ACID			0x00100000L	/* Item ignores Acid Damage */
4608 #define TR3_IGNORE_ELEC			0x00200000L	/* Item ignores Elec Damage */
4609 #define TR3_IGNORE_FIRE			0x00400000L	/* Item ignores Fire Damage */
4610 #define TR3_IGNORE_COLD			0x00800000L	/* Item ignores Cold Damage */
4611 #define TR3_ACTIVATE		0x01000000L	/* Item can be activated */
4612 #define TR3_DRAIN_EXP		0x02000000L	/* Item drains Experience */
4613 #define TR3_TELEPORT		0x04000000L	/* Item teleports player */
4614 #define TR3_AGGRAVATE		0x08000000L	/* Item aggravates monsters */
4615 #define TR3_BLESSED			0x10000000L	/* Item is Blessed */
4616 #define TR3_CURSED			0x20000000L	/* Item is Cursed */
4617 #define TR3_HEAVY_CURSE			0x40000000L	/* Item is Heavily Cursed */
4618 #define TR3_PERMA_CURSE			0x80000000L	/* Item is Perma Cursed */
4619 
4620 
4621 #define TR4_NEVER_BLOW		0x00000001L     /* Weapon can't attack */
4622  #define TR4_PRECOGNITION	0x00000002L     /* Like activating the cheat mode -- unused -- */
4623  #define TR4_BLACK_BREATH	0x00000004L     /* Tolkien's Black Breath -- unused -- */
4624 #define TR4_RECHARGE            0x00000008L     /* For artifact Wands and Staffs */
4625 #define TR4_LEVITATE			0x00000010L     /* This one and ONLY this one allow you to fly over trees */
4626 #define TR4_DG_CURSE			0x00000020L     /* The Ancient Morgothian Curse */
4627 #define TR4_SHOULD2H			0x00000040L     /* Can wield it 2 Handed */
4628 #define TR4_MUST2H			0x00000080L     /* Must wield it 2 Handed */
4629 #define TR4_COULD2H		0x00000100L     /* Can wield it 2 Handed */
4630 #define TR4_CLONE		0x00000200L     /* Can clone monsters */
4631 #define TR4_SPECIAL_GENE	0x00000400L     /* The object can only be generated in special conditions like quests, special dungeons, ... */
4632 #define TR4_CLIMB		0x00000800L     /* Allow climbing mountains */
4633 /* rods only -- consider make them like trapkits - Jir - */
4634  #define TR4_FAST_CAST			0x00001000L     /* Rod is x2 time faster to use -- unused -- */
4635  #define TR4_CAPACITY			0x00002000L     /* Rod can take x2 mana -- unused -- */
4636 #define TR4_CHARGING			0x00004000L     /* Rod recharge faster */
4637  #define TR4_CHEAPNESS			0x00008000L     /* Rod spells are cheaper(in mana cost) to cast -- unused - */
4638 #define TR4_FOUNTAIN		0x00010000L     /* Available as fountain (for potions) */
4639 #define TR4_ANTIMAGIC_50	0x00020000L     /* Forbid magic */
4640 #define TR4_ANTIMAGIC_30	0x00040000L     /* Forbid magic */
4641 #define TR4_ANTIMAGIC_20	0x00080000L     /* Forbid magic */
4642 #define TR4_ANTIMAGIC_10		0x00100000L     /* Forbid magic */
4643 #define TR4_EASY_USE			0x00200000L     /* Easily activable */
4644 #define TR4_IM_NETHER			0x00400000L     /* Immunity to nether */
4645  #define TR4_RECHARGED			0x00800000L     /* Object has been recharged once -- unused -- */
4646  #define TR4_ULTIMATE		0x01000000L     /* ULTIMATE artifact -- unused -- */
4647 #define TR4_AUTO_ID		0x02000000L     /* Id stuff on floor */
4648 #define TR4_LITE2		0x04000000L     /* lite radius 2 */
4649 #define TR4_LITE3		0x08000000L     /* lite radius 3 */
4650 #define TR4_FUEL_LITE			0x10000000L     /* fuelable lite */
4651  #define TR4_ART_EXP			0x20000000L     /* Will accumulate xp -- unused -- */
4652 #define TR4_CURSE_NO_DROP		0x40000000L     /* The obj wont be dropped */
4653  #define TR4_NO_RECHARGE		0x80000000L     /* Object Cannot be recharged -- practically unused -- */
4654 
4655 #define TR4_NULL_MASK		0xFFFFFFFCL	//unused
4656 
4657 
4658  #define TR5_TEMPORARY		0x00000001L		/* In timeout turns it is destroyed -- not implemented -- */
4659 #define TR5_DRAIN_MANA		0x00000002L		/* Drains mana */
4660 #define TR5_DRAIN_HP		0x00000004L		/* Drains hp */
4661 #define TR5_VORPAL		0x00000008L		/* XXX5 */
4662 #define TR5_IMPACT			0x00000010L	/* Cause Earthquakes */
4663 #define TR5_CRIT			0x00000020L	/* More critical hits */
4664 #define TR5_ATTR_MULTI			0x00000040L	/* Object shimmer -- only allowed in k_info */
4665  #define TR5_WOUNDING			0x00000080L	/* Wounds monsters -- not implemented -- */
4666  #define TR5_FULL_NAME		0x00000100L		/* Uses direct name from k_info - UNUSED appearently/not implemented -- */
4667 #define TR5_LUCK		0x00000200L		/* Luck += pval */
4668 #define TR5_RES_PLASMA		0x00000400L		/* For the runecraft sigil */
4669  #define TR5_LEVELS		0x00000800L		/* Can gain exp/exp levels !! -- unused -- */
4670 #define TR5_FORCE_DEPTH			0x00001000L	/* Can only occur on depth >= its k_info level */
4671 #define TR5_WHITE_LIGHT			0x00002000L	/* Light source colour is white instead of flame-yellow (for CAVE_LITE_COLOURS) */
4672 #define TR5_IGNORE_DISEN		0x00004000L	/* For 'Arcane' ego power for Heavy winners-only armour */
4673 #define TR5_RES_TELE			0x00008000L     /* For Sky Dragon Scale Mail */
4674 #define TR5_SH_COLD		0x00010000L		/* Winter's might/Snow grasp/Frostweaving (Cold aura) */
4675 #define TR5_IGNORE_MANA		0x00020000L		/* Item ignores Mana Damage */
4676 #define TR5_IGNORE_WATER	0x00040000L		/* Item ignores Water damage */
4677 #define TR5_RES_TIME		0x00080000L
4678 #define TR5_RES_MANA			0x00100000L
4679 #define TR5_IM_POISON			0x00200000L
4680 #define TR5_IM_WATER			0x00400000L	/* Water immunity, should also let you breathe under water */
4681 #define TR5_RES_WATER			0x00800000L	/* Resist Water */
4682 #define TR5_REGEN_MANA		0x01000000L		/* Item induces regeneration */
4683 #define TR5_DISARM		0x02000000L
4684 #define TR5_NO_ENCHANT		0x04000000L
4685 #define TR5_CHAOTIC		0x08000000L
4686 #define TR5_INVIS			0x10000000L
4687 #define TR5_REFLECT			0x20000000L
4688 #define TR5_PASS_WATER			0x40000000L
4689 #define TR5_WINNERS_ONLY		0x80000000L
4690 
4691 
4692 #define TR6_INSTA_EGO		0x00000001L		/* Similar to INSTA_ART, this item is always an ego item */
4693 #define TR6_STARTUP		0x00000002L		/* For weapons: Can be picked for starter item on character creation */
4694 /* Not yet implemented/used. Cold might be needed. For monsters, even susc-poison is implemented.
4695    For the player I think fire and cold are enough. (C. Blue)
4696 #define TR6_SENS_FIRE           0x00000001L
4697 #define TR6_SENS_COLD		0x00000002L
4698 #define TR6_SENS_ACID		0x00000004L
4699 #define TR6_SENS_ELEC		0x00000008L
4700 Also, more curses could be added, like, slow/para/conf curses :D - C. Blue
4701 
4702 // Item not available if no event is running
4703 #define TR6_EVENT_HALLOWEEN	0x00000010L
4704 #define TR6_EVENT_XMAS		0x00000020L
4705 */
4706 
4707 /* Character Sheet Boni Data Flags for Char/Byte PKT Transfer - Kurzel */
4708 #define CB1_SFIRE	0x01
4709 #define CB1_RFIRE	0x02
4710 #define CB1_IFIRE	0x04
4711 #define CB1_SCOLD	0x08
4712 #define CB1_RCOLD	0x10
4713 #define CB1_ICOLD	0x20
4714 #define CB1_SELEC	0x40
4715 #define CB1_RELEC	0x80
4716 
4717 #define CB2_IELEC	0x01
4718 #define CB2_SACID	0x02
4719 #define CB2_RACID	0x04
4720 #define CB2_IACID	0x08
4721 #define CB2_SPOIS	0x10
4722 #define CB2_RPOIS	0x20
4723 #define CB2_IPOIS	0x40
4724 #define CB2_SLITE	0x80
4725 
4726 #define CB3_RLITE	0x01
4727 #define CB3_RDARK	0x02
4728 #define CB3_RCONF	0x04
4729 #define CB3_RPLAS	0x08
4730 #define CB3_RSOUN	0x10
4731 #define CB3_RSHRD	0x20
4732 #define CB3_RWATR	0x40
4733 #define CB3_IWATR	0x80
4734 
4735 #define CB4_RNEXU	0x01
4736 #define CB4_RNETH	0x02
4737 #define CB4_INETH	0x04
4738 #define CB4_RCHAO	0x08
4739 #define CB4_RDISE	0x10
4740 #define CB4_RTIME	0x20
4741 #define CB4_RMANA	0x40
4742 #define CB4_RMIND	0x80
4743 
4744 #define CB5_RFEAR	0x01
4745 #define CB5_RPARA	0x02
4746 #define CB5_RBLND	0x04
4747 #define CB5_STELE	0x08
4748 #define CB5_RTELE	0x10
4749 #define CB5_ITELE	0x20
4750 #define CB5_RFALL	0x40
4751 #define CB5_RFOOD	0x80
4752 
4753 #define CB6_IFOOD	0x01
4754 #define CB6_RLIFE	0x02
4755 #define CB6_SRGHP	0x04
4756 #define CB6_RRGHP	0x08
4757 #define CB6_SRGMP	0x10
4758 #define CB6_RRGMP	0x20
4759 #define CB6_RSINV	0x40
4760 #define CB6_RWRTH	0x80
4761 
4762 #define CB7_RREFL	0x01
4763 #define CB7_RINVS	0x02
4764 #define CB7_RVAMP	0x04
4765 #define CB7_RIDNT	0x08
4766 #define CB7_RRLEV	0x10
4767 #define CB7_RCLMB	0x20
4768 #define CB7_RAMSH	0x40
4769 #define CB7_RAGGR	0x80
4770 
4771 #define CB8_ESPID	0x01
4772 #define CB8_EANIM	0x02
4773 #define CB8_SANIM	0x04
4774 #define CB8_EORCS	0x08
4775 #define CB8_SORCS	0x10
4776 #define CB8_ETROL	0x20
4777 #define CB8_STROL	0x40
4778 #define CB8_EGIAN	0x80
4779 
4780 #define CB9_SGIAN	0x01
4781 #define CB9_EDRGN	0x02
4782 #define CB9_SDRGN	0x04
4783 #define CB9_KDRGN	0x08
4784 #define CB9_EDEMN	0x10
4785 #define CB9_SDEMN	0x20
4786 #define CB9_KDEMN	0x40
4787 #define CB9_EUNDD	0x80
4788 
4789 #define CB10_SUNDD	0x01
4790 #define CB10_KUNDD	0x02
4791 #define CB10_EEVIL	0x04
4792 #define CB10_SEVIL	0x08
4793 #define CB10_EDGRI	0x10
4794 #define CB10_EGOOD	0x20
4795 #define CB10_ENONL	0x40
4796 #define CB10_EUNIQ	0x80
4797 
4798 #define CB11_BFIRE	0x01
4799 #define CB11_AFIRE	0x02
4800 #define CB11_BCOLD	0x04
4801 #define CB11_ACOLD	0x08
4802 #define CB11_BELEC	0x10
4803 #define CB11_AELEC	0x20
4804 #define CB11_BACID	0x40
4805 #define CB11_BPOIS	0x80
4806 
4807 #define CB12_BVORP	0x01
4808 #define CB12_RSSTR	0x02
4809 #define CB12_RSINT	0x04
4810 #define CB12_RSWIS	0x08
4811 #define CB12_RSDEX	0x10
4812 #define CB12_RSCON	0x20
4813 #define CB12_RSCHR	0x40
4814 #define CB12_XHIDD	0x80
4815 
4816 #define CB13_XSTAR	0x01
4817 #define CB13_XCRSE	0x02
4818 #define CB13_XNOEQ	0x04
4819 #define CB13_XSWIM	0x08
4820 #define CB13_XTREE	0x10
4821 #define CB13_XWALL	0x20
4822 #define CB13_XNCUT	0x40
4823 #define CB13_XLITE	0x80
4824 
4825 
4826 /* Allow fallen winners to wear/wield WINNERS_ONLY items? */
4827 #define FALLEN_WINNERSONLY
4828 
4829 
4830 /* Item-generation restriction flags */
4831 #define RESF_NONE		0x00000000
4832 #define RESF_WINNER		0x00000001	/* allow TR5_WINNERS_ONLY items */
4833 #define RESF_NOTRUEART		0x00000002	/* prevent true artifacts */
4834 #define RESF_NORANDART		0x00000004	/* prevent random artifacts */
4835 #define RESF_NODOUBLEEGO	0x00000008	/* prevent double ego items */
4836 #define RESF_NOHIDSM		0x00000010	/* prevent generation of high dragon scale mails */
4837 #define RESF_LOWSPEED		0x00000020	/* not more than +4 speed */
4838 #define RESF_NOHISPEED		0x00000040	/* not more than +6 speed */
4839 #define RESF_LOWVALUE		0x00000080	/* no items worth more than 35000 Au */
4840 #define RESF_MIDVALUE		0x00000100	/* no items worth more than 50000 Au */
4841 #define RESF_NOHIVALUE		0x00000200	/* no items worth more than 100000 Au */
4842 
4843 #define RESF_NOETHEREAL		0x00000400	/* no 'ethereal' ego power (ammo) */
4844 #define RESF_KINDMID		0x00000800	/* k_info value of 500..10000 */
4845 #define RESF_KINDHI		0x00001000	/* k_info value of 10000.. */
4846 #define RESF_EGOLOW		0x00002000	/* e_info value of ..1000 */
4847 #define RESF_EGOMID		0x00004000	/* e_info value of 1000..9000 */
4848 #define RESF_EGOHI		0x00008000	/* e_info value of 9000.. */
4849 
4850 #define RESF_LIFE		0x00010000	/* allow +LIFE randarts */
4851 #define RESF_DEBUG_ITEM		0x00020000	/* generate a certain item (k_idx) for debugging purpose */
4852 #define RESF_STOREFLAT		0x00040000	/* generate all base item types with same probability */
4853 #define RESF_FORCERANDART	0x00080000	/* generate a random artifact */
4854 
4855 #define RESF_LOW		(RESF_NOTRUEART | RESF_NORANDART | RESF_NODOUBLEEGO | RESF_NOHIDSM | RESF_LOWSPEED | RESF_LOWVALUE)	/* prevent generation of especially powerful items */
4856 #define RESF_LOW2		(RESF_NOTRUEART | RESF_NORANDART | RESF_NODOUBLEEGO | RESF_NOHIDSM | RESF_LOWSPEED | RESF_MIDVALUE)	/* prevent generation of especially powerful items */
4857 #define RESF_MID		(RESF_NOTRUEART | RESF_NORANDART | RESF_NOHIDSM | RESF_NOHISPEED | RESF_NOHIVALUE)	/* prevent generation of especially powerful high-level items */
4858 #define RESF_MID2		(RESF_NOTRUEART | RESF_NORANDART | RESF_NOHIDSM | RESF_NOHISPEED)	/* prevent generation of especially powerful high-level items, but allow full ESP for example (no price limit) */
4859 #define RESF_HIGH		RESF_NOART /* alias */
4860 #define RESF_NOART		(RESF_NOTRUEART | RESF_NORANDART)	/* prevent generation of any artefacts */
4861 #define RESF_WILD		RESF_NONE
4862 #define RESF_STORE		(RESF_NOART | RESF_NOETHEREAL) /* not fully implemented yet (see get_obj_num... and kind_is..) */
4863 #define RESF_STOREBM		(RESF_NOART | RESF_NOETHEREAL) /* not fully implemented yet (see get_obj_num... and kind_is..) */
4864 
4865 
4866 /* ESP defines */
4867 #define ESP_ORC                 0x00000001L
4868 #define ESP_TROLL               0x00000002L
4869 #define ESP_DRAGON              0x00000004L
4870 #define ESP_GIANT               0x00000008L
4871 #define ESP_DEMON               0x00000010L
4872 #define ESP_UNDEAD              0x00000020L
4873 #define ESP_EVIL                0x00000040L
4874 #define ESP_ANIMAL              0x00000080L
4875 #define ESP_DRAGONRIDER         0x00000100L
4876 #define ESP_GOOD                0x00000200L
4877 #define ESP_NONLIVING           0x00000400L
4878 #define ESP_UNIQUE              0x00000800L
4879 #define ESP_SPIDER              0x00001000L
4880 /* #define ESP_PLAYER			0x08000000L */
4881 #define R_ESP_LOW               0x10000000L /* animal,giant,orc,troll,dr,good,nonliving,spider */
4882 #define R_ESP_HIGH              0x20000000L /* dragon,demon,undead,evil,unique */
4883 #define R_ESP_ANY               0x40000000L /* random esp == R_ESP from ego flags */
4884 #define ESP_ALL                 0x80000000L
4885 
4886 #define ESP_R_MASK	(R_ESP_LOW | R_ESP_HIGH | R_ESP_ANY)
4887 
4888 /* Number of group of flags to choose from */
4889 #define MAX_FLAG_GROUP          12
4890 #define NEW_GROUP_CHANCE        40      /* Chance to get a new group */
4891 
4892 
4893 
4894 /*
4895  * Hack -- flag set 1 -- mask for "pval-dependant" flags.
4896  * Note that all "pval" dependant flags must be in "flags1".
4897  */
4898 #if 0
4899 #define TR1_PVAL_MASK	\
4900         (TR1_STR | TR1_INT | TR1_WIS | TR1_DEX | \
4901          TR1_CON | TR1_CHR | TR1_MANA | TR1_SPELL_SPEED | \
4902          TR1_STEALTH | TR1_SEARCH | TR1_INFRA | TR1_TUNNEL | \
4903          TR1_SPEED | TR1_BLOWS | TR1_LIFE | TR1_XXX4)
4904 #else
4905 #define TR1_PVAL_MASK   \
4906 	(TR1_STR | TR1_INT | TR1_WIS | TR1_DEX | \
4907      TR1_CON | TR1_CHR | TR1_LIFE | \
4908 	 TR1_STEALTH | TR1_SEARCH | TR1_INFRA | TR1_TUNNEL | \
4909      TR1_SPEED | TR1_BLOWS | TR1_MANA | TR1_SPELL)
4910 /*#define PW_SPELL	0x00000004L*/	/* Display spell list */
4911 #endif	/* 0 */
4912 
4913 #define TR5_PVAL_MASK   \
4914         (TR5_CRIT | TR5_LUCK | TR5_DISARM)
4915 
4916 
4917 /*** Ego flags ***/
4918 #define ETR1_SUSTAIN		0x00000001L	/* Ego-Item gives a Random Sustain */
4919 #define ETR1_OLD_RESIST		0x00000002L	/* The old "extra power" random high resist */
4920 #define ETR1_ABILITY		0x00000004L	/* Ego-Item has a random Sustain */
4921 #define ETR1_R_ELEM		0x00000008L	/* Item resists Acid/Fire/Cold/Elec or Poison */
4922 #define ETR1_R_LOW		0x00000010L	/* Item has a random low resist */
4923 #define ETR1_R_HIGH		0x00000020L	/* Item has a random high resist */
4924 #define ETR1_R_ANY		0x00000040L	/* Item has one additional resist */
4925 #define ETR1_R_DRAGON		0x00000080L	/* Item gets "Dragon" Resist */
4926 #define ETR1_SLAY_WEAP		0x00000100L	/* Special 'Slaying' bonus */
4927 #define ETR1_DAM_DIE		0x00000200L	/* Item has an additional dam die */
4928 #define ETR1_DAM_SIZE		0x00000400L	/* Item has greater damage dice */
4929 #define ETR1_PVAL_M1		0x00000800L	/* Item has +1 to pval */
4930 #define ETR1_PVAL_M2		0x00001000L	/* Item has +(up to 2) to pval */
4931 #define ETR1_PVAL_M3		0x00002000L	/* Item has +(up to 3) to pval */
4932 #define ETR1_PVAL_M5		0x00004000L	/* Item has +(up to 5) to pval */
4933 #define ETR1_AC_M5		0x00008000L	/* Item has +(up to 5) to AC */
4934 #define ETR1_NO_DOUBLE_EGO	0x00010000L	/* Item may not have two ego powers */
4935 #define ETR1_R_ESP		0x01000000L	/* Item has a random ESP */
4936 #define ETR1_NO_SEED		0x02000000L	/* Item doesn't have random seed */
4937 #define ETR1_LOW_ABILITY	0x04000000L	/* like ABILITY without top esp */
4938 #define ETR1_R_P_ABILITY	0x08000000L	/* Item has a random pval-affected ability */
4939 #define ETR1_R_STAT		0x10000000L	/* Item affects a random stat */
4940 #define ETR1_R_STAT_SUST	0x20000000L	/* Item affects a random stat & sustains it */
4941 #define ETR1_R_IMMUNITY		0x40000000L	/* Item gives a random immunity */
4942 #define ETR1_LIMIT_BLOWS	0x80000000L	/* Only on 'Aman' weapons atm - reduces bpr */
4943 
4944 #define ETR1_EASYKNOW_MASK	\
4945     (0xFFFFFFFF & ~(ETR1_DAM_DIE | ETR1_DAM_SIZE | ETR1_PVAL_M1 | \
4946     ETR1_PVAL_M2 | ETR1_PVAL_M3 | ETR1_PVAL_M5 | ETR1_LIMIT_BLOWS | \
4947     ETR1_AC_M5 | ETR1_NO_DOUBLE_EGO | ETR1_NO_SEED))
4948 
4949 #define ETR2_R_SLAY		0x00000001L	/* random slay mod */
4950 
4951 #define ETR2_EASYKNOW_MASK	0xFFFFFFFFL
4952 
4953 
4954 #define BIAS_ELEC 1                     /* "Biases" for random artifact gen */
4955 #define BIAS_POIS 2
4956 #define BIAS_FIRE 3
4957 #define BIAS_COLD 4
4958 #define BIAS_ACID 5
4959 #define BIAS_STR 6
4960 #define BIAS_INT 7
4961 #define BIAS_WIS 8
4962 #define BIAS_DEX 9
4963 #define BIAS_CON 10
4964 #define BIAS_CHR 11
4965 #define BIAS_CHAOS 12
4966 #define BIAS_PRIESTLY 13
4967 #define BIAS_NECROMANTIC 14
4968 #define BIAS_LAW 15
4969 #define BIAS_ROGUE 16
4970 #define BIAS_MAGE 17
4971 #define BIAS_WARRIOR 18
4972 #define BIAS_RANGER 19
4973 
4974 
4975 
4976 /*** Monster blow constants ***/
4977 
4978 
4979 /*
4980  * New monster blow methods
4981  */
4982 #define RBM_HIT		1
4983 #define RBM_TOUCH	2
4984 #define RBM_PUNCH	3
4985 #define RBM_KICK	4
4986 #define RBM_CLAW	5
4987 #define RBM_BITE	6
4988 #define RBM_STING	7
4989 #define RBM_XXX1	8
4990 #define RBM_BUTT	9
4991 #define RBM_CRUSH	10
4992 #define RBM_ENGULF	11
4993 /*#define RBM_XXX2	12 */
4994 #define RBM_CRAWL	13
4995 #define RBM_DROOL	14
4996 #define RBM_SPIT	15
4997 /*#define RBM_XXX3	16 */
4998 #define RBM_GAZE	17
4999 #define RBM_WAIL	18
5000 #define RBM_SPORE	19
5001 #define RBM_XXX4	20
5002 #define RBM_BEG		21
5003 #define RBM_INSULT	22
5004 #define RBM_MOAN	23
5005 /*#define RBM_XXX5	24 */
5006 
5007 #define RBM_ANY          0
5008 #define RBM_CHARGE      12
5009 #define RBM_EXPLODE     16
5010 #define RBM_SHOW        24
5011 
5012 #define RBM_WHISPER	25
5013 
5014 /*
5015  * New monster blow effects
5016  */
5017 #define RBE_HURT	1
5018 #define RBE_POISON	2
5019 #define RBE_UN_BONUS	3
5020 #define RBE_UN_POWER	4
5021 #define RBE_EAT_GOLD	5
5022 #define RBE_EAT_ITEM	6
5023 #define RBE_EAT_FOOD	7
5024 #define RBE_EAT_LITE	8
5025 #define RBE_ACID	9
5026 #define RBE_ELEC	10
5027 #define RBE_FIRE	11
5028 #define RBE_COLD	12
5029 #define RBE_BLIND	13
5030 #define RBE_CONFUSE	14
5031 #define RBE_TERRIFY	15
5032 #define RBE_PARALYZE	16
5033 #define RBE_LOSE_STR	17
5034 #define RBE_LOSE_INT	18
5035 #define RBE_LOSE_WIS	19
5036 #define RBE_LOSE_DEX	20
5037 #define RBE_LOSE_CON	21
5038 #define RBE_LOSE_CHR	22
5039 #define RBE_LOSE_ALL	23
5040 #define RBE_SHATTER	24
5041 #define RBE_EXP_10	25
5042 #define RBE_EXP_20	26
5043 #define RBE_EXP_40	27
5044 #define RBE_EXP_80	28
5045 
5046 #define RBE_DISEASE     29
5047 #define RBE_TIME        30
5048 #define RBE_SANITY      31
5049 #define RBE_HALLU       32
5050 #define RBE_PARASITE    33
5051 
5052 #define RBE_DISARM	34
5053 #define RBE_FAMINE	35
5054 #define RBE_SEDUCE	36
5055 
5056 #define RBE_LITE	37	/* explosion-only effect. No actual hit! */
5057 
5058 /*** Monster flag values (hard-coded) ***/
5059 
5060 
5061 /*
5062  * New monster race bit flags
5063  */
5064 #define RF1_UNIQUE			0x00000001	/* Unique Monster */
5065 #define RF1_QUESTOR			0x00000002	/* Quest Monster */
5066 #define RF1_MALE			0x00000004	/* Male gender */
5067 #define RF1_FEMALE			0x00000008	/* Female gender */
5068 #define RF1_CHAR_CLEAR		0x00000010	/* Absorbs symbol */
5069 #define RF1_CHAR_MULTI		0x00000020	/* Changes symbol */
5070 #define RF1_ATTR_CLEAR		0x00000040	/* Absorbs color */
5071 #define RF1_ATTR_MULTI		0x00000080	/* Changes color */
5072 #define RF1_FORCE_DEPTH			0x00000100	/* Start at "correct" depth */
5073 #define RF1_FORCE_MAXHP			0x00000200	/* Start with max hitpoints */
5074 #define RF1_FORCE_SLEEP			0x00000400	/* Start out with very low energy - but this is now deprecated since monsters even start out with negative energy nowadays to avoid insta-breath-kills - C. Blue */
5075 #define RF1_FORCE_EXTRA			0x00000800	/* Start out something */
5076 #define RF1_FRIEND		0x00001000	/* Arrive with a friend */
5077 #define RF1_FRIENDS		0x00002000	/* Arrive with some friends */
5078 #define RF1_ESCORT		0x00004000	/* Arrive with an escort */
5079 #define RF1_ESCORTS		0x00008000	/* Arrive with some escorts */
5080 #define RF1_NEVER_BLOW			0x00010000	/* Never make physical blow */
5081 #define RF1_NEVER_MOVE			0x00020000	/* Never make physical move */
5082 #define RF1_RAND_25			0x00040000	/* Moves randomly (25%) */
5083 #define RF1_RAND_50			0x00080000	/* Moves randomly (50%) */
5084 #define RF1_ONLY_GOLD		0x00100000	/* Drop only gold */
5085 #define RF1_ONLY_ITEM		0x00200000	/* Drop only items */
5086 #define RF1_DROP_60		0x00400000	/* Drop an item/gold (60%) */
5087 #define RF1_DROP_90		0x00800000	/* Drop an item/gold (90%) */
5088 #define RF1_DROP_1D2			0x01000000	/* Drop 1d2 items/gold */
5089 #define RF1_DROP_2D2			0x02000000	/* Drop 2d2 items/gold */
5090 #define RF1_DROP_3D2			0x04000000	/* Drop 3d2 items/gold */
5091 #define RF1_DROP_4D2			0x08000000	/* Drop 4d2 items/gold */
5092 #define RF1_DROP_GOOD		0x10000000	/* Drop good items */
5093 #define RF1_DROP_GREAT		0x20000000	/* Drop great items */
5094 #define RF1_DROP_USEFUL		0x40000000	/* Drop "useful" items */
5095 #define RF1_DROP_CHOSEN		0x80000000	/* Drop "chosen" items */
5096 
5097 /*
5098  * New monster race bit flags
5099  */
5100 #define RF2_STUPID			0x00000001	/* Monster is stupid */
5101 #define RF2_SMART			0x00000002	/* Monster is smart */
5102 #define RF2_CAN_SPEAK			0x00000004  /* TY: can speak */
5103 #define RF2_REFLECTING			0x00000008      /* Reflects bolts */
5104 #define RF2_INVISIBLE		0x00000010	/* Monster avoids vision */
5105 #define RF2_COLD_BLOOD		0x00000020	/* Monster avoids infra */
5106 #define RF2_EMPTY_MIND		0x00000040	/* Monster avoids telepathy */
5107 #define RF2_WEIRD_MIND		0x00000080	/* Monster avoids telepathy? */
5108 #define RF2_DEATH_ORB			0x00000100      /* Death Orb */
5109 #define RF2_REGENERATE			0x00000200	/* Monster regenerates */
5110 #define RF2_SHAPECHANGER		0x00000400  /* TY: shapechanger */
5111 #define RF2_ATTR_ANY			0x00000800  /* TY: Attr_any */
5112 #define RF2_POWERFUL		0x00001000	/* Monster has strong breath */
5113 #define RF2_ELDRITCH_HORROR	0x00002000      /* Sanity-blasting horror    */
5114 #define RF2_AURA_FIRE		0x00004000      /* Burns in melee */
5115 #define RF2_AURA_ELEC		0x00008000      /* Shocks in melee */
5116 #define RF2_OPEN_DOOR			0x00010000	/* Monster can open doors */
5117 #define RF2_BASH_DOOR			0x00020000	/* Monster can bash doors */
5118 #define RF2_PASS_WALL			0x00040000	/* Monster can pass walls */
5119 #define RF2_KILL_WALL			0x00080000	/* Monster can destroy walls */
5120 #define RF2_MOVE_BODY		0x00100000	/* Monster can move monsters */
5121 #define RF2_KILL_BODY		0x00200000	/* Monster can kill monsters */
5122 #define RF2_TAKE_ITEM		0x00400000	/* Monster can pick up items */
5123 #define RF2_KILL_ITEM		0x00800000	/* Monster can crush items */
5124 //POTENTIAL FLAG HOLE: those RF2_BRAINs..
5125 #define RF2_BRAIN_1			0x01000000 /* unusued..? */
5126 #define RF2_BRAIN_2			0x02000000
5127 #define RF2_BRAIN_3			0x04000000
5128 #define RF2_BRAIN_4			0x08000000
5129 #define RF2_BRAIN_5		0x10000000
5130 #define RF2_BRAIN_6		0x20000000
5131 #define RF2_BRAIN_7		0x40000000
5132 #define RF2_BRAIN_8		0x80000000
5133 
5134 /*
5135  * New monster race bit flags
5136  */
5137 #define RF3_ORC			0x00000001	/* Orc */
5138 #define RF3_TROLL		0x00000002	/* Troll */
5139 #define RF3_GIANT		0x00000004	/* Giant */
5140 #define RF3_DRAGON		0x00000008	/* Dragon */
5141 #define RF3_DEMON			0x00000010	/* Demon */
5142 #define RF3_UNDEAD			0x00000020	/* Undead */
5143 #define RF3_EVIL			0x00000040	/* Evil */
5144 #define RF3_ANIMAL			0x00000080	/* Animal */
5145 #define RF3_DRAGONRIDER		0x00000100  /* DG: DragonRider */
5146 #define RF3_GOOD		0x00000200      /* Good */
5147 #define RF3_AURA_COLD		0x00000400      /* Freezes in melee */
5148 #define RF3_NONLIVING		0x00000800  /* TY: Non-Living (?) */
5149 #define RF3_HURT_LITE			0x00001000	/* Hurt by lite */
5150 #define RF3_HURT_ROCK			0x00002000	/* Hurt by rock remover */
5151 #define RF3_SUSCEP_FIRE			0x00004000      /* Hurt badly by fire */
5152 #define RF3_SUSCEP_COLD			0x00008000      /* Hurt badly by cold */
5153 #define RF3_IM_ACID		0x00010000	/* Resist acid a lot */
5154 #define RF3_IM_ELEC		0x00020000	/* Resist elec a lot */
5155 #define RF3_IM_FIRE		0x00040000	/* Resist fire a lot */
5156 #define RF3_IM_COLD		0x00080000	/* Resist cold a lot */
5157 #define RF3_IM_POIS			0x00100000	/* Resist poison a lot */
5158 #define RF3_RES_TELE			0x00200000      /* Resist teleportation */
5159 #define RF3_RES_NETH			0x00400000	/* Resist nether a lot */
5160 #define RF3_RES_WATE			0x00800000	/* Resist water */
5161 #define RF3_RES_PLAS		0x01000000	/* Resist plasma */
5162 #define RF3_RES_NEXU		0x02000000	/* Resist nexus */
5163 #define RF3_RES_DISE		0x04000000	/* Resist disenchantment */
5164 #define RF3_UNIQUE_4		0x08000000      /* Is a "Nazgul" unique -- UNUSED*/
5165 #define RF3_NO_FEAR			0x10000000	/* Cannot be scared */
5166 #define RF3_NO_STUN			0x20000000	/* Cannot be stunned */
5167 #define RF3_NO_CONF			0x40000000	/* Cannot be confused */
5168 #define RF3_NO_SLEEP			0x80000000	/* Cannot be slept */
5169 
5170 /*
5171  * New monster race bit flags
5172  */
5173 #define RF4_SHRIEK		0x00000001	/* Shriek for help */
5174 #define RF4_UNMAGIC		0x00000002	/* Cancel player's timed spell */
5175 #define RF4_S_ANIMAL		0x00000004  /* Summon animals */
5176 #define RF4_ROCKET		0x00000008  /* TY: Rocket */
5177 #define RF4_ARROW_1			0x00000010	/* Fire an arrow (light) */
5178 #define RF4_ARROW_2			0x00000020	/* Fire a shot (heavy) */
5179 #define RF4_ARROW_3			0x00000040	/* Fire a bolt (heavy) */
5180 #define RF4_ARROW_4			0x00000080	/* Fire a missile (heavy) */
5181 #define RF4_BR_ACID		0x00000100	/* Breathe Acid */
5182 #define RF4_BR_ELEC		0x00000200	/* Breathe Elec */
5183 #define RF4_BR_FIRE		0x00000400	/* Breathe Fire */
5184 #define RF4_BR_COLD		0x00000800	/* Breathe Cold */
5185 #define RF4_BR_POIS			0x00001000	/* Breathe Poison */
5186 #define RF4_BR_NETH			0x00002000	/* Breathe Nether */
5187 #define RF4_BR_LITE			0x00004000	/* Breathe Lite */
5188 #define RF4_BR_DARK			0x00008000	/* Breathe Dark */
5189 #define RF4_BR_CONF		0x00010000	/* Breathe Confusion */
5190 #define RF4_BR_SOUN		0x00020000	/* Breathe Sound */
5191 #define RF4_BR_CHAO		0x00040000	/* Breathe Chaos */
5192 #define RF4_BR_DISE		0x00080000	/* Breathe Disenchant */
5193 #define RF4_BR_NEXU			0x00100000	/* Breathe Nexus */
5194 #define RF4_BR_TIME			0x00200000	/* Breathe Time */
5195 #define RF4_BR_INER			0x00400000	/* Breathe Inertia */
5196 #define RF4_BR_GRAV			0x00800000	/* Breathe Gravity */
5197 #define RF4_BR_SHAR		0x01000000	/* Breathe Shards */
5198 #define RF4_BR_PLAS		0x02000000	/* Breathe Plasma */
5199 #define RF4_BR_WALL		0x04000000	/* Breathe Force */
5200 #define RF4_BR_MANA		0x08000000	/* Breathe Mana */
5201 #define RF4_BR_DISI			0x10000000  /* Breathe Disintegration */
5202 #define RF4_BR_NUKE			0x20000000  /* TY: Toxic Breath */
5203 #define RF4_MOAN			0x40000000	/* For Halloween event :) -C. Blue */
5204 #define RF4_BOULDER			0x80000000  /* Hurl Boulder (Vanilla) */
5205 
5206 #define RF4_PLAYER_SPELLS (RF4_SHRIEK | RF4_ROCKET | \
5207     RF4_ARROW_1 | RF4_ARROW_2 | RF4_ARROW_3 | RF4_ARROW_4 | \
5208     RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS | RF4_BR_NETH | \
5209     RF4_BR_LITE | RF4_BR_DARK | RF4_BR_CONF | RF4_BR_SOUN | RF4_BR_CHAO | RF4_BR_DISE | \
5210     RF4_BR_NEXU | RF4_BR_TIME | RF4_BR_INER | RF4_BR_GRAV | RF4_BR_SHAR | RF4_BR_PLAS | \
5211     RF4_BR_WALL | RF4_BR_MANA | RF4_BR_DISI | RF4_BR_NUKE)
5212 /* NOTE: BR_DISI is not considered as 'radius spell', since this can
5213  * eliminate walls between the caster and the player. */
5214 #if 0
5215  #define RF4_RADIUS_SPELLS (0xafffff08) /* Changed for Halloween event, now includes ranged MOAN. -C. Blue */
5216  //1010-1111-1111-1111-1111-1111-0000-1000
5217 #else
5218  /* Note: RF4_BR_DISI and RF4_ROCKET _can_ be used for 'tunneling' by monsters just
5219     because they are _excluded_ here. Including them would break that. */
5220  #define RF4_RADIUS_SPELLS (RF4_MOAN | RF4_BR_NUKE | 0x0fffff00)
5221 #endif
5222 
5223 /*
5224  * New monster race bit flags
5225  */
5226 #define RF5_BA_ACID		0x00000001	/* Acid Ball */
5227 #define RF5_BA_ELEC		0x00000002	/* Elec Ball */
5228 #define RF5_BA_FIRE		0x00000004	/* Fire Ball */
5229 #define RF5_BA_COLD		0x00000008	/* Cold Ball */
5230 #define RF5_BA_POIS			0x00000010	/* Poison Ball */
5231 #define RF5_BA_NETH			0x00000020	/* Nether Ball */
5232 #define RF5_BA_WATE			0x00000040	/* Water Ball */
5233 #define RF5_BA_MANA			0x00000080	/* Mana Storm */
5234 #define RF5_BA_DARK		0x00000100	/* Darkness Storm */
5235 #define RF5_DRAIN_MANA		0x00000200	/* Drain Mana */
5236 #define RF5_MIND_BLAST		0x00000400	/* Blast Mind */
5237 #define RF5_BRAIN_SMASH		0x00000800	/* Smash Brain */
5238 #define RF5_CURSE			0x00001000	/* Cause Light Wound */
5239 #define RF5_RAND_100			0x00002000	/* 100% random movement */
5240 #define RF5_BA_NUKE			0x00004000  /* TY: Nuke Ball */
5241 #define RF5_BA_CHAO			0x00008000  /* Chaos Ball */
5242 #define RF5_BO_ACID		0x00010000	/* Acid Bolt */
5243 #define RF5_BO_ELEC		0x00020000	/* Elec Bolt (unused) */
5244 #define RF5_BO_FIRE		0x00040000	/* Fire Bolt */
5245 #define RF5_BO_COLD		0x00080000	/* Cold Bolt */
5246 #define RF5_BO_POIS			0x00100000	/* Poison Bolt (unused/not implemented for monsters) */
5247 #define RF5_BO_NETH			0x00200000	/* Nether Bolt */
5248 #define RF5_BO_WATE			0x00400000	/* Water Bolt */
5249 #define RF5_BO_MANA			0x00800000	/* Mana Bolt */
5250 #define RF5_BO_PLAS		0x01000000	/* Plasma Bolt */
5251 #define RF5_BO_ICEE		0x02000000	/* Ice Bolt */
5252 #define RF5_MISSILE		0x04000000	/* Magic Missile */
5253 #define RF5_SCARE		0x08000000	/* Frighten Player */
5254 #define RF5_BLIND			0x10000000	/* Blind Player */
5255 #define RF5_CONF			0x20000000	/* Confuse Player */
5256 #define RF5_SLOW			0x40000000	/* Slow Player */
5257 #define RF5_HOLD			0x80000000	/* Paralyze Player */
5258 
5259 #define RF5_PLAYER_SPELLS (0xffffffff & ~(RF5_DRAIN_MANA))
5260 #define RF5_RADIUS_SPELLS ( RF5_BA_ACID | RF5_BA_ELEC | RF5_BA_FIRE | \
5261 		RF5_BA_COLD | RF5_BA_POIS | RF5_BA_NETH | RF5_BA_WATE | \
5262 		RF5_BA_MANA | RF5_BA_DARK | RF5_BA_NUKE | RF5_BA_CHAO )
5263 
5264 /*
5265  * New monster race bit flags
5266  */
5267 #define RF6_HASTE		0x00000001	/* Speed self */
5268 #define RF6_HAND_DOOM		0x00000002      /* Hand of Doom */
5269 #define RF6_HEAL		0x00000004	/* Heal self */
5270 #define RF6_S_ANIMALS		0x00000008      /* Summon animals */
5271 #define RF6_BLINK			0x00000010	/* Teleport Short */
5272 #define RF6_TPORT			0x00000020	/* Teleport Long */
5273 #define RF6_RAISE_DEAD			0x00000040      /* Raise Dead -- not implemented */
5274 #define RF6_S_BUG			0x00000080      /* Summon Software bug */
5275 #define RF6_TELE_TO		0x00000100	/* Move player to monster */
5276 #define RF6_TELE_AWAY		0x00000200	/* Move player far away */
5277 #define RF6_TELE_LEVEL		0x00000400	/* Move player vertically */
5278 #define RF6_S_RNG		0x00000800      /* Summon RNG */
5279 #define RF6_DARKNESS			0x00001000	/* Create Darkness */
5280 #define RF6_TRAPS			0x00002000	/* Create Traps */
5281 #define RF6_FORGET			0x00004000	/* Cause amnesia */
5282 #define RF6_S_DRAGONRIDER		0x00008000      /* Summon DragonRiders */
5283 #define RF6_S_KIN		0x00010000      /* Summon "kin" */
5284 #define RF6_S_HI_DEMON		0x00020000      /* Summon greater demons! */
5285 #define RF6_S_MONSTER		0x00040000	/* Summon Monster */
5286 #define RF6_S_MONSTERS		0x00080000	/* Summon Monsters */
5287 #define RF6_S_ANT			0x00100000	/* Summon Ants */
5288 #define RF6_S_SPIDER			0x00200000	/* Summon Spiders */
5289 #define RF6_S_HOUND			0x00400000	/* Summon Hounds */
5290 #define RF6_S_HYDRA			0x00800000	/* Summon Hydras */
5291 #define RF6_S_ANGEL		0x01000000	/* Summon Angel */
5292 #define RF6_S_DEMON		0x02000000	/* Summon Demon */
5293 #define RF6_S_UNDEAD		0x04000000	/* Summon Undead */
5294 #define RF6_S_DRAGON		0x08000000	/* Summon Dragon */
5295 #define RF6_S_HI_UNDEAD			0x10000000	/* Summon Greater Undead */
5296 #define RF6_S_HI_DRAGON			0x20000000	/* Summon Ancient Dragon */
5297 #define RF6_S_NAZGUL			0x40000000	/* Summon Unique Wraith */
5298 #define RF6_S_UNIQUE			0x80000000	/* Summon Unique Monster */
5299 
5300 #define RF6_PLAYER_SPELLS (RF6_HASTE | RF6_HAND_DOOM | RF6_HEAL | \
5301 		RF6_BLINK | RF6_TPORT | RF6_TELE_TO | RF6_TELE_AWAY)
5302 #define RF6_RADIUS_SPELLS (0L)
5303 
5304 /*
5305  * New monster race bit flags from ToME.		- Jir -
5306  */
5307 #define RF7_AQUATIC		0x00000001  /* Aquatic monster */
5308 #define RF7_CAN_SWIM		0x00000002  /* Monster can swim */
5309 #define RF7_CAN_FLY		0x00000004  /* Monster can fly */
5310 #define RF7_FRIENDLY		0x00000008  /* Monster is friendly */
5311 #define RF7_PET				0x00000010  /* Monster is a pet */
5312 #define RF7_MORTAL			0x00000020  /* Monster is a mortal being -- UNUSED */
5313 #define RF7_SPIDER			0x00000040  /* Monster is a spider (can pass webs) */
5314 #define RF7_NAZGUL			0x00000080  /* Monster is a Nazgul */
5315 #define RF7_DG_CURSE		0x00000100  /* If killed the monster grant a DG Curse to the player */
5316 #define RF7_POSSESSOR		0x00000200  /* Is it a dreaded possessor monster ? -- UNUSED */
5317 #define RF7_NO_DEATH		0x00000400  /* Cannot be killed */
5318 #define RF7_NO_TARGET		0x00000800  /* Cannot be targeted */
5319 #define RF7_AI_ANNOY			0x00001000  /* Try to tease the player */
5320 #define RF7_AI_SPECIAL			0x00002000  /* For quests */
5321 #define RF7_NEUTRAL			0x00004000  /* Monster is neutral */
5322 #define RF7_DROPART			0x00008000  /* Monster is neutral */
5323 #define RF7_DROPRANDART		0x00010000  /* Monster is neutral */
5324 #define RF7_AI_PLAYER		0x00020000  /* Monster is neutral */
5325 #define RF7_NO_THEFT		0x00040000  /* Monster is neutral */
5326 #define RF7_NEVER_ACT		0x00080000  /* Monster is neutral */
5327 #define RF7_NO_ESP			0x00100000	/* monster isn't ESPable */
5328 #define RF7_ATTR_BASE			0x00200000	/* show base attr too. Atm works if a) only 1 breath and ATTR_MULTI (DRs) or b) ATTR_BNW is set */
5329 #define RF7_VORTEX			0x00400000	/* experimental: flicker extremely fast - not working atm */
5330 #define RF7_OOD_20			0x00800000	/* Cannot occur more than 20 levels OoD */
5331 #define RF7_OOD_15		0x01000000	/* Cannot occur more than 15 levels OoD */
5332 #define RF7_OOD_10		0x02000000	/* Cannot occur more than 10 levels OoD */
5333 #define RF7_ATTR_BNW		0x04000000	/* Monster flickers w/ TERM_BNW colour (ie black and white), also see SLOW_ATTR_BNW */
5334 #define RF7_S_LOWEXP		0x08000000  /* Summons/Clones give little exp */
5335 #define RF7_S_NOEXP			0x10000000  /* Summons/Clones don't give exp */
5336 #define RF7_ATTR_BREATH			0x20000000  /* Use client breath colouring (unused & not implemented) */
5337 #define RF7_MULTIPLY			0x40000000  /* Monster reproduces */
5338 #define RF7_DISBELIEVE			0x80000000	/* Antimagic shield */
5339 
5340 
5341 /*
5342  * Monster race flags
5343  */
5344 #define RF8_DUNGEON		0x00000001
5345 #define RF8_WILD_TOWN		0x00000002
5346 #define RF8_WILD_EASY		0x00000004
5347 #define RF8_WILD_SHORE		0x00000008
5348 #define RF8_WILD_OCEAN			0x00000010
5349 #define RF8_WILD_WASTE			0x00000020
5350 #define RF8_WILD_WOOD			0x00000040
5351 #define RF8_WILD_VOLCANO		0x00000080
5352 #define RF8_RAND_5		0x00000100	/* Moves very slightly randomly (5%) (for Panda, so it's not appearing totally 'passive' - C. Blue) */
5353 #define RF8_WILD_MOUNTAIN	0x00000200
5354 #define RF8_WILD_GRASS		0x00000400
5355 #define RF8_NO_CUT		0x00000800
5356 #define RF8_CTHANGBAND			0x00001000
5357 #define RF8_PERNANGBAND			0x00002000
5358 #define RF8_ZANGBAND			0x00004000
5359 #define RF8_JOKEANGBAND			0x00008000
5360 #define RF8_ANGBAND		0x00010000
5361 #define RF8_BLUEBAND		0x00020000	/* C. Blue's bestiary */
5362 #define RF8_NO_AUTORET		0x00040000	/* don't auto-retaliate against this monster */
5363 #define RF8_WILD_DESERT		0x00080000
5364 #define RF8_WILD_ICE			0x00100000
5365 #define RF8_NETHER_REALM		0x00200000	/* may only spawn in the Nether Realm */
5366 #define RF8_PLURAL			0x00400000	/* The monster's name is already in plural form */
5367 #define RF8_NO_BLOCK			0x00800000	/* This monster never blocks hits */
5368 #define RF8_ALLOW_RUNNING	0x01000000	/* Player may run even with this monster (awake) in LoS */
5369 #define RF8_AVOID_PERMAWALLS	0x02000000	/* spawns distant of permanent walls (maybe/only for Dor) */
5370 #define RF8_PSEUDO_UNIQUE	0x04000000	/* Not a unique monster (does not appear in the uniques list), but named/looks like one (added for Santa Claus); monster form cannot be learnt by mimics */
5371 #define RF8_GENO_PERSIST	0x08000000	/* Don't automatically genocide/compact this monster */
5372 #define RF8_GENO_NO_THIN		0x10000000	/* Don't genocide this monster when thinning out surface spawns */
5373 #define RF8_CLIMB			0x20000000	/* NOT YET IMPLEMENTED: Can walk over mountain fields */
5374 #define RF8_WILD_SWAMP			0x40000000	/* ToDo: Implement Swamp */
5375 #define RF8_WILD_TOO			0x80000000
5376 
5377 #define RF8_WILD_TOO_MASK \
5378 	( RF8_WILD_TOWN | RF8_WILD_EASY | RF8_WILD_SHORE | \
5379 	  RF8_WILD_OCEAN | RF8_WILD_WASTE | RF8_WILD_WOOD | RF8_WILD_VOLCANO | \
5380 	  RF8_WILD_MOUNTAIN | RF8_WILD_GRASS | RF8_WILD_SWAMP | \
5381 	  RF8_WILD_DESERT | RF8_WILD_ICE)
5382 
5383 #define RF8_WILD_EASY_MASK \
5384         ( RF8_WILD_TOWN | RF8_WILD_SHORE | \
5385           RF8_WILD_WASTE | \
5386 	  RF8_WILD_GRASS | RF8_WILD_SWAMP)
5387 
5388 
5389 /*
5390  * Monster race flags
5391  */
5392 #define RF9_DROP_CORPSE		0x00000001
5393 #define RF9_DROP_SKELETON	0x00000002
5394 #define RF9_HAS_LITE		0x00000004      /* Carries a lite */
5395 #define RF9_MIMIC		0x00000008      /* *REALLY* looks like an object ... only nastier */
5396 #define RF9_HAS_EGG			0x00000010      /* Can be monster's eggs */
5397 #define RF9_IMPRESSED			0x00000020      /* The monster can follow you on each level until he dies */
5398 #define RF9_SUSCEP_ACID			0x00000040      /* Susceptible to acid */
5399 #define RF9_SUSCEP_ELEC			0x00000080      /* Susceptible to lightning */
5400 #define RF9_SUSCEP_POIS		0x00000100      /* Susceptible to poison */
5401 #define RF9_KILL_TREES		0x00000200      /* Monster can eat trees */
5402 #define RF9_WYRM_PROTECT	0x00000400      /* The monster is protected by great wyrms of power: They'll be summoned if it's killed */
5403 #define RF9_DOPPLEGANGER	0x00000800      /* The monster looks like you */
5404 #define RF9_ONLY_DEPTH			0x00001000      /* The monster can only be generated at the GIVEN depth */
5405 #define RF9_SPECIAL_GENE		0x00002000      /* The monster can only be generated in special conditions like quests, special dungeons, ... NOTE: currently no effect! */
5406 #define RF9_NEVER_GENE			0x00004000      /* The monster cannot be normaly generated */
5407 /* no_conf, no_fear, no_sleep, res_<others> already exist (C. Blue) */
5408 /* These flags are added to r_info for improved logic in mimic forms (eg chaos hound gives res_chaos) */
5409 /* The resistance flags are added to distinguish between im_ and res_ now. Until now im_ was simply a strong res. */
5410 #define RF9_RES_ACID			0x00008000L
5411 #define RF9_RES_ELEC		0x00010000L
5412 #define RF9_RES_FIRE		0x00020000L
5413 #define RF9_RES_COLD		0x00040000L
5414 #define RF9_RES_POIS		0x00080000L
5415 #define RF9_RES_LITE			0x00100000L
5416 #define RF9_RES_DARK			0x00200000L
5417 #define RF9_RES_BLIND			0x00400000L
5418 #define RF9_RES_SOUND			0x00800000L
5419 #define RF9_RES_SHARDS		0x01000000L
5420 #define RF9_RES_CHAOS		0x02000000L
5421 #define RF9_RES_TIME		0x04000000L
5422 #define RF9_RES_MANA		0x08000000L
5423 #define RF9_IM_WATER			0x10000000L	/* Water immunity, should also let you breathe under water */
5424 /* Hm, fits in perfectly :) Fate? */
5425 /* these flags are not in PernA nor in PernM-monsters,
5426  * but the code for them already exists in our code..
5427  * Let's consider of recycling them :)		- Jir - */
5428 #define RF9_IM_TELE			0x20000000      /* Resist teleportation */
5429 #define RF9_IM_PSI			0x40000000	/* Immune to (?) */
5430 #define RF9_RES_PSI			0x80000000	/* Resist (?) */
5431 
5432 
5433 /* New monster attack spells and stuff - C. Blue */
5434 #define RF0_S_HI_MONSTER	0x00000001
5435 #define RF0_S_HI_MONSTERS	0x00000002
5436 #define RF0_S_HI_UNIQUE		0x00000004
5437 #define RF0_ASTAR		0x00000008		/* monster uses A* pathfinding (use with care, might strain CPU) */
5438 #define RF0_NO_ESCORT			0x00000010	/* monster will never occur in groups, like escorts or nests/pits */
5439 #define RF0_NO_NEST			0x00000020	/* monster will never occur in groups, like escorts or nests/pits */
5440 #define RF0_FINAL_GUARDIAN		0x00000040	/* monster is defined as FINAL_GUARDIAN_ in d_info.txt */
5441 #define RF0_BO_DISE			0x00000080
5442 #define RF0_BA_DISE		0x00000100
5443 #define RF0_ROAMING		0x00000200		/* monster never spawns in vaults or pits (ie on CAVE_ICKY/CAVE_NEST_PIT grids) */
5444 #define RF0_DROP_1		0x00000400		/* Drop exactly 1 item/gold */
5445 
5446 #define RF0_NO_GROUP_MASK	(RF0_NO_ESCORT | RF0_NO_NEST)
5447 
5448 #define RF0_PLAYER_SPELLS (0L)
5449 /* monster spells are currently RF4+RF5+RF6 only (todo: add RF0)
5450 #define RF0_PLAYER_SPELLS (RF0_BO_DISE | RF0_BA_DISE)
5451 */
5452 #define RF0_RADIUS_SPELLS (RF0_BA_DISE)
5453 
5454 /* Special addition, since RF0_ mixes quite different types of flags.
5455    This is to sort them out a bit. */
5456 #define RF0_ACTIVE_MASK (RF0_S_HI_MONSTER | RF0_S_HI_MONSTERS | RF0_BO_DISE | RF0_BA_DISE)
5457 
5458 /* currently disabled r_info.txt flags (not implemented or some other reason) */
5459 #define RF1_DISABLE_MASK	(0x0)
5460 #define RF2_DISABLE_MASK	(0x0)
5461 #define RF3_DISABLE_MASK	(0x0)
5462 #define RF4_DISABLE_MASK	(0x0)
5463 
5464 #define RF5_DISABLE_MASK	(RF5_BO_POIS)
5465 #define RF6_DISABLE_MASK	(RF6_RAISE_DEAD | RF6_HAND_DOOM)
5466 #define RF7_DISABLE_MASK	(0x0)
5467 
5468 #define RF8_DISABLE_MASK	(0x0)
5469 #define RF9_DISABLE_MASK	(0x0)
5470 
5471 #define RF0_DISABLE_MASK	(0x0)
5472 
5473 /*
5474  * Hack -- choose "intelligent" spells when desperate
5475  */
5476 /* I suspect the usefulness of this mask.. */
5477 
5478 #define RF4_INT_MASK \
5479    (RF4_S_ANIMAL | RF4_UNMAGIC)
5480 
5481 #define RF5_INT_MASK \
5482   (RF5_HOLD | RF5_SLOW | RF5_CONF | RF5_BLIND | RF5_SCARE)
5483 
5484 #define RF6_INT_MASK \
5485    (RF6_BLINK |  RF6_TPORT | RF6_TELE_LEVEL | RF6_TELE_AWAY | \
5486     RF6_HEAL | RF6_HASTE | RF6_TRAPS | \
5487     RF6_S_KIN | RF6_S_HI_DEMON | RF6_S_MONSTER | RF6_S_MONSTERS | \
5488     RF6_S_ANT | RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | \
5489     RF6_S_ANGEL | RF6_S_DRAGON | RF6_S_UNDEAD | RF6_S_DEMON | \
5490     RF6_S_HI_DRAGON | RF6_S_HI_UNDEAD | RF6_S_NAZGUL | RF6_S_UNIQUE | \
5491     RF6_S_DRAGONRIDER | RF6_S_BUG | RF6_S_RNG | RF6_S_ANIMALS)
5492 
5493 #define RF0_INT_MASK \
5494     (RF0_S_HI_MONSTER | RF0_S_HI_MONSTERS | RF0_S_HI_UNIQUE)
5495 
5496 /*
5497  * Spells castable even when farther than MAX_RANGE
5498  */
5499 #define RF4_INDIRECT_MASK \
5500 	(RF4_MOAN)
5501 /*	(0L)	-	Ranged MOAN needed for Halloween event -C. Blue */
5502 
5503 #define RF5_INDIRECT_MASK \
5504 	(0L)
5505 
5506 #define RF6_INDIRECT_MASK \
5507 	(RF6_HASTE | RF6_BLINK | RF6_TPORT | RF6_HEAL)
5508 
5509 #define RF0_INDIRECT_MASK \
5510 	(0L)
5511 
5512 
5513 /*
5514  * Spells castable only when within the sight
5515  */
5516 #define RF4_DIRECT_MASK \
5517 	(RF4_SHRIEK | RF4_UNMAGIC)
5518 
5519 #define RF5_DIRECT_MASK \
5520 	(RF5_DRAIN_MANA | RF5_MIND_BLAST | RF5_BRAIN_SMASH | RF5_CURSE | \
5521 	 RF5_SCARE | RF5_BLIND | RF5_CONF | RF5_SLOW | RF5_HOLD)
5522 
5523 
5524 #define RF6_DIRECT_MASK \
5525 	(RF6_TELE_TO | RF6_TELE_AWAY | RF6_TELE_LEVEL | RF6_DARKNESS | \
5526 	 RF6_TRAPS | RF6_FORGET)
5527 
5528 #define RF0_DIRECT_MASK \
5529 	(0L)
5530 
5531 
5532 /*
5533  * Hack -- "bolt" spells that may hurt fellow monsters
5534  */
5535 #define RF4_BOLT_MASK \
5536   (RF4_ARROW_1 | RF4_ARROW_2 | RF4_ARROW_3 | RF4_ARROW_4 | RF4_BOULDER)
5537 
5538 #define RF5_BOLT_MASK \
5539    (RF5_BO_ACID | RF5_BO_ELEC | RF5_BO_FIRE | RF5_BO_COLD | \
5540     RF5_BO_POIS | RF5_BO_NETH | RF5_BO_WATE | RF5_BO_MANA | \
5541     RF5_BO_PLAS | RF5_BO_ICEE | RF5_MISSILE)
5542 
5543 #define RF6_BOLT_MASK \
5544     (0L)
5545 
5546 #define RF0_BOLT_MASK \
5547     (RF0_BO_DISE)
5548 
5549 
5550 /* Hack -- summon spells */
5551 
5552 #define RF4_SUMMON_MASK \
5553     (0L)
5554 
5555 #define RF5_SUMMON_MASK \
5556     (0L)
5557 
5558 #define RF6_SUMMON_MASK \
5559     (RF6_S_KIN | RF6_S_HI_DEMON | RF6_S_MONSTER | RF6_S_MONSTERS | RF6_S_ANT | \
5560      RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | RF6_S_ANGEL | RF6_S_DEMON | \
5561      RF6_S_UNDEAD | RF6_S_DRAGON | RF6_S_HI_UNDEAD | RF6_S_HI_DRAGON | \
5562      RF6_S_NAZGUL | RF6_S_UNIQUE | RF6_S_DRAGONRIDER | RF6_S_BUG | RF6_S_RNG)
5563 
5564 #define RF0_SUMMON_MASK \
5565     (RF0_S_HI_MONSTER | RF0_S_HI_MONSTERS | RF0_S_HI_UNIQUE)
5566 
5567 
5568 /*
5569  * Spells that allow the caster to escape
5570  */
5571 #define RF4_ESCAPE_MASK \
5572 	(0L)
5573 
5574 #define RF5_ESCAPE_MASK \
5575 	(0L)
5576 
5577 #define RF6_ESCAPE_MASK \
5578 	(RF6_BLINK | RF6_TPORT | RF6_TELE_AWAY | RF6_TELE_LEVEL)
5579 
5580 #define RF0_ESCAPE_MASK \
5581 	(0L)
5582 
5583 /*
5584  * Spells that hurt the player directly
5585  */
5586 #define RF4_ATTACK_MASK \
5587 	(RF4_ROCKET | RF4_ARROW_1 | RF4_ARROW_2 | RF4_ARROW_3 | RF4_ARROW_4 | \
5588 	 RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS | \
5589 	 RF4_BR_NETH | RF4_BR_LITE | RF4_BR_DARK | RF4_BR_CONF | RF4_BR_SOUN | \
5590 	 RF4_BR_CHAO | RF4_BR_DISE | RF4_BR_NEXU | RF4_BR_TIME | RF4_BR_INER | \
5591 	 RF4_BR_GRAV | RF4_BR_SHAR | RF4_BR_PLAS | RF4_BR_WALL | RF4_BR_MANA | \
5592 	 RF4_BR_NUKE | RF4_BR_DISI | RF4_BOULDER)
5593 /*	 RF4_BA_NUKE | RF4_BR_NUKE | RF4_BA_CHAO | RF4_BR_DISI) */
5594 
5595 #define RF5_ATTACK_MASK \
5596 	(RF5_BA_ACID | RF5_BA_ELEC | RF5_BA_FIRE | RF5_BA_COLD | RF5_BA_POIS | \
5597 	 RF5_BA_NETH | RF5_BA_WATE | RF5_BA_MANA | RF5_BA_DARK | \
5598 	 RF5_BA_NUKE | RF5_BA_CHAO | \
5599 	 RF5_MIND_BLAST | RF5_BRAIN_SMASH | RF5_CURSE | \
5600 	 RF5_BO_ACID | RF5_BO_ELEC | RF5_BO_FIRE | \
5601 	 RF5_BO_COLD | RF5_BO_POIS | RF5_BO_NETH | RF5_BO_WATE | RF5_BO_MANA | \
5602 	 RF5_BO_PLAS | RF5_BO_ICEE | RF5_MISSILE)
5603 
5604 #define RF6_ATTACK_MASK \
5605 	(RF6_HAND_DOOM)
5606 
5607 #define RF0_ATTACK_MASK \
5608 	(RF0_BO_DISE | RF0_BA_DISE)
5609 
5610 
5611 /*
5612  * Spells that improve the caster's tactical position
5613  */
5614 #define RF4_TACTIC_MASK \
5615 	(0L)
5616 
5617 #define RF5_TACTIC_MASK \
5618 	(0L)
5619 
5620 #define RF6_TACTIC_MASK \
5621 	(RF6_BLINK)
5622 
5623 #define RF0_TACTIC_MASK \
5624 	(0L)
5625 
5626 /*
5627  * Annoying spells
5628  */
5629 #define RF4_ANNOY_MASK \
5630 	(RF4_SHRIEK | RF4_UNMAGIC | RF4_MOAN)
5631 /*	(RF4_SHRIEK | RF4_UNMAGIC)  ranged MOAN added for Halloween event. -C. Blue */
5632 
5633 #define RF5_ANNOY_MASK \
5634 	(RF5_DRAIN_MANA | RF5_MIND_BLAST | RF5_BRAIN_SMASH | \
5635 	 RF5_SCARE | RF5_BLIND | RF5_CONF | RF5_SLOW | RF5_HOLD)
5636 
5637 #define RF6_ANNOY_MASK \
5638 	(RF6_TELE_TO | RF6_DARKNESS | RF6_TRAPS | RF6_FORGET)
5639 
5640 #define RF0_ANNOY_MASK \
5641 	(0L)
5642 
5643 /*
5644  * Spells that increase the caster's relative speed
5645  */
5646 #define RF4_HASTE_MASK \
5647 	(0L)
5648 
5649 #define RF5_HASTE_MASK \
5650 	(RF5_SLOW | RF5_HOLD)
5651 
5652 #define RF6_HASTE_MASK \
5653 	(RF6_HASTE)
5654 
5655 #define RF0_HASTE_MASK \
5656 	(0L)
5657 
5658 /*
5659  * Healing spells
5660  */
5661 #define RF4_HEAL_MASK \
5662 	(0L)
5663 
5664 #define RF5_HEAL_MASK \
5665 	(0L)
5666 
5667 #define RF6_HEAL_MASK \
5668 	(RF6_HEAL)
5669 
5670 #define RF0_HEAL_MASK \
5671 	(0L)
5672 
5673 /* Masks to find out if a monster is really a spellcaster,
5674    which uses magic spells, or if the 'spells' are merely
5675    actions as firing arrows or hurling boulders.. - C. Blue */
5676 #define	RF4_SPELLCASTER_MASK \
5677 	(RF4_S_ANIMAL)
5678 #define	RF5_SPELLCASTER_MASK \
5679 	(RF5_BA_ACID | RF5_BA_ELEC | RF5_BA_FIRE | RF5_BA_COLD | RF5_BA_POIS | \
5680 	RF5_BA_NETH | RF5_BA_WATE | RF5_BA_MANA | RF5_BA_DARK | \
5681 	RF5_DRAIN_MANA | RF5_CURSE | RF5_BA_NUKE | RF5_BA_CHAO | \
5682 	RF5_BO_ACID | RF5_BO_ELEC | RF5_BO_FIRE | RF5_BO_COLD | RF5_BO_POIS |\
5683 	RF5_BO_NETH | RF5_BO_WATE | RF5_BO_MANA | RF5_BO_PLAS | \
5684 	RF5_BO_ICEE | RF5_SCARE | RF5_BLIND | RF5_CONF | RF5_SLOW | RF5_HOLD)
5685 	/* RF6_TRAPS and RF6_FORGET don't count as spells (trapping / telepathy) */
5686 #define RF6_SPELLCASTER_MASK \
5687 	(RF6_HASTE | RF6_HAND_DOOM | RF6_HEAL | RF6_S_ANIMALS | RF6_BLINK | RF6_TPORT | \
5688 	RF6_RAISE_DEAD | RF6_S_BUG | RF6_TELE_TO | RF6_TELE_AWAY | RF6_TELE_LEVEL | RF6_S_RNG | RF6_DARKNESS | \
5689 	RF6_S_DRAGONRIDER | RF6_S_KIN | RF6_S_HI_DEMON | RF6_S_MONSTER | RF6_S_MONSTERS | RF6_S_ANT | \
5690 	RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | RF6_S_ANGEL | RF6_S_DEMON | RF6_S_UNDEAD | RF6_S_DRAGON | \
5691 	RF6_S_HI_UNDEAD | RF6_S_HI_DRAGON | RF6_S_NAZGUL | RF6_S_UNIQUE)
5692 #define RF0_SPELLCASTER_MASK \
5693 	(RF0_S_HI_MONSTER | RF0_S_HI_MONSTERS | RF0_S_HI_UNIQUE | RF0_BO_DISE | RF0_BA_DISE)
5694 
5695 
5696 /*
5697 	Different types of terrain, used for the wilderness.
5698 	-APD-
5699 
5700 	HACK -- I am temporarily using these numbers to determine
5701 	how many monsters to generate.
5702 */
5703 
5704 #define		WILD_LAKE		0
5705 #define		WILD_GRASSLAND		1
5706 #define		WILD_FOREST		2
5707 #define		WILD_VOLCANO		3
5708 #define		WILD_SHORE1		4 /* temporary */
5709 #define		WILD_SHORE2		5 /* temporary */
5710 #define		WILD_OCEANBED1		6 /* temporary */
5711 #define		WILD_WASTELAND		7
5712 #define		WILD_UNDEFINED		8
5713 #define		WILD_CLONE		9 /* we should copy the terrain type of a neighbor */
5714 #define		WILD_TOWN		10
5715 #define		WILD_OCEAN		11
5716 #define		WILD_RIVER		12
5717 #define		WILD_COAST		13
5718 #define		WILD_MOUNTAIN		14
5719 #define		WILD_DENSEFOREST	15
5720 #define		WILD_OCEANBED2		16 /* temporary */
5721 #define		WILD_DESERT		17 /* new, similar to WILD_WASTELAND probably */
5722 #define		WILD_ICE		18 /* new, polar style */
5723 #define		WILD_SWAMP		20
5724 
5725 /* different buildings */
5726 #define		WILD_LOG_CABIN		0
5727 #define		WILD_ROCK_HOME		1
5728 #define		WILD_PERM_HOME		2
5729 #define		WILD_SHACK		3
5730 #define		WILD_TOWN_HOME		4
5731 
5732 /* types of crops */
5733 #define		WILD_CROP_POTATO	0
5734 #define		WILD_CROP_CABBAGE	1
5735 #define		WILD_CROP_CARROT	2
5736 #define		WILD_CROP_BEET		3
5737 #define		WILD_CROP_MUSHROOM	4
5738 #define		WILD_CROP_SQUASH	5
5739 #define		WILD_CROP_CORN		6
5740 
5741 /* used for wilderness generation */
5742 #define		DIR_NORTH		0
5743 #define		DIR_EAST		1
5744 #define		DIR_SOUTH		2
5745 #define		DIR_WEST		3
5746 
5747 /* wilderness flags */
5748 /* flags belonging to (+) family may be cleared to cause the according
5749    effect when desired, any time in the code, it's harmless ;)
5750    (the wilderness generation function will set them again after processing.) */
5751 #define	WILD_F_GENERATED	0x00000001	/* wilderness has been generated once - actually unused now after splitting it up into more detailed flags below, which are marked (+) - C. Blue */
5752 #define	WILD_F_INHABITED	0x00000002	/* if unset, add some monsters on day/night change (part of the (+) flag family actually, semantically) */
5753 #define	WILD_F_IN_MEMORY	0x00000004
5754 #define	WILD_F_UP		0x00000008	/* these are to show dungeons etc. */
5755 #define	WILD_F_DOWN		0x00000010
5756 #define WILD_F_LOCKUP		0x00000020	/* lock to prevent creation */
5757 #define WILD_F_LOCKDOWN		0x00000040
5758 
5759 #define WILD_F_INVADERS		0x00000080	/* (+) if unset, spawn some invaders */
5760 #define WILD_F_HOME_OWNERS	0x00000100	/* (+) if unset, respawn home-owners */
5761 #define WILD_F_BONES		0x00000200	/* (+) if unset, spawn some bones */
5762 #define WILD_F_FOOD		0x00000400	/* (+) if unset, spawn some food (not regrowing gardens, see below for that one) */
5763 #define WILD_F_OBJECTS		0x00000800	/* (+) if unset, spawn some objects */
5764 #define WILD_F_CASH		0x00001000	/* (+) if unset, spawn some cash */
5765 #define WILD_F_GARDENS		0x00002000	/* (+) if unset, regrow gardens */
5766 
5767 
5768 /*** Features flags -- DG ***/
5769 #define FF1_NO_WALK             0x00000001L
5770 #define FF1_NO_VISION           0x00000002L
5771 #define FF1_CAN_FEATHER		0x00000004L
5772 #define FF1_CAN_PASS            0x00000008L
5773 #define FF1_FLOOR               0x00000010L
5774 #define FF1_WALL                0x00000020L
5775 #define FF1_PERMANENT           0x00000040L
5776 #define FF1_CAN_LEVITATE	0x00000080L
5777 #define FF1_REMEMBER            0x00000100L
5778 #define FF1_NOTICE              0x00000200L
5779 #define FF1_DONT_NOTICE_RUNNING 0x00000400L
5780 #define FF1_CAN_RUN             0x00000800L
5781 #define FF1_DOOR                0x00001000L
5782  #define FF1_SUPPORT_LIGHT       0x00002000L	/* -- currently NO EFFECT! -- */
5783 #define FF1_CAN_CLIMB           0x00004000L
5784 #define FF1_TUNNELABLE          0x00008000L
5785 #define FF1_WEB                 0x00010000L
5786 #define FF1_ATTR_MULTI          0x00020000L
5787 #define FF1_SLOW_RUNNING_1	0x00040000L	/* half speed */
5788 #define FF1_SLOW_RUNNING_2	0x00080000L	/* quarter speed */
5789 #define FF1_SLOW_LEVITATING_1	0x00100000L
5790 #define FF1_SLOW_LEVITATING_2	0x00200000L
5791 #define FF1_SLOW_CLIMBING_1	0x00400000L
5792 #define FF1_SLOW_CLIMBING_2	0x00800000L
5793 #define FF1_SLOW_WALKING_1	0x01000000L
5794 #define FF1_SLOW_WALKING_2	0x02000000L
5795 #define FF1_SLOW_SWIMMING_1	0x04000000L
5796 #define FF1_SLOW_SWIMMING_2	0x08000000L
5797 #define FF1_PROTECTED		0x10000000L	/* monsters cannot teleport to nor spawn on this grid */
5798 #define FF1_LOS			0x20000000L	/* can shoot/cast/throw through this one, but may not be able to walk through (FEAT_DARK_PIT) */
5799 #define FF1_BLOCK_LOS		0x40000000L	/* can't shoot/cast/throw through this one, but may be able to walk through ('easy door') */
5800 #define FF1_BLOCK_CONTACT	0x80000000L	/* like BLOCK_LOS, except players can see across it even if they cant attack (nor can monsters) */
5801 
5802 /* for switching places with another player: */
5803 #define FF1_SWITCH_MASK \
5804 	(FF1_FLOOR | FF1_CAN_FEATHER | FF1_CAN_LEVITATE | FF1_CAN_RUN | FF1_CAN_CLIMB)
5805 
5806 
5807 #define FF2_LAMP_LITE		0x00000001L	/* Gets coloured by wall_lighting. Implies SPECIAL_LITE. */
5808 #define FF2_LAMP_LITE_SNOW	0x00000002L	/* Gets coloured by wall_lighting, if it's winter season, due to assumed snow-covering. Implies SPECIAL_LITE if successful. */
5809 #define FF2_SPECIAL_LITE	0x00000004L	/* Gets coloured slate/gets slightly darkened by special fx: no LoS/no GLOW. This is implied by LAMP_LITE and successful LAMP_LITE_SNOW. */
5810 #define FF2_NIGHT_DARK		0x00000008L	/* Stays darkened at night, unaffected by glow (magical light) or lite (lamps) */
5811 #define FF2_NO_SHADE		0x00000010L	/* Don't shade to TERM_SLATE in view_shade_floor (or vault walls become indistinguishable from granite, without magic light) */
5812 #define FF2_NO_LITE_WHITEN	0x00000020L	/* Won't change to WHITE or L_WHITE lamp light colour. For tiles that are affected from yellow light but retain their colour in white light. */
5813 #define FF2_LAMP_LITE_OPTIONAL	0x00000040L	/* For more floor/wall grids: Get coloured by floor/wall_lighting, if user has toggled the according option. */
5814 #define FF2_NO_ARTICLE		0x00000080L	/* floor feat doesn't have an article ('a(n)'/'the') in front of it when being described */
5815 //hole
5816 #define FF2_BOUNDARY		0x80000000L	/* Is permanent wall that serves as boundary of a dungeon level - cannot even be crossed by admins */
5817 
5818 
5819 /*** Dungeon type flags -- DG ***/
5820 
5821 #define DF1_PRINCIPAL           0x00000001L	/* Is a principal dungeon --- UNUSED */
5822 #define DF1_MAZE                0x00000002L	/* Is a maze-type dungeon */
5823 #define DF1_SMALLEST            0x00000004L	/* Creates VERY small levels like The Maze */
5824 #define DF1_SMALL               0x00000008L	/* Creates small levels like Dol Goldor */
5825 
5826 #define DF1_BIG                 0x00000010L	/* Creates big levels like Moria, and Angband dungeons */
5827 #define DF1_NO_DOORS            0x00000020L	/* No doors on rooms, like Barrowdowns, Old Forest etc) */
5828 #define DF1_WATER_RIVER         0x00000040L	/* Allow a single water streamer on a level */
5829 #define DF1_LAVA_RIVER          0x00000080L	/* Allow a single lava streamer on a level */
5830 
5831 #define DF1_WATER_RIVERS        0x00000100L	/* Allow multiple water streamers on a level */
5832 #define DF1_LAVA_RIVERS         0x00000200L	/* Allow multiple lava streamers on a level */
5833 #define DF1_CAVE                0x00000400L	/* Allow rooms */
5834 #define DF1_CAVERN              0x00000800L	/* Allow cavern rooms */
5835 
5836 #define DF1_NO_UP               0x00001000L	/* Disallow up stairs */
5837 #define DF1_HOT                 0x00002000L	/* Corpses on ground and in pack decay quicker through heat */
5838 #define DF1_COLD                0x00004000L	/* Corpses on ground and in pack decay quicker through cold */
5839 #define DF1_FORCE_DOWN          0x00008000L	/* No up stairs generated */
5840 
5841 #define DF1_FORGET              0x00010000L	/* Features are forgotten, like the Maze and Illusory Castle */
5842 #define DF1_NO_DESTROY          0x00020000L	/* No destroyed levels in dungeon */
5843 #define DF1_SAND_VEIN           0x00040000L	/* Like in the sandworm lair */
5844 #define DF1_CIRCULAR_ROOMS      0x00080000L	/* Allow circular rooms */
5845 
5846 #define DF1_EMPTY               0x00100000L	/* All arena levels */
5847 #define DF1_DAMAGE_FEAT         0x00200000L	/* --- UNUSED */
5848 #define DF1_FLAT                0x00400000L	/* Creates paths to next areas at edge of level, like Barrowdowns */
5849 #define DF1_TOWER               0x00800000L	/* You start at bottom and go up rather than the reverse */
5850 
5851 #define DF1_RANDOM_TOWNS        0x01000000L	/* Allow random towns */
5852 #define DF1_DOUBLE              0x02000000L	/* Creates double-walled dungeon like Helcaraxe and Erebor --- UNUSED */
5853 #define DF1_LIFE_LEVEL          0x04000000L	/* Creates dungeon level on modified 'game of life' algorithm --- UH, CHECK */
5854 #define DF1_EVOLVE              0x08000000L	/* Evolving, pulsing levels like Heart of the Earth --- UNUSED */
5855 
5856 #define DF1_ADJUST_LEVEL_1      0x10000000L	/* Minimum monster level will be equal to dungeon level --- UNUSED */
5857 #define DF1_ADJUST_LEVEL_2      0x20000000L	/* Minimum monster level will be double the dungeon level --- UNUSED */
5858 #define DF1_NO_RECALL           0x40000000L	/* No recall allowed; also includes everything NO_RECALL_INTO does! */
5859 #define DF1_NO_STREAMERS        0x80000000L	/* No streamers (water, lava, trees) */
5860 
5861 /* all flags that may modify a custom 'wilderness' (type 0) dungeon's appearance, 'theming' it,
5862    without changing its main flags (set my admin on dungeon creation) too much */
5863 #define DF1_THEME_MASK \
5864 	(DF1_MAZE | DF1_SMALL | DF1_SMALLEST | DF1_BIG | DF1_NO_DOORS | DF1_WATER_RIVER | DF1_LAVA_RIVER | \
5865 	DF1_WATER_RIVERS | DF1_WATER_RIVERS | DF1_CAVE | DF1_CAVERN | DF1_HOT | DF1_COLD | \
5866 	DF1_FORGET | DF1_NO_DESTROY | DF1_SAND_VEIN | DF1_CIRCULAR_ROOMS | DF1_EMPTY | DF1_DAMAGE_FEAT | \
5867 	DF1_DOUBLE | DF1_LIFE_LEVEL | DF1_EVOLVE | DF1_NO_STREAMERS)
5868 
5869 
5870 /* dungeon flags for dungeon_type
5871  * they should be renamed to DFx_*
5872  */
5873 /* XXX One problem - master-command from client can only handle flags
5874  * from 0x01 to 0x80!  FIXME
5875  */
5876 
5877 /* Maybe better DF2_PRELOADED? */
5878 #define DF2_RANDOM		0x00000001L /* random dungeon - not preloaded */
5879 /* DF2_IRON => DF1_NO_RECALL + DF1_FORCE_DOWN */
5880 #define DF2_IRON		0x00000002L /* one way dungeon - return portal at max level */
5881 #define DF2_HELL		0x00000004L /* hellish dungeon - forces hellish mode on all */
5882 /* DF2_NO_MAP => DF1_FORGET */
5883 /*#define DF2_NO_MAP		0x00000008L *//* player never gains level knowledge */
5884 #define DF2_NO_RECALL_INTO	0x00000008L /* Player may not recall downwards into this dungeon \
5885 					       upwards into this tower. Added it especially for Nether Realm - C. Blue \
5886 					       Note: this also prevents probability travel while inside, \
5887 					             floating into it, and sending items via telekinesis, \
5888 					             and it prevents ghost-floating deeper into it. */
5889 #define DF2_NO_MAGIC_MAP	0x00000010L /* non magic-mappable */
5890 #define DF2_MISC_STORES		0x00000020L /* spawn low-level dungeon stores such as under "RPG Server" rules */
5891 #define DF2_TOWNS_IRONRECALL	0x00000040L /* DF2_IRON: if level allows premature recalling then it has a town */
5892 #define DF2_NO_DEATH		0x00000080L /* death penalty is reduced */
5893 
5894 #define DF2_IRONFIX1		0x00000100L /* DF2_IRON: but you may recall every 250 ft */
5895 #define DF2_IRONFIX2		0x00000200L /* DF2_IRON: but you may recall every 500 ft */
5896 #define DF2_IRONFIX3		0x00000400L /* DF2_IRON: but you may recall every 750 ft */
5897 #define DF2_IRONFIX4		0x00000800L /* DF2_IRON: but you may recall every 1000 ft */
5898 
5899 #define DF2_IRONRND1		0x00001000L /* DF2_IRON: but each dlvl has 20% chance of allowing recall */
5900 #define DF2_IRONRND2		0x00002000L /* DF2_IRON: but each dlvl has 10% chance of allowing recall */
5901 #define DF2_IRONRND3		0x00004000L /* DF2_IRON: but each dlvl has 7% chance of allowing recall */
5902 #define DF2_IRONRND4		0x00008000L /* DF2_IRON: but each dlvl has 5% chance of allowing recall */
5903 
5904 #define DF2_NO_ENTRY_STAIR	0x00010000L /* Can't be entered by staircases */
5905 #define DF2_NO_ENTRY_WOR	0x00020000L /* Can't be entered by word-of-recall (plain and less restrictive than NO_RECALL_INTO) */
5906 #define DF2_NO_ENTRY_PROB	0x00040000L /* Can't be entered by probability travel */
5907 #define DF2_NO_ENTRY_FLOAT	0x00080000L /* Can't be entered by floating */
5908 
5909 #define DF2_NO_EXIT_STAIR	0x00100000L /* Can't be exited by staircases */
5910 #define DF2_NO_EXIT_WOR		0x00200000L /* Can't be exited by word-of-recall */
5911 #define DF2_NO_EXIT_PROB	0x00400000L /* Can't be exited by probability travel */
5912 #define DF2_NO_EXIT_FLOAT	0x00800000L /* Can't be exited by floating */
5913 
5914 #define DF2_NO_STAIRS_UP	0x01000000L /* no '<' staircases inside */
5915 #define DF2_NO_STAIRS_DOWN	0x02000000L /* no '>' staircases inside */
5916 #define DF2_TOWNS_FIX		0x04000000L /* generated towns every n levels (for HUGE ironman) */
5917 #define DF2_TOWNS_RND		0x08000000L /* generated towns with n% chance (for HUGE ironman) */
5918 
5919 #define DF2_ADJUST_LEVEL_1_2	0x10000000L /* Minimum monster level will be half the dungeon level --- UNUSED */
5920 #define DF2_NO_SHAFT		0x20000000L /* No shafts --- UNUSED (#if0'ed) */
5921 #define DF2_ADJUST_LEVEL_PLAYER	0x40000000L /* Uses player level*2 instead of dungeon level for other ADJUST_LEVEL flags */
5922 #define DF2_DELETED		0x80000000L /* Deleted, but not yet removed */
5923 
5924 #define DF2_NO_ENTRY_MASK       (DF2_NO_ENTRY_STAIR | DF2_NO_ENTRY_WOR | DF2_NO_ENTRY_PROB | DF2_NO_ENTRY_FLOAT)
5925 #define DF2_NO_EXIT_MASK        (DF2_NO_EXIT_STAIR | DF2_NO_EXIT_WOR | DF2_NO_EXIT_PROB | DF2_NO_EXIT_FLOAT)
5926 
5927 /* all flags that may modify a custom 'wilderness' (type 0) dungeon's appearance, 'theming' it,
5928    without changing its main flags (set my admin on dungeon creation) too much */
5929 #define DF2_THEME_MASK \
5930 	(DF2_NO_MAGIC_MAP | \
5931 	DF2_ADJUST_LEVEL_1_2)
5932 
5933 
5934 /* moar flags */
5935 #define DF3_JAIL_DUNGEON	0x00000001L	/* purpose is just to display the name "Jail Dungeon" in dungeon list */
5936 #define DF3_HIDDENLIB		0x00000002L	/* allow generation of 'Hidden Library' dungeon store (for ironman deep dive challenge) (overrides DF3_NO_SIMPLE_STORES) */
5937 #define DF3_NO_SIMPLE_STORES	0x00000004L	/* disallow generation misc ironman helper stores and of low-level dungeon stores (herbalist) */
5938 #define DF3_NO_DUNGEON_BONUS	0x00000008L	/* This dungeon never yields bonus experience from dungeon_bonus[] (rare exploration) */
5939 
5940 #define DF3_EXP_5		0x00000010L	/* Add +5% bonus to experience gains while inside this dungeon */
5941 #define DF3_EXP_10		0x00000020L	/* Add +10% bonus to experience gains while inside this dungeon */
5942 #define DF3_EXP_20		0x00000040L	/* Add +20% bonus to experience gains while inside this dungeon */
5943 #define DF3_LUCK_1		0x00000080L	/* Add +1 luck while inside this dungeon */
5944 
5945 #define DF3_LUCK_5		0x00000100L	/* Add +5 luck while inside this dungeon */
5946 #define DF3_LUCK_20		0x00000200L	/* Add +20 luck while inside this dungeon */
5947 #define DF3_LUCK_PROG_IDDC	0x00000400L	/* Add luck progressively while inside this dungeon, for Ironman Deep Dive Challenge */
5948 #define DF3_SHORT_IDDC		0x00000800L	/* As theme in IDDC, this dungeon only has half as many floors as usual */
5949 
5950 #define DF3_DERARE_MONSTERS	0x00001000L	/* Treat rarity of all monsters as '1' aka most common */
5951 #define DF3_MANY_MONSTERS	0x00002000L	/* Spawn 1.5x as many monsters as usual */
5952 #define DF3_VMANY_MONSTERS	0x00004000L	/* Spawn twice as many monsters as usual */
5953 #define DF3_DEEPSUPPLY		0x00008000L	/* allow generation of dungeon stores offering supplies, on deep floors (for ironman deep dive challenge) (overrides DF3_NO_SIMPLE_STORES) */
5954 
5955 #define DF3_NO_WALL_STREAMERS	0x00010000L	/* No streamers (any wall types) */
5956 #define DF3_NOT_EMPTY		0x00020000L	/* Disallow arena levels */
5957 #define DF3_NOT_WATERY		0x00040000L	/* No 'watery' dungeon -> no water rivers */
5958 #define DF3_FEW_ROOMS		0x00080000L	/* Less room_build() calls for any sort of struct (including vaults) */
5959 
5960 #define DF3_NO_VAULTS		0x00100000L	/* Less room_build() calls for any sort of struct (including vaults) */
5961 #define DF3_NO_MAZE		0x00200000L	/* don't build (perma)mazes */
5962 #define DF3_NO_EMPTY		0x00400000L	/* don't build empty levels (arenas) */
5963 #define DF3_NO_DESTROYED	0x00800000L	/* don't build 'destroyed' levels */
5964 
5965 #define DF3_NO_TELE		0x01000000L	/* Disallow any teleportation (to go with NO_SUMMON -- for new experimental dungeoneering) */
5966 #define DF3_NO_ESP		0x02000000L	/* Disallow any ESP */
5967 #define DF3_NO_SUMMON		0x04000000L	/* Disallow any summoning (to go with NO_TELE -- for new experimental dungeoneering) */
5968 #define DF3_LIMIT_ESP		0x08000000L	/* All ESP gets its range limited */
5969 
5970 /* all flags that may modify a custom 'wilderness' (type 0) dungeon's appearance, 'theming' it,
5971    without changing its main flags (set my admin on dungeon creation) too much */
5972 #define DF3_THEME_MASK \
5973 	(DF3_DERARE_MONSTERS | DF3_MANY_MONSTERS | DF3_VMANY_MONSTERS | \
5974 	DF3_NO_WALL_STREAMERS | DF3_NOT_EMPTY | DF3_NOT_WATERY | DF3_FEW_ROOMS | DF3_NO_VAULTS | DF3_NO_MAZE | DF3_NO_EMPTY | DF3_NO_DESTROYED)
5975 
5976 
5977 /* level flags for dun_level */
5978 #define LF1_DUNGEON_TOWN	0x00000001L /* is a dungeon town! (why was there a flag hole at 0x1 here? oO) */
5979 #define LF1_ASK_LEAVE           0x00000002L /* XXX */
5980 #define LF1_NO_STAIR            0x00000004L /* XXX ok */
5981 #define LF1_SPECIAL             0x00000008L /* XXX */
5982 
5983 #define LF1_NO_NEW_MONSTER      0x00000010L /* XXX ok */
5984 #define LF1_DESC                0x00000020L /* XXX */
5985 #define LF1_NO_GENO             0x00000040L
5986 #define LF1_NO_MAP		0x00000080L /* player never gains level knowledge */
5987 
5988 #define LF1_NO_MAGIC_MAP	0x00000100L /* player never does magic mapping */
5989 #define LF1_NO_DESTROY          0x00000200L /* Cannot use Destruction spells/Earthquakes */
5990 #define LF1_NO_MAGIC		0x00000400L /* very nasty */
5991 #define LF1_NO_GHOST		0x00000800L /* Players who die on this level are erased completely! */
5992 
5993 #define LF1_IRON_RECALL		0x00001000L /* Recalling is allowed on this floor of an IRONMAN dungeon/tower */
5994 #define LF1_RANDOM_TOWN		0x00002000L /* it's a random (dungeon) town (for tracking in IDDC) */
5995 #define LF1_CUSTOM_GATEWAY	0x00004000L /* Marker that on this floor a custom gateway has been placed by a player (limiter) */
5996 //FLAG HOLE
5997 
5998 #define LF1_WATER		0x01000000L	/* for DIGGING: water rivers or base grids are being used */
5999 #define LF1_LAVA		0x02000000L	/* for DIGGING: lava rivers or base grids are being used */
6000 #define LF1_NO_WATER		0x04000000L	/* for DIGGING: water rivers or base grids are being used */
6001 #define LF1_NO_LAVA		0x08000000L	/* for DIGGING: lava rivers or base grids are being used */
6002 
6003 #define LF1_DEEP_WATER		0x10000000L	/* Dungeon uses deep water as floor tile: Make all water streamers/rivers deep too */
6004 #define LF1_DEEP_LAVA		0x20000000L	/* Dungeon uses deep lava as floor tile: Make all lava streamers/rivers deep too */
6005 //#define LF1_SPAWN_MARKER	0x40000000L	/* Mark that a special monster has already been spawned; Added for Nether Guards in the Nether Realm */
6006 #define LF1_NO_MULTIPLY		0x80000000L /* for scrolls of vermin control */
6007 
6008 #define LF1_FEELING_MASK \
6009 	(LF1_NO_GENO | LF1_NO_MAP | LF1_NO_MAGIC_MAP | \
6010 	 LF1_NO_DESTROY | LF1_NO_MAGIC | LF1_NO_GHOST)
6011 /*
6012  * Possible flags for the future:
6013  *
6014  * (generation:)
6015  * LF1_ALL_PERMAWALL
6016  * LF1_WATERY
6017  * LF1_LAVA
6018  *
6019  * (gameplay:)
6020  */
6021 
6022 /* extra level flags for dun_level -- for 'extra feeling' generation */
6023 #define LF2_UNIQUE	0x00000001L	/* a unique monster has been generated */
6024 #define LF2_OOD		0x00000002L	/* a freely roaming ood has been generated */
6025 #define LF2_OOD_FREE	0x00000004L	/* a freely roaming ood has been generated */
6026 #define LF2_OOD_HI	0x00000008L	/* a freely roaming ood has been generated */
6027 
6028 #define LF2_VAULT	0x00000010L	/* a vault has been generated */
6029 #define LF2_VAULT_OPEN	0x00000020L	/* a non-closed vault has been generated (ew) */
6030 #define LF2_VAULT_HI	0x00000040L	/* a highly ood in vault been generated */
6031 #define LF2_PITNEST	0x00000080L	/* pit/nest on level */
6032 
6033 #define LF2_PITNEST_HI	0x00000100L	/* high threat pit/nest on level */
6034 #define LF2_ITEM_OOD	0x00000200L	/* ood item on level */
6035 #define LF2_ARTIFACT	0x00000400L	/* artifact on level */
6036 #define LF2_INDOORS	0x00000800L	/* world surface (sector00 usually) is treated like a dungeon floor, causing no sun burn to vampires */
6037 
6038 #define LF2_NO_RUN	0x00001000L	/* Cannot run on this level, walk only */
6039 #define LF2_NO_TELE	0x00002000L	/* Cannot use phase/tele on this level */
6040 #define LF2_NO_DETECT	0x00004000L	/* Cannot use detection on this level */
6041 #define LF2_NO_ESP	0x00008000L	/* ESP is disabled on this level */
6042 
6043 #define LF2_ESP		0x00010000L	/* Everyone on the level automatically gains full ESP */
6044 #define LF2_NO_SPEED	0x00020000L	/* Everyone on the level moves at most at +0 speed */
6045 #define LF2_NO_RES_HEAL	0x00040000L	/* Players on the level will have no elemental resistances/immunities and unable to utilise healing magic/potions */
6046 #define LF2_LIMIT_ESP	0x00080000L	/* All ESP gets limited in range */
6047 
6048 #define LF2_FAIR_TERRAIN_DAM	0x00100000L	/* Terain damage each player takes is roughly a fixed percentage of his max HP */
6049 #define LF2_DUN_BOSS	0x00200000L
6050 #define LF2_COLLAPSING	0x00400000L	/* audiovisual show when Zu-Aon is defeated ;) - C. Blue */
6051 #define LF2_NO_SUMMON	0x00800000L	/* disallow any summoning (to go with NO_TELE :) for new experimental dungeoneering) */
6052 
6053 
6054 /* minimum time required to stay on current floor in order to get an extra feeling on next floor */
6055 #define TURNS_FOR_EXTRA_FEELING		(cfg.fps * 120)
6056 
6057 /* Enable strict probability-travel prevention by NO_MAGIC floor flag, even in up/down direction? */
6058 //#define NOMAGIC_INHIBITS_LEVEL_PROBTRAVEL
6059 
6060 
6061 
6062 /* vault flags for v_info */
6063 #define VF1_FORCE_FLAGS		0x00000001L
6064 #define VF1_NO_TELEPORT         0x00000002L
6065 #define VF1_NO_GENO             0x00000004L
6066 #define VF1_NO_MAP		0x00000008L	/* player never gains level knowledge */
6067 #define VF1_NO_MAGIC_MAP	0x00000010L	/* player never does magic mapping */
6068 #define VF1_NO_DESTROY          0x00000020L
6069 #define VF1_NO_MAGIC		0x00000040L /* very nasty */
6070 
6071 #define VF1_NO_EASY_TRUEARTS	0x001000000L /* on shallow levels, this vault won't contain any truearts */
6072 #define VF1_NO_EASY_RANDARTS	0x002000000L /* on shallow levels, this vault won't contain any randarts */
6073 #define VF1_RARE_TRUEARTS	0x004000000L /* reduced chance to contain truearts */
6074 #define VF1_RARE_RANDARTS	0x008000000L /* reduced chance to contain randarts */
6075 
6076 #define VF1_NO_TRUEARTS		0x01000000L /* this vault won't contain any truearts (except if a monster drops one) */
6077 #define VF1_NO_RANDARTS		0x02000000L /* this vault won't contain any randarts (except if a monster drops one) */
6078 
6079 #define VF1_NO_PENETR		0x10000000L /* river/lava never penetrates vault */
6080 #define VF1_HIVES		0x20000000L /* put same vaults like beehives */
6081 #define VF1_NO_MIRROR		0x40000000L /* not suitable for mirroring */
6082 #define VF1_NO_ROTATE		0x80000000L /* not suitable for rotation */
6083 
6084 
6085 
6086 /*** Macro Definitions ***/
6087 
6088 
6089 /*
6090  * Hack -- Old-style names
6091  */
6092 #define term_screen	(ang_term[0])
6093 #define term_mirror	(ang_term[1])
6094 #define term_recall	(ang_term[2])
6095 #define term_choice	(ang_term[3])
6096 #define term_term_4     (ang_term[4])
6097 #define term_term_5     (ang_term[5])
6098 #define term_term_6     (ang_term[6])
6099 #define term_term_7     (ang_term[7])
6100 
6101 
6102 /*
6103  * Determine if a given inventory item is "aware"
6104  */
6105 #define object_aware_p(IND, T) \
6106     (Players[IND]->obj_aware[(T)->k_idx])
6107 
6108 /*
6109  * Determine if a given inventory item is "tried"
6110  */
6111 #define object_tried_p(IND, T) \
6112     (Players[IND]->obj_tried[(T)->k_idx])
6113 
6114 /*
6115  * Determine if a given inventory item is "felt"
6116  */
6117 #define object_felt_p(IND, T) \
6118     (Players[IND]->obj_felt[(T)->k_idx])
6119 #define object_felt_heavy_p(IND, T) \
6120     (Players[IND]->obj_felt_heavy[(T)->k_idx])
6121 
6122 
6123 /*
6124  * Determine if a given inventory item is "known"
6125  * Test One -- Check for special "known" tag
6126  * Test Two -- Check for "Easy Know" + "Aware" ( + not "Arts" nor "ego")
6127  */
6128 #define object_known_p(IND, T) \
6129     (((T)->ident & ID_KNOWN) || \
6130      (k_info[(T)->k_idx].easy_know && Players[IND]->obj_aware[(T)->k_idx] && \
6131 	 !(T)->name1 && !(T)->name2 && !(T)->name2b))
6132 
6133 #define object_fully_known_p(IND, T) \
6134 	(object_known_p(IND,T) && ((T)->ident & ID_MENTAL))
6135 
6136 
6137 /*
6138  * Return the "attr" for a given item.
6139  * Allow user redefinition of "aware" items.
6140  * Default to the "base" attr for unaware items
6141  */
6142 #if 0
6143  #define object_attr(T) \
6144     ((k_info[(T)->k_idx].aware) ? \
6145      (k_info[(T)->k_idx].x_attr) : \
6146      (k_info[(T)->k_idx].d_attr))
6147 
6148  #define object_attr(T) \
6149     (k_info[(T)->k_idx].x_attr)
6150 
6151  #define object_attr(T) \
6152     (p_ptr->k_attr[(T)->k_idx])
6153 
6154 #endif
6155 
6156 #define object_attr(T) \
6157     ((p_ptr->obj_aware[(T)->k_idx]) ? \
6158      (p_ptr->k_attr[(T)->k_idx]) : \
6159      (p_ptr->d_attr[(T)->k_idx]))
6160 
6161 /*
6162  * Return the "char" for a given item.
6163  * Allow user redefinition of "aware" items.
6164  * Default to the "base" char for unaware items
6165  */
6166 #if 0
6167 #define object_char(T) \
6168     ((k_info[(T)->k_idx].aware) ? \
6169      (k_info[(T)->k_idx].x_char) : \
6170      (k_info[(T)->k_idx].d_char))
6171 
6172 #define object_char(T) \
6173     (k_info[(T)->k_idx].x_char)
6174 
6175 #define object_char(T) \
6176     (p_ptr->k_char[(T)->k_idx])
6177 #endif
6178 
6179 #define object_char(T) \
6180     ((p_ptr->obj_aware[(T)->k_idx]) ? \
6181      (p_ptr->k_char[(T)->k_idx]) : \
6182      (p_ptr->d_char[(T)->k_idx]))
6183 
6184 
6185 
6186 /*
6187  * Artifacts use the "name1" field
6188  */
6189 #define artifact_p(T) \
6190         ((T)->name1 ? TRUE : FALSE)
6191 
6192 #define true_artifact_p(T) \
6193         (artifact_p(T) && ((T)->name1 != ART_RANDART))
6194 
6195 /* artifacts that can occur multiple times legally */
6196 #define multiple_artifact_p(T) \
6197         ((T)->name1 == ART_MORGOTH || (T)->name1 == ART_GROND || \
6198 	(T)->name1 == ART_CLOAK_DM || (T)->name1 == ART_GOGGLES_DM || (T)->name1 == ART_SCYTHE_DM)
6199 
6200 /* artifacts that aren't supposed to show up in non-admins' art lists */
6201 #define admin_artifact_p(T) \
6202 	((T)->name1 == ART_CLOAK_DM || (T)->name1 == ART_GOGGLES_DM || (T)->name1 == ART_SCYTHE_DM)
6203 
6204 /* artifacts that as an exception can by used by winners */
6205 #define winner_artifact_p(T) \
6206 	((k_info[(T)->k_idx].flags5 & TR5_WINNERS_ONLY) || \
6207 	(T)->name1 == ART_MORGOTH || (T)->name1 == ART_GROND || \
6208 	(T)->name1 == ART_PHASING || (T)->name1 == ART_MIRROROFGLORY)
6209 
6210 /* allow Ring of Phasing to be permanent until someone else beats Zu-Aon */
6211 #define RING_OF_PHASING_NO_TIMEOUT
6212 
6213 /* artifacts that cannot be deposited on an empty/deallocated dun/wild floor,
6214    nor being dropped inside houses (if cfg.anti_arts_hoard is on.) */
6215 #define undepositable_artifact_p(T) \
6216 	(true_artifact_p(T) && !multiple_artifact_p(T))
6217 
6218 /* artifacts that are not reset on server artifact resets.
6219    NOTE: for winner_artefacts that AREN'T multiple_artifacts it's debatable! */
6220 #define resettable_artifact_p(T) \
6221 	(true_artifact_p(T) && !( \
6222 	admin_artifact_p(T) || \
6223 	(winner_artifact_p(T) && multiple_artifact_p(T)) \
6224 	))
6225 
6226 /* items that are supposed to act like artifacts in certain situations.
6227    Example: Stormbringer resists Nazgul, although it's just an ego item. */
6228 #define like_artifact_p(T) \
6229 	(artifact_p(T) || \
6230 	((T)->name2 == EGO_STORMBRINGER) || ((T)->name2b == EGO_STORMBRINGER) \
6231 	)
6232 
6233 
6234 /*
6235  * Ego-Items use the "name2" field
6236  */
6237 #define ego_item_p(T) \
6238         ((T)->name2 || (T)->name2b ? TRUE : FALSE)
6239 
6240 /*
6241  * Ego-Items use the "name2" field
6242  */
6243 #define is_ego_p(T, e) \
6244 	(((T)->name2 == (e)) || ((T)->name2b == (e)))
6245 /*	((T)->name2 == (e)) */
6246 
6247 
6248 /*
6249  * Broken items.
6250  */
6251 #define broken_p(T) \
6252         ((T)->ident & ID_BROKEN)
6253 
6254 /*
6255  * Cursed items.
6256  */
6257 #define cursed_p(T) \
6258         ((T)->ident & ID_CURSED)
6259 
6260 
6261 
6262 /*
6263  * Determines if a map location is fully inside the outer walls
6264  */
6265 #define in_bounds(Y,X) \
6266    (((Y) > 0) && ((X) > 0) && ((Y) < MAX_HGT-1) && ((X) < MAX_WID-1))
6267 
6268 /* loosest check for seg fault */
6269 #define in_bounds_array(Y,X) \
6270    (((Y) >= 0) && ((X) >= 0) && ((Y) < MAX_HGT) && ((X) < MAX_WID))
6271 
6272 
6273 /*
6274  * Determines if a map location is on or inside the outer walls
6275  */
6276 #define in_bounds2(WPOS,Y,X) \
6277    ((istown(WPOS) ? (((Y) >= 0) && ((X) >= 0) && ((Y) < MAX_HGT) && ((X) < MAX_WID)) \
6278            : (((Y) > 0) && ((X) > 0) && ((Y) < MAX_HGT) && ((X) < MAX_WID))))
6279 
6280 /*
6281  * replacement of in_bound2 -
6282  * Determines if a map location is on or inside the outer walls,
6283  * using current hgt/wid	- Jir -
6284  */
6285 #define in_bounds3(WPOS,l_ptr,Y,X) \
6286 	(istown(WPOS) ? in_bounds2(WPOS,Y,X) : in_bounds4(l_ptr,Y,X))
6287 #if 0
6288    (istown(WPOS) ? (((Y) >= 0) && ((X) >= 0) && ((Y) < (l_ptr)->hgt) && ((X) < (l_ptr)->wid)) \
6289            : (((Y) > 0) && ((X) > 0) && ((Y) < MAX_HGT) && ((X) < MAX_WID))))
6290 #endif	/* 0 */
6291 
6292 /* replacement of in_bounds. */
6293 #define in_bounds4(l_ptr,Y,X) \
6294    (l_ptr ? \
6295 	(((Y) > 0) && ((X) > 0) && ((Y) < (l_ptr)->hgt - 1) && ((X) < (l_ptr)->wid - 1)) \
6296 	: in_bounds(Y,X))
6297 
6298 /*   (((Y) > 0) && ((X) > 0) && ((Y) < (l_ptr)->hgt) && ((X) < (l_ptr)->wid))  */
6299 
6300 
6301 /* wilderness version of in_bounds */
6302 #define in_bounds_wild(Y,X) \
6303    (((Y) >= 0) && ((X) >= 0) && ((Y) < MAX_WILD_Y) && ((X) < MAX_WILD_X))
6304 
6305 
6306 /*
6307  * Determines if a map location is currently "on screen" -RAK-
6308  * Note that "panel_contains(Y,X)" always implies "in_bounds2(Y,X)".
6309  */
6310 #define panel_contains(Y,X) \
6311   (((Y) >= p_ptr->panel_row_min) && ((Y) <= p_ptr->panel_row_max) && \
6312    ((X) >= p_ptr->panel_col_min) && ((X) <= p_ptr->panel_col_max))
6313 
6314 
6315 
6316 /*
6317  * Determine if a "legal" grid is a "floor" grid
6318  *
6319  * Line 1 -- forbid doors, rubble, seams, walls
6320  *
6321  * Note that the terrain features are split by a one bit test
6322  * into those features which block line of sight and those that
6323  * do not, allowing an extremely fast single bit check below.
6324  */
6325 #define cave_floor_bold(ZCAVE,Y,X) \
6326 	(f_info[ZCAVE[Y][X].feat].flags1 & FF1_FLOOR)
6327 
6328 /* Adding FF1_LOS to have LOS across FEAT_DARK_PIT grids */
6329 #define cave_los(ZCAVE,Y,X) \
6330 	(((f_info[ZCAVE[Y][X].feat].flags1 & FF1_LOS) || (f_info[ZCAVE[Y][X].feat].flags1 & FF1_FLOOR)) && \
6331 	!(f_info[ZCAVE[Y][X].feat].flags1 & FF1_BLOCK_LOS))
6332 
6333 /* Complete check for projections/shots */
6334 #define cave_contact(ZCAVE,Y,X) \
6335 	(((f_info[ZCAVE[Y][X].feat].flags1 & FF1_LOS) || (f_info[ZCAVE[Y][X].feat].flags1 & FF1_FLOOR)) && \
6336 	!(f_info[ZCAVE[Y][X].feat].flags1 & (FF1_BLOCK_LOS | FF1_BLOCK_CONTACT)))
6337 
6338 /* a 'wall los' which ignores non-perma-walls (for los_wall()) */
6339 #define cave_los_wall(ZCAVE,Y,X) \
6340 	(!(f_info[ZCAVE[Y][X].feat].flags1 & FF1_PERMANENT))
6341 
6342 /* Replaces cave_los() for projection-blockade checks, so project() can directly target
6343    certain wall-like feats that aren't really walls, such as mountains and trees */
6344 #define cave_proj(ZCAVE,Y,X) \
6345 	(cave_los(ZCAVE,Y,X) || \
6346 	(f_info[ZCAVE[Y][X].feat].flags1 & FF1_CAN_CLIMB) || \
6347 	(f_info[ZCAVE[Y][X].feat].flags1 & FF1_CAN_LEVITATE))
6348 
6349 /*
6350 #define cave_block_los(ZCAVE,Y,X) \
6351 	(f_info[ZCAVE[Y][X].feat].flags1 & FF1_BLOCK_LOS)*/
6352 
6353 /* Is a grid any sort of removable wall? */
6354 #define cave_dig_wall(ZCAVE,Y,X) \
6355 	(!(f_info[ZCAVE[Y][X].feat].flags1 & (FF1_FLOOR | FF1_PERMANENT)))
6356 
6357 /*
6358  * Determine if a "legal" grid is a "floor" grid or a passable grid
6359  * due to special abilities of a player, making it same to floor grid. (for run_test())
6360  * (NEW_RUNNING_FEAT)
6361 92  == FEAT_DEAD_TREE
6362 96  == FEAT_TREE
6363 202 == FEAT_IVY
6364 219 == FEAT_BUSH
6365 84  == FEAT_SHAL_WATER
6366 103 == FEAT_GLIT_WATER
6367 174 == FEAT_TAINTED_WATER
6368 187 == FEAT_DEEP_WATER
6369 
6370 97  == FEAT_MOUNTAIN
6371  */
6372 #define cave_running_bold(p_ptr,ZCAVE,Y,X) \
6373 	((f_info[ZCAVE[Y][X].feat].flags1 & FF1_FLOOR) || \
6374 	((f_info[ZCAVE[Y][X].feat].flags1 & FF1_CAN_LEVITATE) && p_ptr->levitate) || \
6375 	((ZCAVE[Y][X].feat == FEAT_DEAD_TREE || ZCAVE[Y][X].feat == FEAT_TREE || ZCAVE[Y][X].feat == FEAT_BUSH) && (p_ptr->pass_trees || p_ptr->levitate)) || /* fly is redundant, covered a line above */ \
6376 	((ZCAVE[Y][X].feat == FEAT_SHAL_WATER || ZCAVE[Y][X].feat == FEAT_GLIT_WATER || ZCAVE[Y][X].feat == FEAT_TAINTED_WATER || ZCAVE[Y][X].feat == FEAT_DEEP_WATER) && p_ptr->can_swim))
6377 /* adding this to prevent annoying stops when running in barrow-downs while tree-passing --
6378    note last line, added for Paths of the Dead, allowing to run over pits */
6379 #define cave_running_bold_notrees(p_ptr,ZCAVE,Y,X) \
6380 	( ((f_info[ZCAVE[Y][X].feat].flags1 & FF1_FLOOR) || \
6381 	((f_info[ZCAVE[Y][X].feat].flags1 & FF1_CAN_LEVITATE) && p_ptr->levitate) || \
6382 	((ZCAVE[Y][X].feat == FEAT_SHAL_WATER || ZCAVE[Y][X].feat == FEAT_GLIT_WATER || ZCAVE[Y][X].feat == FEAT_TAINTED_WATER || ZCAVE[Y][X].feat == FEAT_DEEP_WATER) && p_ptr->can_swim)) \
6383 	&& !(ZCAVE[Y][X].feat == FEAT_DEAD_TREE || ZCAVE[Y][X].feat == FEAT_TREE || ZCAVE[Y][X].feat == FEAT_BUSH || \
6384 	    ZCAVE[Y][X].feat == FEAT_DARK_PIT) )
6385 /* adding this to prevent annoying stops when running in barrow-downs while tree-passing --
6386    note last line, added for Paths of the Dead, so players running through hallways don't stop at pits */
6387 #define cave_running_bold_trees(p_ptr,ZCAVE,Y,X) \
6388 	(((ZCAVE[Y][X].feat == FEAT_DEAD_TREE || ZCAVE[Y][X].feat == FEAT_TREE || ZCAVE[Y][X].feat == FEAT_BUSH) && (p_ptr->pass_trees || p_ptr->levitate)) || \
6389 	((ZCAVE[Y][X].feat == FEAT_DARK_PIT) && p_ptr->levitate))
6390 
6391 /* for summoning on mountains */
6392 #define cave_empty_mountain(ZCAVE,Y,X) \
6393     (cave_mountain_bold(ZCAVE,Y,X) && \
6394      !(ZCAVE[Y][X].m_idx))
6395 #define cave_mountain_bold(ZCAVE,Y,X) \
6396 	(f_info[ZCAVE[Y][X].feat].flags1 & FF1_CAN_CLIMB)
6397 
6398 /*
6399  * Determine if a "legal" grid is a "clean" floor grid
6400  *
6401  * Line 1 -- forbid non-floors
6402  * Line 2 -- forbid normal objects
6403  */
6404 #define cave_clean_bold(ZCAVE,Y,X) \
6405 	((f_info[ZCAVE[Y][X].feat].flags1 & FF1_FLOOR) && \
6406 	 !(f_info[ZCAVE[Y][X].feat].flags1 & FF1_PERMANENT) && \
6407 	 (ZCAVE[Y][X].o_idx == 0))
6408 #if 0
6409     ((ZCAVE[Y][X].feat >= FEAT_FLOOR) && \
6410      (ZCAVE[Y][X].feat <= FEAT_MUD) && \
6411      (!ZCAVE[Y][X].o_idx))
6412 /*     (ZCAVE[Y][X].feat <= FEAT_LOOSE_DIRT) && \   */
6413 #endif	/* 0 */
6414 
6415 /*
6416  * Determine if a "legal" grid is an "empty" floor grid
6417  *
6418  * Line 1 -- forbid doors, rubble, seams, walls
6419  * Line 2 -- forbid normal monsters
6420  * Line 3 -- forbid any player
6421  */
6422 #define cave_empty_bold(ZCAVE,Y,X) \
6423     (cave_floor_bold(ZCAVE,Y,X) && \
6424      !(ZCAVE[Y][X].m_idx))
6425 
6426 /*
6427  * Determine if a "legal" grid is an "naked" floor grid
6428  *
6429  * Line 1 -- forbid non-floors
6430  * Line 2 -- forbid normal objects
6431  * Line 3 -- forbid normal monsters
6432  * Line 4 -- forbid any player
6433  */
6434 /* Hrm, the new one allows to create stairs/fountains etc on a open door.
6435  * Should it be banned? */
6436 #define cave_naked_bold(ZCAVE,Y,X) \
6437 	((f_info[ZCAVE[Y][X].feat].flags1 & FF1_FLOOR) && \
6438 	 !(f_info[ZCAVE[Y][X].feat].flags1 & FF1_PERMANENT) && \
6439 	  (ZCAVE[Y][X].o_idx == 0) && \
6440 	  (ZCAVE[Y][X].m_idx == 0))
6441 
6442 #if 0
6443     ((ZCAVE[Y][X].feat >= FEAT_FLOOR) && \
6444      (ZCAVE[Y][X].feat <= FEAT_MUD) && \
6445      !(ZCAVE[Y][X].o_idx) && \
6446      !(ZCAVE[Y][X].m_idx))
6447 /*     (ZCAVE[Y][X].feat <= FEAT_DIRT) && \ */
6448 #endif	/* 0 */
6449 
6450 #define cave_naked_bold2(Y,X) \
6451 	((f_info[ZCAVE[Y][X].feat].flags1 & FF1_FLOOR) && \
6452 	  (ZCAVE[Y][X].o_idx == 0) && \
6453 	  (ZCAVE[Y][X].m_idx == 0))
6454 
6455 
6456 /*
6457  * Determine if a "legal" grid is "permanent"
6458  *
6459  * Line 1 -- perma-walls
6460  * Line 2-3 -- stairs
6461  * Line 4-5 -- shop doors
6462  * Lines 5-6 -- home doors
6463  */
6464 #define cave_perma_bold(ZCAVE,Y,X) \
6465 	(f_info[ZCAVE[Y][X].feat].flags1 & FF1_PERMANENT)
6466 #if 0
6467     ((ZCAVE[Y][X].feat >= FEAT_PERM_EXTRA) || \
6468      ((ZCAVE[Y][X].feat == FEAT_LESS) || \
6469       (ZCAVE[Y][X].feat == FEAT_MORE)) || \
6470      ((ZCAVE[Y][X].feat >= FEAT_SHOP_HEAD) && \
6471       (ZCAVE[Y][X].feat <= FEAT_SHOP_TAIL)) || \
6472      ((ZCAVE[Y][X].feat >= FEAT_HOME_HEAD) && \
6473       (ZCAVE[Y][X].feat <= FEAT_HOME_TAIL)))
6474 #endif	/* 0 */
6475 
6476 /*
6477  * Is a given location "valid" for placing things?
6478  *
6479  * Permanent grids are never "valid" (see above).
6480  *
6481  * Hack -- a grid with an artifact in it is never valid.
6482  *
6483  * This function is often "combined" with "cave_floor_bold(Y,X)"
6484  * or one of the other similar macros above.
6485  *
6486  * Line 1 -- forbid perma-grids
6487  * Line 2-3 -- forbid grids containing artifacts
6488  * Line 4 -- forbit house doors
6489  */
6490 #if 0	/* moved to cave.c */
6491 #define cave_valid_bold(ZCAVE,Y,X) \
6492     (!cave_perma_bold(ZCAVE,Y,X) && \
6493      (!ZCAVE[Y][X].o_idx || \
6494       !artifact_p(&o_list[ZCAVE[Y][X].o_idx])))
6495 #endif	/* 0 */
6496 
6497 /*
6498  * Grid based version of "cave_floor_bold()"
6499  */
6500 #define cave_floor_grid(C) \
6501     (f_info[(C)->feat].flags1 & FF1_FLOOR)
6502 
6503 /* Grid based version of "cave_dig_wall()" */
6504 #define cave_dig_wall_grid(C) \
6505 	(!(f_info[(C)->feat].flags1 & (FF1_FLOOR | FF1_PERMANENT)))
6506 
6507 /*
6508  * Grid based version of "cave_floor_bold()"
6509  */
6510 #define cave_los_grid(C) \
6511     (((f_info[(C)->feat].flags1 & FF1_FLOOR) || (f_info[(C)->feat].flags1 & FF1_LOS)) && \
6512     !(f_info[(C)->feat].flags1 & FF1_BLOCK_LOS))
6513 
6514 /*
6515  * Grid based version of "cave_plain_floor_bold()"
6516  */
6517 #define cave_plain_floor_grid(C) \
6518 	((f_info[(C)->feat].flags1 & FF1_FLOOR) && \
6519 	 !(f_info[(C)->feat].flags1 & FF1_REMEMBER))
6520 
6521 
6522 /*
6523  * Grid based version of "cave_clean_bold()"
6524  */
6525 #define cave_clean_grid(C) \
6526     ((f_info[(C)->feat].flags1 & FF1_FLOOR) && (!(C)->o_idx))
6527 #if 0
6528     (((C)->feat >= FEAT_FLOOR) && \
6529      ((C)->feat <= FEAT_DIRT) && \
6530      (!(C)->o_idx))
6531 #endif	/* 0 */
6532 
6533 /*
6534  * Grid based version of "cave_empty_bold()"
6535  */
6536 #define cave_empty_grid(C) \
6537     (cave_floor_grid(C) && \
6538      !((C)->m_idx))
6539 
6540 /*
6541  * Grid based version of "cave_empty_bold()"
6542  */
6543 #define cave_naked_grid(C) \
6544     ((f_info[(C)->feat].flags1 & FF1_FLOOR) && \
6545      !((C)->o_idx) && \
6546      !((C)->m_idx) && \
6547      !((C) == &cave[py][px]))
6548 #if 0
6549     (((C)->feat >= FEAT_FLOOR) && \
6550      ((C)->feat <= FEAT_DIRT) && \
6551      !((C)->o_idx) && \
6552      !((C)->m_idx))
6553 #endif	/* 0 */
6554 
6555 
6556 /*
6557  * Grid based version of "cave_perma_bold()"
6558  */
6559 #define cave_perma_grid(C) \
6560        (f_info[(C)->feat].flags1 & FF1_PERMANENT)
6561 #if 0
6562     (((C)->feat >= FEAT_PERM_EXTRA) || \
6563      (((C)->feat == FEAT_LESS) || \
6564       ((C)->feat == FEAT_MORE)) || \
6565      (((C)->feat >= FEAT_SHOP_HEAD) && \
6566       ((C)->feat <= FEAT_SHOP_TAIL)))
6567 #endif	/* 0 */
6568 
6569 
6570 /*
6571  * Grid based version of "cave_valid_bold()"
6572  */
6573 #define cave_valid_grid(C) \
6574     (!cave_perma_grid(C) && \
6575      (!(C)->o_idx || \
6576       !artifact_p(&o_list[(C)->o_idx])))
6577 
6578 
6579 
6580 /*
6581  * Determine if a "legal" grid is within "los" of the player
6582  *
6583  * Note the use of comparison to zero to force a "boolean" result
6584  */
6585 #define player_has_los_bold(IND,Y,X) \
6586     ((Players[IND]->cave_flag[Y][X] & CAVE_VIEW) != 0)
6587 
6588 
6589 
6590 
6591 /*
6592  * Determine if a creature can enter a certain grid - C. Blue
6593  * Every check that would return a "do_move = TRUE" is added below.
6594  * The two checks that check whether do_move wouldn't be set to TRUE are left out for now,
6595  * those will remain in the according places in melee2.c.
6596  * One check that checks for an opposing player is also left out, since this function might
6597  * be used for pets/golem monsters.
6598  * Summary: This macro performs all checks which wouldn't do more than setting do_move = TRUE.
6599  *          The checks that do more than that (like setting did_pass_wall) are excluded.
6600  */
6601 
6602 #define creature_can_enter(R,C) \
6603     (cave_floor_grid(C) || /* Floor is open? */ \
6604     (((f_info[(C)->feat].flags1 & FF1_CAN_FEATHER) && ((R)->flags7 & RF7_CAN_FLY)) || /* Some monsters can fly */ \
6605     ((f_info[(C)->feat].flags1 & FF1_CAN_LEVITATE) && ((R)->flags7 & RF7_CAN_FLY))) || \
6606     /* Some monsters live in the woods natively - Should be moved to monster_can_cross_terrain (C. Blue) */ \
6607     /* else if <<c_ptr->feat==FEAT_TREE || c_ptr->feat==FEAT_EVIL_TREE || */ \
6608     (((C)->feat == FEAT_DEAD_TREE || (C)->feat == FEAT_TREE || (C)->feat == FEAT_BUSH) && \
6609     (((R)->flags8 & RF8_WILD_WOOD) || ((R)->flags3 & RF3_ANIMAL) || \
6610     /* KILL_WALL / PASS_WALL  monsters can hack down / pass trees */ \
6611     ((R)->flags2 & RF2_PASS_WALL) || ((R)->flags2 & RF2_KILL_WALL) || \
6612     /* POWERFUL monsters can hack down trees */ \
6613     ((R)->flags2 & RF2_POWERFUL))) || \
6614     /* Some monsters live in the mountains natively - Should be moved to monster_can_cross_terrain (C. Blue) */ \
6615     (((C)->feat == FEAT_MOUNTAIN) && \
6616     (((R)->flags8 & RF8_WILD_MOUNTAIN) || ((R)->flags8 & RF8_WILD_VOLCANO))))
6617 
6618     //((C)->m_idx < 0)) /* Player ghost in wall XXX */
6619     // (((c_ptr->feat != FEAT_SHOP) && /* Tavern entrance?(need GetCS to check that) // if (c_ptr->feat == FEAT_SHOP_TAIL - 1) */
6620     // ((m_ptr->ai_state & AI_STATE_EFFECT) || monster_is_safe(m_idx, m_ptr, r_ptr, c_ptr))) && /* Tainted grid? */
6621 
6622 /*
6623  * Extended version of the above. This one is used in find_hiding and find_safety - C. Blue
6624  * This version includes a full movement check of all possible grids, EXCEPT for
6625  * shops, AI_STATE vs monster_is_safe, bashable/openable features (doors).
6626  */
6627 
6628 #define creature_can_enter2(R,C) \
6629 (cave_floor_grid(C) || /* Floor is open? */ \
6630 (((f_info[(C)->feat].flags1 & FF1_CAN_FEATHER) && ((R)->flags7 & RF7_CAN_FLY)) || /* Some monsters can fly */ \
6631 ((f_info[(C)->feat].flags1 & FF1_CAN_LEVITATE) && ((R)->flags7 & RF7_CAN_FLY))) || \
6632 /* Some monsters live in the woods natively - Should be moved to monster_can_cross_terrain (C. Blue) */ \
6633 /* else if <<c_ptr->feat==FEAT_TREE || c_ptr->feat==FEAT_EVIL_TREE || */ \
6634 (((C)->feat == FEAT_DEAD_TREE || (C)->feat == FEAT_TREE || (C)->feat == FEAT_BUSH) && \
6635 (((R)->flags8 & RF8_WILD_WOOD) || ((R)->flags3 & RF3_ANIMAL) || \
6636 /* KILL_WALL / PASS_WALL  monsters can hack down / pass trees */ \
6637 ((R)->flags2 & RF2_PASS_WALL) || ((R)->flags2 & RF2_KILL_WALL) || \
6638 /* POWERFUL monsters can hack down trees */ \
6639 ((R)->flags2 & RF2_POWERFUL))) || \
6640 /* Some monsters live in the mountains natively - Should be moved to monster_can_cross_terrain (C. Blue) */ \
6641 (((C)->feat == FEAT_MOUNTAIN) && \
6642 (((R)->flags8 & RF8_WILD_MOUNTAIN) || ((R)->flags8 & RF8_WILD_VOLCANO))) || \
6643 /* Monster moves through walls (and doors) */ \
6644 /*  -- added check whether it's actually a WALL, to prevent monsters from crossing terrain they don't like (eg lava) */ \
6645 /*              else if (r_ptr->flags2 & RF2_PASS_WALL) */ \
6646 ((f_info[(C)->feat].flags1 & FF1_WALL) && (f_info[(C)->feat].flags1 & FF1_CAN_PASS) && ((R)->flags2 & (RF2_PASS_WALL))) || \
6647 /* Monster can crush walls (note: Morgoth isn't taken into account here, shouldn't matter much though) */ \
6648 /*  -- added check whether it's actually a WALL, to prevent monsters from crossing terrain they don't like (eg lava) */ \
6649 ((f_info[(C)->feat].flags1 & FF1_WALL) &&!(f_info[(C)->feat].flags1 & FF1_PERMANENT) && ((R)->flags2 & (RF2_KILL_WALL))) || \
6650 (C)->feat == FEAT_MON_TRAP) /* Floor is trapped? */ \
6651 
6652 
6653 /* A wall that doesn't "fill" the grid completely, ie could be passed without
6654    wraithform provided the required tools/abilities. */
6655 #define cave_passable(ZCAVE,Y,X) \
6656 	(f_info[ZCAVE[Y][X].feat].flags1 & FF1_SWITCH_MASK)
6657 
6658 
6659 
6660 /*
6661  * Hack -- Prepare to use the "Secure" routines
6662  */
6663 #if defined(SET_UID) && defined(SECURE)
6664 extern int PlayerUID;
6665 # define getuid() PlayerUID
6666 # define geteuid() PlayerUID
6667 #endif
6668 
6669 
6670 
6671 /*** Color constants ***/
6672 
6673 /*
6674  * Angband "attributes" (with symbols, and base (R,G,B) codes)
6675  *
6676  * The "(R,G,B)" codes are given in "fourths" of the "maximal" value,
6677  * and should "gamma corrected" on most (non-Macintosh) machines.
6678  */
6679 #define TERM_DARK	0	/* 'd' */	/* 0,0,0 */
6680 #define TERM_WHITE	1	/* 'w' */	/* 4,4,4 */
6681 #define TERM_SLATE	2	/* 's' */	/* 2,2,2 */
6682 #define TERM_ORANGE	3	/* 'o' */	/* 4,2,0 */
6683 #define TERM_RED	4	/* 'r' */	/* 3,0,0 */
6684 #define TERM_GREEN	5	/* 'g' */	/* 0,2,1 */
6685 #define TERM_BLUE	6	/* 'b' */	/* 0,0,4 */
6686 #define TERM_UMBER	7	/* 'u' */	/* 2,1,0 */
6687 #define TERM_L_DARK	8	/* 'D' */	/* 1,1,1 */
6688 #define TERM_L_WHITE	9	/* 'W' */	/* 3,3,3 */
6689 #define TERM_VIOLET	10	/* 'v' */	/* 4,0,4 */
6690 #define TERM_YELLOW	11	/* 'y' */	/* 4,4,0 */
6691 #define TERM_L_RED	12	/* 'R' */	/* 4,0,0 */
6692 #define TERM_L_GREEN	13	/* 'G' */	/* 0,4,0 */
6693 #define TERM_L_BLUE	14	/* 'B' */	/* 0,4,4 */
6694 #define TERM_L_UMBER	15	/* 'U' */	/* 3,2,1 */
6695 
6696 /* Non encoded shimmer attributes */
6697 #define TERM_MULTI	16	/* all the main colours */
6698 #define TERM_POIS	17	/* I Love this ;) */
6699 #define TERM_FIRE	18	/* fireball */
6700 #define TERM_COLD	19	/* cold */
6701 #define TERM_ACID	20	/* acid, similar to darkness */
6702 #define TERM_ELEC	21	/* elec */
6703 #define TERM_CONF	22	/* umber/lumber */
6704 #define TERM_SOUN	23	/* similar to lite */
6705 #define TERM_SHAR	24	/* umber/slate */
6706 #define TERM_LITE	25	/* similar to sound */
6707 #define TERM_DARKNESS	26	/* similar to acid */
6708 
6709 #define TERM_SHIELDM	27	/* mana shield */
6710 #define TERM_SHIELDI	28	/* invulnerability */
6711 
6712 #ifdef EXTENDED_TERM_COLOURS
6713  #define TERM_CURSE	29
6714  #define TERM_ANNI	30
6715 #endif
6716 
6717 #define TERM_HALF	31	/* only the brighter colours */
6718 
6719 #ifdef EXTENDED_TERM_COLOURS
6720  #define TERM_OLD_BNW	0x20	/* 32: black & white MASK, for admin wizards */
6721  #define TERM_OLD_PVP	0x40	/* 64: black & red MASK, for active PvP-hostility (or stormbringer) */
6722 
6723  #define TERM_PSI	32
6724  #define TERM_NEXU	33
6725  #define TERM_NETH	34
6726  #define TERM_DISE	35
6727  #define TERM_INER	36
6728  #define TERM_FORC	37
6729  #define TERM_GRAV	38
6730  #define TERM_TIME	39
6731  #define TERM_METEOR	40
6732  #define TERM_MANA	41
6733  #define TERM_DISI	42
6734  #define TERM_WATE	43
6735  #define TERM_ICE	44
6736  #define TERM_PLAS	45
6737  #define TERM_DETO	46
6738  #define TERM_NUKE	47
6739  #define TERM_UNBREATH	48
6740  #define TERM_HOLYORB	49
6741  #define TERM_HOLYFIRE	50
6742  #define TERM_HELLFIRE	51
6743  #define TERM_THUNDER	52
6744 
6745  #define TERM_LAMP	53
6746  #define TERM_LAMP_DARK	54
6747 
6748  #ifdef EXTENDED_BG_COLOURS
6749   #define TERM2_BLUE	63
6750  #endif
6751 
6752  #define TERM_BNW	0x40	/* 64: black & white MASK, for admin wizards */
6753  #define TERM_PVP	0x80	/* 128: black & red MASK, for active PvP-hostility (or stormbringer) */
6754 #else
6755  #define TERM_BNW	0x20	/* 32: black & white MASK, for admin wizards */
6756  #define TERM_PVP	0x40	/* 64: black & red MASK, for active PvP-hostility (or stormbringer) */
6757 
6758  /* Reserved attr values - do not exceed */
6759  #define TERM_RESERVED	0x80	/* 128 */
6760 #endif
6761 
6762 
6763 /*** Sound constants ***/
6764 /*
6765  * Mega-Hack -- some primitive sound support (see "main-win.c")
6766  *
6767  * Some "sound" constants for "Term_xtra(TERM_XTRA_SOUND, val)"
6768  */
6769 #define SOUND_HIT	1
6770 #define SOUND_MISS	2
6771 #define SOUND_FLEE	3
6772 #define SOUND_DROP	4
6773 #define SOUND_KILL	5
6774 #define SOUND_LEVEL	6
6775 #define SOUND_DEATH	7
6776 #define SOUND_WARN	8
6777 /*
6778  * Mega-Hack -- maximum known sounds
6779  */
6780 #define SOUND_MAX	8
6781 
6782 #ifdef USE_SOUND_2010
6783  #define SOUND_MAX_2010	400 /*for experimenting purpose - C. Blue*/
6784  #define MUSIC_MAX	100 /*for experimenting purpose - C. Blue*/
6785 
6786  //defines.h: (for client-side, from angband)
6787  /* Given an array, determine how many elements are in it: */
6788  //note: appearently doesnt work for the main purpose ie sound_modules -_- -C. Blue
6789  #define N_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
6790 
6791  /* for ovl_sfx_.. client options */
6792  #define SFX_TYPE_ATTACK	0
6793  #define SFX_TYPE_COMMAND	1
6794  #define SFX_TYPE_MISC		2
6795  #define SFX_TYPE_MON_ATTACK	3
6796  #define SFX_TYPE_MON_SPELL	4
6797  #define SFX_TYPE_MON_MISC	5
6798  #define SFX_TYPE_NO_OVERLAP	6
6799  /* special sound fx that "belong" to the looped background channel for
6800     'weather' or for 'ambient' sounds, yet use the normal sfx channels
6801     because they're one-time only: */
6802  #define SFX_TYPE_WEATHER	7	/* sfx uses 'weather' mixer settings instead of 'sound' */
6803  #define SFX_TYPE_AMBIENT	8
6804 
6805  /* new in 2013: for ambient sound fx channel (inn fireplace!) */
6806  #define SFX_AMBIENT_NONE	-1
6807  #define SFX_AMBIENT_FIREPLACE	0
6808  #define SFX_AMBIENT_SHORE	1
6809  #define SFX_AMBIENT_LAKE	2
6810 
6811  /* Reduction in percent (on linear scale) of ambient/weather sfx
6812     depending on which grid the player is on (ie inside house or outside): [40] */
6813  #define GRID_SFX_REDUCTION	50
6814 
6815  /* Play slightly quieter shriek sfx to not blast people's ear drums =P [0..100] */
6816  #define SFX_SHRIEK_VOLUME	50
6817 #endif
6818 
6819 
6820 /*
6821  * Hack -- attempt to reduce various values
6822  */
6823 #ifdef ANGBAND_LITE
6824  #undef MACRO_MAX
6825  #define MACRO_MAX	128
6826  #undef QUARK_MAX
6827  #define QUARK_MAX	128
6828  #undef MESSAGE_MAX
6829  #define MESSAGE_MAX	128
6830  #undef MESSAGE_BUF
6831  #define MESSAGE_BUF	4096
6832 #endif
6833 
6834 
6835 
6836 /*
6837  * Ghost spell "realm"
6838  */
6839 #define GHOST_SPELLS	7
6840 
6841 
6842 /* Kings/Queens abilities */
6843 #define KING_OWN	0
6844 
6845 /* Added melee weapons for temp weapon brands */
6846 /* Generic weapon branding */
6847 #define BRAND_ELEC          0
6848 #define BRAND_COLD          1
6849 #define BRAND_FIRE          2
6850 #define BRAND_ACID          3
6851 #define BRAND_POIS          4
6852 #define BRAND_BASE          5
6853 #define BRAND_CHAO          6
6854 #define BRAND_VORP          7
6855 #define BRAND_BALL_FIRE     8
6856 #define BRAND_BALL_COLD     9
6857 #define BRAND_BALL_ELEC     10
6858 #define BRAND_BALL_ACID     11
6859 #define BRAND_BALL_SOUN     12
6860 
6861 /* Client modes (e) */
6862 #define CLIENT_NORMAL		0x0000
6863 #define CLIENT_PARTY		0x0001
6864 
6865 /* Diff mode (type is 'byte') */
6866 #define MODE_NORMAL		0x00
6867 #define MODE_MALE		0x01	/* Dummy */
6868 
6869 #define MODE_HARD		0x02	/* Penalized */
6870 #define MODE_NO_GHOST		0x04	/* traditional 'hellish' is 3 */
6871 #define MODE_EVERLASTING	0x08	/* No death counter */
6872 #define MODE_PVP		0x10
6873 
6874 #define MODE_FRUIT_BAT		0x20
6875 
6876 #define MODE_DED_IDDC		0x40	/* Dedicated extra character slot for Ironman Deep Dive Challenge */
6877 #define MODE_DED_PVP		0x80	/* Dedicated extra character slot for PvP-mode */
6878 
6879 /* NOTE: modes are bytes, but 'connp->sex' is int, so this is ok for just that purpose */
6880 #define MODE_DED_IDDC_OK	0x100	/* Temporary control flag during char creation */
6881 #define MODE_DED_PVP_OK		0x200	/* Temporary control flag during char creation */
6882 
6883 #define MODE_MASK       (MODE_HARD | MODE_NO_GHOST | MODE_EVERLASTING | MODE_PVP)       /* real character modes */
6884 
6885 /* Monk martial arts... */
6886 #define MAX_NONWINNER_MA 17 /* total_winners can use more techniques, see next line.. */
6887 #define MAX_MA 19 /* total_winners have access to all techniques */
6888 #define MA_KNEE 1
6889 #define MA_SLOW 2
6890 #define MA_ROYAL_SLOW 3
6891 
6892 /* Mental links */
6893 #define LINK_NONE 0
6894 #define LINK_DOMINANT 1
6895 #define LINK_DOMINATED 2
6896 
6897 #define LINKF_VIEW      0x0001 /* Share view */
6898 #define LINKF_MOV       0x0002 /* Share movments */
6899 #define LINKF_PAIN      0x0004 /* Share hp & xp */
6900 #define LINKF_OBJ       0x0008 /* Share obj things */
6901 #define LINKF_MISC      0x0010 /* Share misc things */
6902 #define LINKF_OPEN      0x0020 /* Mind Open */
6903 /* Ready to receive items via telekinesis -
6904    to prevent exploiting this for PK! - C. Blue: */
6905 #define LINKF_TELEKIN	0x0040
6906 /* Additional link flags */
6907 #define LINKF_HIDDEN	0x0080 /* No link status messages */
6908 #define LINKF_VIEW_DEDICATED	0x0100 /* View dedicated for watching other player */
6909 
6910 /* Monster gaining levels */
6911 #define MONSTER_LEVEL_MAX       500
6912 #define MONSTER_TOO_WEAK		50
6913 #define MONSTER_EXP(level)      ((((level) > MONSTER_LEVEL_MAX)?MONSTER_LEVEL_MAX:(level)) * (((level) > MONSTER_LEVEL_MAX)?MONSTER_LEVEL_MAX:(level)) * (((level) > MONSTER_LEVEL_MAX)?MONSTER_LEVEL_MAX:(level)) * 9)
6914 /* R_INFO is obsolete; use race_inf instead.	- Jir -	*/
6915 #define R_INFO(m_ptr)           (r_info_get(m_ptr))
6916 
6917 /*
6918  * Golem defines
6919  */
6920 #define GOLEM_NONE      0x00
6921 #define GOLEM_ATTACK    0x01
6922 #define GOLEM_FOLLOW    0x02
6923 #define GOLEM_GUARD     0x04
6924 
6925 /*
6926  * Monster AI-state defines	- Jir -
6927  */
6928 #define AI_STATE_EFFECT		0x0001
6929 #define AI_STATE_TERRAIN	0x0002
6930 /*
6931 #define AI_STATE_ANNOY		0x0004
6932 #define AI_STATE_RUN		0x0008
6933 */
6934 
6935 /*
6936  * Utility
6937  */
6938 #define BITS(x)  (1 << (x))
6939 
6940 /* Ego monsters defines from PernA	- Jir - */
6941 #define MEGO_CHAR_ANY           127 /* note: also used for 'attr's */
6942 #define MEGO_ADD                0
6943 #define MEGO_SUB                1
6944 #define MEGO_FIX                2
6945 #define MEGO_PRC                3
6946 
6947 
6948 /* pfft */
6949 /* #define race_inf(m_ptr) (race_info_idx((m_ptr)->r_idx, (m_ptr)->ego, (m_ptr)->name3))
6950  */
6951 #define race_inf(m_ptr) r_info_get(m_ptr)
6952 
6953 /* wpos to old-fashioned wilderness 'height' */
6954 /* #define wild_idx(p_ptr) (p_ptr->wpos.wx+p_ptr->wpos.wy*MAX_WILD_X); */
6955 /* #define wild_idx(wpos) ((wpos).wx + (wpos).wy * MAX_WILD_X); */
6956 
6957 /*
6958  * traps ported from PernAngband...
6959  * Hats off to the precedent coders!	- Jir -
6960  */
6961 /* jk */
6962 #define FTRAP_CHEST		0x000000001 /* may appear on chests */
6963 #define FTRAP_DOOR		0x000000002 /* may appear on doors/floors */
6964 #define FTRAP_FLOOR		0x000000004 /* may appear on floor */
6965 #define FTRAP_CHANGE		0x000000008 /* Color changing */
6966 #define FTRAP_SPECIAL_GENE	0x000000010 /* Dont randomly generate */
6967 #define FTRAP_LEVEL_GEN		0x000000020
6968 #define FTRAP_XXX7		0x000000040
6969 #define FTRAP_XXX8		0x000000080
6970 #define FTRAP_XXX9		0x000000100
6971 #define FTRAP_XXX10		0x000000200
6972 #define FTRAP_XXX11		0x000000400
6973 #define FTRAP_XXX12		0x000000800
6974 #define FTRAP_XXX13		0x000001000
6975 #define FTRAP_XXX14		0x000002000
6976 #define FTRAP_XXX15		0x000004000
6977 #define FTRAP_XXX16		0x000008000
6978 #define FTRAP_LEVEL1		0x000010000 /* low level ball/bolt trap */
6979 #define FTRAP_LEVEL2		0x000020000 /* medium level ball/bolt trap */
6980 #define FTRAP_LEVEL3		0x000040000 /* high level ball/bolt trap */
6981 #define FTRAP_LEVEL4		0x000080000 /* oops level ball/bolt trap */
6982 #define FTRAP_XXX21		0x000100000
6983 #define FTRAP_XXX22		0x000200000
6984 #define FTRAP_XXX23		0x000400000
6985 #define FTRAP_XXX24		0x000800000
6986 #define FTRAP_XXX25		0x001000000
6987 #define FTRAP_XXX26		0x002000000
6988 #define FTRAP_XXX27		0x004000000
6989 #define FTRAP_XXX28		0x008000000
6990 #define FTRAP_XXX29		0x010000000
6991 #define FTRAP_XXX30		0x020000000
6992 #define FTRAP_EASY_ID		0x040000000
6993 #define FTRAP_NO_ID		0x080000000	/* nominally implemented (but not used) */
6994 
6995 /* jk */
6996 #define STAT_DEC_TEMPORARY 1
6997 #define STAT_DEC_NORMAL 2
6998 #define STAT_DEC_PERMANENT 3
6999 
7000 /* jk - which trap is which number */
7001 #define TRAP_OF_WEAKNESS_I		1
7002 #define TRAP_OF_WEAKNESS_II		2
7003 #define TRAP_OF_WEAKNESS_III		3
7004 #define TRAP_OF_INTELLIGENCE_I		4
7005 #define TRAP_OF_INTELLIGENCE_II		5
7006 #define TRAP_OF_INTELLIGENCE_III	6
7007 #define TRAP_OF_WISDOM_I		7
7008 #define TRAP_OF_WISDOM_II		8
7009 #define TRAP_OF_WISDOM_III		9
7010 #define TRAP_OF_FUMBLING_I		10
7011 #define TRAP_OF_FUMBLING_II		11
7012 #define TRAP_OF_FUMBLING_III		12
7013 #define TRAP_OF_WASTING_I		13
7014 #define TRAP_OF_WASTING_II		14
7015 #define TRAP_OF_WASTING_III		15
7016 #define TRAP_OF_BEAUTY_I		16
7017 #define TRAP_OF_BEAUTY_II		17
7018 #define TRAP_OF_BEAUTY_III		18
7019 
7020 #define TRAP_OF_CURSE_WEAPON		20
7021 #define TRAP_OF_CURSE_ARMOR		21
7022 #define TRAP_OF_EARTHQUAKE		22
7023 #define TRAP_OF_POISON_NEEDLE		23
7024 #define TRAP_OF_SUMMON_MONSTER		24
7025 #define TRAP_OF_SUMMON_UNDEAD		25
7026 #define TRAP_OF_SUMMON_GREATER_UNDEAD	26
7027 #define TRAP_OF_TELEPORT		27
7028 #define TRAP_OF_PARALYZING		28
7029 #define TRAP_OF_EXPLOSIVE_DEVICE	29
7030 #define TRAP_OF_TELEPORT_AWAY		30
7031 #define TRAP_OF_LOSE_MEMORY		31
7032 #define TRAP_OF_BITTER_REGRET		32
7033 #define TRAP_OF_BOWEL_CRAMPS		33
7034 #define TRAP_OF_BLINDNESS_CONFUSION	34
7035 #define TRAP_OF_AGGRAVATION		35
7036 #define TRAP_OF_MULTIPLICATION		36
7037 #define TRAP_OF_STEAL_ITEM		37
7038 #define TRAP_OF_SUMMON_FAST_QUYLTHULGS	38
7039 #define TRAP_OF_SINKING			39
7040 #define TRAP_OF_MANA_DRAIN		40
7041 #define TRAP_OF_MISSING_MONEY		41
7042 #define TRAP_OF_NO_RETURN		42
7043 #define TRAP_OF_SILENT_SWITCHING	43
7044 #define TRAP_OF_WALLS			44
7045 #define TRAP_OF_CALLING_OUT		45
7046 #define TRAP_OF_SLIDING			46
7047 #define TRAP_OF_CHARGES_DRAIN		47
7048 #define TRAP_OF_STAIR_MOVEMENT		48
7049 #define TRAP_OF_NEW			49
7050 #define TRAP_OF_SCATTER_ITEMS		50
7051 #define TRAP_OF_DECAY			51
7052 #define TRAP_OF_WASTING_WANDS		52
7053 #define TRAP_OF_FILLING			53
7054 #define TRAP_OF_DRAIN_SPEED		54
7055 
7056 #define TRAP_OF_ELEC_BOLT		60
7057 #define TRAP_OF_POIS_BOLT		61
7058 #define TRAP_OF_ACID_BOLT		62
7059 #define TRAP_OF_COLD_BOLT		63
7060 #define TRAP_OF_FIRE_BOLT		64
7061 #define TRAP_OF_PLASMA_BOLT		65
7062 #define TRAP_OF_WATER_BOLT		66
7063 #define TRAP_OF_LITE_BOLT		67
7064 #define TRAP_OF_DARK_BOLT		68
7065 #define TRAP_OF_SHARDS_BOLT		69
7066 #define TRAP_OF_SOUND_BOLT		70
7067 #define TRAP_OF_CONFUSION_BOLT		71
7068 #define TRAP_OF_FORCE_BOLT		72
7069 #define TRAP_OF_INERTIA_BOLT		73
7070 #define TRAP_OF_MANA_BOLT		74
7071 #define TRAP_OF_ICE_BOLT		75
7072 #define TRAP_OF_CHAOS_BOLT		76
7073 #define TRAP_OF_NETHER_BOLT		77
7074 #define TRAP_OF_DISENCHANT_BOLT		78
7075 #define TRAP_OF_NEXUS_BOLT		79
7076 #define TRAP_OF_TIME_BOLT		80
7077 #define TRAP_OF_GRAVITY_BOLT		81
7078 
7079 #define TRAP_OF_ELEC_BALL		82
7080 #define TRAP_OF_POIS_BALL		83
7081 #define TRAP_OF_ACID_BALL		84
7082 #define TRAP_OF_COLD_BALL		85
7083 #define TRAP_OF_FIRE_BALL		86
7084 #define TRAP_OF_PLASMA_BALL		87
7085 #define TRAP_OF_WATER_BALL		88
7086 #define TRAP_OF_LITE_BALL		89
7087 #define TRAP_OF_DARK_BALL		90
7088 #define TRAP_OF_SHARDS_BALL		91
7089 #define TRAP_OF_SOUND_BALL		92
7090 #define TRAP_OF_CONFUSION_BALL		93
7091 #define TRAP_OF_FORCE_BALL		94
7092 #define TRAP_OF_INERTIA_BALL		95
7093 #define TRAP_OF_MANA_BALL		96
7094 #define TRAP_OF_ICE_BALL		97
7095 #define TRAP_OF_CHAOS_BALL		98
7096 #define TRAP_OF_NETHER_BALL		99
7097 #define TRAP_OF_DISENCHANT_BALL		100
7098 #define TRAP_OF_NEXUS_BALL		101
7099 #define TRAP_OF_TIME_BALL		102
7100 #define TRAP_OF_GRAVITY_BALL		103
7101 
7102 #define TRAP_OF_ARROW_I			110
7103 #define TRAP_OF_ARROW_II		111
7104 #define TRAP_OF_ARROW_III		112
7105 #define TRAP_OF_ARROW_IV		113
7106 #define TRAP_OF_POISON_ARROW_I		114
7107 #define TRAP_OF_POISON_ARROW_II		115
7108 #define TRAP_OF_POISON_ARROW_III	116
7109 #define TRAP_OF_POISON_ARROW_IV		117
7110 #define TRAP_OF_DAGGER_I		118
7111 #define TRAP_OF_DAGGER_II		119
7112 #define TRAP_OF_POISON_DAGGER_I		120
7113 #define TRAP_OF_POISON_DAGGER_II	121
7114 #define TRAP_OF_ARROWS_I		122
7115 #define TRAP_OF_ARROWS_II		123
7116 #define TRAP_OF_ARROWS_III		124
7117 #define TRAP_OF_ARROWS_IV		125
7118 #define TRAP_OF_POISON_ARROWS_I		126
7119 #define TRAP_OF_POISON_ARROWS_II	127
7120 #define TRAP_OF_POISON_ARROWS_III	128
7121 #define TRAP_OF_POISON_ARROWS_IV	129
7122 #define TRAP_OF_DAGGERS_I		130
7123 #define TRAP_OF_DAGGERS_II		131
7124 #define TRAP_OF_POISON_DAGGERS_I	132
7125 #define TRAP_OF_POISON_DAGGERS_II	133
7126 
7127 #define TRAP_OF_DROP_ITEMS		140
7128 #define TRAP_OF_DROP_ALL_ITEMS		141
7129 #define TRAP_OF_DROP_EVERYTHING		142
7130 
7131 /* -SC- */
7132 #define TRAP_OF_FEMINITY		150
7133 #define TRAP_OF_MASCULINITY		151
7134 #define TRAP_OF_NEUTRALITY		152
7135 #define TRAP_OF_AGING			153
7136 #define TRAP_OF_GROWING			154
7137 #define TRAP_OF_SHRINKING		155
7138 #define TRAP_OF_ELDRITCH_HORROR		156
7139 #define TRAP_OF_TANKER_DRAIN		157
7140 #define TRAP_OF_DIVINE_ANGER		158
7141 #define TRAP_OF_DIVINE_WRATH		159
7142 #define TRAP_OF_HALLUCINATION		160
7143 
7144 #define TRAP_OF_ROCKET			161
7145 #define TRAP_OF_NUKE_BOLT		162
7146 #define TRAP_OF_DEATH_RAY		163
7147 #define TRAP_OF_HOLY_FIRE		164
7148 #define TRAP_OF_HELL_FIRE		165
7149 #define TRAP_OF_PSI_BOLT		166
7150 #define TRAP_OF_PSI_DRAIN		167
7151 #define TRAP_OF_NUKE_BALL		168
7152 #define TRAP_OF_PSI_BALL		169
7153 
7154 /* DG */
7155 #define TRAP_OF_ACQUIREMENT		170
7156 
7157 /* Jir */
7158 #define TRAP_OF_ALE			171
7159 #define TRAP_OF_GARBAGE			172
7160 #define TRAP_OF_HOSTILITY		173
7161 #define TRAP_OF_CUISINE			174
7162 #define TRAP_OF_UNMAGIC			175
7163 #define TRAP_OF_VERMIN			176
7164 #define TRAP_OF_RANDOM_EFFECT		177
7165 #define TRAP_OF_AMNESIA			178
7166 #define TRAP_OF_SILLINESS		179
7167 #define TRAP_OF_GOODBYE_CHARLIE		180
7168 #define TRAP_OF_PRESENT_EXCHANGE	181
7169 #define TRAP_OF_GARBAGE_FILLING		182
7170 #define TRAP_OF_CHASM			183
7171 #define TRAP_OF_PIT			184
7172 #define TRAP_OF_SEASONED_TRAVELER	185
7173 #define TRAP_OF_SCRIBBLE		186
7174 #define TRAP_OF_SLUMP			187
7175 #define TRAP_OF_OPHIUCHUS		188
7176 #define TRAP_OF_LOST_LABOR		189
7177 #define TRAP_OF_DESPAIR			190
7178 #define TRAP_OF_RARE_BOOKS		191
7179 #define TRAP_OF_WRONG_TARGET		192
7180 #define TRAP_OF_CLEANING		193
7181 #define TRAP_OF_PREPARE			194
7182 #define TRAP_OF_MOAT_I			195
7183 #define TRAP_OF_MOAT_II			196
7184 #define TRAP_OF_DISINTEGRATION_I	197
7185 #define TRAP_OF_DISINTEGRATION_II	198
7186 #define TRAP_OF_BATTLE_FIELD		199
7187 #define TRAP_OF_DEATH_MOLDS		200
7188 #define TRAP_OF_DEATH_SWORDS		201
7189 #define TRAP_OF_UNLIGHT			202
7190 #define TRAP_OF_THIRST			203
7191 #define TRAP_OF_FINGER_CATCHING		204
7192 #define TRAP_OF_ANIMATE_COINS		205
7193 #define TRAP_OF_REMITTANCE		206
7194 #define TRAP_OF_HIDE_TRAPS		207
7195 #define TRAP_OF_RESPAWN			208
7196 #define TRAP_OF_JACK			209
7197 #define TRAP_OF_SPREAD 			210
7198 #define TRAP_OF_LASER 			211
7199 #define TRAP_OF_ROCKETS			212
7200 #define TRAP_OF_HEALING			213
7201 #define TRAP_OF_SPOOKINESS		214
7202 
7203 /*
7204  * Shield effect options
7205  */
7206 #define SHIELD_NONE		0x0000
7207 #define SHIELD_COUNTER		0x0001
7208 #define SHIELD_FIRE		0x0002
7209 #define SHIELD_ELEC		0x0004
7210 #define SHIELD_FEAR		0x0008
7211 
7212 /* special 'projector' types, used in project(). */
7213 #define PROJECTOR_UNUSUAL	-1000
7214 #define PROJECTOR_TRAP		-1001
7215 #define PROJECTOR_POTION	-1002
7216 #define PROJECTOR_TERRAIN	-1003
7217 #define PROJECTOR_MON_TRAP	-1004
7218 #define PROJECTOR_EFFECT	-1005
7219 #define PROJECTOR_PLAYER	-1006
7220 #define PROJECTOR_RUNE		-1007
7221 
7222 //see true_artifact_p - #define TRUE_ARTS(o_ptr) ((artifact_p(o_ptr)) && (!o_ptr->name3))
7223 #define PRICE_BOOST(value, base, step) \
7224 			(value > base ? value << ((value - base)/step) : value )
7225 
7226 #define is_fighter(p_ptr) \
7227 	((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_PALADIN) || (p_ptr->pclass == CLASS_RANGER) || (p_ptr->pclass == CLASS_MIMIC))
7228 
7229 #define is_admin(p_ptr) (p_ptr->admin_wiz || p_ptr->admin_dm)
7230 #define admin_p(Ind) (Players[Ind]->admin_wiz || Players[Ind]->admin_dm)
7231 
7232 #define TOOL_EQUIPPED(p_ptr) (p_ptr->inventory[INVEN_TOOL].k_idx && \
7233 		p_ptr->inventory[INVEN_TOOL].tval == TV_TOOL ? \
7234 		p_ptr->inventory[INVEN_TOOL].sval : -1)
7235 
7236 /* complete weight of all equipment parts */
7237 #define equip_weight(p_ptr) \
7238 	(p_ptr->inventory[INVEN_WIELD].weight \
7239 	+ p_ptr->inventory[INVEN_ARM].weight \
7240 	+ p_ptr->inventory[INVEN_BOW].weight \
7241 	+ p_ptr->inventory[INVEN_LEFT].weight \
7242 	+ p_ptr->inventory[INVEN_RIGHT].weight \
7243 	+ p_ptr->inventory[INVEN_NECK].weight \
7244 	+ p_ptr->inventory[INVEN_LITE].weight \
7245 	+ p_ptr->inventory[INVEN_BODY].weight \
7246 	+ p_ptr->inventory[INVEN_OUTER].weight \
7247 	+ p_ptr->inventory[INVEN_HEAD].weight \
7248 	+ p_ptr->inventory[INVEN_HANDS].weight \
7249 	+ p_ptr->inventory[INVEN_FEET].weight \
7250 	+ p_ptr->inventory[INVEN_AMMO].weight \
7251 	+ p_ptr->inventory[INVEN_TOOL].weight)
7252 
7253 /* armour weight of all armour items + shield currently equipped */
7254 #define armour_weight(p_ptr) \
7255 	( p_ptr->inventory[INVEN_BODY].weight \
7256 	+ p_ptr->inventory[INVEN_HEAD].weight \
7257 	+ ((p_ptr->inventory[INVEN_ARM].k_idx && p_ptr->inventory[INVEN_ARM].tval == TV_SHIELD) ? \
7258 	    p_ptr->inventory[INVEN_ARM].weight : 0) \
7259 	+ p_ptr->inventory[INVEN_OUTER].weight \
7260 	+ p_ptr->inventory[INVEN_HANDS].weight \
7261 	+ p_ptr->inventory[INVEN_FEET].weight)
7262 
7263 /* armour weight without the shield (if any) */
7264 #define worn_armour_weight(p_ptr) \
7265 	( p_ptr->inventory[INVEN_BODY].weight \
7266 	+ p_ptr->inventory[INVEN_HEAD].weight \
7267 	+ p_ptr->inventory[INVEN_OUTER].weight \
7268 	+ p_ptr->inventory[INVEN_HANDS].weight \
7269 	+ p_ptr->inventory[INVEN_FEET].weight)
7270 
7271 /* encumberment check for martial arts skill */
7272 #define monk_heavy_armor(p_ptr) \
7273 	(get_skill(p_ptr, SKILL_MARTIAL_ARTS) && \
7274 	 armour_weight(p_ptr) > \
7275 	 50 + get_skill_scale(p_ptr, SKILL_MARTIAL_ARTS, 210))
7276 
7277 /* encumberment check for rogueish skill, abilities and techniques.
7278    Was 200+..50, but increased it to +60, for wearing Morgoth's crown + DSM
7279    without having to omit any other equipment slot. */
7280 #define rogue_heavy_armor(p_ptr) \
7281 	((p_ptr->pclass == CLASS_ROGUE || \
7282 	  (get_skill(p_ptr, SKILL_DUAL) && \
7283 	   p_ptr->inventory[INVEN_WIELD].k_idx && \
7284 	   p_ptr->inventory[INVEN_ARM].k_idx && p_ptr->inventory[INVEN_ARM].tval != TV_SHIELD) || \
7285 	   (get_skill(p_ptr, SKILL_DODGE)) || \
7286 	   (get_skill(p_ptr, SKILL_CRITS))) && \
7287 	 (armour_weight(p_ptr) > \
7288 	 200 + get_skill_scale(p_ptr, SKILL_COMBAT, 60)))
7289 
7290 /* maximum weapon weight to allow dual-wielding, 999 for no limit	[999] */
7291 #define DUAL_MAX_WEIGHT 999
7292 
7293 
7294 /* replacement of helper functions in cave.c */
7295 /* prolly compilers will do this job anyway..? */
7296 #if 0
7297 #define level_speed(wpos) ((wpos)->wz ? level_speeds[getlevel(wpos)] * 5 : level_speeds[0] * 5)
7298 #else /* NR = +20%..+37% slower than dlvl 127 (200 level_speed base) */
7299 #define level_speed(wpos) \
7300 	((wpos)->wz && !isdungeontown(wpos) ? (getlevel(wpos) <= 127 ? \
7301 	    level_speeds[getlevel(wpos)] * 5 : \
7302 	    (level_speeds[getlevel(wpos)] * (getlevel(wpos) + 60)) / 37) \
7303 	: level_speeds[0] * 5)
7304 #endif
7305 
7306 #define inarea(apos, bpos) \
7307 	((apos)->wx == (bpos)->wx && (apos)->wy == (bpos)->wy && (apos)->wz == (bpos)->wz)
7308 
7309 /* alias */
7310 #define wpcmp(apos, bpos) (inarea(apos, bpos))
7311 
7312 #define wild_idx(wpos) \
7313 	((wpos)->wx + (wpos)->wy * MAX_WILD_X)
7314 
7315 /* NOTE: not all the towns should be on the surface, should they? */
7316 #define isdungeontown(wpos) \
7317 	(((wpos)->wz != 0) && (getfloor(wpos) != NULL) && (getfloor(wpos)->flags1 & LF1_DUNGEON_TOWN))
7318 #define istown(wpos) \
7319 	((!(wpos)->wz && wild_info[(wpos)->wy][(wpos)->wx].type == WILD_TOWN))
7320 #define istownarea(wpos, rad) \
7321 	(istown(wpos) || ((wpos)->wz == 0 && wild_info[(wpos)->wy][(wpos)->wx].radius <= rad))
7322 
7323 
7324 /* paralysis should be handled by other means! (0..80, or 1000 if paralyzed. Usually 10..25.) */
7325 #define UNAWARENESS(p_ptr) ( \
7326 	(p_ptr->stun > 50 ? 10 : 0) + \
7327 	(p_ptr->stun ? 15 : 0) + \
7328 	(p_ptr->confused ? 25 : 0) + \
7329 	(p_ptr->image ? 10 : 0) + \
7330 	(p_ptr->blind ? 20 : 0) + \
7331 	(p_ptr->paralyzed ? 1000 : 0) )
7332 
7333 /*
7334 #define inarea(apos, bpos) \
7335 	(apos->wx==bpos->wx && apos->wy==bpos->wy && apos->wz==bpos->wz)
7336 	(apos.wx==bpos.wx && apos.wy==bpos.wy && apos.wz==bpos.wz)
7337 */
7338 
7339 /* Alias - to ease backporting :) */
7340 #define object_prep(o_ptr, k_idx)	invcopy(o_ptr, k_idx)
7341 
7342 /* Hooks, scripts */
7343 #define HOOK_MONSTER_DEATH      0
7344 #define HOOK_OPEN               1
7345 #define HOOK_GEN_QUEST          2
7346 #define HOOK_END_TURN           3
7347 #define HOOK_FEELING            4
7348 #define HOOK_NEW_MONSTER        5
7349 #define HOOK_GEN_LEVEL          6
7350 #define HOOK_BUILD_ROOM1        7
7351 #define HOOK_NEW_LEVEL          8
7352 #define HOOK_QUEST_FINISH       9
7353 #define HOOK_QUEST_FAIL         10
7354 #define HOOK_GIVE               11
7355 #define HOOK_CHAR_DUMP          12
7356 #define HOOK_INIT_QUEST         13
7357 #define HOOK_WILD_GEN           14
7358 #define HOOK_DROP               15
7359 #define HOOK_IDENTIFY           16
7360 #define HOOK_MOVE               17
7361 #define HOOK_STAIR              18
7362 #define HOOK_MONSTER_AI         19
7363 #define HOOK_PLAYER_LEVEL       20
7364 #define HOOK_WIELD              21
7365 #define HOOK_INIT               22
7366 #define HOOK_QUAFF              23
7367 #define HOOK_AIM                24
7368 #define HOOK_USE                25
7369 #define HOOK_ACTIVATE           26
7370 #define HOOK_ZAP                27
7371 #define HOOK_READ               28
7372 #define HOOK_CALC_BONUS         29
7373 #define HOOK_PLAYER_FLAGS       30
7374 #define HOOK_KEYPRESS           31
7375 #define HOOK_CHAT               32
7376 #define HOOK_MON_SPEAK          33
7377 #define HOOK_MKEY               34
7378 #define HOOK_BIRTH_OBJECTS      35
7379 #define HOOK_ACTIVATE_DESC      36
7380 #define HOOK_INIT_GAME          37
7381 #define HOOK_ACTIVATE_POWER     38
7382 #define HOOK_ITEM_NAME          39
7383 #define HOOK_SAVE_GAME          40
7384 #define HOOK_LOAD_GAME          41
7385 #define HOOK_LEVEL_REGEN        42
7386 #define HOOK_LEVEL_END_GEN      43
7387 #define HOOK_BUILDING_ACTION    44
7388 #define HOOK_PROCESS_WORLD      45
7389 #define HOOK_WIELD_SLOT         46
7390 #define HOOK_STORE_STOCK        47
7391 #define HOOK_STORE_BUY          48
7392 #define HOOK_GEN_LEVEL_BEGIN    49
7393 #define HOOK_GET                50
7394 #define HOOK_NPCTEST            51
7395 #define MAX_HOOKS               52
7396 
7397 /*
7398  * Mkeys are skill activations
7399  */
7400 #if 0
7401  #define MKEY_SORCERY            1	/* unused */
7402  #define MKEY_MAGERY             2	/* unused */
7403  #define MKEY_SHADOW             4	/* unused */
7404  #define MKEY_PRAY               7	/* unused */
7405 #endif
7406 
7407 #define MKEY_DUAL_MODE		1	/* dual-wield mode: mainhand vs dualhand */
7408 //#define MKEY_UNUSED		2	/*pft*/
7409 
7410 #define MKEY_MIMICRY            3
7411 #define MKEY_SHOOT_TILL_KILL	4	/* toggle this firing mode */
7412 #define MKEY_MELEE              5	/* new fighter abilities */
7413 #define MKEY_RANGED             6	/* not "Hunting" anymore, but new archer abilities */
7414 
7415 #define MKEY_DODGE              8
7416 #define MKEY_FLETCHERY		9	/* constant to be unused when fletchery becomes subskill of archer abilities */
7417 #define MKEY_TRAP               10
7418 #define MKEY_SCHOOL             11
7419 #define MKEY_RCRAFT		12
7420 
7421 #define MKEY_STANCE		13	/* combat stances for warriors - C. Blue */
7422 #define MKEY_PARRYBLOCK		14	/* check parry/block chance */
7423 
7424 #define MKEY_AURA_FEAR		15	/* Make auras toggleable for greater utilization! - C. Blue */
7425 #define MKEY_AURA_SHIVER	16
7426 #define MKEY_AURA_DEATH		17
7427 
7428 #define MKEY_BREATH		18
7429 
7430 #define MAX_AURAS 		3
7431 
7432 
7433 /*
7434  * Skills
7435  */
7436 #define SKILL_MAX               50000           /* Maximun skill value */
7437 #define SKILL_STEP              1000            /* 1 skill point */
7438 
7439 #define SKILL_EXCLUSIVE         9999            /* Flag to tell exclusive skills */
7440 
7441 #define SKILL_COMBAT            1
7442 #define SKILL_MASTERY           2
7443 #define SKILL_SWORD             3
7444 #define SKILL_CRITS             4
7445 #define SKILL_POLEARM           5
7446 #define SKILL_BLUNT		6
7447 #define SKILL_ARCHERY           7
7448 #define SKILL_SLING             8
7449 #define SKILL_BOW               9
7450 #define SKILL_XBOW              10
7451 #define SKILL_BACKSTAB          11
7452 #define SKILL_MAGIC             12
7453 //#define SKILL_CASTSPEED         13
7454 #define SKILL_SHOOT_TILL_KILL	13
7455 #define SKILL_SORCERY           14
7456 #define SKILL_MAGERY            15
7457 #define SKILL_MIMIC             16
7458 #define SKILL_DEVICE            17
7459 #define SKILL_SHADOW            18
7460 #define SKILL_PRAY              19
7461 #define SKILL_SPELLLENGTH       20
7462 #define SKILL_SNEAKINESS        21
7463 #define SKILL_DISARM            22
7464 #define SKILL_STEALTH           23
7465 #define SKILL_STEALING          24
7466 #define SKILL_NECROMANCY        25
7467 #define SKILL_ANTIMAGIC         26
7468 /* #define SKILL_AURA_POWER       27 */
7469 #define SKILL_TRAUMATURGY       27
7470 #define SKILL_AURA_FEAR         28
7471 #define SKILL_AURA_SHIVER       29
7472 #define SKILL_AURA_DEATH        30
7473 #define SKILL_HUNTING		31
7474 #define SKILL_TECHNIQUE		32
7475 #define SKILL_MISC              33
7476 #define SKILL_AGILITY		34
7477 #define SKILL_CALMNESS		35
7478 #define SKILL_SWIM		36
7479 #define SKILL_MARTIAL_ARTS	37
7480 #define SKILL_RICOCHET		38
7481 #define SKILL_BOOMERANG		39
7482 #define SKILL_TRAINING		40
7483 #define SKILL_INTERCEPT		41
7484 #define SKILL_DODGE		42
7485 #define SKILL_HEALTH		43
7486 #define SKILL_DIG		44
7487 #define SKILL_SPELLRAD		45
7488 #define SKILL_TRAPPING          46
7489 #define SKILL_AXE		47	/* hrm, bad order */
7490 
7491 /* School skills */
7492 #define SKILL_CONVEYANCE        48
7493 #define SKILL_SPELL		49
7494 #define SKILL_MANA              50
7495 #define SKILL_FIRE              51
7496 #define SKILL_AIR               52
7497 #define SKILL_WATER             53
7498 #define SKILL_NATURE            54
7499 #define SKILL_EARTH             55
7500 #define SKILL_DIVINATION        56
7501 #define SKILL_TEMPORAL          57
7502 #define SKILL_META              58
7503 #define SKILL_MIND              59
7504 #define SKILL_UDUN              60
7505 
7506 #define SKILL_HOFFENSE          70
7507 #define SKILL_HDEFENSE          71
7508 #define SKILL_HCURING           72
7509 #define SKILL_HSUPPORT          73
7510 
7511 #define SKILL_DRUID_ARCANE	74
7512 #define SKILL_DRUID_PHYSICAL	75
7513 
7514 #define SKILL_ASTRAL		77
7515 
7516 #define SKILL_DUAL		78 /* dual-wield for rogues */
7517 #define SKILL_STANCE		79 /* combat stances for warriors */
7518 
7519 #define SKILL_PPOWER		80 /* the new mindcrafter skills */
7520 #define SKILL_TCONTACT		81 /* the new mindcrafter skills */
7521 #define SKILL_MINTRUSION	82 /* the new mindcrafter skills */
7522 
7523 /* Dummy skills - just to make the mass of schools appear more ordered - C. Blue */
7524 #define SKILL_SCHOOL_MAGIC	83
7525 #define SKILL_SCHOOL_PRAYING	84
7526 #define SKILL_SCHOOL_DRUIDISM	85
7527 #define SKILL_SCHOOL_MINDCRAFT	86
7528 
7529 /* additional ones */
7530 #define SKILL_CLIMB		90
7531 #define SKILL_LEVITATE		91
7532 #define SKILL_FREEACT		92
7533 #define SKILL_RESCONF		93
7534 #if 0	/* skills to come	- Jir - */
7535  #define SKILL_INNATE_POWER	/* in mimicry tree */
7536  #define SKILL_EGO_POWER
7537 #endif	/* 0 */
7538 
7539 #define SKILL_SCHOOL_RUNECRAFT	95
7540 #define SKILL_R_LITE		96
7541 #define SKILL_R_DARK		97
7542 #define SKILL_R_NEXU		98
7543 #define SKILL_R_NETH		99
7544 #define SKILL_R_CHAO		100
7545 #define SKILL_R_MANA		101
7546 
7547 /* For Draconians */
7548 #define SKILL_BREATH		110
7549 
7550 /*#define MAX_SKILLS              70 */
7551 #define MAX_SKILLS              128
7552 
7553 /* SKill flags - Note: Only the first byte is transferred to client-side */
7554 #define SKF1_HIDDEN             0x00000001	/* Starts hidden */
7555 #define SKF1_AUTO_HIDE		0x00000002	/* Starts hidden */
7556 #define SKF1_DUMMY		0x00000004	/* Just for visual ordering */
7557 #define SKF1_MAX_1		0x00000008	/* Skill maxes at 1.000 */
7558 #define SKF1_MAX_10		0x00000010	/* Skill maxes at 10.000 */
7559 #define SKF1_MAX_20		0x00000020	/* Skill maxes at 20.000 */
7560 #define SKF1_MAX_25		0x00000040	/* Skill maxes at 25.000 */
7561 #define SKF1_AUTO_MAX		0x00000080	/* Skill is always automatically at maximum */
7562 /* --- the first byte ends here! --- */
7563 #define SKF1_MKEY_SCHOOL	0x04000000	/* mkey is school type */
7564 #define SKF1_MKEY_HARDCODE	0x08000000	/* mkey uses hard-coded routine */
7565 #define SKF1_MKEY_SPELL		0x10000000	/* mkey is realm spell type */
7566 #define SKF1_MKEY_TVAL		0x20000000	/* mkey uses specific tval(not used) */
7567 #define SKF1_MKEY_ITEM		0x40000000	/* mkey requires an item */
7568 #define SKF1_MKEY_DIRECTION	0x80000000	/* mkey requires direction */
7569 
7570 
7571 /* Skill points per level (xtra2.c) */
7572 #ifdef ARCADE_SERVER
7573  #define SKILL_NB_BASE		0
7574 #else
7575  #define SKILL_NB_BASE		5
7576 #endif
7577 
7578 
7579 
7580 
7581 
7582 /*
7583  * Buildings actions
7584  */
7585 #define BACT_RESEARCH_ITEM           1
7586 #define BACT_TOWN_HISTORY            2
7587 #define BACT_RACE_LEGENDS            3
7588 #define BACT_GREET_KING              4
7589 #define BACT_KING_LEGENDS            5
7590 #define BACT_QUEST1                  6
7591 #define BACT_GOLD                    7
7592 #define BACT_POSTER                  8
7593 #define BACT_ARENA_RULES             9
7594 #define BACT_ARENA                  10
7595 #define BACT_ARENA_LEGENDS          11
7596 #define BACT_IN_BETWEEN             12
7597 #define BACT_GAMBLE_RULES           13
7598 #define BACT_CRAPS                  14
7599 #define BACT_SPIN_WHEEL             15
7600 #define BACT_DICE_SLOTS             16
7601 #define BACT_REST                   17
7602 #define BACT_FOOD                   18
7603 #define BACT_RUMORS                 19
7604 #define BACT_RESEARCH_MONSTER       20
7605 #define BACT_COMPARE_WEAPONS        21
7606 #define BACT_LEGENDS                22
7607 #define BACT_ENCHANT_WEAPON         23
7608 #define BACT_ENCHANT_ARMOR          24
7609 #define BACT_RECHARGE               25
7610 #define BACT_IDENTS                 26
7611 #define BACT_LEARN                  27
7612 #define BACT_HEALING                28
7613 #define BACT_RESTORE                29
7614 #define BACT_ENCHANT_ARROWS         30
7615 #define BACT_ENCHANT_BOW            31
7616 #define BACT_GREET                  32
7617 #define BACT_RECALL                 33
7618 #define BACT_TELEPORT_LEVEL         34
7619 #define BACT_BUYFIRESTONE           35
7620 #define BACT_COMEBACKTIME           36
7621 #define BACT_MIMIC_NORMAL           37
7622 #define BACT_VIEW_BOUNTIES          38
7623 #define BACT_SELL_CORPSES           39
7624 #define BACT_VIEW_QUEST_MON         40
7625 #define BACT_SELL_QUEST_MON         41
7626 #define BACT_DIVINATION             42
7627 #define BACT_SELL                   43
7628 #define BACT_BUY                    44
7629 #define BACT_EXAMINE                45
7630 #define BACT_STEAL                  46
7631 #define BACT_QUEST2                 47
7632 #define BACT_QUEST3                 48
7633 #define BACT_QUEST4                 49
7634 #define BACT_STAR_HEAL              50
7635 #define BACT_REQUEST_ITEM           51
7636 #define BACT_GET_LOAN               52
7637 #define BACT_PAY_BACK_LOAN          53
7638 #define BACT_DEPOSIT			54
7639 #define BACT_WITHDRAW			55
7640 #define BACT_EXTEND_HOUSE		56
7641 
7642 #define BACT_CHEEZE_LIST		57
7643 #define BACT_DEED_ITEM			58
7644 #define BACT_DEED_BLESSING		59
7645 #define BACT_GO				60
7646 #define BACT_INSTANT_RES		61
7647 #define BACT_EXPLORATIONS		62
7648 #define BACT_RENAME_GUILD		63
7649 #define BACT_STATIC			64
7650 /* If one adds new BACT_ do NOT forget to increase max_bact in variables.c */
7651 /* MAX_BA_IDX for TomeNET	- Jir - */
7652 
7653 
7654 #define BACT_F_NOTHING		0x00
7655 #define BACT_F_STORE_ITEM	0x01
7656 #define BACT_F_INVENTORY	0x02
7657 #define BACT_F_GOLD		0x04
7658 #define BACT_F_HARDCODE		0x80
7659 
7660 /* Town types, not to be confused with town default indices */
7661 #define TOWN_VANILLA	0
7662 #define TOWN_BREE	1
7663 #define TOWN_GONDOLIN	2
7664 #define TOWN_MINAS_ANOR	3
7665 #define TOWN_LOTHLORIEN	4
7666 #define TOWN_KHAZADDUM	5	/* this town seems to be under construction in ToME */
7667 
7668 /* Town default indices (hard-coding is ok since the order of allocation is fixed) */
7669 #define TIDX_BREE	0
7670 #define TIDX_GONDLIN	1
7671 #define TIDX_MINAS_ANOR	2
7672 #define TIDX_LORIEN	3
7673 #define TIDX_KHAZAD	4
7674 
7675 /* Town defines */
7676 /* defines for random towns in the dungeon. (will be implemented in v5?)
7677  * For now, it's here just to deceive the parser. */
7678 #define TOWN_RANDOM     20              /* First random town */
7679 #define TOWN_DUNGEON    4               /* Maximun number of towns per dungeon */
7680 #define TOWN_CHANCE     50              /* Chance of 1 town */
7681 
7682 /* Limit terraforming in towns, to preserve intended layout somewhat?
7683  *  0 = not allowed to change
7684  *  32000 = no limit
7685  *  other number = use as limit
7686  * Note: The limit counts for both, creating and destroying related features.
7687          (Mostly, because we don't remember previous features, so we cannot
7688          restore them appropriately. So each change is probably a modification,
7689          and never a reversal to the original layout.) */
7690 #define TOWN_TERRAFORM_TREES	1000	/* allow to carve some paths out? */
7691 #define TOWN_TERRAFORM_WALLS	1000	/* allow to create cool but annoying speedways?^^ */
7692 #define TOWN_TERRAFORM_WATER	0	/* dry up loth / water gondo? :/ */
7693 #define TOWN_TERRAFORM_GLYPHS	100	/* provide some safety for beginners, in Bree */
7694 
7695 /*
7696  * Defines of the different dungeon types
7697  */
7698 #define DUNGEON_WILDERNESS      0
7699 #define DUNGEON_MIRKWOOD        1
7700 #define DUNGEON_MORDOR          2
7701 #define DUNGEON_ANGBAND         3
7702 #define DUNGEON_GALGALS         4
7703 #define DUNGEON_VOLCANO         5
7704 #define DUNGEON_HELL            6
7705 #define DUNGEON_NUMENOR         7
7706 #define DUNGEON_MANDOS          8
7707 #define DUNGEON_MAZE            18
7708 #define DUNGEON_DEATH           28
7709 #define DUNGEON_DOL_GULDUR      23
7710 
7711 /* Max depth of each dungeon(max_depth - min_depth) */
7712 #define MAX_DUNGEON_DEPTH       128
7713 
7714 #define DUNGEON_MODE_NONE       0
7715 #define DUNGEON_MODE_AND        1
7716 #define DUNGEON_MODE_NAND       2
7717 #define DUNGEON_MODE_OR         3
7718 #define DUNGEON_MODE_NOR        4
7719 
7720 /* Object generation */
7721 #define OBJ_GENE_TREASURE       20
7722 #define OBJ_GENE_COMBAT         20
7723 #define OBJ_GENE_MAGIC          20
7724 #define OBJ_GENE_TOOL           20
7725 
7726 
7727 /* Special powers */
7728 #define MAX_POWERS              50      /* 2 should be enough but let's be on the *SAFE* side ;) */
7729 #define MAX_KNOW_POWERS         2
7730 
7731 /* evileye games */
7732 #define EEGAME_CTF		1
7733 #define EEGAME_RUGBY		2
7734 
7735 /* erase items on the floor? */
7736 #define ITEM_REMOVAL_NORMAL	0	/* this must always be 0 (assumed as default if not set to a different value) */
7737 #define ITEM_REMOVAL_NEVER	1	/* Item will never 'timeout' */
7738 #define ITEM_REMOVAL_HOUSE	2	/* Item is inside a house and because of that will never 'timeout' */
7739 #define ITEM_REMOVAL_DEATH_WILD	3	/* Items are death loot, but not in dungeon (would be ITEM_REMOVAL_NEVER) but in the wilderness */
7740 #define ITEM_REMOVAL_LONG_WILD	4	/* Item times out even much slower than from ITEM_REMOVAL_DEATH_WILD */
7741 #define ITEM_REMOVAL_QUICK	5	/* To keep pvp-arena clean: 10 minutes timeout flat. */
7742 #define ITEM_REMOVAL_MONTRAP	6	/* Item is part of a monster trap and hence should last quite a while */
7743 
7744 
7745 /* Invalid (Nothing) items: Enable backtracing if we're using glibc */
7746 #ifdef __GLIBC__
7747  #define BACKTRACE_NOTHINGS
7748 #endif
7749 /* Actually remove the invalid c_ptr->o_idx reference? */
7750 #define FIX_NOTHINGS
7751 #define FIX_NOTHINGS_ON_SIGHT
7752 
7753 
7754 /* C. Blue - Automatic transport sequences for characters
7755    (kind of scripted transport for special situations) */
7756 #define AT_BLINK	1	/* teleport short range; used after panic-save auto-recalling */
7757 #define AT_TPORT	2	/* teleport long range */
7758 #define AT_VALINOR	3	/* send player to the shores of Valinor */
7759 #define AT_VALINOR2	4
7760 #define AT_VALINOR3	5
7761 #define AT_VALINOR4	6
7762 #define AT_VALINOR5	7
7763 #define AT_VALINOR6	8
7764 
7765 
7766 /* Admin-specific item powers - C. Blue */
7767 /* Can a player see the secret_dungeon_master? Only if he wears the special Goggles.. */
7768 #define player_sees_dm(I)	\
7769 	(Players[I]->inventory[INVEN_HEAD].tval && Players[I]->inventory[INVEN_HEAD].name1 == ART_GOGGLES_DM)
7770 #define instakills(I)	\
7771 	(Players[I]->inventory[INVEN_WIELD].tval && Players[I]->inventory[INVEN_WIELD].name1 == ART_SCYTHE_DM)
7772 
7773 
7774 /* Masks for restricted mimicry */
7775 /*	Shaman: Animals, Giants, Dragon(rider)s, Elementals/Spirits, Ghosts.
7776 	No undead/nonliving material beings; no Invisible Stalker/Unmaker/Death Orb. */
7777 /*	!(r_info[ridx].flags3 & (RF3_UNDEAD | RF3_NONLIVING)) && !(r_info[ridx].d_char == 'O')) || \ */
7778 #define mimic_shaman(ridx)	\
7779 	((ridx == 0) || \
7780 	(((r_info[ridx].flags3 & (RF3_ANIMAL | RF3_DRAGON | RF3_GIANT | RF3_DRAGONRIDER)) || \
7781 	(r_info[ridx].d_char == 'H') || (r_info[ridx].d_char == 'T')) && \
7782  	!(r_info[ridx].flags3 & (RF3_UNDEAD | RF3_NONLIVING))) || \
7783 	(r_info[ridx].d_char == 'G') || mimic_shaman_E(ridx) || (r_info[ridx].d_char == 'X') || \
7784 	(r_info[ridx].d_char == 'g') || (r_info[ridx].d_char == 'A'))
7785 #define mimic_shaman_E(ridx)	\
7786 	((r_info[ridx].d_char == 'E') && !(ridx == 514 || ridx == 815 || ridx == 975))
7787 #define mimic_shaman_fulleq(c)	(strchr("EGX", c))
7788 /*	Druid: Selected Animals and animal-similar creatures. */
7789 #define mimic_druid(ridx, plv)	\
7790 	((ridx == 0) || \
7791 	(plv >= 5 && (ridx == 160 || ridx == 198)) || \
7792 	(plv >= 10 && (ridx == 191 || ridx == 154)) || \
7793 	(plv >= 15 && (ridx == 279 || ridx == 343)) || \
7794 	(plv >= 20 && (ridx == 414 || ridx == 335 || ridx == 898 || ridx == 963)) || \
7795 	(plv >= 25 && (ridx == 334 || ridx == 513)) || \
7796 	(plv >= 30 && (ridx == 440 || ridx == 641 || ridx == 482)) || \
7797 	(plv >= 35 && (ridx == 614 || ridx == 726 || ridx == 964)) || \
7798 	(plv >= 40 && (ridx == 688 || ridx == 640 || ridx == 740)) || \
7799 	(plv >= 45 && (ridx == 723 || ridx == 704)) || /* || ridx == 716 || \ */ \
7800 	(plv >= 50 && (ridx == 705 || ridx == 778 || ridx == 775)) || /* 782 */ \
7801 	(plv >= 55 && (ridx == 1131)) || \
7802 	(plv >= 60 && (ridx == 1127)))
7803 	/* possible postking additions - guiding ideas:
7804 	   fire immunity for NR; very maybe pass wall for comfort.
7805 	    1127 firebird, 739 ethereal hound? */
7806 /* for vampires, who learn to transform into a vampire bat and back for transportation - C. Blue */
7807 #define mimic_vampire(ridx, plv)	\
7808 	((ridx == 0) || \
7809 	(plv >= 20 && ridx == 391))
7810 //	add vampiric mist at higher level or something
7811 
7812 #define mimic_hatchling(ridx)	\
7813 	((ridx == 0) || \
7814 	(r_info[ridx].flags3 & RF3_DRAGON))
7815 
7816 
7817 /* for global_event - C. Blue */
7818 #define MAX_GLOBAL_EVENT_TYPES	16	/* amount of different event types */
7819 #define MAX_GLOBAL_EVENTS	16	/* max # of concurrently running events */
7820 #define MAX_GE_PARTICIPANTS	64
7821 
7822 /* types of global events: */
7823 #define GE_NONE			0	/* <disabled> ie no event running */
7824 #define GE_HIGHLANDER		1	/* Highlander Tournament */
7825 #define GE_HIGHLANDER_NEW	2	/* [NOT YET IMPLEMENTED] (with highlander town and set-up cash+items etc) */
7826 #define GE_ARENA_MONSTER	3	/* Areana Monster Challenge */
7827 #define GE_GAME_RUGBY		4	/* [NOT YET IMPLEMENTED] Evileye's good ole game of rugby, now in event-form ;) */
7828 #define GE_DUNGEON_KEEPER	5	/* 'Dungeon Keeper' Labyrinth */
7829 
7830 /* player flags while participating in global events (p_ptr->global_event_temp) */
7831 #define PEVF_NONE		0x00000000
7832 #define PEVF_PASS_00		0x00000001 /* may enter/leave sector 0,0 */
7833 #define PEVF_NOGHOST_00		0x00000002 /* will permanently die in sector 0,0 */
7834 #define PEVF_SAFEDUN_00		0x00000004 /* won't die in dungeon/tower in 0,0 */
7835 #define PEVF_AUTOPVP_00		0x00000008 /* will always be hostile to others in 0,0 */
7836 #define PEVF_SEPDUN_00		0x00000010 /* unable to leave dungeon or tower in 0,0 via stairs */
7837 #define PEVF_NO_RUN_00		0x00000020 /* can only walk but not run in 0,0 */
7838 #define PEVF_NOTELE_00		0x00000040 /* cannot use phasing/teleportation in 0,0 */
7839 #define PEVF_INDOORS_00		0x00000080 /* the 0,0 event is classified as indoors, so vampires don't get sun burn */
7840 #define PEVF_ICKY_OK		0x00000100 /* allow wpos changes onto CAVE_ICKY grid */
7841 #define PEVF_STCK_OK		0x00000200 /* allow wpos changes onto CAVE_STCK grid */
7842 
7843 /* for achievements (top PvP mode rank) - C. Blue */
7844 #define ACHV_PVP_MAX		1
7845 #define ACHV_PVP_MID		2
7846 #define ACHV_PVP_MASS		3
7847 
7848 /* modify the base crit bonus to make it less linear, remotely similar to LUCK */
7849 //#define BOOST_CRIT(xtra_crit)	(65 - (975 / ((xtra_crit) + 15))) /* 1:5, 2: 8, 3:11, 5:17, 7:21, 10:26, 15:33, 20:38 */
7850 //xtra_crit = 60 - (600 / (xtra_crit + 10)); /* 1:6, 2:10, 3:15, 5:20, 7:25, 10:30, 15:36, 20:40 */
7851 #define BOOST_CRIT(xtra_crit)	(66 - (1350 / ((xtra_crit) + 20))) /* 1:2, 2: 5, 3:8, 5:12, 7:16, 10:21, 15:28, 20:33 */
7852 
7853 
7854 /* Auction system - mikaelh */
7855 #ifdef AUCTION_SYSTEM
7856 
7857 /* Minimum required value of an auctionable item */
7858 #ifdef AUCTION_BETA
7859 #define AUCTION_MINIMUM_VALUE		1
7860 #else
7861 #define AUCTION_MINIMUM_VALUE		1000
7862 #endif
7863 
7864 /* Auction fee in percents of the price */
7865 #define AUCTION_FEE			1
7866 
7867 /* Maximum amount of items per player */
7868 #define AUCTION_MAX_ITEMS_PLAYER	48
7869 
7870 /* Time limits */
7871 #ifdef AUCTION_BETA
7872 #define AUCTION_MINIMUM_DURATION	15	/* 15 seconds */
7873 #define AUCTION_MAXIMUM_DURATION	604800  /* 7 days */
7874 #else
7875 #define AUCTION_MINIMUM_DURATION	3600	/* 1 hour */
7876 #define AUCTION_MAXIMUM_DURATION	604800	/* 7 days */
7877 #endif
7878 
7879 /* Minimum starting price (in percents of the real value) */
7880 #define AUCTION_MINIMUM_STARTING_PRICE	100
7881 
7882 /* Maximum starting price (in percents of the real value) */
7883 #define AUCTION_MAXIMUM_STARTING_PRICE	1000
7884 
7885 /* Minimum buyout price (in percents of the real value) */
7886 #define AUCTION_MINIMUM_BUYOUT_PRICE	100
7887 
7888 /* Maximum buyout price (in percents of the real value) */
7889 #define AUCTION_MAXIMUM_BUYOUT_PRICE	2000
7890 
7891 /* Status codes */
7892 #define AUCTION_STATUS_EMPTY		0
7893 #define AUCTION_STATUS_SETUP		1
7894 #define AUCTION_STATUS_BIDDING		2
7895 #define AUCTION_STATUS_FINISHED		3
7896 #define AUCTION_STATUS_CANCELLED	4
7897 
7898 /* Flags */
7899 #define AUCTION_FLAG_WINNER_PAID	1 /* If the winning bidder has paid for the item */
7900 #define AUCTION_FLAG_SELLER_PAID	2 /* If money from the auction has been given to the seller */
7901 
7902 /* Error codes */
7903 #define	AUCTION_ERROR_INVALID_ID		-1 /* Invalid auction id */
7904 #define AUCTION_ERROR_NOT_BIDDING		-2 /* Bidding hasn't yet started */
7905 #define AUCTION_ERROR_OWN_ITEM			-3 /* Own item */
7906 #define AUCTION_ERROR_OVERFLOW			-4 /* Overflow or invalid input */
7907 #define AUCTION_ERROR_INVALID_SLOT		-5 /* Invalid inventory slot */
7908 #define AUCTION_ERROR_EMPTY_SLOT		-6 /* Empty inventory slot */
7909 #define AUCTION_ERROR_TOO_CHEAP			-7 /* Item is too cheap to be auctioned */
7910 #define AUCTION_ERROR_ALREADY_STARTED		-8 /* Auction has already been started */
7911 #define AUCTION_ERROR_NOT_SUPPORTED		-9 /* Action not supported for auction */
7912 #define AUCTION_ERROR_INSUFFICIENT_MONEY	-10 /* Not enough money */
7913 #define AUCTION_ERROR_TOO_SMALL			-11 /* Bid is too small */
7914 #define AUCTION_ERROR_INSUFFICIENT_LEVEL	-12 /* Player doesn't satisfy the item's level requirement */
7915 #define AUCTION_ERROR_EVERLASTING_ITEM		-13 /* Non-everlasting / everlasting separation */
7916 #define AUCTION_ERROR_NONEVERLASTING_ITEM	-14 /* Non-everlasting / everlasting separation */
7917 #define AUCTION_ERROR_INVALID_ACCOUNT		-15 /* Invalid account */
7918 #define AUCTION_ERROR_INVALID_PRICE		-16 /* Invalid price */
7919 #define AUCTION_ERROR_INVALID_DURATION		-17 /* Invalid duration */
7920 #define AUCTION_ERROR_TOO_MANY			-18 /* Too many auctions */
7921 #define AUCTION_ERROR_NO_BIDDING		-19 /* No bidding */
7922 #define AUCTION_ERROR_NO_BUYOUT			-20 /* No buyout */
7923 #define AUCTION_ERROR_EITHER_BID_OR_BUYOUT	-21 /* Either bidding or buyout needs to be allowed */
7924 
7925 #endif
7926 
7927 /* Runecraft */
7928 /* Physical Runes - match k_info.txt and common/tables.c index; Sigils in object_flags() */
7929 #define SV_R_LITE			0
7930 #define SV_R_DARK			1
7931 #define SV_R_NEXU			2
7932 #define SV_R_NETH			3
7933 #define SV_R_CHAO			4
7934 #define SV_R_MANA			5
7935 
7936 #define SV_R_CONF			6
7937 #define SV_R_INER			7
7938 #define SV_R_ELEC			8
7939 #define SV_R_FIRE			9
7940 #define SV_R_WATE			10
7941 #define SV_R_GRAV			11
7942 #define SV_R_COLD			12
7943 #define SV_R_ACID			13
7944 #define SV_R_POIS			14
7945 #define SV_R_TIME			15
7946 #define SV_R_SOUN			16
7947 #define SV_R_SHAR			17
7948 #define SV_R_DISE			18
7949 #define SV_R_FORC			19
7950 #define SV_R_PLAS			20
7951 
7952 #define RSPELL_MAX_ELEMENTS 2
7953 
7954 /* Elements */
7955 /* Reduced for elegance while maintaining 'original' element completion / Tolkien lore. */
7956 #define RCRAFT_MAX_ELEMENTS 6
7957 
7958 #define R_LITE 0x0001
7959 #define R_DARK 0x0002
7960 #define R_NEXU 0x0004
7961 #define R_NETH 0x0008
7962 
7963 #define R_CHAO 0x0010
7964 #define R_MANA 0x0020
7965 
7966 /* Projections */
7967 /* Combinations including the above that appear as projectable GF_TYPE elements */
7968 #define RCRAFT_MAX_PROJECTIONS 21 //6c2+6c1=21
7969 
7970 /* Types */
7971 /* Order matches the index in common/tables.c; ascending by level. */
7972 #define RCRAFT_MAX_TYPES 7
7973 
7974 #define T_BOLT 0x0001
7975 //#define T_BEAM 0x0002
7976 #define T_CLOU 0x0002
7977 #define T_BALL 0x0004
7978 
7979 #define T_SIGN 0x0008
7980 #define T_RUNE 0x0010
7981 #define T_WAVE 0x0020
7982 #define T_ENCH 0x0040
7983 
7984 /* Imperatives */
7985 /* Order matches the index in common/tables.c; ascending by level. */
7986 #define RCRAFT_MAX_IMPERATIVES 8
7987 
7988 #define I_MINI 0x0100
7989 #define I_LENG 0x0200
7990 #define I_COMP 0x0400
7991 #define I_MODE 0x0800
7992 
7993 #define I_EXPA 0x1000
7994 #define I_BRIE 0x2000
7995 #define I_MAXI 0x4000
7996 #define I_ENHA 0x8000
7997 
7998 /* Constants */
7999 /* Runespell constants for balancing and sanity checks */
8000 #define S_COST_MIN 1
8001 #define S_COST_MAX 75
8002 #define S_DIFF_MAX 15 //Maximum level difference between spell and skill levels
8003 #define S_RADIUS_MIN 1
8004 #define S_RADIUS_MAX 5
8005 #define S_DURATION_MIN 3
8006 #define S_DURATION_MAX 50
8007 #define S_WEIGHT_LO 150 //refer common/tables.c
8008 #define S_WEIGHT_HI 1200 //refer common/tables.c
8009 #define S_WEIGHT_INFLUENCE 80 //0 to S_WEIGHT_INFLUENCE_MAX; directly proportional to the spread of element damage caps.
8010 #define S_WEIGHT_INFLUENCE_MAX 100 //Used to be 10, now one more significant figure!
8011 
8012 /* Macros */
8013 #define rget_level(x) ((skill * (x)) / 50)
8014 #define rget_weight(x) ((S_WEIGHT_HI * (100 * (S_WEIGHT_INFLUENCE_MAX - S_WEIGHT_INFLUENCE) + (100 * S_WEIGHT_INFLUENCE * (x - S_WEIGHT_LO) / (S_WEIGHT_HI - S_WEIGHT_LO))) / S_WEIGHT_INFLUENCE_MAX + 100 * S_WEIGHT_LO) / 100)
8015 #define rget_dice_weight(x) ((S_WEIGHT_HI * (100 * (S_WEIGHT_INFLUENCE_MAX - S_WEIGHT_INFLUENCE / 2) + (100 * S_WEIGHT_INFLUENCE / 2 * (x - S_WEIGHT_LO) / (S_WEIGHT_HI - S_WEIGHT_LO))) / S_WEIGHT_INFLUENCE_MAX + 100 * S_WEIGHT_LO) / 100)
8016 
8017 /* macro for debugging Doppelgaenger @s */
8018 #define cave_midx_debug(wpos_, cy, cx, midx) { \
8019     if (midx < 0) { \
8020         if (-(midx) > NumPlayers) { s_printf("MIDX_DEBUG: out of range (%d of %d) (%s:%d)\n", -(midx), NumPlayers, __FILE__, __LINE__); } \
8021         if ((wpos_)->wx != Players[-(midx)]->wpos.wx) { s_printf("MIDX_DEBUG: wrong wpos wx (%d : %d) (%s:%d)\n", (wpos_)->wx, Players[-(midx)]->wpos.wx, __FILE__, __LINE__); } \
8022         if ((wpos_)->wy != Players[-(midx)]->wpos.wy) { s_printf("MIDX_DEBUG: wrong wpos wy (%d : %d) (%s:%d)\n", (wpos_)->wy, Players[-(midx)]->wpos.wy, __FILE__, __LINE__); } \
8023         if ((wpos_)->wz != Players[-(midx)]->wpos.wz) { s_printf("MIDX_DEBUG: wrong wpos wz (%d : %d) (%s:%d)\n", (wpos_)->wz, Players[-(midx)]->wpos.wz, __FILE__, __LINE__); } \
8024         if (Players[-(midx)]->py == cy) { \
8025             if (Players[-(midx)]->px != cx) { s_printf("MIDX_DEBUG: wrong x (%d : %d) (%s:%d)\n", cx, Players[-(midx)]->px, __FILE__, __LINE__); } \
8026         } else { \
8027             if (Players[-(midx)]->px != cx) { s_printf("MIDX_DEBUG: wrong x,y (%d : %d, %d : %d) (%s:%d)\n", cx, Players[-(midx)]->px, cy, Players[-(midx)]->py, __FILE__, __LINE__); } \
8028             else { s_printf("MIDX_DEBUG: wrong y (%d : %d) (%s:%d)\n", cy, Players[-(midx)]->py, __FILE__, __LINE__); } \
8029         } \
8030     } \
8031 }
8032 
8033 
8034 /* Client chat modes */
8035 #define CHAT_MODE_NORMAL	0
8036 #define CHAT_MODE_PARTY		1
8037 #define CHAT_MODE_LEVEL		2
8038 #define CHAT_MODE_GUILD		3
8039 
8040 /* Mode bits for askfor_aux */
8041 #define ASKFOR_PRIVATE		0x01
8042 #define ASKFOR_CHATTING		0x02
8043 
8044 
8045 /* Hard-coded coordinates keeping track of special worldmap locations */
8046 #define WPOS_SECTOR00_X		0       /* location of our protected and used-for-special-cases sector 'sector00' */
8047 #define WPOS_SECTOR00_Y		0
8048 #define WPOS_SECTOR00_Z		0
8049 #define WPOS_SECTOR00_ADJAC_X	1	/* if we want to get out of sector00, what coord can be used for x? */
8050 #define WPOS_SECTOR00_ADJAC_Y	1	/* if we want to get out of sector00, what coord can be used for y? */
8051 
8052 #define WPOS_HIGHLANDER_X	0	/* deathmatch location of global event 'Highlander Tournament' */
8053 #define WPOS_HIGHLANDER_Y	0
8054 #define WPOS_HIGHLANDER_Z	0
8055 #define WPOS_HIGHLANDER_DUN_X	0	/* dungeon location of global event 'Highlander Tournament' */
8056 #define WPOS_HIGHLANDER_DUN_Y	0
8057 #define WPOS_HIGHLANDER_DUN_Z	-1
8058 
8059 /* important: note connection of WPOS_ARENA_ and 'ge_special_sector' */
8060 #define WPOS_ARENA_X		cfg.town_x	/* location of global event 'Arena Monster Challenge' */
8061 #define WPOS_ARENA_Y		cfg.town_y
8062 #define WPOS_ARENA_Z		2
8063 
8064 #define WPOS_PVPARENA_X		0	/* location of pvp arena for MODE_PVP players */
8065 #define WPOS_PVPARENA_Y		0
8066 #define WPOS_PVPARENA_Z		1
8067 
8068 #ifdef ARCADE_SERVER
8069  #define WPOS_ARCADE_X		32
8070  #define WPOS_ARCADE_Y		32
8071  #define WPOS_ARCADE_Z		11
8072 #endif
8073 
8074 /* WPOS_IRONDEEPDIVE_X/Y are defined in defines-local.h,
8075    since those values are server-specific. */
8076 
8077 
8078 /* Inventory change types */
8079 #define INVENTORY_CHANGE_SLIDE	1
8080 #define INVENTORY_CHANGE_MOVE	2
8081 #define INVENTORY_CHANGE_ERASE	3
8082 
8083 
8084 /* Client-side auto inscriptions */
8085 #define MAX_AUTO_INSCRIPTIONS 20
8086 
8087 /* Maximum amount of ping reception times logged for each player */
8088 #define MAX_PING_RECVS_LOGGED	10
8089 
8090 
8091 /* Request types for p_ptr->request_type - C. Blue */
8092 #define RTYPE_STR	0
8093 #define RTYPE_NUM	1
8094 #define RTYPE_KEY	2
8095 #define RTYPE_CFR	3
8096 
8097 /* ..and request IDs for p_ptr->request_id */
8098 #define RID_NONE		0	/* fixed */
8099 #ifdef ENABLE_GO_GAME			/* go.c Go minigame */
8100  #define RID_GO			1
8101  #define RID_GO_START		2
8102  #define RID_GO_MOVE		3
8103 #endif
8104 #define RID_GUILD_RENAME	4
8105 #define RID_GUILD_CREATE	5
8106 #define RID_QUEST		100	/* this is a broadband RID, going from its value up to value+MAX_Q_IDX-1 */
8107 #define RID_QUEST_ACQUIRE	(RID_QUEST + MAX_Q_IDX)	/* this is a broadband RID, going from its value up to value+MAX_Q_IDX-1 */
8108 
8109 /* House type flags */
8110 #define HF_NONE		0x0000
8111 #define HF_MOAT		0x0001
8112 #define HF_RECT		0x0002	/* Rectangular house; used for non-trad-houses (currently ALL houses are HF_RECT) */
8113 #define HF_STOCK	0x0004	/* house generated by town */
8114 #define HF_NOFLOOR	0x0008	/* courtyard generated without floor */
8115 #define HF_JAIL		0x0010	/* generate with CAVE_STCK */
8116 #define HF_APART	0x0020	/* build apartment (obsolete - DELETEME) */
8117 #define HF_TRAD		0x0040	/* Vanilla style house */
8118 #define HF_DELETED	0x0080	/* Ruined house - do not save/reload */
8119 #define HF_SELFBUILT	0x0100	/* Was constructed by "builders" (aka scroll of house creation) */
8120 #define HF_GUILD_SUS	0x0200	/* Guild hall of a currently leaderless guild: 'suspended' guild hall */
8121 
8122 #define MAXCOORD 200		/* Maximum vertices on non-rect house */
8123 
8124 /* House owner type flags */
8125 #define OT_PLAYER	1
8126 #define OT_GUILD	2
8127 #define OT_PARTY	3
8128 #define OT_CLASS	4
8129 #define OT_RACE		5
8130 
8131 /* house access flags */
8132 #define ACF_NONE	0x00
8133 
8134 #define ACF_PARTY		0x01
8135 #define ACF_CLASS		0x02
8136 #define ACF_RACE		0x04
8137 #define ACF_LEVEL		0x08
8138 #define ACF_WINNER		0x10
8139 #define ACF_FALLENWINNER	0x20
8140 #define ACF_NOGHOST		0x40
8141 #define ACF_STORE		0x80	/* older idea, I implemented it differently now (see PLAYER_STORES) - C. Blue */
8142 
8143 
8144 /* account flags */
8145 #define ACC_TRIAL	0x00000001	/* Account is awaiting validation */
8146 #define ACC_ADMIN	0x00000002	/* Account members are admins */
8147 #define ACC_MULTI	0x00000004	/* Simultaneous play */
8148 #define ACC_NOSCORE	0x00000008	/* No scoring allowed */
8149 #define ACC_RESTRICTED	0x00000010	/* is restricted (ie after cheezing) */
8150 #define ACC_VRESTRICTED	0x00000020	/* is restricted (ie after cheating) */
8151 #define ACC_PRIVILEGED	0x00000040	/* has privileged powers (ie for running quests) */
8152 #define ACC_VPRIVILEGED	0x00000080	/* has privileged powers (ie for running quests) */
8153 #define ACC_PVP		0x00000100	/* may kill other players */
8154 #define ACC_NOPVP	0x00000200	/* is not able to kill other players */
8155 #define ACC_ANOPVP	0x00000400	/* cannot kill other players; gets punished on trying */
8156 #define ACC_GREETED	0x00000800	/* This player has received a one-time greeting. */
8157 #define ACC_QUIET	0x00001000	/* may not chat or emote in public */
8158 #define ACC_VQUIET	0x00002000	/* may not chat or emote, be it public or private */
8159 #define ACC_BANNED	0x00004000	/* account is temporarily suspended */
8160 #define ACC_DELD	0x00008000	/* Delete account/members */
8161 
8162 #define ACC_GUILD_ADDER	0x20000000	/* Character who died last was a guild adder (for auto-re-add) */
8163 #define ACC_WARN_SALE	0x40000000	/* 'Warn' that he has sold items in a player store */
8164 #define ACC_WARN_REST	0x80000000	/* Received a one-time warning about resting */
8165 
8166 
8167 /* CS_flags - Cave special types */
8168 #define CS_NONE		0
8169 #define CS_DNADOOR	1
8170 #define CS_KEYDOOR	2
8171 #define CS_TRAPS	3	/* CS stands for Cave Special */
8172 #define CS_INSCRIP	4	/* ok ;) i'll follow that from now */
8173 #define CS_FOUNTAIN	5
8174 #define CS_BETWEEN	6	/* petit jump type */
8175 #define CS_BEACON	7	/* now used for events */
8176 #define CS_MON_TRAP	8	/* monster traps */
8177 #define CS_SHOP		9	/* shop/building */
8178 #define CS_MIMIC	10	/* mimic-ing feature (eg. secret door) */
8179 #define CS_RUNE		11	/* runecraft glyphs */
8180 
8181 /* heheh it's kludge.. */
8182 #define sc_is_pointer(type)<--->(type < 3 || type == 4 || type > 10)
8183 
8184 
8185 /* Quest types */
8186 #define QUEST_RANDOM	0x01	/* Random quest, not set by the DM */
8187 #define QUEST_MONSTER	0x02	/* Kill some normal monsters. */
8188 #define QUEST_UNIQUE	0x04	/* Kill unique monster (unkilled by players) */
8189 #define QUEST_OBJECT	0x08	/* Find some object. Must not be owned, or found in the town. */
8190 #define QUEST_RACE	0x10	/* Race quest - ie, not personal */
8191 #define QUEST_GUILD	0x20	/* Guildmaster's quest (no prize) */
8192 
8193 
8194 /* Guild flags */
8195 #define GFLG_NONE		0x00000000
8196 #define GFLG_EVERLASTING	0x00000001	/* it's an everlasting-mode guild (for auto_readd) */
8197 #define GFLG_PVP		0x00000002	/* it's a pvp-mode guild (for auto_readd) - currently not eligible */
8198 #define GFLG_AUTO_READD		0x00000004	/* automatically adds a player again after his char died, within 20 minutes */
8199 #define GFLG_ALLOW_ADDERS	0x00000008	/* enable adding more people by designated 'adders' (see PGF_ADDER below) */
8200 
8201 /* Player guild flags */
8202 #define PGF_NONE		0x00000000
8203 #define PGF_ADDER		0x00000001	/* player may add other players to the guild although he's not the leader */
8204 
8205 #ifdef HOUSE_PAINTING
8206  /* Don't display house paint of mode-wise unusable player stores? */
8207  #define HOUSE_PAINTING_HIDE_BAD_MODE
8208  /* Don't display house paint of stores that contain more unsellable items than sellable ones? */
8209  //TODO:implement fully
8210  //#define HOUSE_PAINTING_HIDE_UNSELLABLE
8211  /* Don't display house paint of 'museum' like player stores, where most sellable items are priced > 50x value? Added new '@S-' for this! */
8212  //TODO:implement fully
8213  //#define HOUSE_PAINTING_HIDE_MUSEUM
8214 #endif
8215 
8216 
8217 #define in_bree(wpos) ((wpos)->wx == cfg.town_x && (wpos)->wy == cfg.town_y && (wpos)->wz == 0)
8218 #define in_trainingtower(wpos) ((wpos)->wx == cfg.town_x && (wpos)->wy == cfg.town_y && (wpos)->wz > 0)
8219 
8220 /* check if a player is in the Nether Realms */
8221 //#define in_netherrealm(wpos) (getlevel(wpos) >= netherrealm_start)
8222 #define in_netherrealm(wpos) ((wpos)->wx == netherrealm_wpos_x && (wpos)->wy == netherrealm_wpos_y && (wpos)->wz * netherrealm_wpos_z > 0)
8223 #define at_netherrealm(wpos) ((wpos)->wx == netherrealm_wpos_x && (wpos)->wy == netherrealm_wpos_y && (wpos)->wz * netherrealm_wpos_z >= 0)
8224 #define netherrealm_bottom(wpos) ((wpos)->wx == netherrealm_wpos_x && (wpos)->wy == netherrealm_wpos_y && (wpos)->wz == netherrealm_end_wz)
8225 
8226 #define in_hallsofmandos(wpos) ((wpos)->wx == hallsofmandos_wpos_x && (wpos)->wy == hallsofmandos_wpos_y && (wpos)->wz * hallsofmandos_wpos_z > 0)
8227 
8228 /* Restrict escape from final Nether Realm level to WoR + ghost floating? (no stairs+no probtrav!) */
8229 //#define NETHERREALM_BOTTOM_RESTRICT
8230 
8231 /* check if a player is in Valinor */
8232 #define in_valinor(wpos) ((wpos)->wx == valinor_wpos_x && (wpos)->wy == valinor_wpos_y && (wpos)->wz * valinor_wpos_z > 0)
8233 
8234 /* quickly check if a given wpos is within certain special dungeons */
8235 #define in_irondeepdive(wpos) \
8236 	((wpos)->wx == WPOS_IRONDEEPDIVE_X && (wpos)->wy == WPOS_IRONDEEPDIVE_Y && (wpos)->wz * WPOS_IRONDEEPDIVE_Z > 0)
8237 
8238 /* in sector00, and it is active (separated)? */
8239 #define in_sector00(wpos) \
8240 	(sector00separation && (wpos)->wx == WPOS_SECTOR00_X && (wpos)->wy == WPOS_SECTOR00_Y && (wpos)->wz == WPOS_SECTOR00_Z)
8241 
8242 /* Is given wpos-pointer one of the two fixed towns, Menegroth or Nargothrond
8243    at dlvl 40 and 80 respectively, in the Ironman Deep Dive Challenge dungeon? */
8244 #define is_fixed_irondeepdive_town(wpos, dlev) \
8245 	(in_irondeepdive(wpos) && \
8246         ((dlev) == 40 || (dlev) == 80))
8247 /* For guaranteed 'wild' towns at the intermediate floors of 1k and 3k */
8248 #define is_extra_fixed_irondeepdive_town(wpos, dlev) \
8249 	(in_irondeepdive(wpos) && \
8250         ((dlev) == 20 || (dlev) == 60))
8251 
8252 /* Are we on the final floor and therefore eligile for recalling out? */
8253 #define irondeepdive_bottom(wpos) \
8254 	((wpos)->wx == WPOS_IRONDEEPDIVE_X && (wpos)->wy == WPOS_IRONDEEPDIVE_Y && (wpos)->wz * WPOS_IRONDEEPDIVE_Z == 127)
8255 
8256 
8257 /* constants for get_item() to be transmitted to the client for choosing an item_tester_hook */
8258 #define ITH_NONE	0
8259 #define ITH_RECHARGE	1
8260 #define ITH_ENCH_AC	2
8261 #define ITH_ENCH_WEAP	3
8262 #define ITH_CUSTOM_TOME	4
8263 #define ITH_RUNE	5
8264 #define ITH_ENCH_AC_NO_SHIELD 6
8265 /* keen hack: 4.6.0+ clients use ITH_ codes >= 50 and in turn signed char overflow < 0
8266    for transmitting max_weight for picking items for telekinesis. - C. Blue */
8267 #define ITH_MAX_WEIGHT	50
8268 
8269 /* Macros for less direct hard-coding of melee/ranged techniques */
8270 /* Melee techniques */
8271 #define MT_NONE		0x0000
8272 
8273 #define MT_SPRINT	0x0001
8274 #define MT_TAUNT	0x0002
8275 #define MT_JUMP		0x0004
8276 #define MT_DISTRACT	0x0008
8277 
8278 #if 0
8279  #define MT_STAB	0x0010
8280  #define MT_SLICE	0x0020
8281  #define MT_QUAKE	0x0040
8282  #define MT_SWEEP	0x0080
8283 
8284  #define MT_BASH	0x0100
8285  #define MT_KNOCK	0x0200
8286  #define MT_CHARGE	0x0400
8287  #define MT_FLASH	0x0800
8288 
8289  #define MT_SPIN	0x1000
8290  #define MT_BERSERK	0x2000
8291  #define MT_SJUMP	0x4000
8292  #define MT_ICLOAK	0x8000
8293 #else
8294  #define MT_BASH	0x0010
8295  #define MT_KNOCK	0x0020
8296  #define MT_CHARGE	0x0040
8297  #define MT_FLASH	0x0080
8298 
8299  #define MT_CLOAK	0x0100
8300  #define MT_SPIN	0x0200
8301  #define MT_ASSA	0x0400
8302  #define MT_BERSERK	0x0800
8303 
8304  #define MT_XXX1000	0x1000
8305  #define MT_SJUMP	0x2000
8306  #define MT_SRUN	0x4000
8307  #define MT_ICLOAK	0x8000
8308 #endif
8309 
8310 /* Ranged techniques */
8311 #define RT_NONE		0x0000
8312 
8313 #define RT_FLARE	0x0001
8314 #define RT_PRECS	0x0002
8315 #define RT_CRAFT	0x0004
8316 #define RT_DOUBLE	0x0008
8317 
8318 #define RT_BARRAGE	0x0010
8319 #define RT_XXX0020	0x0020
8320 #define RT_XXX0040	0x0040
8321 #define RT_XXX0080	0x0080
8322 
8323 #define RT_XXX0100	0x0100
8324 #define RT_XXX0200	0x0200
8325 #define RT_XXX0400	0x0400
8326 #define RT_XXX0800	0x0800
8327 
8328 #define RT_XXX1000	0x1000
8329 #define RT_XXX2000	0x2000
8330 #define RT_XXX4000	0x4000
8331 #define RT_XXX8000	0x8000
8332 
8333