Annotation of early-roguelike/urogue/init.c, Revision 1.1.1.1
1.1 rubenllo 1: /*
2: init.c - global variable initializaton
3:
4: UltraRogue: The Ultimate Adventure in the Dungeons of Doom
5: Copyright (C) 1985, 1986, 1992, 1993, 1995 Herb Chong
6: All rights reserved.
7:
8: Based on "Advanced Rogue"
9: Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka
10: All rights reserved.
11:
12: Based on "Rogue: Exploring the Dungeons of Doom"
13: Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
14: All rights reserved.
15:
16: See the file LICENSE.TXT for full copyright and licensing information.
17: */
18:
19: /*
20: Notes
21:
22: Need to add ring of maintain armor (same as ring of prot, armor only)
23: Resplit file into one just for data, one just for functions
24: */
25:
26: #define _ALL_SOURCE /* Need to remove need for this AIXism */
27:
28: #include <string.h>
29: #include <stdlib.h>
30: #include <ctype.h>
31: #include "rogue.h"
32:
33: static char *rainbow[] =
34: {
35: "Red", "Blue", "Green", "Yellow",
36: "Black", "Brown", "Orange", "Pink",
37: "Purple", "Grey", "White", "Silver",
38: "Gold", "Violet", "Clear", "Vermilion",
39: "Ecru", "Turquoise", "Magenta", "Amber",
40: "Topaz", "Plaid", "Tan", "Tangerine",
41: "Aquamarine", "Scarlet", "Khaki", "Crimson",
42: "Indigo", "Beige", "Lavender", "Saffron"
43: };
44:
45: #define NCOLORS (sizeof rainbow / sizeof (char *))
46:
47: static char *sylls[] =
48: {
49: "a", "ab", "ag", "aks", "ala", "an", "ankh", "app", "arg", "arze",
50: "ash", "ban", "bar", "bat", "bek", "bie", "bin", "bit", "bjor",
51: "blu", "bot", "bu", "byt", "comp", "con", "cos", "cre", "dalf",
52: "dan", "den", "do", "e", "eep", "el", "eng", "er", "ere", "erk",
53: "esh", "evs", "fa", "fid", "for", "fri", "fu", "gan", "gar",
54: "glen", "gop", "gre", "ha", "he", "hyd", "i", "ing", "ion", "ip",
55: "ish", "it", "ite", "iv", "jo", "kho", "kli", "klis", "la", "lech",
56: "man", "mar", "me", "mi", "mic", "mik", "mon", "mung", "mur",
57: "nej", "nelg", "nep", "ner", "nes", "nes", "nih", "nin", "o", "od",
58: "ood", "org", "orn", "ox", "oxy", "pay", "pet", "ple", "plu", "po",
59: "pot", "prok", "re", "rea", "rhov", "ri", "ro", "rog", "rok", "rol",
60: "sa", "san", "sat", "see", "sef", "seh", "shu", "ski", "sna",
61: "sne", "snik", "sno", "so", "sol", "sri", "sta", "sun", "ta",
62: "tab", "tem", "ther", "ti", "tox", "trol", "tue", "turs", "u",
63: "ulk", "um", "un", "uni", "ur", "val", "viv", "vly", "vom", "wah",
64: "wed", "werg", "wex", "whon", "wun", "xo", "y", "yot", "yu",
65: "zant", "zap", "zeb", "zim", "zok", "zon", "zum"
66: };
67:
68: static char *stones[] =
69: {
70: "Agate", "Alexandrite", "Amethyst",
71: "Azurite", "Carnelian", "Chrysoberyl",
72: "Chrysoprase", "Citrine", "Diamond",
73: "Emerald", "Garnet", "Hematite",
74: "Jacinth", "Jade", "Kryptonite",
75: "Lapus lazuli", "Malachite", "Moonstone",
76: "Obsidian", "Olivine", "Onyx",
77: "Opal", "Pearl", "Peridot",
78: "Quartz", "Rhodochrosite", "Ruby",
79: "Sapphire", "Sardonyx", "Serpentine",
80: "Spinel", "Tiger eye", "Topaz",
81: "Tourmaline", "Turquoise"
82: };
83:
84: #define NSTONES (sizeof stones / sizeof (char *))
85:
86: static char *wood[] =
87: {
88: "Avocado wood", "Balsa", "Banyan", "Birch",
89: "Cedar", "Cherry", "Cinnibar", "Dogwood",
90: "Driftwood", "Ebony", "Eucalyptus", "Hemlock",
91: "Ironwood", "Mahogany", "Manzanita", "Maple",
92: "Oak", "Pine", "Redwood", "Rosewood",
93: "Teak", "Walnut", "Zebra wood", "Persimmon wood"
94: };
95:
96: #define NWOOD (sizeof wood / sizeof (char *))
97:
98: static char *metal[] =
99: {
100: "Aluminium", "Bone", "Brass", "Bronze",
101: "Copper", "Chromium", "Iron", "Lead",
102: "Magnesium", "Pewter", "Platinum", "Steel",
103: "Tin", "Titanium", "Zinc", "Carbon",
104: "Plastic", "Glass", "Ice", "Chocolate",
105: "Gold", "Silver", "Invisible"
106: };
107:
108: #define NMETAL (sizeof metal / sizeof (char *))
109:
110: const char *monstern = "monster";
111: char *spacemsg = "--Press SPACE to continue--";
112: char *morestr = "--More--";
113: char *retstr = "[Press RETURN to continue]";
114:
115: /* 15 named levels */
116:
117: const char *cnames[C_NOTSET][15] =
118: {
119: { "Veteran", "Warrior",
120: "Swordsman", "Hero", /* Fighter */
121: "Swashbuckler", "Myrmidon",
122: "Champion", "Superhero",
123: "Lord", "Lord",
124: "Lord", "Lord",
125: "Lord", "Lord",
126: "Lord"
127: },
128:
129: { "Gallant", "Keeper",
130: "Protector", "Defender", /* Paladin */
131: "Warder", "Guardian",
132: "Chevalier", "Justiciar",
133: "Paladin", "Paladin",
134: "Paladin", "Paladin",
135: "Paladin", "Paladin",
136: "Paladin"
137: },
138:
139: { "Runner", "Strider",
140: "Scout", "Courser", /* Ranger */
141: "Tracker", "Guide",
142: "Pathfinder", "Ranger",
143: "Ranger Knight", "Ranger Lord",
144: "Ranger Lord", "Ranger Lord",
145: "Ranger Lord", "Ranger Lord",
146: "Ranger Lord"
147: },
148:
149: { "Acolyte", "Adept",
150: "Priest", "Curate", /* Cleric */
151: "Prefect", "Canon",
152: "Lama", "Patriarch",
153: "High Priest", "High Priest",
154: "High Priest", "High Priest",
155: "High Priest", "High Priest",
156: "High Priest"
157: },
158:
159: { "Aspirant", "Ovate", /* Druid */
160: "Initiate of the 1st Circle", "Initiate of the 2nd Circle",
161: "Initiate of the 3rd Circle", "Initiate of the 4th Circle",
162: "Initiate of the 5th Circle", "Initiate of the 6th Circle",
163: "Initiate of the 7th Circle", "Initiate of the 8th Circle",
164: "Initiate of the 9th Circle", "Druid",
165: "Archdruid", "The Great Druid",
166: "The Grand Druid"
167: },
168:
169: { "Prestidigitator", "Evoker",
170: "Conjurer", "Theurgist", /* Magic User */
171: "Thaumaturgist", "Magician",
172: "Enchanter", "Warlock",
173: "Sorcerer", "Necromancer",
174: "Wizard", "Wizard",
175: "Wizard", "Wizard",
176: "Wizard"
177: },
178:
179: { "Prestidigitator", "Minor Trickster",
180: "Trickster", "Master Trickster", /* Illusionist */
181: "Cabalist", "Visionist",
182: "Phantasmist", "Apparitionist",
183: "Spellbinder", "Illusionist",
184: "Illusionist", "Illusionist",
185: "Illusionist", "Illusionist",
186: "Illusionist"
187: },
188:
189: { "Rogue", "Footpad",
190: "Cutpurse", "Robber", /* Thief */
191: "Burglar", "Filcher",
192: "Sharper", "Magsman",
193: "Thief", "Master Thief",
194: "Master Thief", "Master Thief",
195: "Master Thief", "Master Thief",
196: "Master Thief"
197: },
198:
199: { "Bravo", "Rutterkin",
200: "Waghalter", "Murderer", /* Assasin */
201: "Thug", "Killer",
202: "Cutthroat", "Executioner",
203: "Assassin", "Expert Assassin",
204: "Senior Assassin", "Chief Assassin",
205: "Prime Assassin", "Guildmaster Assassin",
206: "Grandfather of Assassins"
207: },
208:
209: { "Ninja", "Ninja",
210: "Ninja", "Ninja", /* Ninja */
211: "Ninja", "Ninja",
212: "Ninja", "Ninja",
213: "Ninja", "Ninja",
214: "Ninja", "Ninja",
215: "Ninja", "Ninja",
216: "Ninja"
217: }
218: };
219:
220: const struct h_list helpstr[] =
221: {
222: { '?', " prints help" },
223: { '/', " identify object" },
224: { 'h', " left" },
225: { 'j', " down" },
226: { 'k', " up" },
227: { 'l', " right" },
228: { 'y', " up & left" },
229: { 'u', " up & right" },
230: { 'b', " down & left" },
231: { 'n', " down & right" },
232: { '<', "SHIFT><dir> run that way" },
233: { 'm', "<dir> move onto without picking up" },
234: { 't', "<dir> throw something" },
235: { 'z', "<dir> zap a wand or staff" },
236: { '>', " go down a staircase" },
237: { 's', " search for trap/secret door" },
238: { '.', " rest for a while" },
239: { ',', " pick up an object" },
240: { 'i', " inventory all items" },
241: { 'I', " inventory type of item" },
242: { 'q', " quaff potion" },
243: { 'r', " read paper" },
244: { 'e', " eat food" },
245: { 'w', " wield a weapon" },
246: { 'W', " wear armor" },
247: { 'T', " take armor off" },
248: { 'P', " put on ring" },
249: { 'R', " remove ring" },
250: { 'A', " activate/apply an artifact" },
251: { 'd', " drop object" },
252: { 'C', " call object (generic)" },
253: { 'M', " mark object (specific)" },
254: { 'o', " examine/set options" },
255: { 'c', " cast a spell/say a prayer" },
256: { 'p', " pray for help (risky)" },
257: { 'a', " affect the undead" },
258: { '^', " set a trap" },
259: { 'D', " dip something (into a pool)" },
260: { 20, "<dir> take (steal) from (direction)" }, /* ctrl-t */
261: { 18, " redraw screen" }, /* ctrl-r */
262: { 16, " back up to 10 previous messages" }, /* ctrl-p */
263: { ESCAPE, " cancel command" },
264: { 'v', " print program version number" },
265: { 'S', " save game" },
266: { 'Q', " quit" },
267: { '=', " listen for monsters" },
268: { 'f', "<dir> fight monster" },
269: { 'F', "<dir> fight monster to the death" },
270:
271: /* Wizard commands. Identified by (h_ch != 0 && h_desc == 0). */
272:
273: {'-', 0 },
274: { 23, " enter wizard mode" }, /* ctrl-w */
275: { 23, "v toggle wizard verbose mode" },
276: { 23, "e exit wizard mode" },
277: { 23, "r random number check" },
278: { 23, "s system statistics" },
279: { 23, "F food statistics" },
280: { 23, "f floor map" },
281: { 23, "m see monster" },
282: { 23, "M create monster" },
283: { 23, "c create item" },
284: { 23, "i inventory level" },
285: { 23, "I identify item" },
286: { 23, "t random teleport" },
287: { 23, "g goto level" },
288: { 23, "C charge item" },
289: { 23, "w print worth of object" },
290: { 23, "o improve stats and pack" },
291: { 0, 0 }
292: };
293:
294: struct magic_item things[] =
295: {
296: {"potion", "POTION", 250, 5}, /* potion */
297: {"scroll", "SCROLL", 260, 30},/* scroll */
298: {"ring", "RING", 70, 5}, /* ring */
299: {"stick", "STICK", 60, 0}, /* stick */
300: {"food", "FOOD", 210, 7}, /* food */
301: {"weapon", "WEAPON", 60, 0}, /* weapon */
302: {"armor", "ARMOR", 90, 0}, /* armor */
303: {"artifact","ARTIFACT", 0, 0} /* special artifacts*/
304: };
305:
306: int numthings = NUMTHINGS;
307:
308: struct magic_item s_magic[] =
309: {
310: {"monster confusion", "CON", 50, 125, 0, 0 },
311: {"magic mapping", "MAP", 45, 150, 20, 10 },
312: {"light", "WATT", 0, 0, 0, 0 },
313: {"hold monster", "HOLD", 25, 200, 33, 10 },
314: {"sleep", "SNOOZE", 23, 50, 20, 10 },
315: {"enchantment", "ENCHANT", 110,400, 15, 10 },
316: {"identify", "ID", 150,50, 0, 15 },
317: {"scare monster", "SCARE", 35, 250, 27, 21 },
318: {"detect gold", "GOLD", 0, 0, 0, 0 },
319: {"teleportation", "TELEP", 50, 165, 10, 20 },
320: {"create monster", "CREATE", 25, 75, 30, 0 },
321: {"remove curse", "REM", 75, 220, 10, 15 },
322: {"petrification", "PET", 25, 285, 0, 0 },
323: {"genocide", "GEN", 10, 1200, 0, 0 },
324: {"cure disease", "CURE", 70, 80, 0, 0 },
325: {"acquirement", "MAKE", 5, 2500, 50, 15 },
326: {"protection", "PROT", 50, 1150, 0, 0 },
327: {"nothing", "NOTHING", 75, 50, 50, 50 },
328: {"magic hitting", "SILVER", 25, 1875, 45, 10 },
329: {"ownership", "OWN", 15, 1550, 45, 10 },
330: {"detect food", "FOOD", 0, 0, 0, 0 },
331: {"electrification", "ELECTRIFY",20, 1450, 0, 0 },
332: {"charm monster", "CHARM", 26, 1500, 25, 15 },
333: {"summon monster", "SUMMON", 26, 1500, 25, 15 },
334: {"gaze reflection", "REFLECT", 25, 400, 25, 15 },
335: {"summon familiar", "SUMFAM", 0, 0, 0, 0 },
336: {"fear", "FEAR", 20, 200, 20, 10 },
337: {"missile protection", "MSHIELD", 20, 300, 20, 10 }
338: };
339:
340: int maxscrolls = MAXSCROLLS;
341:
342: struct magic_item p_magic[] =
343: {
344: {"clear thought", "CLEAR", 90, 380, 27, 15 },
345: {"gain ability", "GAINABIL", 40, 1250, 15, 15 },
346: {"see invisible", "SEE", 0, 0, 0, 0 },
347: {"healing", "HEAL", 120,330, 27, 27 },
348: {"detect monster", "MON", 0, 0, 0, 0 },
349: {"detect magic", "MAG", 0, 0, 0, 0 },
350: {"raise level", "RAISE", 1, 1900, 11, 10 },
351: {"haste self", "HASTE", 140,300, 30, 5 },
352: {"restore abilities", "RESTORE", 130,120, 0, 0 },
353: {"phasing", "PHASE", 45, 340, 21, 20 },
354: {"invisibility", "INVIS", 30, 300, 0, 15 },
355: {"acute scent", "SMELL", 30, 100, 20, 15 },
356: {"acute hearing", "HEAR", 30, 100, 20, 15 },
357: {"super heroism", "SUPER", 10, 800, 20, 15 },
358: {"disguise", "DISGUISE", 30, 500, 0, 15 },
359: {"fire resistance", "NOFIRE", 40, 350, 20, 15 },
360: {"cold resistance", "NOCOLD", 40, 300, 20, 15 },
361: {"continuous breathing","BREATHE", 10, 200, 20, 15 },
362: {"flying", "FLY", 30, 300, 20, 15 },
363: {"regeneration", "REGEN", 20, 500, 20, 15 },
364: {"shield", "SHIELD", 100,200, 20, 10 },
365: {"true sight", "TRUESEE", 64, 570, 25, 15 }
366: };
367:
368: int maxpotions = MAXPOTIONS;
369:
370: struct magic_item r_magic[] =
371: {
372: {"protection", "", 70, 500, 33, 25 },
373: {"add strength", "", 65, 300, 33, 25 },
374: {"sustain ability", "", 40, 380, 10, 0 },
375: {"searching", "", 65, 250, 10, 0 },
376: {"see invisible", "", 30, 175, 10, 0 },
377: {"alertness", "", 40, 190, 10, 0 },
378: {"aggravate monster", "", 35, 100, 100,0 },
379: {"dexterity", "", 65, 220, 33, 25 },
380: {"increase damage", "", 65, 320, 33, 25 },
381: {"regeneration", "", 35, 860, 10, 0 },
382: {"slow digestion", "", 40, 340, 15, 10 },
383: {"teleportation", "", 35, 100, 100,0 },
384: {"stealth", "", 50, 700, 10, 0 },
385: {"add intelligence", "", 60, 540, 33, 25 },
386: {"increase wisdom", "", 60, 540, 33, 25 },
387: {"sustain health", "", 60, 250, 10, 0 },
388: {"vampiric regeneration", "", 20, 900, 25, 10 },
389: {"illumination", "", 20, 300, 10, 0 },
390: {"delusion", "", 20, 100, 75, 0 },
391: {"carrying", "", 20, 400, 30, 30 },
392: {"adornment", "", 15, 10000, 10, 0 },
393: {"levitation", "", 20, 450, 30, 0 },
394: {"fire resistance", "", 10, 750, 10, 0 },
395: {"cold resistance", "", 10, 650, 10, 0 },
396: {"lightning resistance", "", 10, 750, 10, 0 },
397: {"resurrection", "", 1, 8000, 10, 0 },
398: {"breathing", "", 10, 250, 10, 0 },
399: {"free action", "", 10, 225, 10, 0 },
400: {"wizardry", "", 2, 1950, 10, 0 },
401: {"piety", "", 2, 1950, 10, 0 },
402: {"teleport control", "", 5, 450, 10, 0 },
403: {"true sight", "", 10, 775, 10, 0 }
404: };
405:
406: int maxrings = MAXRINGS;
407:
408: struct magic_item ws_magic[] =
409: {
410: {"light", "LIGHT", 90, 150, 20, 20 },
411: {"striking", "HIT", 58, 400, 0, 0 },
412: {"lightning", "BOLT", 25, 800, 0, 0 },
413: {"fire", "FIRE", 25, 600, 0, 0 },
414: {"cold", "COLD", 30, 600, 0, 0 },
415: {"polymorph", "POLY", 90, 210, 0, 0 },
416: {"magic missile", "MLE", 90, 500, 0, 0 },
417: {"slow monster", "SLOW", 76, 320, 25, 20 },
418: {"drain life", "DRAIN", 90, 310, 20, 0 },
419: {"charging", "CHARGE", 70, 1100, 0, 0 },
420: {"teleport monster","RANDOM", 90, 240, 25, 20 },
421: {"cancellation", "CANCEL", 38, 230, 0, 0 },
422: {"confuse monster", "CONFMON", 50, 200, 0, 0 },
423: {"disintegration", "KILL-O-ZAP", 10, 1550, 33, 0 },
424: {"anti-matter", "BLACKHOLE", 30, 980, 0, 0 },
425: {"paralyze monster","PARAL", 38, 200, 0, 0 },
426: {"heal monster", "XENOHEAL", 30, 200, 40, 10 },
427: {"nothing", "NOTHING", 30, 100, 0, 0 },
428: {"invisibility", "WS_INVIS", 30, 150, 30, 5 },
429: {"blasting", "BLAST", 10, 220, 0, 0 },
430: {"webbing", "WEB", 0, 0, 0, 0 },
431: {"door opening", "KNOCK", 0, 0, 0, 0 },
432: {"hold portal", "CLOSE", 0, 0, 0, 0 }
433: };
434:
435: int maxsticks = MAXSTICKS;
436:
437: struct magic_item fd_data[] =
438: {
439: {"food ration", "RATION", 400, 20, 20, 20 },
440: {"random fruit","FRUIT", 300, 10, 0, 0},
441: {"cram", "CRAM", 120, 30, 0, 0 },
442: {"honey cake", "CAKES", 80, 10, 0, 0 },
443: {"lemba", "LEMBA", 50, 80, 0, 0 },
444: {"miruvor", "MIRUVOR", 50, 200, 0, 0 }
445: };
446:
447: int maxfoods = MAXFOODS;
448:
449: /*
450: * weapons and their attributes
451: * Average Damage = (min_damage + max_damage) / 2)
452: * AD of 2D5+3 = (5 + 13) / 2 = 9
453: * AD of 3D6 = (3 + 18) / 2 = 10.5
454: */
455:
456: #define ISSHARPMETAL (ISSHARP | ISMETAL)
457: #define ISCRYSKNIFE (ISSHARP | ISPOISON | ISMANY | ISLITTLE)
458:
459: struct init_weps weaps[] =
460: {
461: /* Missile weapons */
462: {"sling", "0d0", "0d0", NONE, 5, 1,
463: ISLAUNCHER | ISLITTLE, },
464: {"rock", "1d2", "1d4", SLING, 5, 1,
465: ISMANY | ISMISL | ISLITTLE },
466: {"sling bullet", "1d1", "1d8", SLING, 3, 1,
467: ISSHARP | ISMANY | ISMISL | ISMETAL | ISLITTLE },
468: {"short bow", "1d1", "1d1", NONE, 40, 75,
469: ISLAUNCHER },
470: {"arrow", "1d1", "2d3", BOW, 5, 1,
471: ISSHARP | ISMANY | ISMISL | ISLITTLE },
472: {"arrow", "1d2", "2d8", BOW, 10, 5,
473: ISSHARP | ISSILVER | ISMANY | ISMISL | ISLITTLE },
474: {"fire arrow", "1d2", "2d8", BOW, 10, 3,
475: ISSHARP | CANBURN | ISMANY | ISMISL | ISLITTLE },
476: {"footbow", "1d1", "1d1", NONE, 90, 125,
477: ISLAUNCHER },
478: {"footbow bolt", "1d2", "1d10", FOOTBOW, 5, 1,
479: ISSHARP | ISMANY | ISMISL | ISLITTLE },
480: {"crossbow", "1d1", "1d1", NONE, 100,175,
481: ISLAUNCHER },
482: {"crossbow bolt", "1d2", "2d5", CROSSBOW, 7, 3,
483: ISSHARP | ISMANY | ISMISL | ISLITTLE },
484:
485: /* Useful throwing weapons */
486: {"dart", "1d1", "1d3", NONE, 5, 1,
487: ISSHARP | ISMANY | ISMISL | ISLITTLE },
488: {"dagger", "1d6", "1d4", NONE, 10, 2,
489: ISSHARP | ISMETAL | ISMANY | ISMISL | ISLITTLE },
490: {"hammer", "1d3", "1d5", NONE, 50, 3,
491: ISMETAL | ISMISL },
492: {"leuku", "1d6", "1d5", NONE, 40, 4,
493: ISSHARP | ISMETAL | ISTWOH },
494: {"javelin", "1d4", "1d6", NONE, 10, 5,
495: ISSHARP | ISMISL | ISTWOH },
496: {"tomahawk", "1d6", "1d6", NONE, 45, 7,
497: ISSHARP | ISMISL },
498: {"machete", "1d7", "1d6", NONE, 45, 4,
499: ISSHARP | ISMETAL | ISMISL },
500: {"throwing axe","1d3", "1d6+2", NONE, 50, 8,
501: ISSHARP | ISMETAL | ISMISL },
502: {"spear", "2d3", "1d6", NONE, 50, 2,
503: ISSHARP | ISMETAL | ISMISL },
504: {"boomerang", "1d1", "1d8", NONE, 10, 13,
505: CANRETURN | ISMANY | ISMISL | ISLITTLE },
506: {"long spear", "1d8", "1d10", NONE, 50, 20,
507: ISSHARP | ISMETAL | ISMISL | ISTWOH },
508: {"shuriken", "1d1", "2d5", NONE, 4, 20,
509: ISSHARP | ISMETAL | ISMANY | ISMISL | ISLITTLE },
510: {"burning oil", "0d0", "2d10+5", NONE, 20, 30,
511: CANBURN | ISMANY | ISMISL | ISLITTLE },
512: {"grenade", "1d1", "1d2/4d8", NONE, 10, 50,
513: ISMANY | ISSMALL },
514:
515: /* other weapons */
516: {"club", "1d4", "1d2", NONE, 30, 2, 0 },
517: {"pitchfork", "1d5", "2d2", NONE, 15, 5, ISSHARPMETAL },
518: {"short sword", "1d6", "1d2", NONE, 50, 10, ISSHARPMETAL },
519: {"hand axe", "1d6", "1d2", NONE, 40, 15, ISSHARPMETAL },
520: {"partisan", "1d6", "1d2", NONE, 75, 4, ISSHARPMETAL | ISTWOH },
521: {"grain flail", "1d6", "1d4", NONE, 100, 2, ISSHARPMETAL },
522: {"singlestick", "1d4+2", "1d2", NONE, 30, 20, 0 },
523: {"rapier", "1d6+1", "1d2", NONE, 7, 75, ISSHARPMETAL },
524: {"sickle", "1d6+1", "1d2", NONE, 30, 15, ISSHARPMETAL },
525: {"hatchet", "1d6+1", "1d4", NONE, 50, 10, ISSHARPMETAL },
526: {"scimitar", "1d8", "1d2", NONE, 40, 10, ISSHARPMETAL },
527: {"mace", "2d4", "1d3", NONE, 100, 40, 0 },
528: {"morning star", "2d4", "1d3", NONE, 125, 35, ISMETAL },
529: {"broad sword", "2d4", "1d3", NONE, 75, 50, ISSHARPMETAL },
530: {"miner's pick", "2d4", "1d2", NONE, 85, 40, ISSHARPMETAL },
531: {"guisarme", "2d4", "1d3", NONE, 100, 25, ISSHARPMETAL | ISTWOH },
532: {"war flail", "1d6+2", "1d4", NONE, 150, 50, ISSHARPMETAL | ISTWOH },
533: {"crysknife", "3d3", "1d3", NONE, 12, 100, ISCRYSKNIFE },
534: {"battle axe", "1d8+2", "1d3", NONE, 80, 100, ISSHARPMETAL },
535: {"cutlass", "1d10", "1d2", NONE, 55, 120, ISSHARPMETAL },
536: {"glaive", "1d10", "1d3", NONE, 80, 80, ISSHARPMETAL | ISTWOH },
537: {"pertuska", "2d5", "1d3", NONE, 130, 100, ISSHARPMETAL | ISTWOH },
538: {"long sword", "3d4", "1d2", NONE, 100, 150, ISSHARPMETAL },
539: {"lance", "1d12", "1d8", NONE, 80, 140, ISSHARP | ISTWOH },
540: {"ranseur", "1d12", "1d8", NONE, 100, 130, ISSHARPMETAL | ISTWOH },
541: {"sabre", "2d6", "1d3", NONE, 50, 200, ISSHARPMETAL },
542: {"spetum", "2d6", "1d3", NONE, 50, 180, ISSHARPMETAL | ISTWOH },
543: {"halberd", "2d6", "1d3", NONE, 150, 125, ISSHARPMETAL | ISTWOH },
544: {"trident", "3d4", "1d4", NONE, 50, 200, ISSHARPMETAL | ISTWOH },
545: {"war pick", "3d4", "1d2", NONE, 75, 175, ISSHARPMETAL | ISTWOH },
546: {"bardiche", "3d4", "1d2", NONE, 125, 125, ISSHARPMETAL | ISTWOH },
547: {"heavy mace", "3d4", "1d3", NONE, 200, 50, ISTWOH },
548: {"great scythe", "2d6+2", "1d2", NONE, 100, 200, ISSHARP | ISTWOH },
549: {"quarter staff", "3d5", "1d2", NONE, 70, 250, 0 },
550: {"bastard sword", "2d8", "1d2", NONE, 150, 300, ISSHARPMETAL },
551: {"pike", "2d8", "2d6", NONE, 200, 275, ISSHARPMETAL | ISTWOH },
552: {"great flail", "2d6+2", "1d4", NONE, 200, 275, ISSHARPMETAL | ISTWOH },
553: {"great maul", "4d4", "1d3", NONE, 400, 250, ISTWOH },
554: {"great pick", "2d9", "1d2", NONE, 175, 330, ISSHARPMETAL | ISTWOH },
555: {"two handed sword","4d4", "1d2", NONE, 250, 300, ISSHARPMETAL | ISTWOH },
556: {"claymore", "3d7", "1d2", NONE, 200, 500, ISSHARPMETAL | ISTWOH }
557: };
558:
559: int maxweapons = MAXWEAPONS;
560:
561: struct init_armor armors[] =
562: {
563: { "soft leather", 75, 20, 9, 50 },
564: { "cuirboilli", 150, 30, 8, 130 },
565: { "leather armor", 175, 40, 8, 100 },
566: { "ring mail", 350, 49, 7, 250 },
567: { "studded leather armor",400,58, 7, 200 },
568: { "scale mail", 500, 66, 6, 250 },
569: { "padded armor", 550, 72, 6, 150 },
570: { "chain mail", 750, 78, 5, 300 },
571: { "brigandine", 800, 84, 5, 280 },
572: { "splint mail", 1000, 88, 4, 350 },
573: { "banded mail", 1250, 90, 4, 300 },
574: { "superior chain", 1500, 93, 3, 350 },
575: { "plate mail", 1400, 96, 3, 400 },
576: { "plate armor", 1650, 98, 2, 450 },
577: { "mithril", 30000, 99, 2, 200 },
578: { "crystalline armor", 15000, 100, 0, 300 }
579: };
580:
581: int maxarmors = MAXARMORS;
582:
583: struct init_artifact arts[] = {
584: { "Magic Purse of Yendor", 15, 1, 1, 1, 1, 4600L, 50 },
585: { "Phial of Galadriel", 20, 2, 2, 2, 1, 12500L, 10 },
586: { "Amulet of Yendor", 25, 4, 1, 1, 2, 16000L, 10 },
587: { "Palantir of Might", 30, 1, 4, 1, 2, 18500L, 70 },
588: { "Crown of Might", 35, 6, 2, 1, 1, 23500L, 50 },
589: { "Sceptre of Might", 40, 2, 2, 1, 6, 38000L, 50 },
590: { "Silmaril of Ea", 45, 4, 2, 5, 1, 50000L, 50 },
591: { "Wand of Yendor", 50, 4, 2, 3, 10, 80000L, 50 }
592: };
593:
594: int maxartifact = MAXARTIFACT;
595:
596: /*
597: init_player()
598: roll up the rogue
599: */
600:
601: void
602: init_player(void)
603: {
604: int special = rnd(100) < 20;
605: struct linked_list *item;
606: struct object *obj;
607: int which_armor = 0, which_weapon = 0;
608: int other_weapon_flags = 0;
609:
610: pstats.s_lvl = 1;
611: pstats.s_exp = 0L;
612: pstats.s_arm = 10;
613:
614: if (!geta_player())
615: {
616: do_getplayer(); /* get character class */
617: pstats.s_str = 8 + rnd(5);
618: pstats.s_intel = 8 + rnd(5);
619: pstats.s_wisdom = 8 + rnd(5);
620: pstats.s_dext = 8 + rnd(5);
621: pstats.s_const = 10 + rnd(8);
622: pstats.s_charisma = 8 + rnd(4);
623: pstats.s_power = 5 + rnd(5);
624: pstats.s_hpt = 15 + rnd(5);
625:
626: switch (char_type) /* Class-specific abilities */
627: {
628: case C_FIGHTER:
629: pstats.s_str = 17;
630: pstats.s_const += rnd(4) + 1;
631: if (special)
632: {
633: pstats.s_str += rnd(3);
634: pstats.s_dext += rnd(4);
635: }
636: pstats.s_const = max(pstats.s_const, 16);
637: break;
638:
639: case C_PALADIN:
640: pstats.s_charisma = 17;
641:
642: if (special)
643: {
644: pstats.s_charisma += rnd(3);
645: pstats.s_wisdom += rnd(4);
646: pstats.s_str += rnd(5);
647: }
648:
649: pstats.s_str = max(pstats.s_str, 16);
650: pstats.s_wisdom = max(pstats.s_wisdom, 16);
651: break;
652:
653: case C_RANGER:
654: if (special)
655: {
656: pstats.s_wisdom += rnd(4);
657: pstats.s_intel += rnd(4);
658: pstats.s_str += rnd(5);
659: }
660:
661: pstats.s_str = max(pstats.s_str, 16);
662: pstats.s_wisdom = max(pstats.s_wisdom, 16);
663: pstats.s_const = max(pstats.s_const, 14);
664: break;
665:
666: case C_MAGICIAN:
667: pstats.s_intel = (special) ? 18 : 16;
668: pstats.s_power += 5 + rnd(10);
669: break;
670:
671: case C_ILLUSION:
672: pstats.s_intel = (special) ? 18 : 16;
673: pstats.s_dext = (special) ? 18 : 14;
674: pstats.s_power += 5 + rnd(10);
675: break;
676:
677: case C_CLERIC:
678: pstats.s_wisdom = (special) ? 18 : 16;
679: pstats.s_str += rnd(4);
680: pstats.s_power += 5 + rnd(10);
681: break;
682:
683: case C_DRUID:
684: if (special)
685: {
686: pstats.s_wisdom += rnd(5);
687: pstats.s_charisma += rnd(4);
688: }
689: pstats.s_str += rnd(4);
690: pstats.s_power += 5 + rnd(10);
691: pstats.s_wisdom = max(pstats.s_wisdom, 16);
692: break;
693:
694: case C_THIEF:
695: pstats.s_dext = 18;
696: if (special)
697: pstats.s_const += rnd(4) + 1;
698: break;
699:
700: case C_ASSASIN:
701: pstats.s_dext = (special) ? 18 : 16;
702: pstats.s_intel = (special) ? 18 : 16;
703: break;
704:
705: case C_NINJA:
706: if (special)
707: {
708: pstats.s_dext += rnd(5);
709: pstats.s_str += rnd(4);
710: pstats.s_intel += rnd(3);
711: pstats.s_wisdom += rnd(3);
712: }
713: pstats.s_dext = max(pstats.s_dext, 16);
714: pstats.s_str = max(pstats.s_str, 15);
715: pstats.s_wisdom = max(pstats.s_wisdom, 15);
716: pstats.s_const = max(pstats.s_const, 15);
717: pstats.s_charisma = max(pstats.s_charisma, 11);
718: }
719:
720: puta_player();
721: }
722:
723: if (char_type == C_ASSASIN || char_type == C_NINJA
724: || char_type == C_FIGHTER)
725: pstats.s_dmg = "2d6";
726: else
727: pstats.s_dmg = "1d4";
728:
729: if (char_type == C_NINJA || char_type == C_FIGHTER)
730: pstats.s_arm = 8;
731:
732: if (pstats.s_const > 15)
733: pstats.s_hpt += pstats.s_const - 15;
734:
735: max_stats = pstats;
736: player.t_rest_hpt = player.t_rest_pow = 0;
737: player.t_praycnt = 0;
738: pstats.s_carry = totalenc();
739: pack = NULL;
740:
741: switch (player.t_ctype) /* now outfit pack */
742: {
743: case C_PALADIN:
744: purse = roll(20, 60);
745: which_armor = CHAIN_MAIL;
746: which_weapon = LONG_SWORD;
747: break;
748:
749: case C_FIGHTER:
750: purse = roll(50, 60);
751: which_armor = SCALE_MAIL;
752: which_weapon = BROAD_SWORD;
753: break;
754:
755: case C_RANGER:
756: purse = roll(50, 60);
757: which_armor = PADDED_ARMOR;
758: which_weapon = LONG_SPEAR;
759: other_weapon_flags |= ISOWNED | CANRETURN;
760: break;
761:
762: case C_CLERIC:
763: purse = roll(30, 80);
764: which_armor = RING_MAIL;
765: which_weapon = MORNINGSTAR;
766: break;
767:
768: case C_DRUID:
769: purse = roll(30, 80);
770: which_armor = STUDDED_LEATHER;
771: which_weapon = LIGHT_MACE;
772: break;
773:
774: case C_THIEF:
775: purse = roll(40, 80);
776: which_armor = HEAVY_LEATHER;
777: which_weapon = CUTLASS;
778: break;
779:
780: case C_ASSASIN:
781: purse = roll(20, 80);
782: which_armor = CUIRBOLILLI;
783: which_weapon = SABRE;
784: other_weapon_flags |= ISPOISON;
785: break;
786:
787: case C_NINJA:
788: purse = roll(20, 80);
789: which_armor = CUIRBOLILLI;
790: which_weapon = CRYSKNIFE;
791: other_weapon_flags |= ISPOISON;
792: item = spec_item(WEAPON, SHURIKEN, 1, 1);
793: obj = OBJPTR(item);
794: obj->o_count = 1;
795: obj->o_flags |= ISKNOW | ISPOISON | ISOWNED | CANRETURN;
796: add_pack(item, NOMESSAGE);
797: break;
798:
799: case C_MAGICIAN:
800: case C_ILLUSION:
801: purse = roll(20, 60);
802: which_armor = SOFT_LEATHER;
803: which_weapon = SINGLESTICK;
804: break;
805:
806: default:
807: break;
808: }
809:
810: /* Add weapon to pack */
811:
812: item = spec_item(WEAPON, which_weapon, 1, 1);
813: obj = OBJPTR(item);
814:
815: obj->o_flags |= ISKNOW;
816: obj->o_flags |= other_weapon_flags;
817: obj->o_count = 1;
818: add_pack(item, NOMESSAGE);
819: cur_weapon = obj;
820:
821: /* Add armor to pack */
822:
823: item = spec_item(ARMOR, which_armor, 0, 0);
824: obj = OBJPTR(item);
825:
826: obj->o_flags |= ISKNOW;
827: obj->o_weight = armors[which_armor].a_wght;
828: add_pack(item, NOMESSAGE);
829: cur_armor = obj;
830:
831: /* Add some food to pack */
832:
833: item = spec_item(FOOD, FD_CRAM, 0, 0);
834: obj = OBJPTR(item);
835:
836: obj->o_weight = things[TYP_FOOD].mi_wght;
837: obj->o_count = 3;
838: add_pack(item, NOMESSAGE);
839: }
840:
841: /*
842: init_flags()
843: Initialize flags on startup
844: */
845:
846: void
847: init_flags(void)
848: {
849: switch (player.t_ctype)
850: {
851: case C_MAGICIAN:
852: case C_ILLUSION:
853: case C_CLERIC:
854: case C_DRUID:
855: case C_RANGER:
856: case C_PALADIN:
857: turn_on(player, CANSUMMON);
858: break;
859:
860: default:
861: break;
862: }
863:
864: turn_on(player, CANCAST);
865: turn_on(player, CANWIELD);
866: }
867:
868: /*
869: * Contains definitions and functions for dealing with things like potions
870: * and scrolls
871: */
872:
873: /*
874: init_things()
875: Initialize the probabilities for types of things
876: */
877:
878: void
879: init_things(void)
880: {
881: struct magic_item *mp;
882:
883: for (mp = &things[1]; mp < &things[numthings]; mp++)
884: mp->mi_prob += (mp - 1)->mi_prob;
885:
886: badcheck("things", things, numthings);
887: }
888:
889: /*
890: init_fd()
891: Initialize the probabilities for types of food
892: */
893:
894: void
895: init_fd(void)
896: {
897: struct magic_item *mp;
898:
899: for (mp = &fd_data[1]; mp < &fd_data[maxfoods]; mp++)
900: mp->mi_prob += (mp - 1)->mi_prob;
901:
902: badcheck("food", fd_data, maxfoods);
903: }
904:
905: /*
906: init_colors()
907: Initialize the potion color scheme for this time
908: */
909:
910: void
911: init_colors(void)
912: {
913: int i;
914: char *str;
915:
916: for (i = 0; i < maxpotions; i++)
917: {
918: do
919: str = rainbow[rnd(NCOLORS)];
920: while( !isupper(*str) );
921:
922: p_colors[i] = md_strdup(str);
923: p_colors[i][0] = (char) tolower(p_colors[i][0]);
924:
925: know_items[TYP_POTION][i] = FALSE;
926: guess_items[TYP_POTION][i] = NULL;
927:
928: if (i > 0)
929: p_magic[i].mi_prob += p_magic[i - 1].mi_prob;
930: }
931:
932: badcheck("potions", p_magic, maxpotions);
933: }
934:
935: /*
936: init_names()
937: Generate the names of the various scrolls
938: */
939:
940: void
941: init_names(void)
942: {
943: int nsyl;
944: char *cp, *sp;
945: int i, nwords;
946:
947: for (i = 0; i < maxscrolls; i++)
948: {
949: cp = prbuf;
950: nwords = rnd(COLS / 20) + 1 + (COLS > 40 ? 1 : 0);
951:
952: while (nwords--)
953: {
954: nsyl = rnd(3) + 1;
955:
956: while (nsyl--)
957: {
958: sp = sylls[rnd((sizeof sylls) /
959: (sizeof(char *)))];
960:
961: while (*sp)
962: *cp++ = *sp++;
963: }
964: *cp++ = ' ';
965: }
966:
967: *--cp = '\0';
968: s_names[i] = (char *) new_alloc(strlen(prbuf) + 1);
969:
970: know_items[TYP_SCROLL][i] = FALSE;
971: guess_items[TYP_SCROLL][i] = 0;
972:
973: strcpy(s_names[i], prbuf);
974:
975: if (i > 0)
976: s_magic[i].mi_prob += s_magic[i - 1].mi_prob;
977: }
978:
979: badcheck("scrolls", s_magic, maxscrolls);
980: }
981:
982: /*
983: init_stones()
984: Initialize the ring stone setting scheme for this time
985: */
986:
987: void
988: init_stones(void)
989: {
990: int i;
991: char *str;
992:
993: for (i = 0; i < maxrings; i++)
994: {
995: do
996: str = stones[rnd(NSTONES)];
997: while(!isupper(*str));
998:
999: r_stones[i] = md_strdup(str);
1000: r_stones[i][0] = (char) tolower( r_stones[i][0] );
1001:
1002: know_items[TYP_RING][i] = FALSE;
1003: guess_items[TYP_RING][i] = NULL;
1004:
1005: if (i > 0)
1006: r_magic[i].mi_prob += r_magic[i - 1].mi_prob;
1007: }
1008:
1009: badcheck("rings", r_magic, maxrings);
1010: }
1011:
1012: /*
1013: init_materials()
1014: Initialize the construction materials for wands and staffs
1015: */
1016:
1017: void
1018: init_materials(void)
1019: {
1020: int i;
1021: char *str;
1022:
1023: for (i = 0; i < maxsticks; i++)
1024: {
1025: do
1026: {
1027: if (rnd(100) > 50)
1028: {
1029: str = metal[rnd(NMETAL)];
1030:
1031: if (isupper(*str))
1032: ws_type[i] = "wand";
1033: }
1034: else
1035: {
1036: str = wood[rnd(NWOOD)];
1037:
1038: if (isupper(*str))
1039: ws_type[i] = "staff";
1040: }
1041: }
1042: while(!isupper(*str));
1043:
1044: ws_made[i] = md_strdup(str);
1045: ws_made[i][0] = (char) tolower( ws_made[i][0] );
1046:
1047: know_items[TYP_STICK][i] = FALSE;
1048: guess_items[TYP_STICK][i] = 0;
1049:
1050: if (i > 0)
1051: ws_magic[i].mi_prob += ws_magic[i - 1].mi_prob;
1052: }
1053:
1054: badcheck("sticks", ws_magic, maxsticks);
1055: }
1056:
1057: void
1058: badcheck(char *name, struct magic_item *magic, int bound)
1059: {
1060: struct magic_item *end;
1061:
1062: if (magic[bound - 1].mi_prob == 1000)
1063: return;
1064:
1065: printf("\nBad percentages for %s:\n", name);
1066:
1067: for (end = &magic[bound]; magic < end; magic++)
1068: printf("%3d%% %s\n", magic->mi_prob, magic->mi_name);
1069:
1070: printf("[Hit RETURN to continue]");
1071: fflush(stdout);
1072:
1073: while ((readchar() & 0177) != '\n')
1074: continue;
1075: }
CVSweb