xref: /netbsd/games/larn/data.c (revision bf9ec67e)
1 /*	$NetBSD: data.c,v 1.9 1997/10/25 01:40:47 thorpej Exp $	 */
2 
3 /*-
4  * Copyright (c) 1988 The Regents of the University of California.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by the University of
18  *	California, Berkeley and its contributors.
19  * 4. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  */
35 
36 #include <sys/cdefs.h>
37 #ifndef lint
38 #if 0
39 static char     sccsid[] = "@(#)data.c	5.3 (Berkeley) 5/13/91";
40 #else
41 __RCSID("$NetBSD: data.c,v 1.9 1997/10/25 01:40:47 thorpej Exp $");
42 #endif
43 #endif /* not lint */
44 
45 /* data.c		Larn is copyrighted 1986 by Noah Morgan. */
46 /* #define NODEFS */
47 #include "header.h"
48 #include "extern.h"
49 
50 /*
51 	class[c[LEVEL]-1] gives the correct name of the players experience level
52  */
53 static char     aa1[] = " mighty evil master";
54 static char     aa2[] = "apprentice demi-god";
55 static char     aa3[] = "  minor demi-god   ";
56 static char     aa4[] = "  major demi-god   ";
57 static char     aa5[] = "    minor deity    ";
58 static char     aa6[] = "    major deity    ";
59 static char     aa7[] = "  novice guardian  ";
60 static char     aa8[] = "apprentice guardian";
61 static char     aa9[] = "    The Creator    ";
62 u_char           *class[] =
63 {
64 	"  novice explorer  ", "apprentice explorer", " practiced explorer",	/* -3 */
65 	"   expert explorer ", "  novice adventurer", "     adventurer    ",	/* -6 */
66 	"apprentice conjurer", "     conjurer      ", "  master conjurer  ",	/* -9 */
67 	"  apprentice mage  ", "        mage       ", "  experienced mage ",	/* -12 */
68 	"     master mage   ", " apprentice warlord", "   novice warlord  ",	/* -15 */
69 	"   expert warlord  ", "   master warlord  ", " apprentice gorgon ",	/* -18 */
70 	"       gorgon      ", "  practiced gorgon ", "   master gorgon   ",	/* -21 */
71 	"    demi-gorgon    ", "    evil master    ", " great evil master ",	/* -24 */
72 	aa1, aa1, aa1,		/* -27 */
73 	aa1, aa1, aa1,		/* -30 */
74 	aa1, aa1, aa1,		/* -33 */
75 	aa1, aa1, aa1,		/* -36 */
76 	aa1, aa1, aa1,		/* -39 */
77 	aa2, aa2, aa2,		/* -42 */
78 	aa2, aa2, aa2,		/* -45 */
79 	aa2, aa2, aa2,		/* -48 */
80 	aa3, aa3, aa3,		/* -51 */
81 	aa3, aa3, aa3,		/* -54 */
82 	aa3, aa3, aa3,		/* -57 */
83 	aa4, aa4, aa4,		/* -60 */
84 	aa4, aa4, aa4,		/* -63 */
85 	aa4, aa4, aa4,		/* -66 */
86 	aa5, aa5, aa5,		/* -69 */
87 	aa5, aa5, aa5,		/* -72 */
88 	aa5, aa5, aa5,		/* -75 */
89 	aa6, aa6, aa6,		/* -78 */
90 	aa6, aa6, aa6,		/* -81 */
91 	aa6, aa6, aa6,		/* -84 */
92 	aa7, aa7, aa7,		/* -87 */
93 	aa8, aa8, aa8,		/* -90 */
94 	aa8, aa8, aa8,		/* -93 */
95 	"  earth guardian   ", "   air guardian    ", "   fire guardian   ",	/* -96 */
96 	"  water guardian   ", "  time guardian    ", " ethereal guardian ",	/* -99 */
97 	aa9, aa9, aa9,		/* -102 */
98 };
99 
100 /*
101 	table of experience needed to be a certain level of player
102 	skill[c[LEVEL]] is the experience required to attain the next level
103  */
104 #define MEG 1000000
105 long            skill[] = {
106 	0, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120,	/* 1-11 */
107 	10240, 20480, 40960, 100000, 200000, 400000, 700000, 1 * MEG,	/* 12-19 */
108 	2 * MEG, 3 * MEG, 4 * MEG, 5 * MEG, 6 * MEG, 8 * MEG, 10 * MEG,	/* 20-26 */
109 	12 * MEG, 14 * MEG, 16 * MEG, 18 * MEG, 20 * MEG, 22 * MEG, 24 * MEG, 26 * MEG, 28 * MEG,	/* 27-35 */
110 	30 * MEG, 32 * MEG, 34 * MEG, 36 * MEG, 38 * MEG, 40 * MEG, 42 * MEG, 44 * MEG, 46 * MEG,	/* 36-44 */
111 	48 * MEG, 50 * MEG, 52 * MEG, 54 * MEG, 56 * MEG, 58 * MEG, 60 * MEG, 62 * MEG, 64 * MEG,	/* 45-53 */
112 	66 * MEG, 68 * MEG, 70 * MEG, 72 * MEG, 74 * MEG, 76 * MEG, 78 * MEG, 80 * MEG, 82 * MEG,	/* 54-62 */
113 	84 * MEG, 86 * MEG, 88 * MEG, 90 * MEG, 92 * MEG, 94 * MEG, 96 * MEG, 98 * MEG, 100 * MEG,	/* 63-71 */
114 	105 * MEG, 110 * MEG, 115 * MEG, 120 * MEG, 125 * MEG, 130 * MEG, 135 * MEG, 140 * MEG,	/* 72-79 */
115 	145 * MEG, 150 * MEG, 155 * MEG, 160 * MEG, 165 * MEG, 170 * MEG, 175 * MEG, 180 * MEG,	/* 80-87 */
116 	185 * MEG, 190 * MEG, 195 * MEG, 200 * MEG, 210 * MEG, 220 * MEG, 230 * MEG, 240 * MEG,	/* 88-95 */
117 	250 * MEG, 260 * MEG, 270 * MEG, 280 * MEG, 290 * MEG, 300 * MEG	/* 96-101 */
118 };
119 #undef MEG
120 
121 u_char           *lpbuf, *lpnt, *inbuffer, *lpend;	/* input/output pointers
122 							 * to the buffers */
123 struct cel     *cell;		/* pointer to the dungeon storage	 */
124 short           hitp[MAXX][MAXY];	/* monster hp on level		 */
125 short           iarg[MAXX][MAXY];	/* arg for the item array	 */
126 u_char          item[MAXX][MAXY];	/* objects in maze if any	 */
127 u_char          know[MAXX][MAXY];	/* 1 or 0 if here before	 */
128 u_char          mitem[MAXX][MAXY];	/* monster item array 		 */
129 u_char          moved[MAXX][MAXY];	/* monster movement flags  */
130 u_char          stealth[MAXX][MAXY];	/* 0=sleeping 1=awake monst */
131 u_char          iven[26];	/* inventory for player			 */
132 short           ivenarg[26];	/* inventory for player			 */
133 char            lastmonst[40];	/* this has the name of the current monster	 */
134 u_char          beenhere[MAXLEVEL + MAXVLEVEL] = {0};	/* 1 if have been on
135 							 * this level */
136 char            VERSION = VER;	/* this is the present version # of the
137 				 * program	 */
138 char            SUBVERSION = SUBVER;
139 u_char          nosignal = 0;	/* set to 1 to disable the signals from doing
140 				 * anything */
141 u_char          predostuff = 0;	/* 2 means that the trap handling routines
142 				 * must do a showplayer() after a trap.  0
143 				 * means don't showplayer() 0 - we are in
144 				 * create player screen 1 - we are in welcome
145 				 * screen 2 - we are in the normal game	 */
146 char            loginname[20];	/* players login name */
147 char            logname[LOGNAMESIZE];	/* players name storage for scoring				 */
148 u_char          sex = 1;	/* default is a man  0=woman						 */
149 u_char          boldon = 1;	/* 1=bold objects  0=inverse objects				 */
150 u_char          ckpflag = 0;	/* 1 if want checkpointing of game, 0
151 				 * otherwise	 */
152 u_char          cheat = 0;	/* 1 if the player has fudged save file			 */
153 short           level = 0;	/* cavelevel player is on = c[CAVELEVEL]			 */
154 u_char          wizard = 0;	/* the wizard mode flag							 */
155 short           lastnum = 0;	/* the number of the monster last hitting
156 				 * player 	 */
157 short           hitflag = 0;	/* flag for if player has been hit when
158 				 * running 	 */
159 short           hit2flag = 0;	/* flag for if player has been hit when
160 				 * running 	 */
161 short           hit3flag = 0;	/* flag for if player has been hit flush
162 				 * input 	 */
163 short           playerx, playery;	/* the room on the present level of
164 					 * the player		 */
165 short           lastpx, lastpy;	/* 0 --- MAXX-1  or  0 --- MAXY-1					 */
166 short           oldx, oldy;
167 short           lasthx = 0, lasthy = 0;	/* location of monster last hit by
168 					 * player		 */
169 short           nobeep = 0;	/* true if program is not to beep  					 */
170 unsigned long   randx = 33601;	/* the random number seed						 */
171 time_t          initialtime = 0;/* time playing began 							 */
172 long            gltime = 0;	/* the clock for the game						 */
173 long            outstanding_taxes = 0;	/* present tax bill from score file 			 */
174 long            c[100], cbak[100];	/* the character description arrays			 */
175 int             enable_scroll = 0;	/* constant for enabled/disabled
176 					 * scrolling regn */
177 char            aborted[] = " aborted";
178 struct sphere  *spheres = 0;	/* pointer to linked list for spheres of
179 				 * annihilation */
180 char           *levelname[] =
181 {" H", " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9", "10", "V1", "V2", "V3"};
182 
183 char            objnamelist[] = " ATOP%^F&^+M=%^$$f*OD#~][[)))(((||||||||{?!BC}o:@.<<<<EVV))([[]]](^ [H*** ^^ S tsTLc............................................";
184 char            monstnamelist[] = " BGHJKOScjtAELNQRZabhiCTYdegmvzFWflorXV pqsyUkMwDDPxnDDuD        ...............................................................";
185 char           *objectname[] =
186 {0, "a holy altar", "a handsome jewel encrusted throne", "the orb", "a pit",
187 	"a staircase leading upwards", "an elevator going up", "a bubbling fountain",
188 	"a great marble statue", "a teleport trap", "the college of Larn",
189 	"a mirror", "the DND store", "a staircase going down", "an elevator going down",
190 	"the bank of Larn", "the 5th branch of the Bank of Larn",
191 	"a dead fountain", "gold", "an open door", "a closed door",
192 	"a wall", "The Eye of Larn", "plate mail", "chain mail", "leather armor",
193 	"a sword of slashing", "Bessman's flailing hammer", "a sunsword",
194 	"a two handed sword", "a spear", "a dagger",
195 	"ring of extra regeneration", "a ring of regeneration", "a ring of protection",
196 	"an energy ring", "a ring of dexterity", "a ring of strength",
197 	"a ring of cleverness", "a ring of increase damage", "a belt of striking",
198 	"a magic scroll", "a magic potion", "a book", "a chest",
199 	"an amulet of invisibility", "an orb of dragon slaying",
200 	"a scarab of negate spirit", "a cube of undead control",
201 	"device of theft prevention", "a brilliant diamond", "a ruby",
202 	"an enchanting emerald", "a sparkling sapphire", "the dungeon entrance",
203 	"a volcanic shaft leaning downward", "the base of a volcanic shaft",
204 	"a battle axe", "a longsword", "a flail", "ring mail", "studded leather armor",
205 	"splint mail", "plate armor", "stainless plate armor", "a lance of death",
206 	"an arrow trap", "an arrow trap", "a shield", "your home",
207 	"gold", "gold", "gold", "a dart trap",
208 	"a dart trap", "a trapdoor", "a trapdoor", "the local trading post",
209 	"a teleport trap", "a massive throne",
210 	"a sphere of annihilation", "a handsome jewel encrusted throne",
211 	"the Larn Revenue Service", "a fortune cookie", "", "", "", "", "", "",
212 	"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
213 };
214 
215 
216 
217 /*
218  *	for the monster data
219  *
220  *	array to do rnd() to create monsters <= a given level
221  */
222 u_char          monstlevel[] = {5, 11, 17, 22, 27, 33, 39, 42, 46, 50, 53, 56, 59};
223 
224 struct monst    monster[] = {
225 	/*
226 	 * NAME			LV	AC	DAM	ATT	DEF	GEN
227 	 * INT GOLD	HP	EXP
228 	 * -----------------------------------------------------------------
229 	 */
230 	{"", 0, 0, 0, 0, 0, 0, 3, 0, 0, 0},
231 	{"bat", 1, 0, 1, 0, 0, 0, 3, 0, 1, 1},
232 	{"gnome", 1, 10, 1, 0, 0, 0, 8, 30, 2, 2},
233 	{"hobgoblin", 1, 14, 2, 0, 0, 0, 5, 25, 3, 2},
234 	{"jackal", 1, 17, 1, 0, 0, 0, 4, 0, 1, 1},
235 	{"kobold", 1, 20, 1, 0, 0, 0, 7, 10, 1, 1},
236 
237 	{"orc", 2, 12, 1, 0, 0, 0, 9, 40, 4, 2},
238 	{"snake", 2, 15, 1, 0, 0, 0, 3, 0, 3, 1},
239 	{"giant centipede", 2, 14, 0, 4, 0, 0, 3, 0, 1, 2},
240 	{"jaculi", 2, 20, 1, 0, 0, 0, 3, 0, 2, 1},
241 	{"troglodyte", 2, 10, 2, 0, 0, 0, 5, 80, 4, 3},
242 	{"giant ant", 2, 8, 1, 4, 0, 0, 4, 0, 5, 5},
243 
244 	/*
245 	 * NAME			LV	AC	DAM	ATT	DEF	GEN
246 	 * INT GOLD	HP	EXP
247 	 * -----------------------------------------------------------------
248 	 */
249 
250 	{"floating eye", 3, 8, 1, 0, 0, 0, 3, 0, 5, 2},
251 	{"leprechaun", 3, 3, 0, 8, 0, 0, 3, 1500, 13, 45},
252 	{"nymph", 3, 3, 0, 14, 0, 0, 9, 0, 18, 45},
253 	{"quasit", 3, 5, 3, 0, 0, 0, 3, 0, 10, 15},
254 	{"rust monster", 3, 4, 0, 1, 0, 0, 3, 0, 18, 25},
255 	{"zombie", 3, 12, 2, 0, 0, 0, 3, 0, 6, 7},
256 
257 	{"assassin bug", 4, 9, 3, 0, 0, 0, 3, 0, 20, 15},
258 	{"bugbear", 4, 5, 4, 15, 0, 0, 5, 40, 20, 35},
259 	{"hell hound", 4, 5, 2, 2, 0, 0, 6, 0, 16, 35},
260 	{"ice lizard", 4, 11, 2, 10, 0, 0, 6, 50, 16, 25},
261 	{"centaur", 4, 6, 4, 0, 0, 0, 10, 40, 24, 45},
262 
263 	/*
264 	 * NAME			LV	AC	DAM	ATT	DEF	GEN
265 	 * INT GOLD	HP	EXP
266 	 * -----------------------------------------------------------------
267 	 */
268 
269 	{"troll", 5, 4, 5, 0, 0, 0, 9, 80, 50, 300},
270 	{"yeti", 5, 6, 4, 0, 0, 0, 5, 50, 35, 100},
271 	{"white dragon", 5, 2, 4, 5, 0, 0, 16, 500, 55, 1000},
272 	{"elf", 5, 8, 1, 0, 0, 0, 15, 50, 22, 35},
273 	{"gelatinous cube", 5, 9, 1, 0, 0, 0, 3, 0, 22, 45},
274 
275 	{"metamorph", 6, 7, 3, 0, 0, 0, 3, 0, 30, 40},
276 	{"vortex", 6, 4, 3, 0, 0, 0, 3, 0, 30, 55},
277 	{"ziller", 6, 15, 3, 0, 0, 0, 3, 0, 30, 35},
278 	{"violet fungi", 6, 12, 3, 0, 0, 0, 3, 0, 38, 100},
279 	{"wraith", 6, 3, 1, 6, 0, 0, 3, 0, 30, 325},
280 	{"forvalaka", 6, 2, 5, 0, 0, 0, 7, 0, 50, 280},
281 
282 	/*
283 	 * NAME			LV	AC	DAM	ATT	DEF	GEN
284 	 * INT GOLD	HP	EXP
285 	 * -----------------------------------------------------------------
286 	 */
287 
288 	{"lama nobe", 7, 7, 3, 0, 0, 0, 6, 0, 35, 80},
289 	{"osequip", 7, 4, 3, 16, 0, 0, 4, 0, 35, 100},
290 	{"rothe", 7, 15, 5, 0, 0, 0, 3, 100, 50, 250},
291 	{"xorn", 7, 0, 6, 0, 0, 0, 13, 0, 60, 300},
292 	{"vampire", 7, 3, 4, 6, 0, 0, 17, 0, 50, 1000},
293 	{"invisible stalker", 7, 3, 6, 0, 0, 0, 5, 0, 50, 350},
294 
295 	{"poltergeist", 8, 1, 4, 0, 0, 0, 3, 0, 50, 450},
296 	{"disenchantress", 8, 3, 0, 9, 0, 0, 3, 0, 50, 500},
297 	{"shambling mound", 8, 2, 5, 0, 0, 0, 6, 0, 45, 400},
298 	{"yellow mold", 8, 12, 4, 0, 0, 0, 3, 0, 35, 250},
299 	{"umber hulk", 8, 3, 7, 11, 0, 0, 14, 0, 65, 600},
300 
301 	/*
302 	 * NAME			LV	AC	DAM	ATT	DEF	GEN
303 	 * INT GOLD	HP	EXP
304 	 * -----------------------------------------------------------------
305 	 */
306 
307 	{"gnome king", 9, -1, 10, 0, 0, 0, 18, 2000, 100, 3000},
308 	{"mimic", 9, 5, 6, 0, 0, 0, 8, 0, 55, 99},
309 	{"water lord", 9, -10, 15, 7, 0, 0, 20, 0, 150, 15000},
310 	{"bronze dragon", 9, 2, 9, 3, 0, 0, 16, 300, 80, 4000},
311 	{"green dragon", 9, 3, 8, 10, 0, 0, 15, 200, 70, 2500},
312 	{"purple worm", 9, -1, 11, 0, 0, 0, 3, 100, 120, 15000},
313 	{"xvart", 9, -2, 12, 0, 0, 0, 13, 0, 90, 1000},
314 
315 	{"spirit naga", 10, -20, 12, 12, 0, 0, 23, 0, 95, 20000},
316 	{"silver dragon", 10, -1, 12, 3, 0, 0, 20, 700, 100, 10000},
317 	{"platinum dragon", 10, -5, 15, 13, 0, 0, 22, 1000, 130, 24000},
318 	{"green urchin", 10, -3, 12, 0, 0, 0, 3, 0, 85, 5000},
319 	{"red dragon", 10, -2, 13, 3, 0, 0, 19, 800, 110, 14000},
320 
321 	{"type I demon lord", 12, -30, 18, 0, 0, 0, 20, 0, 140, 50000},
322 	{"type II demon lord", 13, -30, 18, 0, 0, 0, 21, 0, 160, 75000},
323 	{"type III demon lord", 14, -30, 18, 0, 0, 0, 22, 0, 180, 100000},
324 	{"type IV demon lord", 15, -35, 20, 0, 0, 0, 23, 0, 200, 125000},
325 	{"type V demon lord", 16, -40, 22, 0, 0, 0, 24, 0, 220, 150000},
326 	{"type VI demon lord", 17, -45, 24, 0, 0, 0, 25, 0, 240, 175000},
327 	{"type VII demon lord", 18, -70, 27, 6, 0, 0, 26, 0, 260, 200000},
328 	{"demon prince", 25, -127, 30, 6, 0, 0, 28, 0, 345, 300000}
329 
330 	/*
331 	 * NAME				LV	AC	DAM	ATT	DEF
332 	 * GEN INT GOLD	HP	EXP
333 	 * -------------------------------------------------------------------
334 	 * --
335 	 */
336 };
337 
338 /* name array for scrolls		 */
339 
340 char           *scrollname[] = {"", "", "", "", "", "", "", "", "", "", "", "", "", "",
341 "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
342 
343 char           *scrollhide[] = {
344 	" enchant armor",
345 	" enchant weapon",
346 	" enlightenment",
347 	" blank paper",
348 	" create monster",
349 	" create artifact",
350 	" aggravate monsters",
351 	" time warp",
352 	" teleportation",
353 	" expanded awareness",
354 	" haste monsters",
355 	" monster healing",
356 	" spirit protection",
357 	" undead protection",
358 	" stealth",
359 	" magic mapping",
360 	" hold monsters",
361 	" gem perfection",
362 	" spell extension",
363 	" identify",
364 	" remove curse",
365 	" annihilation",
366 	" pulverization",
367 	" life protection",
368 	"  ",
369 	"  ",
370 	"  ",
371 	"  "
372 };
373 
374 char           *potionname[] = {"", "", "", "", "", "", "", "", "", "", "", "", "", "",
375 	"", "", "", "", "", "", "", "", "", "", "", "", "", "",
376 "", "", "", "", "", "", ""};
377 
378 /* name array for magic potions	 */
379 char           *potionhide[] = {
380 	" sleep",
381 	" healing",
382 	" raise level",
383 	" increase ability",
384 	" wisdom",
385 	" strength",
386 	" raise charisma",
387 	" dizziness",
388 	" learning",
389 	" gold detection",
390 	" monster detection",
391 	" forgetfulness",
392 	" water",
393 	" blindness",
394 	" confusion",
395 	" heroism",
396 	" sturdiness",
397 	" giant strength",
398 	" fire resistance",
399 	" treasure finding",
400 	" instant healing",
401 	" cure dianthroritis",
402 	" poison",
403 	" see invisible",
404 	"  ",
405 	"  ",
406 	"  ",
407 	"  ",
408 	"  ",
409 	"  ",
410 	"  ",
411 	"  ",
412 	"  ",
413 	"  ",
414 	"  "
415 };
416 
417 
418 
419 /*
420 	spell data
421  */
422 u_char          spelknow[SPNUM] = {0};
423 u_char          splev[] = {1, 4, 9, 14, 18, 22, 26, 29, 32, 35, 37, 37, 37, 37, 37};
424 
425 char           *spelcode[] = {
426 	"pro", "mle", "dex", "sle", "chm", "ssp",
427 	"web", "str", "enl", "hel", "cbl", "cre", "pha", "inv",
428 	"bal", "cld", "ply", "can", "has", "ckl", "vpr",
429 	"dry", "lit", "drl", "glo", "flo", "fgr",
430 	"sca", "hld", "stp", "tel", "mfi",	/* 31 */
431 	"sph", "gen", "sum", "wtw", "alt", "per"
432 };
433 
434 char           *spelname[] = {
435 	"protection", "magic missile", "dexterity",
436 	"sleep", "charm monster", "sonic spear",
437 
438 	"web", "strength", "enlightenment",
439 	"healing", "cure blindness", "create monster",
440 	"phantasmal forces", "invisibility",
441 
442 	"fireball", "cold", "polymorph",
443 	"cancellation", "haste self", "cloud kill",
444 	"vaporize rock",
445 
446 	"dehydration", "lightning", "drain life",
447 	"invulnerability", "flood", "finger of death",
448 
449 	"scare monster", "hold monster", "time stop",
450 	"teleport away", "magic fire",
451 
452 	"sphere of annihilation", "genocide", "summon demon",
453 	"walk through walls", "alter reality", "permanence",
454 	""
455 };
456 
457 char           *speldescript[] = {
458 	/* 1 */
459 	"generates a +2 protection field",
460 	"creates and hurls a magic missile equivalent to a + 1 magic arrow",
461 	"adds +2 to the casters dexterity",
462 	"causes some monsters to go to sleep",
463 	"some monsters may be awed at your magnificence",
464 	"causes your hands to emit a screeching sound toward what they point",
465 	/* 7 */
466 	"causes strands of sticky thread to entangle an enemy",
467 	"adds +2 to the casters strength for a short term",
468 	"the caster becomes aware of things around him",
469 	"restores some hp to the caster",
470 	"restores sight to one so unfortunate as to be blinded",
471 	"creates a monster near the caster appropriate for the location",
472 	"creates illusions, and if believed, monsters die",
473 	"the caster becomes invisible",
474 	/* 15 */
475 	"makes a ball of fire that burns on what it hits",
476 	"sends forth a cone of cold which freezes what it touches",
477 	"you can find out what this does for yourself",
478 	"negates the ability of a monster to use his special abilities",
479 	"speeds up the casters movements",
480 	"creates a fog of poisonous gas which kills all that is within it",
481 	"this changes rock to air",
482 	/* 22 */
483 	"dries up water in the immediate vicinity",
484 	"you finger will emit a lightning bolt when this spell is cast",
485 	"subtracts hit points from both you and a monster",
486 	"this globe helps to protect the player from physical attack",
487 	"this creates an avalanche of H2O to flood the immediate chamber",
488 	"this is a holy spell and calls upon your god to back you up",
489 	/* 28 */
490 	"terrifies the monster so that hopefully he wont hit the magic user",
491 	"the monster is frozen in his tracks if this is successful",
492 	"all movement in the caverns ceases for a limited duration",
493 	"moves a particular monster around in the dungeon (hopefully away from you)",
494 	"this causes a curtain of fire to appear all around you",
495 	/* 33 */
496 	"anything caught in this sphere is instantly killed.  Warning -- dangerous",
497 	"eliminates a species of monster from the game -- use sparingly",
498 	"summons a demon who hopefully helps you out",
499 	"allows the player to walk through walls for a short period of time",
500 	"god only knows what this will do",
501 	"makes a character spell permanent, i. e. protection, strength, etc.",
502 	""
503 };
504 
505 char            spelweird[MAXMONST + 8][SPNUM] = {
506 	/*
507 	 * p m d s c s    w s e h c c p i    b c p c h c v    d l d g f f
508 	 * s h s t m    s g s w a p
509 	 */
510 	/*
511 	 * r l e l h s    e t n e b r h n    a l l a a k p    r i r l l g
512 	 * c l t e f    p e u t l e
513 	 */
514 	/*
515 	 * o e x e m p    b r l l l e a v    l d y n s l r    y t l o o r
516 	 * a d p l i    h n m w t r
517 	 */
518 
519 
520 	 /* bat */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
521 	 /* gnome */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
522 	 /* hobgoblin */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
523 	 /* jackal */ {0, 0, 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, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
563 	 /* xorn */ {0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
564 	 /* vampire */ {0, 0, 0, 8, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
565 	 /* invisible staker */ {0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
566 	 /* poltergeist */ {0, 13, 0, 8, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
567 
568 	 /* disenchantress */ {0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
569 	 /* shambling mound */ {0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
570 	 /* yellow mold */ {0, 0, 0, 8, 0, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
571 	 /* umber hulk */ {0, 7, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 5, 0, 4, 9, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
582 	 /* silver dragon */ {0, 6, 0, 9, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
583 	 /* platinum dragon */ {0, 7, 0, 9, 0, 0, 11, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
584 	 /* green urchin */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
585 	 /* red dragon */ {0, 6, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
586 
587 	/*
588 	 * p m d s c s    w s e h c c p i    b c p c h c v    d l d g f f
589 	 * s h s t m    s g s w a p
590 	 */
591 	/*
592 	 * r l e l h s    e t n e b r h n    a l l a a k p    r i r l l g
593 	 * c l t e f    p e u t l e
594 	 */
595 	/*
596 	 * o e x e m p    b r l l l e a v    l d y n s l r    y t l o o r
597 	 * a d p l i    h n m w t r
598 	 */
599 
600 	 /* demon lord */ {0, 7, 0, 4, 3, 0, 1, 0, 0, 0, 0, 0, 14, 5, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0},
601 	 /* demon lord */ {0, 7, 0, 4, 3, 0, 1, 0, 0, 0, 0, 0, 14, 5, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0},
602 	 /* demon lord */ {0, 7, 0, 4, 3, 0, 1, 0, 0, 0, 0, 0, 14, 5, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0},
603 	 /* demon lord */ {0, 7, 0, 4, 3, 0, 1, 0, 0, 0, 0, 0, 14, 5, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0},
604 	 /* demon lord */ {0, 7, 0, 4, 3, 0, 1, 0, 0, 0, 0, 0, 14, 5, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0},
605 	 /* demon lord */ {0, 7, 0, 4, 3, 0, 1, 0, 0, 0, 0, 0, 14, 5, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0},
606 	 /* demon lord */ {0, 7, 0, 4, 3, 0, 1, 0, 0, 0, 0, 0, 14, 5, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0},
607 	 /* demon prince */ {0, 7, 0, 4, 3, 9, 1, 0, 0, 0, 0, 0, 14, 5, 0, 0, 4, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 4, 0, 0, 0, 4, 9, 0, 0, 0, 0, 0}
608 
609 };
610 
611 char           *spelmes[] = {"",
612 	 /* 1 */ "the web had no effect on the %s",
613 	 /* 2 */ "the %s changed shape to avoid the web",
614 	 /* 3 */ "the %s isn't afraid of you",
615 	 /* 4 */ "the %s isn't affected",
616 	 /* 5 */ "the %s can see you with his infravision",
617 	 /* 6 */ "the %s vaporizes your missile",
618 	 /* 7 */ "your missile bounces off the %s",
619 	 /* 8 */ "the %s doesn't sleep",
620 	 /* 9 */ "the %s resists",
621 	 /* 10 */ "the %s can't hear the noise",
622 	 /* 11 */ "the %s's tail cuts it free of the web",
623 	 /* 12 */ "the %s burns through the web",
624 	 /* 13 */ "your missiles pass right through the %s",
625 	 /* 14 */ "the %s sees through your illusions",
626 	 /* 15 */ "the %s loves the cold!",
627 	 /* 16 */ "the %s loves the water!"
628 };
629 
630 u_char          to_lower[] =	/* tolower[character] = lower case converted
631 				 * character */
632 {
633 	0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017,	/* NUL-SI */
634 	0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037,	/* DLE-US */
635 	0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057,	/* SP-/ */
636 	0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077,	/* 0-? */
637 	0100, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,	/* @-O */
638 	0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0170, 0171, 0172, 0133, 0134, 0135, 0136, 0137,	/* P-_ */
639 	0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,	/* `-o */
640 	0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177,	/* p-DEL */
641 };
642 
643 u_char          to_upper[] =	/* toupper[character] = upper case converted
644 				 * character */
645 {
646 	0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017,	/* NUL-SI */
647 	0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037,	/* DLE-US */
648 	0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057,	/* SP-/ */
649 	0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077,	/* 0-? */
650 	0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,	/* @-O */
651 	0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137,	/* P-_ */
652 	0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,	/* `-o */
653 	0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177,	/* p-DEL */
654 };
655 
656 u_char          is_digit[] =	/* isdigit[character] = TRUE || FALSE */
657 {
658 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* NUL-SI */
659 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* DLE-US */
660 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* SP-/ */
661 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,	/* 0-? */
662 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* @-O */
663 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* P-_ */
664 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* `-o */
665 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* p-DEL */
666 };
667 
668 u_char          is_alpha[] =	/* isalpha[character] = TRUE || FALSE */
669 {
670 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* NUL-SI */
671 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* DLE-US */
672 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* SP-/ */
673 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0-? */
674 	0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* @-O */
675 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,	/* P-_ */
676 	0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	/* `-o */
677 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,	/* p-DEL */
678 };
679 
680 /*
681  *	function to create scroll numbers with appropriate probability of
682  *	occurrence
683  *
684  *	0 - armor			1 - weapon		2 - enlightenment	3 - paper
685  *	4 - create monster	5 - create item	6 - aggravate		7 - time warp
686  *	8 - teleportation	9 - expanded awareness				10 - haste monst
687  *	11 - heal monster	12 - spirit protection		13 - undead protection
688  *	14 - stealth		15 - magic mapping			16 - hold monster
689  *	17 - gem perfection 18 - spell extension		19 - identify
690  *	20 - remove curse	21 - annihilation			22 - pulverization
691  *  23 - life protection
692  */
693 u_char          scprob[] = {0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3,
694 	3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9,
695 	9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14,
696 	15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 22,
697 22, 22, 23};
698 
699 /*
700  *	function to return a potion number created with appropriate probability
701  *	of occurrence
702  *
703  *	0 - sleep				1 - healing					2 - raise level
704  *	3 - increase ability	4 - gain wisdom				5 - gain strength
705  *	6 - charismatic character	7 - dizziness			8 - learning
706  *	9 - gold detection		10 - monster detection		11 - forgetfulness
707  *	12 - water				13 - blindness				14 - confusion
708  *	15 - heroism			16 - sturdiness				17 - giant strength
709  *	18 - fire resistance	19 - treasure finding		20 - instant healing
710  *	21 - cure dianthroritis	22 - poison					23 - see invisible
711  */
712 u_char          potprob[] = {0, 0, 1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 20, 22, 22, 23, 23};
713 
714 u_char          nlpts[] = {0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7};
715 u_char          nch[] = {0, 0, 0, 1, 1, 1, 2, 2, 3, 4};
716 u_char          nplt[] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 4};
717 u_char          ndgg[] = {0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5};
718 u_char          nsw[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3};
719