1 /* source/tables.c: store/attack/RNG/etc tables and variables
2 
3    Copyright (c) 1989-94 James E. Wilson, Robert A. Koeneke
4 
5    This software may be copied and distributed for educational, research, and
6    not for profit purposes provided that this copyright and statement are
7    included in all such copies. */
8 
9 #include "config.h"
10 #include "constant.h"
11 #include "types.h"
12 
13 #ifdef MORIA_HOU
14 /* Operating hours for Moria				-RAK-	*/
15 /*	 X = Open; . = Closed					*/
16 char  days[7][29] = { "SUN:XXXXXXXXXXXXXXXXXXXXXXXX",
17 		    "MON:XXXXXXXX.........XXXXXXX",
18 		    "TUE:XXXXXXXX.........XXXXXXX",
19 		    "WED:XXXXXXXX.........XXXXXXX",
20 		    "THU:XXXXXXXX.........XXXXXXX",
21 		    "FRI:XXXXXXXX.........XXXXXXX",
22 		    "SAT:XXXXXXXXXXXXXXXXXXXXXXXX" };
23 #endif
24 
25 #ifdef MAC
26 store_type *store;
27 #else
28 store_type store[MAX_STORES];
29 #endif
30 
31 /* Store owners have different characteristics for pricing and haggling*/
32 /* Note: Store owners should be added in groups, one for each store    */
33 #ifdef MACGAME
34 owner_type *owners;
35 #else
36 owner_type owners[MAX_OWNERS] = {
37 {"Erick the Honest       (Human)      General Store",
38 	  250,	175,  108,    4, 0, 12},
39 {"Mauglin the Grumpy     (Dwarf)      Armory"	    ,
40 	32000,	200,  112,    4, 5,  5},
41 {"Arndal Beast-Slayer    (Half-Elf)   Weaponsmith"  ,
42 	10000,	185,  110,    5, 1,  8},
43 {"Hardblow the Humble    (Human)      Temple"	    ,
44 	 3500,	175,  109,    6, 0, 15},
45 {"Ga-nat the Greedy      (Gnome)      Alchemist"    ,
46 	12000,	220,  115,    4, 4,  9},
47 {"Valeria Starshine      (Elf)        Magic Shop"   ,
48 	32000,	175,  110,    5, 2, 11},
49 {"Andy the Friendly      (Halfling)   General Store",
50 	  200,	170,  108,    5, 3, 15},
51 {"Darg-Low the Grim      (Human)      Armory"	    ,
52 	10000,	190,  111,    4, 0,  9},
53 {"Oglign Dragon-Slayer   (Dwarf)      Weaponsmith"  ,
54 	32000,	195,  112,    4, 5,  8},
55 {"Gunnar the Paladin     (Human)      Temple"	    ,
56 	 5000,	185,  110,    5, 0, 23},
57 {"Mauser the Chemist     (Half-Elf)   Alchemist"    ,
58 	10000,	190,  111,    5, 1,  8},
59 {"Gopher the Great!      (Gnome)      Magic Shop"   ,
60 	20000,	215,  113,    6, 4, 10},
61 {"Lyar-el the Comely     (Elf)        General Store",
62 	  300,	165,  107,    6, 2, 18},
63 {"Mauglim the Horrible   (Half-Orc)   Armory"	    ,
64 	 3000,	200,  113,    5, 6,  9},
65 {"Ithyl-Mak the Beastly  (Half-Troll) Weaponsmith"  ,
66 	 3000,	210,  115,    6, 7,  8},
67 {"Delilah the Pure       (Half-Elf)   Temple"	    ,
68 	25000,	180,  107,    6, 1, 20},
69 {"Wizzle the Chaotic     (Halfling)   Alchemist"    ,
70 	10000,	190,  110,    6, 3,  8},
71 {"Inglorian the Mage     (Human?)     Magic Shop"   ,
72 	32000,	200,  110,    7, 0, 10}
73 };
74 #endif
75 
76 /* Buying and selling adjustments for character race VS store	*/
77 /* owner race							 */
78 int8u rgold_adj[MAX_RACES][MAX_RACES] = {
79 			/*  Hum,  HfE,	Elf,  Hal,  Gno,  Dwa,	HfO,  HfT*/
80 /*Human		 */	  {  100,  105,	 105,  110,  113,  115,	 120,  125},
81 /*Half-Elf	 */	  {  110,  100,	 100,  105,  110,  120,	 125,  130},
82 /*Elf		 */	  {  110,  105,	 100,  105,  110,  120,	 125,  130},
83 /*Halfling	 */	  {  115,  110,	 105,	95,  105,  110,	 115,  130},
84 /*Gnome		 */	  {  115,  115,	 110,  105,   95,  110,	 115,  130},
85 /*Dwarf		 */	  {  115,  120,	 120,  110,  110,   95,	 125,  135},
86 /*Half-Orc	 */	  {  115,  120,	 125,  115,  115,  130,	 110,  115},
87 /*Half-Troll	 */	  {  110,  115,	 115,  110,  110,  130,	 110,  110}
88 			};
89 /* object_list[] index of objects that may appear in the store */
90 int16u store_choice[MAX_STORES][STORE_CHOICES] = {
91 	/* General Store */
92 {366,365,364,84,84,365,123,366,365,350,349,348,347,346,346,345,345,345,
93 	344,344,344,344,344,344,344,344},
94 	/* Armory	 */
95 {94,95,96,109,103,104,105,106,110,111,112,114,116,124,125,126,127,129,103,
96 	104,124,125,91,92,95,96},
97 	/* Weaponsmith	 */
98 {29,30,34,37,45,49,57,58,59,65,67,68,73,74,75,77,79,80,81,83,29,30,80,83,
99 	80,83},
100 	/* Temple	 */
101 {322,323,324,325,180,180,233,237,240,241,361,362,57,58,59,260,358,359,265,
102 	237,237,240,240,241,323,359},
103 	/* Alchemy shop	 */
104 {173,174,175,351,351,352,353,354,355,356,357,206,227,230,236,252,253,352,
105 	353,354,355,356,359,363,359,359},
106 	/* Magic-User store*/
107 {318,141,142,153,164,167,168,140,319,320,320,321,269,270,282,286,287,292,
108 	293,294,295,308,269,290,319,282}
109 };
110 
111 #ifndef MAC
112 /* MPW doesn't seem to handle this very well, so replace store_buy array
113    with a function call on mac */
114 /* functions defined in sets.c */
115 extern int general_store(), armory(), weaponsmith(), temple(),
116   alchemist(), magic_shop();
117 
118 /* Each store will buy only certain items, based on TVAL */
119 int (*store_buy[MAX_STORES])() = {
120        general_store, armory, weaponsmith, temple, alchemist, magic_shop};
121 #endif
122 
123 /* Following are arrays for descriptive pieces			*/
124 
125 #ifdef MACGAME
126 
127 char **colors;
128 char **mushrooms;
129 char **woods;
130 char **metals;
131 char **rocks;
132 char **amulets;
133 char **syllables;
134 
135 #else
136 
137 char *colors[MAX_COLORS] = {
138 /* Do not move the first three */
139   "Icky Green", "Light Brown", "Clear",
140   "Azure","Blue","Blue Speckled","Black","Brown","Brown Speckled","Bubbling",
141   "Chartreuse","Cloudy","Copper Speckled","Crimson","Cyan","Dark Blue",
142   "Dark Green","Dark Red","Gold Speckled","Green","Green Speckled","Grey",
143   "Grey Speckled","Hazy","Indigo","Light Blue","Light Green","Magenta",
144   "Metallic Blue","Metallic Red","Metallic Green","Metallic Purple","Misty",
145   "Orange","Orange Speckled","Pink","Pink Speckled","Puce","Purple",
146   "Purple Speckled","Red","Red Speckled","Silver Speckled","Smoky",
147   "Tangerine","Violet","Vermilion","White","Yellow"
148 };
149 
150 char *mushrooms[MAX_MUSH] = {
151   "Blue","Black","Black Spotted","Brown","Dark Blue","Dark Green","Dark Red",
152   "Ecru","Furry","Green","Grey","Light Blue","Light Green","Plaid","Red",
153   "Slimy","Tan","White","White Spotted","Wooden","Wrinkled","Yellow",
154 };
155 
156 char *woods[MAX_WOODS] = {
157   "Aspen","Balsa","Banyan","Birch","Cedar","Cottonwood","Cypress","Dogwood",
158   "Elm","Eucalyptus","Hemlock","Hickory","Ironwood","Locust","Mahogany",
159   "Maple","Mulberry","Oak","Pine","Redwood","Rosewood","Spruce","Sycamore",
160   "Teak","Walnut",
161 };
162 
163 char *metals[MAX_METALS] = {
164   "Aluminum","Cast Iron","Chromium","Copper","Gold","Iron","Magnesium",
165   "Molybdenum","Nickel","Rusty","Silver","Steel","Tin","Titanium","Tungsten",
166   "Zirconium","Zinc","Aluminum-Plated","Copper-Plated","Gold-Plated",
167   "Nickel-Plated","Silver-Plated","Steel-Plated","Tin-Plated","Zinc-Plated"
168 };
169 
170 char *rocks[MAX_ROCKS] = {
171   "Alexandrite","Amethyst","Aquamarine","Azurite","Beryl","Bloodstone",
172   "Calcite","Carnelian","Corundum","Diamond","Emerald","Fluorite","Garnet",
173   "Granite","Jade","Jasper","Lapis Lazuli","Malachite","Marble","Moonstone",
174   "Onyx","Opal","Pearl","Quartz","Quartzite","Rhodonite","Ruby","Sapphire",
175   "Tiger Eye","Topaz","Turquoise","Zircon"
176 };
177 
178 char *amulets[MAX_AMULETS] = {
179   "Amber","Driftwood","Coral","Agate","Ivory","Obsidian",
180   "Bone","Brass","Bronze","Pewter","Tortoise Shell"
181 };
182 
183 char *syllables[MAX_SYLLABLES] = {
184   "a","ab","ag","aks","ala","an","ankh","app",
185   "arg","arze","ash","aus","ban","bar","bat","bek",
186   "bie","bin","bit","bjor","blu","bot","bu",
187   "byt","comp","con","cos","cre","dalf","dan",
188   "den","doe","dok","eep","el","eng","er","ere","erk",
189   "esh","evs","fa","fid","for","fri","fu","gan",
190   "gar","glen","gop","gre","ha","he","hyd","i",
191   "ing","ion","ip","ish","it","ite","iv","jo",
192   "kho","kli","klis","la","lech","man","mar",
193   "me","mi","mic","mik","mon","mung","mur","nej",
194   "nelg","nep","ner","nes","nis","nih","nin","o",
195   "od","ood","org","orn","ox","oxy","pay","pet",
196   "ple","plu","po","pot","prok","re","rea","rhov",
197   "ri","ro","rog","rok","rol","sa","san","sat",
198   "see","sef","seh","shu","ski","sna","sne","snik",
199   "sno","so","sol","sri","sta","sun","ta","tab",
200   "tem","ther","ti","tox","trol","tue","turs","u",
201   "ulk","um","un","uni","ur","val","viv","vly",
202   "vom","wah","wed","werg","wex","whon","wun","x",
203   "yerg","yp","zun"
204 };
205 #endif
206 
207 /* used to calculate the number of blows the player gets in combat */
208 int8u blows_table[7][6] = {
209 /* STR/W:	   9  18  67 107 117 118   : DEX */
210 /* <2 */	{  1,  1,  1,  1,  1,  1 },
211 /* <3 */	{  1,  1,  1,  1,  2,  2 },
212 /* <4 */	{  1,  1,  1,  2,  2,  3 },
213 /* <5 */	{  1,  1,  2,  2,  3,  3 },
214 /* <7 */	{  1,  2,  2,  3,  3,  4 },
215 /* <9 */	{  1,  2,  2,  3,  4,  4 },
216 /* >9 */	{  2,  2,  3,  3,  4,  4 }
217 };
218 
219 /* this table is used to generate a psuedo-normal distribution.	 See the
220    function randnor() in misc1.c, this is much faster than calling
221    transcendental function to calculate a true normal distribution */
222 int16u normal_table[NORMAL_TABLE_SIZE] = {
223      206,     613,    1022,    1430,	1838,	 2245,	  2652,	   3058,
224     3463,    3867,    4271,    4673,	5075,	 5475,	  5874,	   6271,
225     6667,    7061,    7454,    7845,	8234,	 8621,	  9006,	   9389,
226     9770,   10148,   10524,   10898,   11269,	11638,	 12004,	  12367,
227    12727,   13085,   13440,   13792,   14140,	14486,	 14828,	  15168,
228    15504,   15836,   16166,   16492,   16814,	17133,	 17449,	  17761,
229    18069,   18374,   18675,   18972,   19266,	19556,	 19842,	  20124,
230    20403,   20678,   20949,   21216,   21479,	21738,	 21994,	  22245,
231    22493,   22737,   22977,   23213,   23446,	23674,	 23899,	  24120,
232    24336,   24550,   24759,   24965,   25166,	25365,	 25559,	  25750,
233    25937,   26120,   26300,   26476,   26649,	26818,	 26983,	  27146,
234    27304,   27460,   27612,   27760,   27906,	28048,	 28187,	  28323,
235    28455,   28585,   28711,   28835,   28955,	29073,	 29188,	  29299,
236    29409,   29515,   29619,   29720,   29818,	29914,	 30007,	  30098,
237    30186,   30272,   30356,   30437,   30516,	30593,	 30668,	  30740,
238    30810,   30879,   30945,   31010,   31072,	31133,	 31192,	  31249,
239    31304,   31358,   31410,   31460,   31509,	31556,	 31601,	  31646,
240    31688,   31730,   31770,   31808,   31846,	31882,	 31917,	  31950,
241    31983,   32014,   32044,   32074,   32102,	32129,	 32155,	  32180,
242    32205,   32228,   32251,   32273,   32294,	32314,	 32333,	  32352,
243    32370,   32387,   32404,   32420,   32435,	32450,	 32464,	  32477,
244    32490,   32503,   32515,   32526,   32537,	32548,	 32558,	  32568,
245    32577,   32586,   32595,   32603,   32611,	32618,	 32625,	  32632,
246    32639,   32645,   32651,   32657,   32662,	32667,	 32672,	  32677,
247    32682,   32686,   32690,   32694,   32698,	32702,	 32705,	  32708,
248    32711,   32714,   32717,   32720,   32722,	32725,	 32727,	  32729,
249    32731,   32733,   32735,   32737,   32739,	32740,	 32742,	  32743,
250    32745,   32746,   32747,   32748,   32749,	32750,	 32751,	  32752,
251    32753,   32754,   32755,   32756,   32757,	32757,	 32758,	  32758,
252    32759,   32760,   32760,   32761,   32761,	32761,	 32762,	  32762,
253    32763,   32763,   32763,   32764,   32764,	32764,	 32764,	  32765,
254    32765,   32765,   32765,   32766,   32766,	32766,	 32766,	  32766,
255 };
256