Fandom

Wikihack

Source:SLASH'EM 0.0.7E7F2/u init.c

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Below is the full text to u_init.c from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/u_init.c#line123]], for example.

The latest source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.
1.    /*	SCCS Id: @(#)u_init.c	3.4	2002/10/22	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #include "hack.h"
6.    
7.    struct trobj {
8.    	short trotyp;
9.    	schar trspe;
10.   	char trclass;
11.   	Bitfield(trquan,6);
12.   	Bitfield(trbless,2);
13.   };
14.   
15.   STATIC_DCL void FDECL(ini_inv, (struct trobj *));
16.   STATIC_DCL void FDECL(knows_object,(int));
17.   STATIC_DCL void FDECL(knows_class,(CHAR_P));
18.   STATIC_DCL boolean FDECL(restricted_spell_discipline, (int));
19.   
20.   #define UNDEF_TYP	0
21.   #define UNDEF_SPE	'\177'
22.   #define UNDEF_BLESS	2
23.   
24.   /*
25.    *	Initial inventory for the various roles.
26.    */
27.   
28.   static struct trobj Archeologist[] = {
29.   #define A_BOOK          4
30.   	/* if adventure has a name...  idea from tan@uvm-gen */
31.   	{ BULLWHIP, 2, WEAPON_CLASS, 1, UNDEF_BLESS },
32.   	{ LEATHER_JACKET, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
33.   	{ FEDORA, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
34.   	{ FOOD_RATION, 0, FOOD_CLASS, 3, 0 },
35.   	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },        
36.   	{ UNDEF_TYP, UNDEF_SPE, SCROLL_CLASS, 2, UNDEF_BLESS },
37.   	{ PICK_AXE, UNDEF_SPE, TOOL_CLASS, 1, UNDEF_BLESS },
38.   	{ TINNING_KIT, UNDEF_SPE, TOOL_CLASS, 1, UNDEF_BLESS },
39.   	{ TOUCHSTONE, 0, GEM_CLASS, 1, 0 },
40.   	{ SACK, 0, TOOL_CLASS, 1, 0 },
41.   	{ 0, 0, 0, 0, 0 }
42.   };
43.   static struct trobj Barbarian[] = {
44.   #define B_MAJOR	0	/* two-handed sword or battle-axe  */
45.   #define B_MINOR	1	/* matched with axe or short sword */
46.   	{ TWO_HANDED_SWORD, 0, WEAPON_CLASS, 1, UNDEF_BLESS },
47.   	{ AXE, 0, WEAPON_CLASS, 1, UNDEF_BLESS },
48.   	{ RING_MAIL, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
49.   	{ FOOD_RATION, 0, FOOD_CLASS, 2, 0 },
50.   	{ 0, 0, 0, 0, 0 }
51.   };
52.   static struct trobj Cave_man[] = {
53.   #define C_AMMO	2
54.   	{ CLUB, 1, WEAPON_CLASS, 1, UNDEF_BLESS },
55.   	{ SLING, 2, WEAPON_CLASS, 1, UNDEF_BLESS },
56.   	{ FLINT, 0, GEM_CLASS, 15, UNDEF_BLESS },	/* quan is variable */
57.   	{ ROCK, 0, GEM_CLASS, 3, 0 },			/* yields 18..33 */
58.   	{ LEATHER_ARMOR, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
59.   	{ 0, 0, 0, 0, 0 }
60.   };
61.   static struct trobj Flame_Mage[] = {
62.   #define F_BOOK          9
63.   	{ QUARTERSTAFF, 1, WEAPON_CLASS, 1, 1 },        /* for dealing with ghosts */
64.   	{ STUDDED_LEATHER_ARMOR, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
65.   	{ FOOD_RATION, 0, FOOD_CLASS, 2, 0 },
66.   	{ UNDEF_TYP, UNDEF_SPE, POTION_CLASS, 1, UNDEF_BLESS },
67.   	{ UNDEF_TYP, UNDEF_SPE, SCROLL_CLASS, 1, UNDEF_BLESS },
68.   	{ WAN_FIRE, UNDEF_SPE, WAND_CLASS, 1, UNDEF_BLESS },
69.   	{ UNDEF_TYP, UNDEF_SPE, RING_CLASS, 1, UNDEF_BLESS },
70.   	{ SPE_FLAME_SPHERE, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
71.   	{ SPE_FIREBALL, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
72.   	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
73.     	{ 0, 0, 0, 0, 0 }
74.   };
75.   static struct trobj Healer[] = {
76.   	{ SCALPEL, 1, WEAPON_CLASS, 1, UNDEF_BLESS },
77.   	{ LEATHER_GLOVES, 1, ARMOR_CLASS, 1, UNDEF_BLESS },
78.   	{ STETHOSCOPE, 0, TOOL_CLASS, 1, 0 },
79.   	{ MEDICAL_KIT, 0, TOOL_CLASS, 1, 0 },        
80.   	{ POT_HEALING, 0, POTION_CLASS, 4, UNDEF_BLESS },
81.   	{ POT_EXTRA_HEALING, 0, POTION_CLASS, 4, UNDEF_BLESS },
82.   	{ WAN_SLEEP, UNDEF_SPE, WAND_CLASS, 1, UNDEF_BLESS },
83.   	/* [Tom] they might as well have a wand of healing, too */        
84.   	{ WAN_HEALING, UNDEF_SPE, WAND_CLASS, 1, UNDEF_BLESS },
85.   	/* always blessed, so it's guaranteed readable */
86.   	{ SPE_HEALING, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
87.   	{ SPE_STONE_TO_FLESH, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
88.   	{ APPLE, 0, FOOD_CLASS, 10, 0 },
89.   	{ 0, 0, 0, 0, 0 }
90.   };
91.   static struct trobj Ice_Mage[] = {
92.   #define I_BOOK          9
93.   	{ QUARTERSTAFF, 1, WEAPON_CLASS, 1, 1 },        /* for dealing with ghosts */
94.   	{ STUDDED_LEATHER_ARMOR, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
95.   	{ FOOD_RATION, 0, FOOD_CLASS, 2, 0 },
96.   	{ UNDEF_TYP, UNDEF_SPE, POTION_CLASS, 1, UNDEF_BLESS },
97.   	{ UNDEF_TYP, UNDEF_SPE, SCROLL_CLASS, 1, UNDEF_BLESS },
98.   	{ WAN_COLD, UNDEF_SPE, WAND_CLASS, 1, UNDEF_BLESS },
99.   	{ UNDEF_TYP, UNDEF_SPE, RING_CLASS, 1, UNDEF_BLESS },
100.  	{ SPE_FREEZE_SPHERE, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
101.  	{ SPE_CONE_OF_COLD, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
102.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
103.  	{ 0, 0, 0, 0, 0 }
104.  };
105.  static struct trobj Knight[] = {
106.  	{ LONG_SWORD, 1, WEAPON_CLASS, 1, UNDEF_BLESS },
107.  	{ LANCE, 0, WEAPON_CLASS, 1, UNDEF_BLESS },
108.  	{ PLATE_MAIL, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
109.  	{ HELMET, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
110.  	{ LARGE_SHIELD, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
111.  	{ LEATHER_GLOVES, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
112.  	{ APPLE, 0, FOOD_CLASS, 10, 0 },
113.  	{ CARROT, 0, FOOD_CLASS, 10, 0 },
114.  	{ 0, 0, 0, 0, 0 }
115.  };
116.  static struct trobj Monk[] = {
117.  #define M_BOOK		2
118.  	{ LEATHER_GLOVES, 2, ARMOR_CLASS, 1, UNDEF_BLESS },
119.  	{ ROBE, 1, ARMOR_CLASS, 1, UNDEF_BLESS },
120.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
121.  	{ UNDEF_TYP, UNDEF_SPE, SCROLL_CLASS, 1, UNDEF_BLESS },
122.  	{ POT_HEALING, 0, POTION_CLASS, 3, UNDEF_BLESS },
123.  	{ FOOD_RATION, 0, FOOD_CLASS, 3, 0 },
124.  	{ APPLE, 0, FOOD_CLASS, 5, UNDEF_BLESS },
125.  	{ ORANGE, 0, FOOD_CLASS, 5, UNDEF_BLESS },
126.  	/* Yes, we know fortune cookies aren't really from China.  They were
127.  	 * invented by George Jung in Los Angeles, California, USA in 1916.
128.  	 */
129.  	{ FORTUNE_COOKIE, 0, FOOD_CLASS, 3, UNDEF_BLESS },
130.  	{ 0, 0, 0, 0, 0 }
131.  };
132.  static struct trobj Necromancer[] = {
133.  #define N_BOOK          8
134.  /* pretty much like Wizard, except with pick-axe instead of magic resist. */
135.  	{ QUARTERSTAFF, 1, WEAPON_CLASS, 1, 1 },        /* for dealing with ghosts */
136.  	{ UNDEF_TYP, UNDEF_SPE, RING_CLASS, 2, UNDEF_BLESS },
137.  	{ UNDEF_TYP, UNDEF_SPE, POTION_CLASS, 3, UNDEF_BLESS },
138.  	{ UNDEF_TYP, UNDEF_SPE, SCROLL_CLASS, 3, UNDEF_BLESS },
139.  	{ SPE_SUMMON_UNDEAD, 0, SPBOOK_CLASS, 1, 1 },
140.  	{ SPE_COMMAND_UNDEAD, 0, SPBOOK_CLASS, 1, 1 },
141.  	{ SPE_DRAIN_LIFE, 0, SPBOOK_CLASS, 1, 1 },
142.  		/* WAC -- gave him drain life rather than turn undead */
143.  	{ WAN_DRAINING, UNDEF_SPE, WAND_CLASS, 1, UNDEF_BLESS },
144.  		/* KMH -- ...and the matching wand for the inexperienced */
145.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
146.  	{ PICK_AXE, UNDEF_SPE, TOOL_CLASS, 1, UNDEF_BLESS },
147.  	{ 0, 0, 0, 0, 0 }
148.  };
149.  static struct trobj Priest[] = {
150.  #define P_BOOK          7
151.  	{ MACE, 0, WEAPON_CLASS, 1, 1 },
152.  	{ ROBE, 0, ARMOR_CLASS, 1, 1 },
153.  	{ SMALL_SHIELD, 2, ARMOR_CLASS, 1, 1 },
154.  	{ POT_WATER, 0, POTION_CLASS, 4, 1 },	/* holy water */
155.  	{ CLOVE_OF_GARLIC, 0, FOOD_CLASS, 1, 1 },
156.  	{ SPRIG_OF_WOLFSBANE, 0, FOOD_CLASS, 1, 1 },
157.  	{ SPE_HEALING, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
158.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
159.  	{ UNDEF_TYP, UNDEF_SPE, SCROLL_CLASS, 1, 1 },
160.  	{ 0, 0, 0, 0, 0 }
161.  };
162.  static struct trobj Ranger[] = {
163.  #define RAN_BOW			1
164.  #define RAN_TWO_ARROWS	2
165.  #define RAN_ZERO_ARROWS	3
166.  	{ DAGGER, 1, WEAPON_CLASS, 1, UNDEF_BLESS },
167.  	{ BOW, 1, WEAPON_CLASS, 1, UNDEF_BLESS },
168.  	{ ARROW, 2, WEAPON_CLASS, 50, UNDEF_BLESS },
169.  	{ ARROW, 0, WEAPON_CLASS, 30, UNDEF_BLESS },
170.  	{ CLOAK_OF_DISPLACEMENT, 2, ARMOR_CLASS, 1, UNDEF_BLESS },
171.  	{ CRAM_RATION, 0, FOOD_CLASS, 4, 0 },
172.  	{ 0, 0, 0, 0, 0 }
173.  };
174.  static struct trobj Rogue[] = {
175.  #define R_DAGGERS	1
176.  #define R_DARTS         2
177.  	{ SHORT_SWORD, 0, WEAPON_CLASS, 1, UNDEF_BLESS },
178.  	{ DAGGER, 0, WEAPON_CLASS, 10, 0 },	/* quan is variable */
179.  	{ DART, 0, WEAPON_CLASS, 25, UNDEF_BLESS },
180.  	{ LEATHER_ARMOR, 1, ARMOR_CLASS, 1, UNDEF_BLESS },
181.  	{ POT_SICKNESS, 0, POTION_CLASS, 1, 0 },
182.  	{ SCR_GOLD_DETECTION, 0, SCROLL_CLASS, 4, 1 },
183.  	{ SCR_TELEPORTATION, 0, SCROLL_CLASS, 4, 1 },
184.  	{ LOCK_PICK, 9, TOOL_CLASS, 1, 0 },
185.  	{ OILSKIN_SACK, 0, TOOL_CLASS, 1, 0 },
186.  	{ 0, 0, 0, 0, 0 }
187.  };
188.  static struct trobj Samurai[] = {
189.  #define S_ARROWS	3
190.  	{ KATANA, 0, WEAPON_CLASS, 1, UNDEF_BLESS },
191.  	{ SHORT_SWORD, 0, WEAPON_CLASS, 1, UNDEF_BLESS }, /* wakizashi */
192.  	{ YUMI, 0, WEAPON_CLASS, 1, UNDEF_BLESS },
193.  	{ YA, 0, WEAPON_CLASS, 25, UNDEF_BLESS }, /* variable quan */
194.  	{ SPLINT_MAIL, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
195.  	{ 0, 0, 0, 0, 0 }
196.  };
197.  #ifdef TOURIST
198.  static struct trobj Tourist[] = {
199.  #define T_DARTS		0
200.  	{ DART, 2, WEAPON_CLASS, 25, UNDEF_BLESS },	/* quan is variable */
201.  	{ UNDEF_TYP, UNDEF_SPE, FOOD_CLASS, 12, 0 },
202.  	{ POT_EXTRA_HEALING, 0, POTION_CLASS, 2, UNDEF_BLESS },
203.  	{ SCR_MAGIC_MAPPING, 0, SCROLL_CLASS, 6, UNDEF_BLESS },
204.  	{ HAWAIIAN_SHIRT, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
205.  	{ EXPENSIVE_CAMERA, UNDEF_SPE, TOOL_CLASS, 1, 0 },
206.  	{ CREDIT_CARD, 0, TOOL_CLASS, 1, 0 },
207.  	{ 0, 0, 0, 0, 0 }
208.  };
209.  #endif
210.  static struct trobj UndeadSlayer[] = {
211.  #define U_MINOR 1       /* silver spear or whip [Castlevania] 25/25% */
212.                          /* crossbow 50% [Buffy] */
213.  #define U_RANGE 2       /* silver daggers or crossbow bolts */
214.  #define U_MISC  3       /* +1 boots [Buffy can kick] or helmet */
215.  #define U_ARMOR 4       /* Tshirt/leather +1 or chain mail */
216.  	{ WOODEN_STAKE, 0, WEAPON_CLASS, 1, UNDEF_BLESS },
217.  	{ SILVER_SPEAR, 0, WEAPON_CLASS, 1, UNDEF_BLESS },
218.  	{ SILVER_DAGGER, 0, WEAPON_CLASS, 5, UNDEF_BLESS },
219.  	{ HELMET, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
220.  	{ CHAIN_MAIL, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
221.  	{ CLOVE_OF_GARLIC, 0, FOOD_CLASS, 5, 1 },
222.  	{ SPRIG_OF_WOLFSBANE, 0, FOOD_CLASS, 5, 1 },
223.  	{ HOLY_WAFER, 0, FOOD_CLASS, 4, 0 },
224.  	{ POT_WATER, 0, POTION_CLASS, 4, 1 },        /* holy water */
225.  	{ 0, 0, 0, 0, 0 }
226.  };
227.  static struct trobj Valkyrie[] = {
228.  /*        { LONG_SWORD, 1, WEAPON_CLASS, 1, UNDEF_BLESS }, */
229.  	{ SPEAR, 1, WEAPON_CLASS, 1, UNDEF_BLESS }, /* Traditional Weapon - WAC*/
230.  	{ DAGGER, 0, WEAPON_CLASS, 5, UNDEF_BLESS },
231.  	{ SMALL_SHIELD, 3, ARMOR_CLASS, 1, UNDEF_BLESS },
232.  	{ FOOD_RATION, 0, FOOD_CLASS, 1, 0 },
233.  	{ 0, 0, 0, 0, 0 }
234.  };
235.  static struct trobj Wizard[] = {
236.  #define W_MULTSTART	2
237.  #define W_MULTEND	6
238.  #define W_BOOK1         6
239.  #define W_BOOK2         7
240.  #define W_BOOK3         8
241.  #define W_BOOK4         9
242.  	{ QUARTERSTAFF, 1, WEAPON_CLASS, 1, 1 },
243.  	{ CLOAK_OF_MAGIC_RESISTANCE, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
244.  	{ UNDEF_TYP, UNDEF_SPE, WAND_CLASS, 1, UNDEF_BLESS },
245.  	{ UNDEF_TYP, UNDEF_SPE, RING_CLASS, 2, UNDEF_BLESS },
246.  	{ UNDEF_TYP, UNDEF_SPE, POTION_CLASS, 3, UNDEF_BLESS },
247.  	{ UNDEF_TYP, UNDEF_SPE, SCROLL_CLASS, 3, UNDEF_BLESS },
248.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
249.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
250.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
251.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_CLASS, 1, 1 },
252.  	{ 0, 0, 0, 0, 0 }
253.  };
254.  #ifdef YEOMAN
255.  static struct trobj Yeoman[] = {
256.  	{ SHORT_SWORD, 2, WEAPON_CLASS, 1, UNDEF_BLESS },
257.  	{ PARTISAN, 1, WEAPON_CLASS, 1, UNDEF_BLESS },
258.  	{ LEATHER_ARMOR, 1, ARMOR_CLASS, 1, UNDEF_BLESS },
259.  	{ HIGH_BOOTS, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
260.  	{ LEATHER_GLOVES, 0, ARMOR_CLASS, 1, UNDEF_BLESS },
261.  	{ APPLE, 0, FOOD_CLASS, 10, 0 },
262.  	{ CARROT, 0, FOOD_CLASS, 10, 0 },
263.  	{ POT_WATER, 0, POTION_CLASS, 3, 0 },
264.  	{ FISHING_POLE, 0, TOOL_CLASS, 1, 0 },
265.  	{ 0, 0, 0, 0, 0 }
266.  };
267.  #endif
268.  
269.  /*
270.   *	Optional extra inventory items.
271.   */
272.  
273.  static struct trobj Tinopener[] = {
274.  	{ TIN_OPENER, 0, TOOL_CLASS, 1, 0 },
275.  	{ 0, 0, 0, 0, 0 }
276.  };
277.  static struct trobj Magicmarker[] = {
278.  	{ MAGIC_MARKER, UNDEF_SPE, TOOL_CLASS, 1, 0 },
279.  	{ 0, 0, 0, 0, 0 }
280.  };
281.  static struct trobj Lamp[] = {
282.  	{ OIL_LAMP, 1, TOOL_CLASS, 1, 0 },
283.  	{ 0, 0, 0, 0, 0 }
284.  };
285.  static struct trobj Torch[] = {
286.  	{ TORCH, 0, TOOL_CLASS, 2, 0 },
287.  	{ 0, 0, 0, 0, 0 }
288.  };
289.  static struct trobj Blindfold[] = {
290.  	{ BLINDFOLD, 0, TOOL_CLASS, 1, 0 },
291.  	{ 0, 0, 0, 0, 0 }
292.  };
293.  static struct trobj Instrument[] = {
294.  	{ WOODEN_FLUTE, 0, TOOL_CLASS, 1, 0 },
295.  	{ 0, 0, 0, 0, 0 }
296.  };
297.  static struct trobj Xtra_food[] = {
298.  	{ UNDEF_TYP, UNDEF_SPE, FOOD_CLASS, 2, 0 },
299.  	{ 0, 0, 0, 0, 0 }
300.  };
301.  #ifdef TOURIST
302.  static struct trobj Leash[] = {
303.  	{ LEASH, 0, TOOL_CLASS, 1, 0 },
304.  	{ 0, 0, 0, 0, 0 }
305.  };
306.  static struct trobj Towel[] = {
307.  	{ TOWEL, 0, TOOL_CLASS, 1, 0 },
308.  	{ 0, 0, 0, 0, 0 }
309.  };
310.  #endif	/* TOURIST */
311.  static struct trobj Wishing[] = {
312.  	{ WAN_WISHING, 3, WAND_CLASS, 1, 0 },
313.  	{ 0, 0, 0, 0, 0 }
314.  };
315.  #ifdef GOLDOBJ
316.  static struct trobj Money[] = {
317.  	{ GOLD_PIECE, 0 , COIN_CLASS, 1, 0 },
318.  	{ 0, 0, 0, 0, 0 }
319.  };
320.  #endif
321.  
322.  /* race-based substitutions for initial inventory;
323.     the weaker cloak for elven rangers is intentional--they shoot better */
324.  static struct inv_sub { short race_pm, item_otyp, subs_otyp; } inv_subs[] = {
325.      { PM_ELF,	DAGGER,			ELVEN_DAGGER	      },
326.      { PM_ELF,	SPEAR,			ELVEN_SPEAR	      },
327.      { PM_ELF,	SHORT_SWORD,		ELVEN_SHORT_SWORD     },
328.      { PM_ELF,	BOW,			ELVEN_BOW	      },
329.      { PM_ELF,	ARROW,			ELVEN_ARROW	      },
330.      { PM_ELF,	HELMET,			ELVEN_LEATHER_HELM    },
331.   /* { PM_ELF,	SMALL_SHIELD,		ELVEN_SHIELD	      }, */
332.      { PM_ELF,	CLOAK_OF_DISPLACEMENT,	ELVEN_CLOAK	      },
333.      { PM_ELF,	CRAM_RATION,		LEMBAS_WAFER	      },
334.      { PM_ORC,	DAGGER,			ORCISH_DAGGER	      },
335.      { PM_ORC,	SPEAR,			ORCISH_SPEAR	      },
336.      { PM_ORC,	SHORT_SWORD,		ORCISH_SHORT_SWORD    },
337.      { PM_ORC,	BOW,			ORCISH_BOW	      },
338.      { PM_ORC,	ARROW,			ORCISH_ARROW	      },
339.      { PM_ORC,	HELMET,			ORCISH_HELM	      },
340.      { PM_ORC,	SMALL_SHIELD,		ORCISH_SHIELD	      },
341.      { PM_ORC,	RING_MAIL,		ORCISH_RING_MAIL      },
342.      { PM_ORC,	CHAIN_MAIL,		ORCISH_CHAIN_MAIL     },
343.      { PM_DWARF, SPEAR,			DWARVISH_SPEAR	      },
344.      { PM_DWARF, SHORT_SWORD,		DWARVISH_SHORT_SWORD  },
345.      { PM_DWARF, HELMET,			DWARVISH_IRON_HELM    },
346.   /* { PM_DWARF, SMALL_SHIELD,		DWARVISH_ROUNDSHIELD  }, */
347.   /* { PM_DWARF, PICK_AXE,		DWARVISH_MATTOCK      }, */
348.      { PM_GNOME, BOW,			CROSSBOW	      },
349.      { PM_GNOME, ARROW,			CROSSBOW_BOLT	      },
350.      { PM_HUMAN_WEREWOLF,FOOD_RATION,		TRIPE_RATION	      },
351.      { PM_HUMAN_WEREWOLF,SILVER_SPEAR,		SPEAR		      },
352.      { PM_HUMAN_WEREWOLF,SILVER_DAGGER,		DAGGER		      },
353.  #ifdef FIREARMS
354.      { PM_HUMAN_WEREWOLF,SILVER_BULLET,		BULLET		      },
355.  #endif
356.      { PM_DROW,		DAGGER,			DARK_ELVEN_DAGGER     },
357.      { PM_DROW,		SHORT_SWORD,		DARK_ELVEN_SHORT_SWORD},
358.      { PM_DROW,		BOW,			DARK_ELVEN_BOW	      },
359.      { PM_DROW,		ARROW,			DARK_ELVEN_ARROW      },
360.      { PM_VAMPIRE,	POT_FRUIT_JUICE,	POT_BLOOD	      },
361.      { PM_VAMPIRE,	FOOD_RATION,		POT_VAMPIRE_BLOOD     },
362.      { NON_PM,	STRANGE_OBJECT,		STRANGE_OBJECT	      }
363.  };
364.  
365.  /* align-based substitutions for initial inventory */
366.  struct inv_asub { aligntyp align; short item_otyp, subs_otyp; };
367.  static struct inv_asub inv_asubs[] = {
368.      { A_CHAOTIC,	HOLY_WAFER,		LEMBAS_WAFER	      },
369.      { A_NONE,		STRANGE_OBJECT,		STRANGE_OBJECT	      }
370.  };
371.  
372.  /* KMH -- Expectations for skills.
373.   *	1.	Starting equipment will start as basic, and should have a maximum
374.   *		of at least skilled.  If you enter the dungeon with it, you should
375.   *		know how to use it.  See weapon.c, skill_init().
376.   *	2.	First and second artifact gifts should have a maximum of at least
377.   *		skilled.  See artifact.c, init_artifacts().
378.   *	3.	Quest artifacts should have a maximum of expert.  See artifact.c,
379.   *		init_artifacts().
380.   *	4.	Races that construct weapons (elf, dwarf, orc) should have
381.   *		a maximum of expert in those weapons.
382.   *	5.	Spellcasters should get a maximum of at least basic in all spell
383.   *		categories.
384.   */
385.  
386.  static const struct def_skill Skill_A[] = {
387.      { P_DAGGER, P_BASIC },		{ P_KNIFE,  P_BASIC },
388.      { P_PICK_AXE, P_EXPERT },		{ P_SHORT_SWORD, P_BASIC },
389.      { P_SCIMITAR, P_SKILLED },		{ P_SABER, P_EXPERT },
390.      { P_CLUB, P_SKILLED },              { P_PADDLE, P_BASIC },
391.      { P_QUARTERSTAFF, P_SKILLED },
392.  #ifdef FIREARMS
393.      { P_FIREARM, P_SKILLED },
394.  #endif
395.      { P_SLING, P_SKILLED },		{ P_DART, P_BASIC },
396.      { P_BOOMERANG, P_EXPERT },		{ P_WHIP, P_EXPERT },
397.      { P_UNICORN_HORN, P_SKILLED },
398.      { P_ATTACK_SPELL, P_BASIC },	{ P_HEALING_SPELL, P_BASIC },
399.      { P_DIVINATION_SPELL, P_EXPERT },   { P_ENCHANTMENT_SPELL, P_BASIC },
400.      { P_PROTECTION_SPELL, P_BASIC },    { P_BODY_SPELL, P_BASIC },
401.      { P_MATTER_SPELL, P_SKILLED },
402.      /*WAC- 'A' knows of all spells from studying,  but only really good
403.      at divination class*/
404.      { P_TWO_WEAPON_COMBAT, P_BASIC },
405.      { P_BARE_HANDED_COMBAT, P_EXPERT },
406.      { P_NONE, 0 }
407.  };
408.  
409.  static const struct def_skill Skill_B[] = {
410.      { P_DAGGER, P_BASIC },		{ P_AXE, P_EXPERT },
411.      { P_PICK_AXE, P_SKILLED },	{ P_SHORT_SWORD, P_EXPERT },
412.      { P_BROAD_SWORD, P_SKILLED },	{ P_LONG_SWORD, P_SKILLED },
413.      { P_TWO_HANDED_SWORD, P_EXPERT },	{ P_SCIMITAR, P_SKILLED },
414.      { P_SABER, P_BASIC },		{ P_CLUB, P_SKILLED },
415.      { P_PADDLE, P_SKILLED },
416.      { P_MACE, P_SKILLED },		{ P_MORNING_STAR, P_SKILLED },
417.      { P_FLAIL, P_BASIC },		{ P_HAMMER, P_EXPERT },
418.      { P_QUARTERSTAFF, P_BASIC },	{ P_SPEAR, P_SKILLED },
419.      { P_TRIDENT, P_SKILLED },		{ P_BOW, P_BASIC },
420.      { P_ATTACK_SPELL, P_SKILLED },	{ P_BODY_SPELL, P_SKILLED },
421.  /*WAC - 'B' is good at attack spells and body manipulation spells
422.          -both combat oriented */
423.  #ifdef STEED
424.      { P_RIDING, P_BASIC },
425.  #endif
426.      { P_TWO_WEAPON_COMBAT, P_BASIC },
427.      { P_BARE_HANDED_COMBAT, P_MASTER },
428.      { P_NONE, 0 }
429.  };
430.  
431.  static const struct def_skill Skill_C[] = {
432.      { P_DAGGER, P_BASIC },		{ P_KNIFE,  P_SKILLED },
433.      { P_AXE, P_SKILLED },		{ P_PICK_AXE, P_BASIC },
434.      { P_CLUB, P_EXPERT },               { P_PADDLE, P_EXPERT },
435.      { P_MACE, P_EXPERT },
436.      { P_MORNING_STAR, P_BASIC },	{ P_FLAIL, P_SKILLED },
437.      { P_HAMMER, P_SKILLED },		{ P_QUARTERSTAFF, P_EXPERT },
438.      { P_POLEARMS, P_SKILLED },		{ P_SPEAR, P_EXPERT },
439.      { P_JAVELIN, P_SKILLED },		{ P_TRIDENT, P_SKILLED },
440.      { P_BOW, P_EXPERT },                { P_SLING, P_SKILLED },
441.      { P_BOOMERANG, P_EXPERT },		{ P_UNICORN_HORN, P_BASIC },
442.      { P_MATTER_SPELL, P_SKILLED },      { P_ENCHANTMENT_SPELL, P_BASIC },
443.  
444.  /*WAC - 'C' is at one with the elements - matter spells, as well as
445.          basic enchantments - removed attack spell basic skill as
446.          it is now "dark" spells*/
447.      { P_BARE_HANDED_COMBAT, P_MASTER },
448.      { P_NONE, 0 }
449.  };
450.  
451.  static const struct def_skill Skill_F[] = {
452.  /*Style: small-med edged weapons, blunt weapons*/
453.      { P_DAGGER, P_EXPERT },             { P_KNIFE,  P_SKILLED },
454.      { P_AXE, P_BASIC },                 /*{ P_PICK_AXE, P_BASIC },*/
455.      { P_SHORT_SWORD, P_EXPERT },        /*{ P_BROAD_SWORD, P_BASIC },*/
456.      { P_LONG_SWORD, P_SKILLED },        /*{ P_TWO_HANDED_SWORD, P_BASIC },*/
457.      { P_SCIMITAR, P_SKILLED },          { P_SABER, P_SKILLED },
458.      { P_PADDLE, P_BASIC },
459.      { P_MACE, P_BASIC },                /*{ P_MORNING_STAR, P_BASIC },
460.      { P_FLAIL, P_BASIC },*/               { P_HAMMER, P_BASIC },
461.      { P_QUARTERSTAFF, P_SKILLED },       /* { P_POLEARMS, P_BASIC },*/
462.  /* Relies on spells for ranged attack
463.      { P_SPEAR, P_BASIC },               { P_JAVELIN, P_BASIC },
464.      { P_TRIDENT, P_BASIC },             { P_LANCE, P_BASIC },
465.      { P_BOW, P_BASIC },                 { P_SLING, P_BASIC },
466.      { P_CROSSBOW, P_BASIC },            { P_DART, P_EXPERT },
467.      { P_SHURIKEN, P_BASIC },            { P_BOOMERANG, P_BASIC },
468.  */
469.      { P_WHIP, P_BASIC },                { P_UNICORN_HORN, P_SKILLED },
470.  
471.      { P_ATTACK_SPELL, P_SKILLED },      { P_HEALING_SPELL, P_BASIC },
472.      { P_DIVINATION_SPELL, P_EXPERT },   { P_ENCHANTMENT_SPELL, P_BASIC },
473.      { P_PROTECTION_SPELL, P_BASIC },    { P_BODY_SPELL, P_SKILLED },
474.      { P_MATTER_SPELL, P_EXPERT },
475.  /*  Added expert matter spell (elements), skilled in attack, basic in rest
476.          He is a mage,  so knows the types.*/
477.  #ifdef STEED
478.      { P_RIDING, P_SKILLED },
479.  #endif
480.      { P_TWO_WEAPON_COMBAT, P_SKILLED }, { P_BARE_HANDED_COMBAT, P_SKILLED },
481.      { P_NONE, 0 }
482.  };
483.  
484.  static const struct def_skill Skill_H[] = {
485.      { P_DAGGER, P_SKILLED },		{ P_KNIFE, P_EXPERT },
486.      { P_SHORT_SWORD, P_SKILLED },	{ P_SCIMITAR, P_BASIC },
487.      { P_SABER, P_BASIC },		{ P_CLUB, P_SKILLED },
488.      { P_PADDLE, P_SKILLED },
489.      { P_MACE, P_BASIC },		{ P_QUARTERSTAFF, P_EXPERT },
490.      { P_POLEARMS, P_BASIC },		{ P_SPEAR, P_BASIC },
491.      { P_JAVELIN, P_BASIC },		{ P_TRIDENT, P_BASIC },
492.      { P_SLING, P_SKILLED },		{ P_DART, P_EXPERT },
493.      { P_SHURIKEN, P_SKILLED },		{ P_UNICORN_HORN, P_EXPERT },
494.  
495.      { P_ATTACK_SPELL, P_BASIC },        { P_HEALING_SPELL, P_EXPERT },
496.      { P_DIVINATION_SPELL, P_BASIC },    { P_ENCHANTMENT_SPELL, P_BASIC },
497.      { P_PROTECTION_SPELL, P_BASIC },    { P_BODY_SPELL, P_BASIC },
498.      { P_MATTER_SPELL, P_BASIC },
499.  #ifdef STEED
500.      { P_RIDING, P_BASIC },
501.  #endif
502.      { P_BARE_HANDED_COMBAT, P_BASIC },
503.      { P_NONE, 0 }
504.  };
505.  
506.  static const struct def_skill Skill_I[] = {
507.  /*Resorts mostly to stabbing weapons*/
508.      { P_DAGGER, P_EXPERT },             { P_KNIFE,  P_SKILLED },
509.  /*  { P_AXE, P_BASIC },                 { P_PICK_AXE, P_BASIC },
510.      { P_SHORT_SWORD, P_EXPERT },        { P_BROAD_SWORD, P_BASIC },*/
511.      { P_LONG_SWORD, P_SKILLED },      /*{ P_TWO_HANDED_SWORD, P_BASIC },
512.      { P_SCIMITAR, P_SKILLED },          { P_SABER, P_SKILLED },
513.      { P_MACE, P_BASIC },                { P_MORNING_STAR, P_BASIC },
514.      { P_FLAIL, P_BASIC },               { P_HAMMER, P_BASIC },*/
515.      { P_QUARTERSTAFF, P_SKILLED },      { P_POLEARMS, P_BASIC },
516.      { P_SPEAR, P_BASIC },               { P_JAVELIN, P_BASIC },
517.      { P_TRIDENT, P_BASIC },             { P_LANCE, P_BASIC },
518.  /*  { P_BOW, P_BASIC },                 { P_SLING, P_BASIC },
519.      { P_CROSSBOW, P_BASIC },            { P_DART, P_EXPERT },
520.      { P_SHURIKEN, P_BASIC },            { P_BOOMERANG, P_BASIC },*/
521.      { P_WHIP, P_BASIC },                { P_UNICORN_HORN, P_SKILLED },
522.  
523.      { P_ATTACK_SPELL, P_BASIC },        { P_HEALING_SPELL, P_SKILLED },
524.      { P_DIVINATION_SPELL, P_BASIC },    { P_ENCHANTMENT_SPELL, P_EXPERT },
525.      { P_PROTECTION_SPELL, P_SKILLED },  { P_BODY_SPELL, P_BASIC },
526.      { P_MATTER_SPELL, P_EXPERT },
527.      /*WAC - same as Flame Mage*/
528.  #ifdef STEED
529.      { P_RIDING, P_SKILLED },
530.  #endif
531.      { P_TWO_WEAPON_COMBAT, P_SKILLED }, { P_BARE_HANDED_COMBAT, P_SKILLED },
532.      { P_NONE, 0 }
533.  };
534.  
535.  static const struct def_skill Skill_K[] = {
536.      { P_DAGGER, P_BASIC },		{ P_KNIFE, P_BASIC },
537.      { P_AXE, P_SKILLED },		{ P_PICK_AXE, P_BASIC },
538.      { P_SHORT_SWORD, P_SKILLED },	{ P_BROAD_SWORD, P_SKILLED },
539.      { P_LONG_SWORD, P_EXPERT },	{ P_TWO_HANDED_SWORD, P_SKILLED },
540.      { P_SCIMITAR, P_BASIC },		{ P_SABER, P_SKILLED },
541.      { P_CLUB, P_BASIC },                { P_PADDLE, P_BASIC },
542.      { P_MACE, P_SKILLED },
543.      { P_MORNING_STAR, P_SKILLED },	{ P_FLAIL, P_BASIC },
544.      { P_HAMMER, P_BASIC },		{ P_POLEARMS, P_SKILLED },
545.      { P_SPEAR, P_SKILLED },		{ P_JAVELIN, P_SKILLED },
546.      { P_TRIDENT, P_BASIC },		{ P_LANCE, P_EXPERT },
547.      { P_BOW, P_BASIC },			{ P_CROSSBOW, P_SKILLED },
548.      { P_HEALING_SPELL, P_SKILLED },
549.      { P_PROTECTION_SPELL, P_SKILLED },      { P_BODY_SPELL, P_BASIC },
550.  /*WAC - removed the attack spells - no good having knights summoning
551.          undead!  Replaced with skilled body spells*/
552.  
553.  #ifdef STEED
554.      { P_RIDING, P_EXPERT },
555.  #endif
556.      { P_TWO_WEAPON_COMBAT, P_SKILLED }, { P_BARE_HANDED_COMBAT, P_EXPERT },
557.      { P_NONE, 0 }
558.  };
559.  
560.  static const struct def_skill Skill_Mon[] = {
561.      { P_PADDLE, P_SKILLED },
562.      { P_QUARTERSTAFF, P_SKILLED },	{ P_SPEAR, P_BASIC },
563.      { P_JAVELIN, P_BASIC },		{ P_BOW, P_BASIC },
564.      { P_SHURIKEN, P_BASIC },            { P_MARTIAL_ARTS, P_GRAND_MASTER },
565.  
566.      { P_ATTACK_SPELL, P_BASIC },    { P_HEALING_SPELL, P_EXPERT },
567.      { P_DIVINATION_SPELL, P_BASIC },	{ P_ENCHANTMENT_SPELL, P_SKILLED },
568.      { P_PROTECTION_SPELL, P_EXPERT },	{ P_BODY_SPELL, P_BASIC },
569.      { P_MATTER_SPELL, P_BASIC },
570.  /*WAC - monks are good healers - expert healing - and expert protect*/
571.      { P_NONE, 0 }
572.  };
573.  
574.  static const struct def_skill Skill_N[] = {
575.      { P_DAGGER, P_EXPERT },             { P_KNIFE,  P_SKILLED },
576.      { P_AXE, P_SKILLED },               { P_PICK_AXE, P_SKILLED },
577.      { P_CLUB, P_SKILLED },              { P_MACE, P_BASIC },
578.      { P_QUARTERSTAFF, P_EXPERT },       { P_POLEARMS, P_SKILLED },
579.      { P_SPEAR, P_BASIC },               { P_JAVELIN, P_BASIC },
580.      { P_TRIDENT, P_BASIC },             { P_SLING, P_SKILLED },
581.      { P_DART, P_EXPERT },               { P_SHURIKEN, P_BASIC },
582.  
583.      { P_ATTACK_SPELL, P_EXPERT },
584.      { P_MATTER_SPELL, P_EXPERT },
585.  /*WAC-  expert of dark arts - attack spells,  skilled in matter
586.          -for fireball and cone of cold*/
587.      { P_BARE_HANDED_COMBAT, P_BASIC },
588.      { P_NONE, 0 }
589.  };
590.  
591.  static struct def_skill Skill_P[] = {
592.  	/* KMH -- Long sword for Sunsword */
593.  	{ P_LONG_SWORD, P_SKILLED },
594.      { P_CLUB, P_EXPERT },               { P_PADDLE, P_EXPERT },
595.      { P_MACE, P_EXPERT },
596.      { P_MORNING_STAR, P_EXPERT },	{ P_FLAIL, P_EXPERT },
597.      { P_HAMMER, P_EXPERT },		{ P_QUARTERSTAFF, P_EXPERT },
598.      { P_POLEARMS, P_SKILLED },		{ P_SPEAR, P_SKILLED },
599.      { P_JAVELIN, P_SKILLED },		{ P_TRIDENT, P_SKILLED },
600.      { P_LANCE, P_BASIC },		{ P_BOW, P_BASIC },
601.      { P_SLING, P_BASIC },		{ P_CROSSBOW, P_BASIC },
602.      { P_DART, P_BASIC },		{ P_SHURIKEN, P_BASIC },
603.      { P_BOOMERANG, P_BASIC },		{ P_UNICORN_HORN, P_SKILLED },
604.  
605.      /* [ALI] Depending on the spellbook which priests enter the dungeon with,
606.       * one of the maximum skill levels listed here will be raised by one.
607.       */
608.      { P_ATTACK_SPELL, P_BASIC },        { P_HEALING_SPELL, P_EXPERT },
609.      { P_DIVINATION_SPELL, P_EXPERT },   { P_ENCHANTMENT_SPELL, P_BASIC },
610.      { P_PROTECTION_SPELL, P_SKILLED },  { P_BODY_SPELL, P_BASIC },
611.      { P_MATTER_SPELL, P_BASIC },
612.  
613.      { P_BARE_HANDED_COMBAT, P_BASIC },  /* the monk is added in slash */ 
614.      { P_NONE, 0 }
615.  };
616.  
617.  static const struct def_skill Skill_R[] = {
618.      { P_DAGGER, P_EXPERT },		{ P_KNIFE,  P_EXPERT },
619.      { P_SHORT_SWORD, P_EXPERT },	{ P_BROAD_SWORD, P_SKILLED },
620.      { P_LONG_SWORD, P_SKILLED },	{ P_TWO_HANDED_SWORD, P_BASIC },
621.      { P_SCIMITAR, P_SKILLED },		{ P_SABER, P_SKILLED },
622.      { P_CLUB, P_SKILLED },              { P_PADDLE, P_SKILLED },
623.      { P_MACE, P_SKILLED },              { P_MORNING_STAR, P_BASIC },
624.      { P_FLAIL, P_BASIC },               { P_HAMMER, P_BASIC },
625.      { P_POLEARMS, P_BASIC },            { P_SPEAR, P_BASIC },
626.  #ifdef FIREARMS
627.      { P_FIREARM, P_EXPERT },
628.  #endif
629.      { P_CROSSBOW, P_EXPERT },
630.      { P_DART, P_EXPERT },		{ P_SHURIKEN, P_SKILLED },
631.      { P_DIVINATION_SPELL, P_SKILLED },        { P_BODY_SPELL, P_SKILLED },
632.      { P_MATTER_SPELL, P_SKILLED },
633.  /*WAC Left as is*/
634.  #ifdef STEED
635.      { P_RIDING, P_BASIC },
636.  #endif
637.      { P_TWO_WEAPON_COMBAT, P_EXPERT },  { P_BARE_HANDED_COMBAT, P_EXPERT },
638.      { P_NONE, 0 }
639.  };
640.  
641.  static const struct def_skill Skill_Ran[] = {
642.      { P_DAGGER, P_EXPERT },		 { P_KNIFE,  P_SKILLED },
643.      { P_AXE, P_SKILLED },	 { P_PICK_AXE, P_BASIC },
644.      { P_SHORT_SWORD, P_BASIC },	 { P_MORNING_STAR, P_BASIC },
645.      { P_FLAIL, P_SKILLED },	 { P_HAMMER, P_BASIC },
646.      { P_QUARTERSTAFF, P_BASIC }, { P_POLEARMS, P_SKILLED },
647.      { P_SPEAR, P_SKILLED },	 { P_JAVELIN, P_EXPERT },
648.      { P_TRIDENT, P_BASIC },	 { P_BOW, P_EXPERT },
649.      { P_SLING, P_EXPERT },	 { P_CROSSBOW, P_EXPERT },
650.      { P_DART, P_EXPERT },	 { P_SHURIKEN, P_SKILLED },
651.      { P_BOOMERANG, P_EXPERT },	 { P_WHIP, P_BASIC },
652.      { P_HEALING_SPELL, P_BASIC },
653.      { P_DIVINATION_SPELL, P_EXPERT },
654.      { P_BODY_SPELL, P_BASIC },
655.  #ifdef STEED
656.      { P_RIDING, P_BASIC },
657.  #endif
658.      { P_BARE_HANDED_COMBAT, P_BASIC },
659.      { P_NONE, 0 }
660.  };
661.  
662.  static const struct def_skill Skill_S[] = {
663.      { P_DAGGER, P_BASIC },		{ P_KNIFE,  P_SKILLED },
664.      { P_SHORT_SWORD, P_EXPERT },	{ P_BROAD_SWORD, P_SKILLED },
665.      { P_LONG_SWORD, P_EXPERT },		{ P_TWO_HANDED_SWORD, P_EXPERT },
666.      { P_SCIMITAR, P_BASIC },		{ P_SABER, P_BASIC },
667.      { P_PADDLE, P_BASIC },
668.      { P_FLAIL, P_SKILLED },		{ P_QUARTERSTAFF, P_BASIC },
669.      { P_POLEARMS, P_SKILLED },		{ P_SPEAR, P_BASIC },
670.      { P_JAVELIN, P_BASIC },		{ P_LANCE, P_SKILLED },
671.      { P_BOW, P_EXPERT },		{ P_SHURIKEN, P_EXPERT },
672.      { P_PROTECTION_SPELL, P_SKILLED },      { P_BODY_SPELL, P_BASIC },
673.  
674.  /* WAC - removed the attack spells, replace with body.  clairvoyance, meditate*/
675.  #ifdef STEED
676.      { P_RIDING, P_SKILLED },
677.  #endif
678.      { P_TWO_WEAPON_COMBAT, P_EXPERT },
679.      { P_MARTIAL_ARTS, P_MASTER },
680.      { P_NONE, 0 }
681.  };
682.  
683.  #ifdef TOURIST
684.  static const struct def_skill Skill_T[] = {
685.      { P_DAGGER, P_EXPERT },		{ P_KNIFE,  P_SKILLED },
686.      { P_AXE, P_BASIC },			{ P_PICK_AXE, P_BASIC },
687.      { P_SHORT_SWORD, P_EXPERT },	{ P_BROAD_SWORD, P_BASIC },
688.      { P_LONG_SWORD, P_BASIC },		{ P_TWO_HANDED_SWORD, P_BASIC },
689.      { P_SCIMITAR, P_SKILLED },		{ P_SABER, P_SKILLED },
690.      { P_PADDLE, P_BASIC },
691.      { P_MACE, P_BASIC },		{ P_MORNING_STAR, P_BASIC },
692.      { P_FLAIL, P_BASIC },		{ P_HAMMER, P_BASIC },
693.      { P_QUARTERSTAFF, P_BASIC },	{ P_POLEARMS, P_BASIC },
694.      { P_SPEAR, P_BASIC },		{ P_JAVELIN, P_BASIC },
695.      { P_TRIDENT, P_BASIC },		{ P_LANCE, P_BASIC },
696.      { P_BOW, P_BASIC },			{ P_SLING, P_BASIC },
697.  #ifdef FIREARMS
698.      { P_FIREARM, P_BASIC },
699.  #endif
700.      { P_CROSSBOW, P_BASIC },		{ P_DART, P_EXPERT },
701.      { P_SHURIKEN, P_BASIC },		{ P_BOOMERANG, P_BASIC },
702.      { P_WHIP, P_BASIC },		{ P_UNICORN_HORN, P_SKILLED },
703.      { P_DIVINATION_SPELL, P_BASIC },	{ P_ENCHANTMENT_SPELL, P_BASIC },
704.      { P_BODY_SPELL, P_SKILLED },
705.  /*WAC left alone*/
706.  #ifdef STEED
707.      { P_RIDING, P_BASIC },
708.  #endif
709.      { P_TWO_WEAPON_COMBAT, P_SKILLED }, { P_BARE_HANDED_COMBAT, P_SKILLED },
710.      { P_NONE, 0 }
711.  };
712.  #endif /* TOURIST */
713.  
714.  static const struct def_skill Skill_U[] = {
715.  /*WAC
716.   * -made dagger skill expert too,  since it's a starting weapon
717.   * -made spear skill Expert rather than Skilled
718.   *      Slayer artifact is a spear,  after all
719.   * -made crossbow skill Expert - Dracula movies
720.   * -changed bare handed basic to martial arts master-Buffy the Vampire Slayer
721.   * -Added whip Expert - Castlevania
722.   * -made club, flail, mace, morning star, hammer, quarterstaff Skilled
723.          from Expert to balance
724.   * -removed Trident skill - from Skilled to Restricted
725.   * -removed Lance skill - from Basic to Restricted
726.   */
727.      { P_DAGGER, P_EXPERT },             { P_LONG_SWORD, P_SKILLED },
728.      { P_CLUB, P_SKILLED },              { P_PADDLE, P_SKILLED },
729.      { P_MACE, P_SKILLED },              { P_MORNING_STAR, P_SKILLED },
730.      { P_FLAIL, P_SKILLED },             { P_HAMMER, P_SKILLED },
731.      { P_QUARTERSTAFF, P_SKILLED },      { P_POLEARMS, P_SKILLED },
732.      { P_SPEAR, P_EXPERT },              { P_JAVELIN, P_SKILLED },
733.      { P_BOW, P_BASIC },			        { P_SLING, P_BASIC },
734.  #ifdef FIREARMS
735.      { P_FIREARM, P_EXPERT },
736.  #endif
737.      { P_CROSSBOW, P_EXPERT },           { P_DART, P_BASIC },
738.      { P_SHURIKEN, P_BASIC },		{ P_BOOMERANG, P_BASIC },
739.      { P_WHIP, P_EXPERT },               { P_UNICORN_HORN, P_SKILLED },
740.  
741.      { P_PROTECTION_SPELL, P_SKILLED },    { P_BODY_SPELL, P_SKILLED },
742.      { P_MATTER_SPELL, P_BASIC },
743.  /*WAC - added PROTECTION spells,  body spells as skilled, basic
744.          matter spells - for the fire vs undead*/
745.      { P_BARE_HANDED_COMBAT, P_GRAND_MASTER },    { P_NONE, 0 }
746.  };
747.  
748.  static const struct def_skill Skill_V[] = {
749.      { P_DAGGER, P_EXPERT },		{ P_AXE, P_EXPERT },
750.      { P_PICK_AXE, P_SKILLED },		{ P_SHORT_SWORD, P_SKILLED },
751.      { P_BROAD_SWORD, P_SKILLED },	{ P_LONG_SWORD, P_EXPERT },
752.      { P_TWO_HANDED_SWORD, P_EXPERT },	{ P_SCIMITAR, P_BASIC },
753.      { P_SABER, P_BASIC },		{ P_HAMMER, P_EXPERT },
754.      { P_QUARTERSTAFF, P_BASIC },	{ P_POLEARMS, P_SKILLED },
755.      { P_SPEAR, P_SKILLED },		{ P_JAVELIN, P_BASIC },
756.      { P_TRIDENT, P_BASIC },		{ P_LANCE, P_SKILLED },
757.      { P_SLING, P_BASIC },
758.      { P_BODY_SPELL, P_BASIC },          { P_MATTER_SPELL, P_EXPERT },
759.  /*  replace attack spell with matter spell - cone of cold, lightning
760.   *  Boosted to Expert
761.   */
762.  #ifdef STEED
763.      { P_RIDING, P_SKILLED },
764.  #endif
765.      { P_TWO_WEAPON_COMBAT, P_SKILLED },
766.      { P_BARE_HANDED_COMBAT, P_EXPERT },
767.      { P_NONE, 0 }
768.  };
769.  
770.  static const struct def_skill Skill_W[] = {
771.      { P_DAGGER, P_EXPERT },		{ P_KNIFE,  P_SKILLED },
772.      { P_AXE, P_SKILLED },		{ P_SHORT_SWORD, P_BASIC },
773.      { P_CLUB, P_SKILLED },              { P_PADDLE, P_BASIC },
774.      { P_MACE, P_BASIC },
775.      { P_QUARTERSTAFF, P_EXPERT },	{ P_POLEARMS, P_SKILLED },
776.      { P_SPEAR, P_BASIC },		{ P_JAVELIN, P_BASIC },
777.      { P_TRIDENT, P_BASIC },		{ P_SLING, P_SKILLED },
778.      { P_DART, P_EXPERT },		{ P_SHURIKEN, P_BASIC },
779.  
780.      { P_ATTACK_SPELL, P_EXPERT },	{ P_HEALING_SPELL, P_SKILLED },
781.      { P_DIVINATION_SPELL, P_SKILLED },  { P_ENCHANTMENT_SPELL, P_SKILLED },
782.      { P_PROTECTION_SPELL, P_SKILLED },  { P_BODY_SPELL, P_SKILLED },
783.      { P_MATTER_SPELL, P_SKILLED },
784.  /*      added matter spell skilled,  as fireball and cone of cold are
785.          matter spells, but now specialty of F/I Mages*/
786.  #ifdef STEED
787.      { P_RIDING, P_BASIC },
788.  #endif
789.      { P_BARE_HANDED_COMBAT, P_BASIC },
790.      { P_NONE, 0 }
791.  };
792.  
793.  #ifdef YEOMAN
794.  static const struct def_skill Skill_Y[] = {
795.      { P_DAGGER, P_SKILLED },            { P_KNIFE, P_BASIC },
796.      { P_AXE, P_SKILLED },               { P_SHORT_SWORD, P_EXPERT },
797.      { P_BROAD_SWORD, P_BASIC },         { P_LONG_SWORD, P_SKILLED },
798.      { P_SABER, P_SKILLED },             { P_PADDLE, P_SKILLED },
799.      { P_HAMMER, P_BASIC },              { P_QUARTERSTAFF, P_SKILLED },
800.      { P_POLEARMS, P_EXPERT },           { P_SPEAR, P_BASIC },
801.      { P_JAVELIN, P_SKILLED },           { P_TRIDENT, P_SKILLED },
802.      { P_LANCE, P_SKILLED },             { P_BOW, P_EXPERT },
803.      { P_SLING, P_BASIC },
804.  #ifdef FIREARMS
805.      { P_FIREARM, P_SKILLED },
806.  #endif
807.      { P_CROSSBOW, P_SKILLED },          { P_DART, P_BASIC },
808.      { P_WHIP, P_BASIC },                { P_UNICORN_HORN, P_BASIC },
809.  
810.      { P_ENCHANTMENT_SPELL, P_SKILLED }, { P_PROTECTION_SPELL, P_SKILLED },
811.      { P_BODY_SPELL, P_BASIC },
812.  #ifdef STEED
813.      { P_RIDING, P_EXPERT },
814.  #endif
815.      { P_TWO_WEAPON_COMBAT, P_SKILLED }, { P_BARE_HANDED_COMBAT, P_SKILLED },
816.      { P_NONE, 0 }
817.  };
818.  #endif
819.  
820.  
821.  STATIC_OVL void
822.  knows_object(obj)
823.  register int obj;
824.  {
825.  	discover_object(obj,TRUE,FALSE);
826.  	objects[obj].oc_pre_discovered = 1;	/* not a "discovery" */
827.  }
828.  
829.  /* Know ordinary (non-magical) objects of a certain class,
830.   * like all gems except the loadstone and luckstone.
831.   */
832.  STATIC_OVL void
833.  knows_class(sym)
834.  register char sym;
835.  {
836.  	register int ct;
837.  	for (ct = 1; ct < NUM_OBJECTS; ct++)
838.  		if (objects[ct].oc_class == sym && !objects[ct].oc_magic)
839.  			knows_object(ct);
840.  }
841.  
842.  /* [ALI] Raise one spell skill by one level. Priorities:
843.   * - The skill for the chosen spellbook if not already expert.
844.   * - A skill currently at skilled level.
845.   * - A skill currently at basic level.
846.   * Where more than one skill is possible at a priority level, choose one
847.   * at random.
848.   *
849.   * The idea is that where a role may be given spellbooks in which the
850.   * role is normally at basic level, then the Skill array can be tweaked
851.   * to reduce one skill from expert to skilled. After choosing the
852.   * spellbook we can then dynamically raise one skill which will either be
853.   * the one for the spellbook if that is currently basic (and so avoid the
854.   * warning message from skill_init) or raise the tweaked skill to expert.
855.   *
856.   * Currently only used by priests.
857.   */
858.  
859.  static void
860.  spellbook_skill_raise(class_skill, spellbook)
861.  register struct def_skill *class_skill;
862.  int spellbook;
863.  {
864.      register int i, j;
865.      j = spell_skilltype(spellbook);
866.      for(i = 0; class_skill[i].skill != P_NONE; i++)
867.  	if (class_skill[i].skill == j)
868.  	    break;
869.      if (class_skill[i].skill == P_NONE)
870.  	pline("Warning: No entry for %s in Skill array.",
871.  	  obj_typename(spellbook));
872.      else if (class_skill[i].skmax < P_EXPERT)
873.  	class_skill[i].skmax++;
874.      else
875.      {
876.  	j = 0;
877.  	for(i = 0; class_skill[i].skill != P_NONE; i++) {
878.  	    if (class_skill[i].skill >= P_FIRST_SPELL &&
879.  	      class_skill[i].skill <= P_LAST_SPELL &&
880.  	      class_skill[i].skmax == P_SKILLED)
881.  		j++;
882.  	}
883.  	if (j) {
884.  	    j = rn2(j);
885.  	    for(i = 0; class_skill[i].skill != P_NONE; i++) {
886.  		if (class_skill[i].skill >= P_FIRST_SPELL &&
887.  		  class_skill[i].skill <= P_LAST_SPELL &&
888.  		  class_skill[i].skmax == P_SKILLED)
889.  		    if (!j--) {
890.  			class_skill[i].skmax++;
891.  			break;
892.  		    }
893.  	    }
894.  	}
895.  	else {
896.  	    for(i = 0; class_skill[i].skill != P_NONE; i++) {
897.  		if (class_skill[i].skill >= P_FIRST_SPELL &&
898.  		  class_skill[i].skill <= P_LAST_SPELL &&
899.  		  class_skill[i].skmax >= P_BASIC &&
900.  		  class_skill[i].skmax < P_EXPERT)
901.  		    j++;
902.  	    }
903.  	    if (j) {
904.  		j = rn2(j);
905.  		for(i = 0; class_skill[i].skill != P_NONE; i++) {
906.  		    if (class_skill[i].skill >= P_FIRST_SPELL &&
907.  		      class_skill[i].skill <= P_LAST_SPELL &&
908.  		      class_skill[i].skmax >= P_BASIC &&
909.  		      class_skill[i].skmax < P_EXPERT)
910.  			if (!j--) {
911.  			    class_skill[i].skmax++;
912.  			    break;
913.  			}
914.  		}
915.  	    }
916.  	}
917.      }
918.  }
919.  
920.  void
921.  u_init()
922.  {
923.  	register int i, temp;
924.  	int no_extra_food = FALSE;
925.  
926.  	flags.female = flags.initgend;
927.  	flags.beginner = 1;
928.  
929.  	/* WAC -- Clear Tech List since adjabil will init the 1st level techs*/
930.  	for (i = 0; i <= MAXTECH; i++) tech_list[i].t_id = NO_TECH;
931.  
932.  	/* Initialize spells */
933.  	for (i = 0; i <= MAXSPELL; i++) spl_book[i].sp_id = NO_SPELL;
934.  
935.  	/* Initialize the "u" structure.
936.  	 * Note that some values may have been incorrectly set by a failed restore.
937.  	 */
938.  	(void) memset((genericptr_t)&u, 0, sizeof(u));
939.  	setustuck((struct monst *)0);
940.  #if 0	/* documentation of more zero values as desirable */
941.  	u.usick_cause[0] = 0;
942.  	u.uluck  = u.moreluck = 0;
943.  # ifdef TOURIST
944.  	uarmu = 0;
945.  # endif
946.  	uarm = uarmc = uarmh = uarms = uarmg = uarmf = 0;
947.  	uwep = uball = uchain = uleft = uright = 0;
948.  	/* WAC Added uswapwep, uquiver*/
949.  	uswapwep = uquiver = 0;
950.  	/* KMH -- added two-weapon combat */
951.  	u.twoweap = 0;
952.  	u.ublessed = 0;				/* not worthy yet */
953.  	u.ugangr   = 0;				/* gods not angry */
954.  	u.ugifts   = 0;				/* no divine gifts bestowed */
955.  	/* WAC not needed - use techs */
956.  /*	u.unextuse = 0;
957.  	u.ulastuse = 0;*/
958.  # ifdef ELBERETH
959.  	u.uevent.uhand_of_elbereth = 0;
960.  # endif
961.  	u.uevent.uheard_tune = 0;
962.  	u.uevent.uopened_dbridge = 0;
963.  	u.uevent.udemigod = 0;		/* not a demi-god yet... */
964.  	u.udg_cnt = 0;
965.  	u.mh = u.mhmax = Upolyd = 0;
966.  	u.uz.dnum = u.uz0.dnum = 0;
967.  	u.utotype = 0;
968.  #endif	/* 0 */
969.  
970.  	u.uz.dlevel = 1;
971.  	u.uz0.dlevel = 0;
972.  	u.utolev = u.uz;
973.  
974.  	u.umoved = FALSE;
975.  	u.umortality = 0;
976.  	u.ugrave_arise = NON_PM;
977.  
978.  	u.umonnum = u.umonster = (flags.female &&
979.  			urole.femalenum != NON_PM) ? urole.femalenum :
980.  			urole.malenum;
981.  
982.  	init_uasmon();
983.  
984.  	u.ulevel = 0;	/* set up some of the initial attributes */
985.  	u.uhp = u.uhpmax = newhp();
986.  	u.uenmax = urole.enadv.infix + urace.enadv.infix;
987.  	if (urole.enadv.inrnd > 0)
988.  	    u.uenmax += rnd(urole.enadv.inrnd);
989.  	if (urace.enadv.inrnd > 0)
990.  	    u.uenmax += rnd(urace.enadv.inrnd);
991.  	u.uen = u.uenmax;
992.  	u.uspellprot = 0;
993.  	adjabil(0,1);
994.  	u.ulevel = u.ulevelmax = 1;
995.  
996.  	init_uhunger();
997.  	u.ublesscnt = 300;			/* no prayers just yet */
998.  	u.ualignbase[A_CURRENT] = u.ualignbase[A_ORIGINAL] = u.ualign.type =
999.  			aligns[flags.initalign].value;
1000. 	u.ulycn = NON_PM;
1001. #if defined(BSD) && !defined(POSIX_TYPES)
1002. 	(void) time((long *)&u.ubirthday);
1003. #else
1004. 	(void) time(&u.ubirthday);
1005. #endif
1006. 	/*
1007. 	 *  For now, everyone but elves, cavemen and lycanthropes starts
1008. 	 *  out with a night vision range of 1 and their xray range disabled.
1009. 	 */
1010. 	u.nv_range   =  1;
1011. 	u.xray_range = -1;
1012. 
1013. 	/* Role-specific initializations */
1014. 	switch (Role_switch) {
1015. 	case PM_ARCHEOLOGIST:
1016. 		switch (rnd(5)) {   
1017. 		    case 1: Archeologist[A_BOOK].trotyp = SPE_DETECT_FOOD; break;
1018. 		    case 2: Archeologist[A_BOOK].trotyp = SPE_DETECT_MONSTERS; break;
1019. 		    case 3: Archeologist[A_BOOK].trotyp = SPE_LIGHT; break;
1020. 		    case 4: Archeologist[A_BOOK].trotyp = SPE_KNOCK; break;
1021. 		    case 5: Archeologist[A_BOOK].trotyp = SPE_WIZARD_LOCK; break;
1022. 		    default: break;
1023. 		}
1024. 		ini_inv(Archeologist);
1025. 		if(!rn2(4)) ini_inv(Blindfold);
1026. #ifdef TOURIST
1027. 		else if(!rn2(4)) ini_inv(Towel);
1028. 		if(!rn2(4)) ini_inv(Leash);
1029. #endif
1030. 		if(!rn2(4)) ini_inv(Tinopener);
1031. 		else if(!rn2(4))
1032. 		  (rn2(100) > 50 ? ini_inv(Lamp) : ini_inv(Torch));
1033. 		if(!rn2(8)) ini_inv(Magicmarker);
1034. 		knows_object(TOUCHSTONE);
1035. 		knows_object(SACK);
1036. 		skill_init(Skill_A);
1037. 		break;
1038. 	case PM_BARBARIAN:
1039. 		if (rn2(100) >= 50) {   /* see Elf comment */
1040. 		    Barbarian[B_MAJOR].trotyp = BATTLE_AXE;
1041. 		    Barbarian[B_MINOR].trotyp = SHORT_SWORD;
1042. 		}
1043. 		ini_inv(Barbarian);
1044. 		if(!rn2(6)) ini_inv(Torch);
1045. 		knows_class(WEAPON_CLASS);
1046. 		knows_class(ARMOR_CLASS);
1047. 		skill_init(Skill_B);
1048. 		break;
1049. 	case PM_CAVEMAN:
1050. 		u.nv_range = 2;
1051. 		Cave_man[C_AMMO].trquan = rn1(11, 10);	/* 10..20 */
1052. 		ini_inv(Cave_man);
1053. 		skill_init(Skill_C);
1054. 		break;
1055. 	case PM_FLAME_MAGE:
1056. 		switch (rnd(2)) {                
1057. 			case 1: Flame_Mage[F_BOOK].trotyp = SPE_DETECT_MONSTERS; break;
1058. 			case 2: Flame_Mage[F_BOOK].trotyp = SPE_LIGHT; break;
1059. 			default: break;
1060. 		}
1061. 		ini_inv(Flame_Mage);
1062. 		if(!rn2(5)) ini_inv(Lamp);
1063. 		else if(!rn2(5)) ini_inv(Blindfold);
1064. 		else if(!rn2(5)) ini_inv(Magicmarker);
1065. 		skill_init(Skill_F);
1066. 		break;
1067. 	case PM_HEALER:
1068. #ifndef GOLDOBJ
1069. 		u.ugold = u.ugold0 = rn1(1000, 1001);
1070. #else
1071. 		u.umoney0 = rn1(1000, 1001);
1072. #endif
1073. 		ini_inv(Healer);
1074. 		knows_class(POTION_CLASS); /* WAC - remove? */
1075. 		knows_object(POT_SICKNESS);
1076. 		knows_object(POT_BLINDNESS);
1077. 		knows_object(POT_HALLUCINATION);
1078. 		knows_object(POT_RESTORE_ABILITY);
1079. 		knows_object(POT_FULL_HEALING);
1080. 		knows_object(HEALTHSTONE);	/* KMH */
1081. 		if(!rn2(5)) ini_inv(Lamp);
1082. 		if(!rn2(5)) ini_inv(Magicmarker);
1083. 		if(!rn2(5)) ini_inv(Blindfold);
1084. 		skill_init(Skill_H);
1085. 		break;
1086. 	case PM_ICE_MAGE:
1087. 		switch (rnd(2)) {                
1088. 			case 1: Ice_Mage[I_BOOK].trotyp = SPE_CONFUSE_MONSTER; break;
1089. 			case 2: Ice_Mage[I_BOOK].trotyp = SPE_SLOW_MONSTER; break;
1090. 			default: break;
1091. 		}
1092. 		ini_inv(Ice_Mage);
1093. 		if(!rn2(5)) ini_inv(Lamp);
1094. 		else if(!rn2(5)) ini_inv(Blindfold);
1095. 		else if(!rn2(5)) ini_inv(Magicmarker);
1096. 		skill_init(Skill_I);
1097. 		break;
1098. 	case PM_KNIGHT:
1099. 		ini_inv(Knight);
1100. 		knows_class(WEAPON_CLASS);
1101. 		knows_class(ARMOR_CLASS);
1102. 		/* give knights chess-like mobility
1103. 		 * -- idea from wooledge@skybridge.scl.cwru.edu */
1104. 		HJumping |= FROMOUTSIDE;
1105. 		skill_init(Skill_K);
1106. 		break;
1107. 	case PM_MONK:
1108. 		switch (rn2(90) / 30) {
1109. 		case 0: Monk[M_BOOK].trotyp = SPE_HEALING; break;
1110. 		case 1: Monk[M_BOOK].trotyp = SPE_PROTECTION; break;
1111. 		case 2: Monk[M_BOOK].trotyp = SPE_SLEEP; break;
1112. 		}
1113. 		ini_inv(Monk);
1114. 		if(!rn2(5)) ini_inv(Magicmarker);
1115. 		else if(!rn2(10)) ini_inv(Lamp);
1116. 		knows_class(ARMOR_CLASS);
1117. 		skill_init(Skill_Mon);
1118. 		break;
1119. 	case PM_NECROMANCER:
1120. 		switch (rnd(5)) {   
1121.                     case 1: Necromancer[N_BOOK].trotyp = SPE_FORCE_BOLT; break;
1122.                     case 2: Necromancer[N_BOOK].trotyp = SPE_KNOCK; break;
1123.                     case 3: Necromancer[N_BOOK].trotyp = SPE_MAGIC_MISSILE; break;
1124.                     case 4: Necromancer[N_BOOK].trotyp = SPE_CREATE_MONSTER; break;
1125.                     case 5: Necromancer[N_BOOK].trotyp = SPE_WIZARD_LOCK; break;
1126. 		    default: break;
1127. 		}
1128. 		ini_inv(Necromancer);
1129. 		knows_class(SPBOOK_CLASS);
1130. 		if(!rn2(5)) ini_inv(Magicmarker);
1131. 		if(!rn2(5)) ini_inv(Blindfold);
1132. 		skill_init(Skill_N);
1133. 		break;
1134. 	case PM_PRIEST:
1135. 		switch (rnd(9)) {   
1136. 		    case 1: Priest[P_BOOK].trotyp = SPE_FORCE_BOLT; break;
1137. 		    case 2: Priest[P_BOOK].trotyp = SPE_SLEEP; break;
1138. 		    case 3: Priest[P_BOOK].trotyp = SPE_RESIST_POISON; break;
1139. 		    case 4: Priest[P_BOOK].trotyp = SPE_RESIST_SLEEP; break;
1140. 		    case 5: Priest[P_BOOK].trotyp = SPE_DETECT_FOOD; break;
1141. 		    case 6: Priest[P_BOOK].trotyp = SPE_DETECT_MONSTERS; break;
1142. 		    case 7: Priest[P_BOOK].trotyp = SPE_LIGHT; break;
1143. 		    case 8: Priest[P_BOOK].trotyp = SPE_KNOCK; break;
1144. 		    case 9: Priest[P_BOOK].trotyp = SPE_WIZARD_LOCK; break;
1145. 		    default: break;
1146. 		}
1147. 		ini_inv(Priest);
1148. 		if(!rn2(10)) ini_inv(Magicmarker);
1149. 		else if(!rn2(10)) 
1150. 		  (rn2(100) > 50 ? ini_inv(Lamp) : ini_inv(Torch));
1151. 		knows_object(POT_WATER);
1152. 		spellbook_skill_raise(Skill_P, Priest[P_BOOK].trotyp);
1153. 		skill_init(Skill_P);
1154. 		/* KMH, conduct --
1155. 		 * Some may claim that this isn't agnostic, since they
1156. 		 * are literally "priests" and they have holy water.
1157. 		 * But we don't count it as such.  Purists can always
1158. 		 * avoid playing priests and/or confirm another player's
1159. 		 * role in their YAAP.
1160. 		 */
1161. 		break;
1162. 	case PM_RANGER:
1163. 		Ranger[RAN_TWO_ARROWS].trquan = rn1(10, 50);
1164. 		Ranger[RAN_ZERO_ARROWS].trquan = rn1(10, 30);
1165. 		ini_inv(Ranger);
1166. 		skill_init(Skill_Ran);
1167. 		break;
1168. 	case PM_ROGUE:
1169. 		Rogue[R_DAGGERS].trquan = rn1(10, 6);
1170. 		Rogue[R_DARTS].trquan = rn1(10, 25);
1171. #ifdef FIREARMS
1172. 		if (rn2(100) < 30) {
1173. 			Rogue[R_DAGGERS].trotyp = PISTOL;
1174. 			Rogue[R_DAGGERS].trquan = 1;
1175. 			Rogue[R_DARTS].trotyp = BULLET;
1176. 		}
1177. #endif
1178. #ifndef GOLDOBJ
1179. 		u.ugold = u.ugold0 = rn1(500 ,1500);
1180. #else
1181. 		u.umoney0 = rn1(500 ,1500);
1182. #endif
1183. 		ini_inv(Rogue);
1184. 		if(!rn2(5)) ini_inv(Blindfold);
1185. 		knows_object(OILSKIN_SACK);
1186. 		skill_init(Skill_R);
1187. 		break;
1188. 	case PM_SAMURAI:
1189. 		Samurai[S_ARROWS].trquan = rn1(20, 26);
1190. 		ini_inv(Samurai);
1191. 		if(!rn2(5)) ini_inv(Blindfold);
1192. 		knows_class(WEAPON_CLASS);
1193. 		knows_class(ARMOR_CLASS);
1194. 		skill_init(Skill_S);
1195. 		break;
1196. #ifdef TOURIST
1197. 	case PM_TOURIST:
1198. 		Tourist[T_DARTS].trquan = rn1(20, 21);
1199. #ifndef GOLDOBJ
1200. 		u.ugold = u.ugold0 = rn1(500,1000);
1201. #else
1202. 		u.umoney0 = rn1(500,1000);
1203. #endif
1204. 		ini_inv(Tourist);
1205. 		if(!rn2(25)) ini_inv(Tinopener);
1206. 		else if(!rn2(25)) ini_inv(Leash);
1207. 		else if(!rn2(25)) ini_inv(Towel);
1208. 		else if(!rn2(25)) ini_inv(Magicmarker);
1209. 		skill_init(Skill_T);
1210. 		break;
1211. #endif /* TOURIST */
1212. 	case PM_UNDEAD_SLAYER:
1213. 		switch (rn2(100) / 25) {
1214. 		    case 0:	/* Pistol and silver bullets */
1215. #ifdef FIREARMS
1216. 			UndeadSlayer[U_MINOR].trotyp = PISTOL;
1217. 			UndeadSlayer[U_RANGE].trotyp = SILVER_BULLET;
1218. 			UndeadSlayer[U_RANGE].trquan = rn1(10, 30);
1219. 			break;
1220. #endif
1221. 		    case 1:	/* Crossbow and bolts */
1222. 			UndeadSlayer[U_MINOR].trotyp = CROSSBOW;
1223. 			UndeadSlayer[U_RANGE].trotyp = CROSSBOW_BOLT;
1224. 			UndeadSlayer[U_RANGE].trquan = rn1(10, 30);
1225. 			UndeadSlayer[U_MISC].trotyp = LOW_BOOTS;
1226. 			UndeadSlayer[U_MISC].trspe = 1;
1227. 			UndeadSlayer[U_ARMOR].trotyp = LEATHER_JACKET;
1228. 			UndeadSlayer[U_ARMOR].trspe = 1;
1229. 			/* helmet & armour are no longer candidates for
1230. 			 * substitution for orcish versions so no extra
1231. 			 * food should be given in compensation.
1232. 			 */
1233. 			if (Race_if(PM_ORC))
1234. 			    no_extra_food = TRUE;
1235. 		        break;
1236. 		    case 2:	/* Whip and daggers */
1237. 		        UndeadSlayer[U_MINOR].trotyp = BULLWHIP;
1238. 		        UndeadSlayer[U_MINOR].trspe = 2;
1239. 		        break;
1240. 		    case 3:	/* Silver spear and daggers */
1241. 			break;
1242. 		}
1243. 		ini_inv(UndeadSlayer);
1244. 		knows_class(WEAPON_CLASS);
1245. 		knows_class(ARMOR_CLASS);
1246. 		if(!rn2(6)) ini_inv(Lamp);
1247. 		skill_init(Skill_U);
1248. 		break;
1249. 	case PM_VALKYRIE:
1250. 		ini_inv(Valkyrie);
1251. 		if(!rn2(6)) 
1252. 		  (rn2(100) > 50 ? ini_inv(Lamp) : ini_inv(Torch));
1253. 		knows_class(WEAPON_CLASS);
1254. 		knows_class(ARMOR_CLASS);
1255. 		skill_init(Skill_V);
1256. 		break;
1257. 	case PM_WIZARD:
1258. 		switch (rnd(2)) {                
1259. 		    case 1: Wizard[W_BOOK1].trotyp = SPE_FORCE_BOLT; break;
1260. 		    case 2: Wizard[W_BOOK1].trotyp = SPE_SLEEP; break;
1261. 		    default: break;
1262. 		}
1263. 		switch (rnd(2)) {
1264. 		    case 1: Wizard[W_BOOK2].trotyp = SPE_RESIST_POISON; break;
1265. 		    case 2: Wizard[W_BOOK2].trotyp = SPE_RESIST_SLEEP; break;
1266. 		    default: break;
1267. 		}
1268. 		switch (rnd(5)) {   
1269. 		    case 1: Wizard[W_BOOK3].trotyp = SPE_DETECT_FOOD; break;
1270. 		    case 2: Wizard[W_BOOK3].trotyp = SPE_DETECT_MONSTERS; break;
1271. 		    case 3: Wizard[W_BOOK3].trotyp = SPE_LIGHT; break;
1272. 		    case 4: Wizard[W_BOOK3].trotyp = SPE_KNOCK; break;
1273. 		    case 5: Wizard[W_BOOK3].trotyp = SPE_WIZARD_LOCK; break;
1274. 		    default: break;
1275. 		}
1276. 		switch (rnd(9)) {
1277. 		    case 1: Wizard[W_BOOK4].trotyp = SPE_MAGIC_MISSILE; break;
1278. 		    case 2: Wizard[W_BOOK4].trotyp = SPE_CONFUSE_MONSTER; break;
1279. 		    case 3: Wizard[W_BOOK4].trotyp = SPE_SLOW_MONSTER; break;
1280. 		    case 4: Wizard[W_BOOK4].trotyp = SPE_CURE_BLINDNESS; break;
1281. 		    case 5: Wizard[W_BOOK4].trotyp = SPE_ENDURE_HEAT; break;
1282. 		    case 6: Wizard[W_BOOK4].trotyp = SPE_ENDURE_COLD; break;
1283. 		    case 7: Wizard[W_BOOK4].trotyp = SPE_INSULATE; break;
1284. 		    case 8: Wizard[W_BOOK4].trotyp = SPE_CREATE_MONSTER; break;
1285. 		    case 9: Wizard[W_BOOK4].trotyp = SPE_HEALING; break;
1286. 		    default: break;
1287. 		}
1288. 		ini_inv(Wizard);
1289. 		knows_class(SPBOOK_CLASS);
1290. 		if(!rn2(5)) ini_inv(Magicmarker);
1291. 		if(!rn2(5)) ini_inv(Blindfold);
1292. 		skill_init(Skill_W);
1293. 		break;
1294. 
1295. #ifdef YEOMAN
1296. 	case PM_YEOMAN:
1297. 		ini_inv(Yeoman);
1298. 		knows_class(WEAPON_CLASS);
1299. 		knows_class(ARMOR_CLASS);
1300. 		skill_init(Skill_Y);
1301. 		break;
1302. #endif
1303. 
1304. 	default:	/* impossible */
1305. 		break;
1306. 	}
1307. 
1308. 	/*** Race-specific initializations ***/
1309. 	switch (Race_switch) {
1310. 	case PM_HUMAN:
1311. 	    /* Nothing special */
1312. 	    break;
1313. 
1314. 	case PM_ELF:
1315. 	    /*
1316. 	     * Elves are people of music and song, or they are warriors.
1317. 	     * Non-warriors get an instrument.  We use a kludge to
1318. 	     * get only non-magic instruments.
1319. 	     */
1320. 	    if (Role_if(PM_PRIEST) || Role_if(PM_WIZARD)) {
1321. 		static int trotyp[] = {
1322. 		    WOODEN_FLUTE, TOOLED_HORN, WOODEN_HARP,
1323. 		    BELL, BUGLE, LEATHER_DRUM
1324. 		};
1325. 		Instrument[0].trotyp = trotyp[rn2(SIZE(trotyp))];
1326. 		ini_inv(Instrument);
1327. 	    }
1328. 
1329. 	    /* Elves can recognize all elvish objects */
1330. 	    knows_object(ELVEN_SHORT_SWORD);
1331. 	    knows_object(ELVEN_ARROW);
1332. 	    knows_object(ELVEN_BOW);
1333. 	    knows_object(ELVEN_SPEAR);
1334. 	    knows_object(ELVEN_DAGGER);
1335. 	    knows_object(ELVEN_BROADSWORD);
1336. 	    knows_object(ELVEN_MITHRIL_COAT);
1337. 	    knows_object(ELVEN_LEATHER_HELM);
1338. 	    knows_object(ELVEN_SHIELD);
1339. 	    knows_object(ELVEN_BOOTS);
1340. 	    knows_object(ELVEN_CLOAK);
1341. 	    break;
1342. 	case PM_DROW:
1343. 	    /* Drows can recognize all droven objects */
1344. 	    knows_object(DARK_ELVEN_SHORT_SWORD);
1345. 	    knows_object(DARK_ELVEN_ARROW);
1346. 	    knows_object(DARK_ELVEN_BOW);
1347. 	    knows_object(DARK_ELVEN_DAGGER);
1348. 	    knows_object(DARK_ELVEN_MITHRIL_COAT);
1349. 	    break;
1350. 
1351. 	case PM_DWARF:
1352. 	    /* Dwarves can recognize all dwarvish objects */
1353. 	    knows_object(DWARVISH_SPEAR);
1354. 	    knows_object(DWARVISH_SHORT_SWORD);
1355. 	    knows_object(DWARVISH_MATTOCK);
1356. 	    knows_object(DWARVISH_IRON_HELM);
1357. 	    knows_object(DWARVISH_MITHRIL_COAT);
1358. 	    knows_object(DWARVISH_CLOAK);
1359. 	    knows_object(DWARVISH_ROUNDSHIELD);
1360. 	    break;
1361. 
1362. 	case PM_GNOME:
1363. 	    break;
1364. 	case PM_HUMAN_WEREWOLF:
1365. 	    u.ulycn = PM_WEREWOLF;
1366. /*	    u.nv_range = 2;
1367. 	    u.uen = u.uenmax += 6;
1368. 	    ini_inv(Lycanthrope);*/
1369. 	    break;
1370. 
1371. 	case PM_ORC:
1372. 	    /* compensate for generally inferior equipment */
1373. 	    if (!no_extra_food && !Role_if(PM_WIZARD) &&
1374. 		    !Role_if(PM_FLAME_MAGE) && !Role_if(PM_ICE_MAGE) &&
1375. 		    !Role_if(PM_NECROMANCER))
1376. 		ini_inv(Xtra_food);
1377. 	    /* Orcs can recognize all orcish objects */
1378. 	    knows_object(ORCISH_SHORT_SWORD);
1379. 	    knows_object(ORCISH_ARROW);
1380. 	    knows_object(ORCISH_BOW);
1381. 	    knows_object(ORCISH_SPEAR);
1382. 	    knows_object(ORCISH_DAGGER);
1383. 	    knows_object(ORCISH_CHAIN_MAIL);
1384. 	    knows_object(ORCISH_RING_MAIL);
1385. 	    knows_object(ORCISH_HELM);
1386. 	    knows_object(ORCISH_SHIELD);
1387. 	    knows_object(URUK_HAI_SHIELD);
1388. 	    knows_object(ORCISH_CLOAK);
1389. 	    break;
1390. 	case PM_VAMPIRE:
1391. 	    /* Vampires start off with gods not as pleased, luck penalty */
1392. 	    adjalign(-5); 
1393. 	    change_luck(-1);
1394. 	    break;
1395. 	default:	/* impossible */
1396. 		break;
1397. 	}
1398. 
1399. 	if (discover)
1400. 		ini_inv(Wishing);
1401. 
1402. #ifdef WIZARD
1403. 	if (wizard)
1404. 		read_wizkit();
1405. #endif
1406. 
1407. #ifndef GOLDOBJ
1408. 	u.ugold0 += hidden_gold();	/* in case sack has gold in it */
1409. #else
1410. 	if (u.umoney0) ini_inv(Money);
1411. 	u.umoney0 += hidden_gold();	/* in case sack has gold in it */
1412. #endif
1413. 
1414. 	temp = rn1(10,70);
1415. 	init_attr(temp);		/* init attribute values */
1416. 	find_ac();			/* get initial ac value */
1417. 	max_rank_sz();			/* set max str size for class ranks */
1418. /*
1419.  *	Do we really need this?
1420.  */
1421. 	for(i = 0; i < A_MAX; i++)
1422. 	    if(!rn2(20)) {
1423. 		register int xd = rn2(7) - 2;	/* biased variation */
1424. 		(void) adjattrib(i, xd, TRUE);
1425. 		if (ABASE(i) < AMAX(i)) AMAX(i) = ABASE(i);
1426. 	    }
1427. 	/* make sure you can carry all you have - especially for Tourists */
1428. 	while (inv_weight() > 0) {
1429. 		if (adjattrib(A_STR, 1, TRUE)) continue;
1430. 		if (adjattrib(A_CON, 1, TRUE)) continue;
1431. 		/* only get here when didn't boost strength or constitution */
1432. 		break;
1433. 	}
1434. 
1435. 	return;
1436. }
1437. 
1438. 
1439. /* skills aren't initialized, so we use the role-specific skill lists */
1440. STATIC_OVL boolean
1441. restricted_spell_discipline(otyp)
1442. int otyp;
1443. {
1444.     const struct def_skill *skills;
1445.     int this_skill = spell_skilltype(otyp);
1446. 
1447.     switch (Role_switch) {
1448.      case PM_ARCHEOLOGIST:	skills = Skill_A; break;
1449.      case PM_BARBARIAN:		skills = Skill_B; break;
1450.      case PM_CAVEMAN:		skills = Skill_C; break;
1451.      case PM_HEALER:		skills = Skill_H; break;
1452.      case PM_KNIGHT:		skills = Skill_K; break;
1453.      case PM_MONK:		skills = Skill_Mon; break;
1454.      case PM_PRIEST:		skills = Skill_P; break;
1455.      case PM_RANGER:		skills = Skill_Ran; break;
1456.      case PM_ROGUE:		skills = Skill_R; break;
1457.      case PM_SAMURAI:		skills = Skill_S; break;
1458. #ifdef TOURIST
1459.      case PM_TOURIST:		skills = Skill_T; break;
1460. #endif
1461.      case PM_VALKYRIE:		skills = Skill_V; break;
1462.      case PM_WIZARD:		skills = Skill_W; break;
1463.      default:			skills = 0; break;	/* lint suppression */
1464.     }
1465. 
1466.     while (skills->skill != P_NONE) {
1467. 	if (skills->skill == this_skill) return FALSE;
1468. 	++skills;
1469.     }
1470.     return TRUE;
1471. }
1472. 
1473. STATIC_OVL void
1474. ini_inv(trop)
1475. register struct trobj *trop;
1476. {
1477. 	struct obj *obj;
1478. 	int otyp, i;
1479. 
1480. 	while (trop->trclass) {
1481. 		if (trop->trotyp != UNDEF_TYP) {
1482. 			otyp = (int)trop->trotyp;
1483. 			if (urace.malenum != PM_HUMAN) {
1484. 			    /* substitute specific items for generic ones */
1485. 			    for (i = 0; inv_subs[i].race_pm != NON_PM; ++i)
1486. 				if (inv_subs[i].race_pm == urace.malenum &&
1487. 					otyp == inv_subs[i].item_otyp) {
1488. 				    otyp = inv_subs[i].subs_otyp;
1489. 				    break;
1490. 				}
1491. 			}
1492. 			for (i = 0; inv_asubs[i].align != A_NONE; ++i)
1493. 			    if (inv_asubs[i].align == u.ualign.type &&
1494. 				    otyp == inv_asubs[i].item_otyp) {
1495. 				otyp = inv_asubs[i].subs_otyp;
1496. 				break;
1497. 			    }
1498. 			obj = mksobj(otyp, TRUE, FALSE);
1499. 		} else {	/* UNDEF_TYP */
1500. 			static NEARDATA short nocreate = STRANGE_OBJECT;
1501. 			static NEARDATA short nocreate2 = STRANGE_OBJECT;
1502. 			static NEARDATA short nocreate3 = STRANGE_OBJECT;
1503. 			static NEARDATA short nocreate4 = STRANGE_OBJECT;
1504. 		/*
1505. 		 * For random objects, do not create certain overly powerful
1506. 		 * items: wand of wishing, ring of levitation, or the
1507. 		 * polymorph/polymorph control combination.  Specific objects,
1508. 		 * i.e. the discovery wishing, are still OK.
1509. 		 * Also, don't get a couple of really useless items.  (Note:
1510. 		 * punishment isn't "useless".  Some players who start out with
1511. 		 * one will immediately read it and use the iron ball as a
1512. 		 * weapon.)
1513. 		 */
1514. 			obj = mkobj(trop->trclass, FALSE);
1515. 			otyp = obj->otyp;
1516. 			while (otyp == WAN_WISHING
1517. 				|| otyp == nocreate
1518. 				|| otyp == nocreate2
1519. 				|| otyp == nocreate3
1520. 				|| otyp == nocreate4
1521. #ifdef ELBERETH
1522. 				|| otyp == RIN_LEVITATION
1523. #endif
1524. 				|| ((Role_if(PM_FLAME_MAGE) || Role_if(PM_ICE_MAGE))
1525. 						&&
1526. 				    (otyp == RIN_FIRE_RESISTANCE || 
1527. 				     otyp == RIN_COLD_RESISTANCE ||
1528. 				     otyp == SPE_ENDURE_HEAT ||
1529. 				     otyp == SPE_ENDURE_COLD))
1530. 
1531. 				/* KMH -- Hobbits shouldn't get ring of invis. */
1532. 				|| (Role_if(PM_HOBBIT) && otyp == RIN_INVISIBILITY)
1533. 
1534. 				/* KMH, balance patch -- now an amulet */
1535. 				|| (Role_if(PM_NECROMANCER) &&
1536. 						otyp == AMULET_OF_DRAIN_RESISTANCE)
1537. 				/* 'useless' or over powerful items */
1538. 				|| otyp == POT_HALLUCINATION
1539. 				|| otyp == POT_ACID
1540. 				|| otyp == SCR_AMNESIA
1541. 				|| otyp == SCR_FIRE
1542. 				|| otyp == SCR_BLANK_PAPER
1543. 				|| otyp == SPE_BLANK_PAPER
1544. 				|| otyp == RIN_AGGRAVATE_MONSTER
1545. 				|| otyp == RIN_HUNGER
1546. 				|| otyp == RIN_SLEEPING
1547. 				|| otyp == WAN_NOTHING
1548. 				/* Monks don't use weapons */
1549. 				|| (otyp == SCR_ENCHANT_WEAPON &&
1550. 				    Role_if(PM_MONK))
1551. 				/* wizard patch -- they already have one */
1552. 				|| (otyp == SPE_FORCE_BOLT &&
1553. 				    Role_if(PM_WIZARD))
1554. 				/* powerful spells are either useless to
1555. 				   low level players or unbalancing; also
1556. 				   spells in restricted skill categories */
1557. 				|| (obj->oclass == SPBOOK_CLASS &&
1558. 				    (objects[otyp].oc_level > 3 ||
1559. 				    restricted_spell_discipline(otyp)))
1560. 							) {
1561. 				dealloc_obj(obj);
1562. 				obj = mkobj(trop->trclass, FALSE);
1563. 				otyp = obj->otyp;
1564. 			}
1565. 
1566. 			/* Don't start with +0 or negative rings */
1567. 			if (objects[otyp].oc_charged && obj->spe <= 0)
1568. 				obj->spe = rne(3);
1569. 
1570. 			/* Heavily relies on the fact that 1) we create wands
1571. 			 * before rings, 2) that we create rings before
1572. 			 * spellbooks, and that 3) not more than 1 object of a
1573. 			 * particular symbol is to be prohibited.  (For more
1574. 			 * objects, we need more nocreate variables...)
1575. 			 */
1576. 			switch (otyp) {
1577. 			    case WAN_POLYMORPH:
1578. 			    case RIN_POLYMORPH:
1579. 			    case POT_POLYMORPH:
1580. 				nocreate = RIN_POLYMORPH_CONTROL;
1581. 				break;
1582. 			    case RIN_POLYMORPH_CONTROL:
1583. 				nocreate = RIN_POLYMORPH;
1584. 				nocreate2 = SPE_POLYMORPH;
1585. 				nocreate3 = POT_POLYMORPH;
1586. 			}
1587. 			/* Don't have 2 of the same ring or spellbook */
1588. 			if (obj->oclass == RING_CLASS ||
1589. 			    obj->oclass == SPBOOK_CLASS)
1590. 				nocreate4 = otyp;
1591. 		}
1592. 
1593. #ifdef GOLDOBJ
1594. 		if (trop->trclass == COIN_CLASS) {
1595. 			/* no "blessed" or "identified" money */
1596. 			obj->quan = u.umoney0;
1597. 		} else {
1598. #endif
1599. 			obj->dknown = obj->bknown = obj->rknown = 1;
1600. 			if (objects[otyp].oc_uses_known) obj->known = 1;
1601. 			obj->cursed = 0;
1602. 			if (obj->opoisoned && u.ualign.type != A_CHAOTIC)
1603. 			    obj->opoisoned = 0;
1604. 			if (obj->oclass == WEAPON_CLASS ||
1605. 				obj->oclass == TOOL_CLASS) {
1606. 			    obj->quan = (long) trop->trquan;
1607. 			    trop->trquan = 1;
1608. 			} else if (obj->oclass == GEM_CLASS &&
1609. 				is_graystone(obj) && obj->otyp != FLINT) {
1610. 			    obj->quan = 1L;
1611. 			}
1612. 			if (trop->trspe != UNDEF_SPE)
1613. 			    obj->spe = trop->trspe;
1614. 			if (trop->trbless != UNDEF_BLESS)
1615. 			    obj->blessed = trop->trbless;
1616. #ifdef GOLDOBJ
1617. 		}
1618. #endif
1619. 		/* defined after setting otyp+quan + blessedness */
1620. 		obj->owt = weight(obj);
1621. 				
1622. 		obj = addinv(obj);
1623. 
1624. 		/* Make the type known if necessary */
1625. 		if (OBJ_DESCR(objects[otyp]) && obj->known)
1626. 			discover_object(otyp, TRUE, FALSE);
1627. 		if (otyp == OIL_LAMP)
1628. 			discover_object(POT_OIL, TRUE, FALSE);
1629. 
1630. 		if(obj->oclass == ARMOR_CLASS){
1631. 			if (is_shield(obj) && !uarms) {
1632. 				setworn(obj, W_ARMS);
1633. 				if (uswapwep) 
1634. 				  setuswapwep((struct obj *) 0, TRUE);
1635. 			} else if (is_helmet(obj) && !uarmh)
1636. 				setworn(obj, W_ARMH);
1637. 			else if (is_gloves(obj) && !uarmg)
1638. 				setworn(obj, W_ARMG);
1639. #ifdef TOURIST
1640. 			else if (is_shirt(obj) && !uarmu)
1641. 				setworn(obj, W_ARMU);
1642. #endif
1643. 			else if (is_cloak(obj) && !uarmc)
1644. 				setworn(obj, W_ARMC);
1645. 			else if (is_boots(obj) && !uarmf)
1646. 				setworn(obj, W_ARMF);
1647. 			else if (is_suit(obj) && !uarm)
1648. 				setworn(obj, W_ARM);
1649. 		}
1650. 
1651. 		if (obj->oclass == WEAPON_CLASS || is_weptool(obj) ||
1652. 			otyp == TIN_OPENER || otyp == FLINT || otyp == ROCK) {
1653. 		    if (is_ammo(obj) || is_missile(obj)) {
1654. 			if (!uquiver) setuqwep(obj);
1655. 		    } else if (!uwep) setuwep(obj, FALSE);
1656. 		    else if (!uswapwep) setuswapwep(obj, FALSE);
1657. 		}
1658. 		if (obj->oclass == SPBOOK_CLASS &&
1659. 				obj->otyp != SPE_BLANK_PAPER)
1660. 		    initialspell(obj);
1661. 
1662. #if !defined(PYRAMID_BUG) && !defined(MAC)
1663. 		if(--trop->trquan) continue;	/* make a similar object */
1664. #else
1665. 		if(trop->trquan) {		/* check if zero first */
1666. 			--trop->trquan;
1667. 			if(trop->trquan)
1668. 				continue;	/* make a similar object */
1669. 		}
1670. #endif
1671. 		
1672. 		trop++;
1673. 	}
1674. }
1675. 
1676. /*u_init.c*/

Also on Fandom

Random Wiki