1 /* NetHack 3.6 u_init.c $NHDT-Date: 1454660565 2016/02/05 08:22:45 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.37 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
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));
21 #define UNDEF_SPE '\177'
25 * Initial inventory for the various roles.
28 static struct trobj Archeologist
[] = {
29 /* if adventure has a name... idea from tan@uvm-gen */
30 { BULLWHIP
, 2, WEAPON_CLASS
, 1, UNDEF_BLESS
},
31 { LEATHER_JACKET
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
32 { FEDORA
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
33 { FOOD_RATION
, 0, FOOD_CLASS
, 3, 0 },
34 { PICK_AXE
, UNDEF_SPE
, TOOL_CLASS
, 1, UNDEF_BLESS
},
35 { TINNING_KIT
, UNDEF_SPE
, TOOL_CLASS
, 1, UNDEF_BLESS
},
36 { TOUCHSTONE
, 0, GEM_CLASS
, 1, 0 },
37 { SACK
, 0, TOOL_CLASS
, 1, 0 },
40 static struct trobj Barbarian
[] = {
41 #define B_MAJOR 0 /* two-handed sword or battle-axe */
42 #define B_MINOR 1 /* matched with axe or short sword */
43 { TWO_HANDED_SWORD
, 0, WEAPON_CLASS
, 1, UNDEF_BLESS
},
44 { AXE
, 0, WEAPON_CLASS
, 1, UNDEF_BLESS
},
45 { RING_MAIL
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
46 { FOOD_RATION
, 0, FOOD_CLASS
, 1, 0 },
49 static struct trobj Cave_man
[] = {
51 { CLUB
, 1, WEAPON_CLASS
, 1, UNDEF_BLESS
},
52 { SLING
, 2, WEAPON_CLASS
, 1, UNDEF_BLESS
},
53 { FLINT
, 0, GEM_CLASS
, 15, UNDEF_BLESS
}, /* quan is variable */
54 { ROCK
, 0, GEM_CLASS
, 3, 0 }, /* yields 18..33 */
55 { LEATHER_ARMOR
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
58 static struct trobj Healer
[] = {
59 { SCALPEL
, 0, WEAPON_CLASS
, 1, UNDEF_BLESS
},
60 { LEATHER_GLOVES
, 1, ARMOR_CLASS
, 1, UNDEF_BLESS
},
61 { STETHOSCOPE
, 0, TOOL_CLASS
, 1, 0 },
62 { POT_HEALING
, 0, POTION_CLASS
, 4, UNDEF_BLESS
},
63 { POT_EXTRA_HEALING
, 0, POTION_CLASS
, 4, UNDEF_BLESS
},
64 { WAN_SLEEP
, UNDEF_SPE
, WAND_CLASS
, 1, UNDEF_BLESS
},
65 /* always blessed, so it's guaranteed readable */
66 { SPE_HEALING
, 0, SPBOOK_CLASS
, 1, 1 },
67 { SPE_EXTRA_HEALING
, 0, SPBOOK_CLASS
, 1, 1 },
68 { SPE_STONE_TO_FLESH
, 0, SPBOOK_CLASS
, 1, 1 },
69 { APPLE
, 0, FOOD_CLASS
, 5, 0 },
72 static struct trobj Knight
[] = {
73 { LONG_SWORD
, 1, WEAPON_CLASS
, 1, UNDEF_BLESS
},
74 { LANCE
, 1, WEAPON_CLASS
, 1, UNDEF_BLESS
},
75 { RING_MAIL
, 1, ARMOR_CLASS
, 1, UNDEF_BLESS
},
76 { HELMET
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
77 { SMALL_SHIELD
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
78 { LEATHER_GLOVES
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
79 { APPLE
, 0, FOOD_CLASS
, 10, 0 },
80 { CARROT
, 0, FOOD_CLASS
, 10, 0 },
83 static struct trobj Monk
[] = {
85 { LEATHER_GLOVES
, 2, ARMOR_CLASS
, 1, UNDEF_BLESS
},
86 { ROBE
, 1, ARMOR_CLASS
, 1, UNDEF_BLESS
},
87 { UNDEF_TYP
, UNDEF_SPE
, SPBOOK_CLASS
, 1, 1 },
88 { UNDEF_TYP
, UNDEF_SPE
, SCROLL_CLASS
, 1, UNDEF_BLESS
},
89 { POT_HEALING
, 0, POTION_CLASS
, 3, UNDEF_BLESS
},
90 { FOOD_RATION
, 0, FOOD_CLASS
, 3, 0 },
91 { APPLE
, 0, FOOD_CLASS
, 5, UNDEF_BLESS
},
92 { ORANGE
, 0, FOOD_CLASS
, 5, UNDEF_BLESS
},
93 /* Yes, we know fortune cookies aren't really from China. They were
94 * invented by George Jung in Los Angeles, California, USA in 1916.
96 { FORTUNE_COOKIE
, 0, FOOD_CLASS
, 3, UNDEF_BLESS
},
99 static struct trobj Priest
[] = {
100 { MACE
, 1, WEAPON_CLASS
, 1, 1 },
101 { ROBE
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
102 { SMALL_SHIELD
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
103 { POT_WATER
, 0, POTION_CLASS
, 4, 1 }, /* holy water */
104 { CLOVE_OF_GARLIC
, 0, FOOD_CLASS
, 1, 0 },
105 { SPRIG_OF_WOLFSBANE
, 0, FOOD_CLASS
, 1, 0 },
106 { UNDEF_TYP
, UNDEF_SPE
, SPBOOK_CLASS
, 2, UNDEF_BLESS
},
109 static struct trobj Ranger
[] = {
111 #define RAN_TWO_ARROWS 2
112 #define RAN_ZERO_ARROWS 3
113 { DAGGER
, 1, WEAPON_CLASS
, 1, UNDEF_BLESS
},
114 { BOW
, 1, WEAPON_CLASS
, 1, UNDEF_BLESS
},
115 { ARROW
, 2, WEAPON_CLASS
, 50, UNDEF_BLESS
},
116 { ARROW
, 0, WEAPON_CLASS
, 30, UNDEF_BLESS
},
117 { CLOAK_OF_DISPLACEMENT
, 2, ARMOR_CLASS
, 1, UNDEF_BLESS
},
118 { CRAM_RATION
, 0, FOOD_CLASS
, 4, 0 },
121 static struct trobj Rogue
[] = {
123 { SHORT_SWORD
, 0, WEAPON_CLASS
, 1, UNDEF_BLESS
},
124 { DAGGER
, 0, WEAPON_CLASS
, 10, 0 }, /* quan is variable */
125 { LEATHER_ARMOR
, 1, ARMOR_CLASS
, 1, UNDEF_BLESS
},
126 { POT_SICKNESS
, 0, POTION_CLASS
, 1, 0 },
127 { LOCK_PICK
, 9, TOOL_CLASS
, 1, 0 },
128 { SACK
, 0, TOOL_CLASS
, 1, 0 },
131 static struct trobj Samurai
[] = {
133 { KATANA
, 0, WEAPON_CLASS
, 1, UNDEF_BLESS
},
134 { SHORT_SWORD
, 0, WEAPON_CLASS
, 1, UNDEF_BLESS
}, /* wakizashi */
135 { YUMI
, 0, WEAPON_CLASS
, 1, UNDEF_BLESS
},
136 { YA
, 0, WEAPON_CLASS
, 25, UNDEF_BLESS
}, /* variable quan */
137 { SPLINT_MAIL
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
140 static struct trobj Tourist
[] = {
142 { DART
, 2, WEAPON_CLASS
, 25, UNDEF_BLESS
}, /* quan is variable */
143 { UNDEF_TYP
, UNDEF_SPE
, FOOD_CLASS
, 10, 0 },
144 { POT_EXTRA_HEALING
, 0, POTION_CLASS
, 2, UNDEF_BLESS
},
145 { SCR_MAGIC_MAPPING
, 0, SCROLL_CLASS
, 4, UNDEF_BLESS
},
146 { HAWAIIAN_SHIRT
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
147 { EXPENSIVE_CAMERA
, UNDEF_SPE
, TOOL_CLASS
, 1, 0 },
148 { CREDIT_CARD
, 0, TOOL_CLASS
, 1, 0 },
151 static struct trobj Valkyrie
[] = {
152 { LONG_SWORD
, 1, WEAPON_CLASS
, 1, UNDEF_BLESS
},
153 { DAGGER
, 0, WEAPON_CLASS
, 1, UNDEF_BLESS
},
154 { SMALL_SHIELD
, 3, ARMOR_CLASS
, 1, UNDEF_BLESS
},
155 { FOOD_RATION
, 0, FOOD_CLASS
, 1, 0 },
158 static struct trobj Wizard
[] = {
159 #define W_MULTSTART 2
161 { QUARTERSTAFF
, 1, WEAPON_CLASS
, 1, 1 },
162 { CLOAK_OF_MAGIC_RESISTANCE
, 0, ARMOR_CLASS
, 1, UNDEF_BLESS
},
163 { UNDEF_TYP
, UNDEF_SPE
, WAND_CLASS
, 1, UNDEF_BLESS
},
164 { UNDEF_TYP
, UNDEF_SPE
, RING_CLASS
, 2, UNDEF_BLESS
},
165 { UNDEF_TYP
, UNDEF_SPE
, POTION_CLASS
, 3, UNDEF_BLESS
},
166 { UNDEF_TYP
, UNDEF_SPE
, SCROLL_CLASS
, 3, UNDEF_BLESS
},
167 { SPE_FORCE_BOLT
, 0, SPBOOK_CLASS
, 1, 1 },
168 { UNDEF_TYP
, UNDEF_SPE
, SPBOOK_CLASS
, 1, UNDEF_BLESS
},
173 * Optional extra inventory items.
176 static struct trobj Tinopener
[] = { { TIN_OPENER
, 0, TOOL_CLASS
, 1, 0 },
178 static struct trobj Magicmarker
[] = { { MAGIC_MARKER
, UNDEF_SPE
, TOOL_CLASS
,
181 static struct trobj Lamp
[] = { { OIL_LAMP
, 1, TOOL_CLASS
, 1, 0 },
183 static struct trobj Blindfold
[] = { { BLINDFOLD
, 0, TOOL_CLASS
, 1, 0 },
185 static struct trobj Instrument
[] = { { WOODEN_FLUTE
, 0, TOOL_CLASS
, 1, 0 },
187 static struct trobj Xtra_food
[] = { { UNDEF_TYP
, UNDEF_SPE
, FOOD_CLASS
, 2, 0 },
189 static struct trobj Leash
[] = { { LEASH
, 0, TOOL_CLASS
, 1, 0 },
191 static struct trobj Towel
[] = { { TOWEL
, 0, TOOL_CLASS
, 1, 0 },
193 static struct trobj Wishing
[] = { { WAN_WISHING
, 3, WAND_CLASS
, 1, 0 },
195 static struct trobj Money
[] = { { GOLD_PIECE
, 0, COIN_CLASS
, 1, 0 },
198 /* race-based substitutions for initial inventory;
199 the weaker cloak for elven rangers is intentional--they shoot better */
200 static struct inv_sub
{
201 short race_pm
, item_otyp
, subs_otyp
;
203 { PM_ELF
, DAGGER
, ELVEN_DAGGER
},
204 { PM_ELF
, SPEAR
, ELVEN_SPEAR
},
205 { PM_ELF
, SHORT_SWORD
, ELVEN_SHORT_SWORD
},
206 { PM_ELF
, BOW
, ELVEN_BOW
},
207 { PM_ELF
, ARROW
, ELVEN_ARROW
},
208 { PM_ELF
, HELMET
, ELVEN_LEATHER_HELM
},
209 /* { PM_ELF, SMALL_SHIELD, ELVEN_SHIELD }, */
210 { PM_ELF
, CLOAK_OF_DISPLACEMENT
, ELVEN_CLOAK
},
211 { PM_ELF
, CRAM_RATION
, LEMBAS_WAFER
},
212 { PM_ORC
, DAGGER
, ORCISH_DAGGER
},
213 { PM_ORC
, SPEAR
, ORCISH_SPEAR
},
214 { PM_ORC
, SHORT_SWORD
, ORCISH_SHORT_SWORD
},
215 { PM_ORC
, BOW
, ORCISH_BOW
},
216 { PM_ORC
, ARROW
, ORCISH_ARROW
},
217 { PM_ORC
, HELMET
, ORCISH_HELM
},
218 { PM_ORC
, SMALL_SHIELD
, ORCISH_SHIELD
},
219 { PM_ORC
, RING_MAIL
, ORCISH_RING_MAIL
},
220 { PM_ORC
, CHAIN_MAIL
, ORCISH_CHAIN_MAIL
},
221 { PM_DWARF
, SPEAR
, DWARVISH_SPEAR
},
222 { PM_DWARF
, SHORT_SWORD
, DWARVISH_SHORT_SWORD
},
223 { PM_DWARF
, HELMET
, DWARVISH_IRON_HELM
},
224 /* { PM_DWARF, SMALL_SHIELD, DWARVISH_ROUNDSHIELD }, */
225 /* { PM_DWARF, PICK_AXE, DWARVISH_MATTOCK }, */
226 { PM_GNOME
, BOW
, CROSSBOW
},
227 { PM_GNOME
, ARROW
, CROSSBOW_BOLT
},
228 { NON_PM
, STRANGE_OBJECT
, STRANGE_OBJECT
}
231 static const struct def_skill Skill_A
[] = {
232 { P_DAGGER
, P_BASIC
},
233 { P_KNIFE
, P_BASIC
},
234 { P_PICK_AXE
, P_EXPERT
},
235 { P_SHORT_SWORD
, P_BASIC
},
236 { P_SCIMITAR
, P_SKILLED
},
237 { P_SABER
, P_EXPERT
},
238 { P_CLUB
, P_SKILLED
},
239 { P_QUARTERSTAFF
, P_SKILLED
},
240 { P_SLING
, P_SKILLED
},
242 { P_BOOMERANG
, P_EXPERT
},
243 { P_WHIP
, P_EXPERT
},
244 { P_UNICORN_HORN
, P_SKILLED
},
245 { P_ATTACK_SPELL
, P_BASIC
},
246 { P_HEALING_SPELL
, P_BASIC
},
247 { P_DIVINATION_SPELL
, P_EXPERT
},
248 { P_MATTER_SPELL
, P_BASIC
},
249 { P_RIDING
, P_BASIC
},
250 { P_TWO_WEAPON_COMBAT
, P_BASIC
},
251 { P_BARE_HANDED_COMBAT
, P_EXPERT
},
254 static const struct def_skill Skill_B
[] = {
255 { P_DAGGER
, P_BASIC
},
257 { P_PICK_AXE
, P_SKILLED
},
258 { P_SHORT_SWORD
, P_EXPERT
},
259 { P_BROAD_SWORD
, P_SKILLED
},
260 { P_LONG_SWORD
, P_SKILLED
},
261 { P_TWO_HANDED_SWORD
, P_EXPERT
},
262 { P_SCIMITAR
, P_SKILLED
},
263 { P_SABER
, P_BASIC
},
264 { P_CLUB
, P_SKILLED
},
265 { P_MACE
, P_SKILLED
},
266 { P_MORNING_STAR
, P_SKILLED
},
267 { P_FLAIL
, P_BASIC
},
268 { P_HAMMER
, P_EXPERT
},
269 { P_QUARTERSTAFF
, P_BASIC
},
270 { P_SPEAR
, P_SKILLED
},
271 { P_TRIDENT
, P_SKILLED
},
273 { P_ATTACK_SPELL
, P_BASIC
},
274 { P_ESCAPE_SPELL
, P_BASIC
}, /* special spell is haste self */
275 { P_RIDING
, P_BASIC
},
276 { P_TWO_WEAPON_COMBAT
, P_BASIC
},
277 { P_BARE_HANDED_COMBAT
, P_MASTER
},
280 static const struct def_skill Skill_C
[] = {
281 { P_DAGGER
, P_BASIC
},
282 { P_KNIFE
, P_SKILLED
},
283 { P_AXE
, P_SKILLED
},
284 { P_PICK_AXE
, P_BASIC
},
285 { P_CLUB
, P_EXPERT
},
286 { P_MACE
, P_EXPERT
},
287 { P_MORNING_STAR
, P_BASIC
},
288 { P_FLAIL
, P_SKILLED
},
289 { P_HAMMER
, P_SKILLED
},
290 { P_QUARTERSTAFF
, P_EXPERT
},
291 { P_POLEARMS
, P_SKILLED
},
292 { P_SPEAR
, P_EXPERT
},
293 { P_TRIDENT
, P_SKILLED
},
294 { P_BOW
, P_SKILLED
},
295 { P_SLING
, P_EXPERT
},
296 { P_ATTACK_SPELL
, P_BASIC
},
297 { P_MATTER_SPELL
, P_SKILLED
},
298 { P_BOOMERANG
, P_EXPERT
},
299 { P_UNICORN_HORN
, P_BASIC
},
300 { P_BARE_HANDED_COMBAT
, P_MASTER
},
303 static const struct def_skill Skill_H
[] = {
304 { P_DAGGER
, P_SKILLED
},
305 { P_KNIFE
, P_EXPERT
},
306 { P_SHORT_SWORD
, P_SKILLED
},
307 { P_SCIMITAR
, P_BASIC
},
308 { P_SABER
, P_BASIC
},
309 { P_CLUB
, P_SKILLED
},
311 { P_QUARTERSTAFF
, P_EXPERT
},
312 { P_POLEARMS
, P_BASIC
},
313 { P_SPEAR
, P_BASIC
},
314 { P_TRIDENT
, P_BASIC
},
315 { P_SLING
, P_SKILLED
},
316 { P_DART
, P_EXPERT
},
317 { P_SHURIKEN
, P_SKILLED
},
318 { P_UNICORN_HORN
, P_EXPERT
},
319 { P_HEALING_SPELL
, P_EXPERT
},
320 { P_BARE_HANDED_COMBAT
, P_BASIC
},
323 static const struct def_skill Skill_K
[] = {
324 { P_DAGGER
, P_BASIC
},
325 { P_KNIFE
, P_BASIC
},
326 { P_AXE
, P_SKILLED
},
327 { P_PICK_AXE
, P_BASIC
},
328 { P_SHORT_SWORD
, P_SKILLED
},
329 { P_BROAD_SWORD
, P_SKILLED
},
330 { P_LONG_SWORD
, P_EXPERT
},
331 { P_TWO_HANDED_SWORD
, P_SKILLED
},
332 { P_SCIMITAR
, P_BASIC
},
333 { P_SABER
, P_SKILLED
},
335 { P_MACE
, P_SKILLED
},
336 { P_MORNING_STAR
, P_SKILLED
},
337 { P_FLAIL
, P_BASIC
},
338 { P_HAMMER
, P_BASIC
},
339 { P_POLEARMS
, P_SKILLED
},
340 { P_SPEAR
, P_SKILLED
},
341 { P_TRIDENT
, P_BASIC
},
342 { P_LANCE
, P_EXPERT
},
344 { P_CROSSBOW
, P_SKILLED
},
345 { P_ATTACK_SPELL
, P_SKILLED
},
346 { P_HEALING_SPELL
, P_SKILLED
},
347 { P_CLERIC_SPELL
, P_SKILLED
},
348 { P_RIDING
, P_EXPERT
},
349 { P_TWO_WEAPON_COMBAT
, P_SKILLED
},
350 { P_BARE_HANDED_COMBAT
, P_EXPERT
},
353 static const struct def_skill Skill_Mon
[] = {
354 { P_QUARTERSTAFF
, P_BASIC
},
355 { P_SPEAR
, P_BASIC
},
356 { P_CROSSBOW
, P_BASIC
},
357 { P_SHURIKEN
, P_BASIC
},
358 { P_ATTACK_SPELL
, P_BASIC
},
359 { P_HEALING_SPELL
, P_EXPERT
},
360 { P_DIVINATION_SPELL
, P_BASIC
},
361 { P_ENCHANTMENT_SPELL
, P_BASIC
},
362 { P_CLERIC_SPELL
, P_SKILLED
},
363 { P_ESCAPE_SPELL
, P_SKILLED
},
364 { P_MATTER_SPELL
, P_BASIC
},
365 { P_MARTIAL_ARTS
, P_GRAND_MASTER
},
368 static const struct def_skill Skill_P
[] = {
369 { P_CLUB
, P_EXPERT
},
370 { P_MACE
, P_EXPERT
},
371 { P_MORNING_STAR
, P_EXPERT
},
372 { P_FLAIL
, P_EXPERT
},
373 { P_HAMMER
, P_EXPERT
},
374 { P_QUARTERSTAFF
, P_EXPERT
},
375 { P_POLEARMS
, P_SKILLED
},
376 { P_SPEAR
, P_SKILLED
},
377 { P_TRIDENT
, P_SKILLED
},
378 { P_LANCE
, P_BASIC
},
380 { P_SLING
, P_BASIC
},
381 { P_CROSSBOW
, P_BASIC
},
383 { P_SHURIKEN
, P_BASIC
},
384 { P_BOOMERANG
, P_BASIC
},
385 { P_UNICORN_HORN
, P_SKILLED
},
386 { P_HEALING_SPELL
, P_EXPERT
},
387 { P_DIVINATION_SPELL
, P_EXPERT
},
388 { P_CLERIC_SPELL
, P_EXPERT
},
389 { P_BARE_HANDED_COMBAT
, P_BASIC
},
392 static const struct def_skill Skill_R
[] = {
393 { P_DAGGER
, P_EXPERT
},
394 { P_KNIFE
, P_EXPERT
},
395 { P_SHORT_SWORD
, P_EXPERT
},
396 { P_BROAD_SWORD
, P_SKILLED
},
397 { P_LONG_SWORD
, P_SKILLED
},
398 { P_TWO_HANDED_SWORD
, P_BASIC
},
399 { P_SCIMITAR
, P_SKILLED
},
400 { P_SABER
, P_SKILLED
},
401 { P_CLUB
, P_SKILLED
},
402 { P_MACE
, P_SKILLED
},
403 { P_MORNING_STAR
, P_BASIC
},
404 { P_FLAIL
, P_BASIC
},
405 { P_HAMMER
, P_BASIC
},
406 { P_POLEARMS
, P_BASIC
},
407 { P_SPEAR
, P_BASIC
},
408 { P_CROSSBOW
, P_EXPERT
},
409 { P_DART
, P_EXPERT
},
410 { P_SHURIKEN
, P_SKILLED
},
411 { P_DIVINATION_SPELL
, P_SKILLED
},
412 { P_ESCAPE_SPELL
, P_SKILLED
},
413 { P_MATTER_SPELL
, P_SKILLED
},
414 { P_RIDING
, P_BASIC
},
415 { P_TWO_WEAPON_COMBAT
, P_EXPERT
},
416 { P_BARE_HANDED_COMBAT
, P_EXPERT
},
419 static const struct def_skill Skill_Ran
[] = {
420 { P_DAGGER
, P_EXPERT
},
421 { P_KNIFE
, P_SKILLED
},
422 { P_AXE
, P_SKILLED
},
423 { P_PICK_AXE
, P_BASIC
},
424 { P_SHORT_SWORD
, P_BASIC
},
425 { P_MORNING_STAR
, P_BASIC
},
426 { P_FLAIL
, P_SKILLED
},
427 { P_HAMMER
, P_BASIC
},
428 { P_QUARTERSTAFF
, P_BASIC
},
429 { P_POLEARMS
, P_SKILLED
},
430 { P_SPEAR
, P_EXPERT
},
431 { P_TRIDENT
, P_BASIC
},
433 { P_SLING
, P_EXPERT
},
434 { P_CROSSBOW
, P_EXPERT
},
435 { P_DART
, P_EXPERT
},
436 { P_SHURIKEN
, P_SKILLED
},
437 { P_BOOMERANG
, P_EXPERT
},
439 { P_HEALING_SPELL
, P_BASIC
},
440 { P_DIVINATION_SPELL
, P_EXPERT
},
441 { P_ESCAPE_SPELL
, P_BASIC
},
442 { P_RIDING
, P_BASIC
},
443 { P_BARE_HANDED_COMBAT
, P_BASIC
},
446 static const struct def_skill Skill_S
[] = {
447 { P_DAGGER
, P_BASIC
},
448 { P_KNIFE
, P_SKILLED
},
449 { P_SHORT_SWORD
, P_EXPERT
},
450 { P_BROAD_SWORD
, P_SKILLED
},
451 { P_LONG_SWORD
, P_EXPERT
},
452 { P_TWO_HANDED_SWORD
, P_EXPERT
},
453 { P_SCIMITAR
, P_BASIC
},
454 { P_SABER
, P_BASIC
},
455 { P_FLAIL
, P_SKILLED
},
456 { P_QUARTERSTAFF
, P_BASIC
},
457 { P_POLEARMS
, P_SKILLED
},
458 { P_SPEAR
, P_SKILLED
},
459 { P_LANCE
, P_SKILLED
},
461 { P_SHURIKEN
, P_EXPERT
},
462 { P_ATTACK_SPELL
, P_BASIC
},
463 { P_DIVINATION_SPELL
, P_BASIC
}, /* special spell is clairvoyance */
464 { P_CLERIC_SPELL
, P_SKILLED
},
465 { P_RIDING
, P_SKILLED
},
466 { P_TWO_WEAPON_COMBAT
, P_EXPERT
},
467 { P_MARTIAL_ARTS
, P_MASTER
},
470 static const struct def_skill Skill_T
[] = {
471 { P_DAGGER
, P_EXPERT
},
472 { P_KNIFE
, P_SKILLED
},
474 { P_PICK_AXE
, P_BASIC
},
475 { P_SHORT_SWORD
, P_EXPERT
},
476 { P_BROAD_SWORD
, P_BASIC
},
477 { P_LONG_SWORD
, P_BASIC
},
478 { P_TWO_HANDED_SWORD
, P_BASIC
},
479 { P_SCIMITAR
, P_SKILLED
},
480 { P_SABER
, P_SKILLED
},
482 { P_MORNING_STAR
, P_BASIC
},
483 { P_FLAIL
, P_BASIC
},
484 { P_HAMMER
, P_BASIC
},
485 { P_QUARTERSTAFF
, P_BASIC
},
486 { P_POLEARMS
, P_BASIC
},
487 { P_SPEAR
, P_BASIC
},
488 { P_TRIDENT
, P_BASIC
},
489 { P_LANCE
, P_BASIC
},
491 { P_SLING
, P_BASIC
},
492 { P_CROSSBOW
, P_BASIC
},
493 { P_DART
, P_EXPERT
},
494 { P_SHURIKEN
, P_BASIC
},
495 { P_BOOMERANG
, P_BASIC
},
497 { P_UNICORN_HORN
, P_SKILLED
},
498 { P_DIVINATION_SPELL
, P_BASIC
},
499 { P_ENCHANTMENT_SPELL
, P_BASIC
},
500 { P_ESCAPE_SPELL
, P_SKILLED
},
501 { P_RIDING
, P_BASIC
},
502 { P_TWO_WEAPON_COMBAT
, P_SKILLED
},
503 { P_BARE_HANDED_COMBAT
, P_SKILLED
},
506 static const struct def_skill Skill_V
[] = {
507 { P_DAGGER
, P_EXPERT
},
509 { P_PICK_AXE
, P_SKILLED
},
510 { P_SHORT_SWORD
, P_SKILLED
},
511 { P_BROAD_SWORD
, P_SKILLED
},
512 { P_LONG_SWORD
, P_EXPERT
},
513 { P_TWO_HANDED_SWORD
, P_EXPERT
},
514 { P_SCIMITAR
, P_BASIC
},
515 { P_SABER
, P_BASIC
},
516 { P_HAMMER
, P_EXPERT
},
517 { P_QUARTERSTAFF
, P_BASIC
},
518 { P_POLEARMS
, P_SKILLED
},
519 { P_SPEAR
, P_SKILLED
},
520 { P_TRIDENT
, P_BASIC
},
521 { P_LANCE
, P_SKILLED
},
522 { P_SLING
, P_BASIC
},
523 { P_ATTACK_SPELL
, P_BASIC
},
524 { P_ESCAPE_SPELL
, P_BASIC
},
525 { P_RIDING
, P_SKILLED
},
526 { P_TWO_WEAPON_COMBAT
, P_SKILLED
},
527 { P_BARE_HANDED_COMBAT
, P_EXPERT
},
530 static const struct def_skill Skill_W
[] = {
531 { P_DAGGER
, P_EXPERT
},
532 { P_KNIFE
, P_SKILLED
},
533 { P_AXE
, P_SKILLED
},
534 { P_SHORT_SWORD
, P_BASIC
},
535 { P_CLUB
, P_SKILLED
},
537 { P_QUARTERSTAFF
, P_EXPERT
},
538 { P_POLEARMS
, P_SKILLED
},
539 { P_SPEAR
, P_BASIC
},
540 { P_TRIDENT
, P_BASIC
},
541 { P_SLING
, P_SKILLED
},
542 { P_DART
, P_EXPERT
},
543 { P_SHURIKEN
, P_BASIC
},
544 { P_ATTACK_SPELL
, P_EXPERT
},
545 { P_HEALING_SPELL
, P_SKILLED
},
546 { P_DIVINATION_SPELL
, P_EXPERT
},
547 { P_ENCHANTMENT_SPELL
, P_SKILLED
},
548 { P_CLERIC_SPELL
, P_SKILLED
},
549 { P_ESCAPE_SPELL
, P_EXPERT
},
550 { P_MATTER_SPELL
, P_EXPERT
},
551 { P_RIDING
, P_BASIC
},
552 { P_BARE_HANDED_COMBAT
, P_BASIC
},
560 discover_object(obj
, TRUE
, FALSE
);
561 objects
[obj
].oc_pre_discovered
= 1; /* not a "discovery" */
564 /* Know ordinary (non-magical) objects of a certain class,
565 * like all gems except the loadstone and luckstone.
572 for (ct
= 1; ct
< NUM_OBJECTS
; ct
++)
573 if (objects
[ct
].oc_class
== sym
&& !objects
[ct
].oc_magic
)
581 struct u_roleplay tmpuroleplay
= u
.uroleplay
; /* set by rcfile options */
583 flags
.female
= flags
.initgend
;
586 /* zero u, including pointer values --
587 * necessary when aborting from a failed restore */
588 (void) memset((genericptr_t
) &u
, 0, sizeof(u
));
589 u
.ustuck
= (struct monst
*) 0;
590 (void) memset((genericptr_t
) &ubirthday
, 0, sizeof(ubirthday
));
591 (void) memset((genericptr_t
) &urealtime
, 0, sizeof(urealtime
));
593 u
.uroleplay
= tmpuroleplay
; /* restore options set via rcfile */
595 #if 0 /* documentation of more zero values as desirable */
596 u
.usick_cause
[0] = 0;
597 u
.uluck
= u
.moreluck
= 0;
599 uarm
= uarmc
= uarmh
= uarms
= uarmg
= uarmf
= 0;
600 uwep
= uball
= uchain
= uleft
= uright
= 0;
601 uswapwep
= uquiver
= 0;
603 u
.ublessed
= 0; /* not worthy yet */
604 u
.ugangr
= 0; /* gods not angry */
605 u
.ugifts
= 0; /* no divine gifts bestowed */
606 u
.uevent
.uhand_of_elbereth
= 0;
607 u
.uevent
.uheard_tune
= 0;
608 u
.uevent
.uopened_dbridge
= 0;
609 u
.uevent
.udemigod
= 0; /* not a demi-god yet... */
611 u
.mh
= u
.mhmax
= u
.mtimedone
= 0;
612 u
.uz
.dnum
= u
.uz0
.dnum
= 0;
622 u
.ugrave_arise
= NON_PM
;
624 u
.umonnum
= u
.umonster
= (flags
.female
&& urole
.femalenum
!= NON_PM
)
630 u
.ulevel
= 0; /* set up some of the initial attributes */
631 u
.uhp
= u
.uhpmax
= newhp();
632 u
.uen
= u
.uenmax
= newpw();
635 u
.ulevel
= u
.ulevelmax
= 1;
638 for (i
= 0; i
<= MAXSPELL
; i
++)
639 spl_book
[i
].sp_id
= NO_SPELL
;
640 u
.ublesscnt
= 300; /* no prayers just yet */
641 u
.ualignbase
[A_CURRENT
] = u
.ualignbase
[A_ORIGINAL
] = u
.ualign
.type
=
642 aligns
[flags
.initalign
].value
;
644 #if defined(BSD) && !defined(POSIX_TYPES)
645 (void) time((long *) &ubirthday
);
647 (void) time(&ubirthday
);
651 * For now, everyone starts out with a night vision range of 1 and
652 * their xray range disabled.
657 /*** Role-specific initializations ***/
658 switch (Role_switch
) {
659 /* rn2(100) > 50 necessary for some choices because some
660 * random number generators are bad enough to seriously
661 * skew the results if we use rn2(2)... --KAA
663 case PM_ARCHEOLOGIST
:
664 ini_inv(Archeologist
);
670 ini_inv(Magicmarker
);
672 knows_object(TOUCHSTONE
);
676 if (rn2(100) >= 50) { /* see above comment */
677 Barbarian
[B_MAJOR
].trotyp
= BATTLE_AXE
;
678 Barbarian
[B_MINOR
].trotyp
= SHORT_SWORD
;
683 knows_class(WEAPON_CLASS
);
684 knows_class(ARMOR_CLASS
);
688 Cave_man
[C_AMMO
].trquan
= rn1(11, 10); /* 10..20 */
693 u
.umoney0
= rn1(1000, 1001);
697 knows_object(POT_FULL_HEALING
);
702 knows_class(WEAPON_CLASS
);
703 knows_class(ARMOR_CLASS
);
704 /* give knights chess-like mobility--idea from wooledge@..cwru.edu */
705 HJumping
|= FROMOUTSIDE
;
709 static short M_spell
[] = { SPE_HEALING
, SPE_PROTECTION
, SPE_SLEEP
};
711 Monk
[M_BOOK
].trotyp
= M_spell
[rn2(90) / 30]; /* [0..2] */
714 ini_inv(Magicmarker
);
717 knows_class(ARMOR_CLASS
);
718 /* sufficiently martial-arts oriented item to ignore language issue */
719 knows_object(SHURIKEN
);
720 skill_init(Skill_Mon
);
726 ini_inv(Magicmarker
);
729 knows_object(POT_WATER
);
732 * Some may claim that this isn't agnostic, since they
733 * are literally "priests" and they have holy water.
734 * But we don't count it as such. Purists can always
735 * avoid playing priests and/or confirm another player's
736 * role in their YAAP.
740 Ranger
[RAN_TWO_ARROWS
].trquan
= rn1(10, 50);
741 Ranger
[RAN_ZERO_ARROWS
].trquan
= rn1(10, 30);
743 skill_init(Skill_Ran
);
746 Rogue
[R_DAGGERS
].trquan
= rn1(10, 6);
755 Samurai
[S_ARROWS
].trquan
= rn1(20, 26);
759 knows_class(WEAPON_CLASS
);
760 knows_class(ARMOR_CLASS
);
764 Tourist
[T_DARTS
].trquan
= rn1(20, 21);
765 u
.umoney0
= rnd(1000);
774 ini_inv(Magicmarker
);
781 knows_class(WEAPON_CLASS
);
782 knows_class(ARMOR_CLASS
);
788 ini_inv(Magicmarker
);
794 default: /* impossible */
798 /*** Race-specific initializations ***/
799 switch (Race_switch
) {
801 /* Nothing special */
806 * Elves are people of music and song, or they are warriors.
807 * Non-warriors get an instrument. We use a kludge to
808 * get only non-magic instruments.
810 if (Role_if(PM_PRIEST
) || Role_if(PM_WIZARD
)) {
811 static int trotyp
[] = { WOODEN_FLUTE
, TOOLED_HORN
, WOODEN_HARP
,
812 BELL
, BUGLE
, LEATHER_DRUM
};
813 Instrument
[0].trotyp
= trotyp
[rn2(SIZE(trotyp
))];
817 /* Elves can recognize all elvish objects */
818 knows_object(ELVEN_SHORT_SWORD
);
819 knows_object(ELVEN_ARROW
);
820 knows_object(ELVEN_BOW
);
821 knows_object(ELVEN_SPEAR
);
822 knows_object(ELVEN_DAGGER
);
823 knows_object(ELVEN_BROADSWORD
);
824 knows_object(ELVEN_MITHRIL_COAT
);
825 knows_object(ELVEN_LEATHER_HELM
);
826 knows_object(ELVEN_SHIELD
);
827 knows_object(ELVEN_BOOTS
);
828 knows_object(ELVEN_CLOAK
);
832 /* Dwarves can recognize all dwarvish objects */
833 knows_object(DWARVISH_SPEAR
);
834 knows_object(DWARVISH_SHORT_SWORD
);
835 knows_object(DWARVISH_MATTOCK
);
836 knows_object(DWARVISH_IRON_HELM
);
837 knows_object(DWARVISH_MITHRIL_COAT
);
838 knows_object(DWARVISH_CLOAK
);
839 knows_object(DWARVISH_ROUNDSHIELD
);
846 /* compensate for generally inferior equipment */
847 if (!Role_if(PM_WIZARD
))
849 /* Orcs can recognize all orcish objects */
850 knows_object(ORCISH_SHORT_SWORD
);
851 knows_object(ORCISH_ARROW
);
852 knows_object(ORCISH_BOW
);
853 knows_object(ORCISH_SPEAR
);
854 knows_object(ORCISH_DAGGER
);
855 knows_object(ORCISH_CHAIN_MAIL
);
856 knows_object(ORCISH_RING_MAIL
);
857 knows_object(ORCISH_HELM
);
858 knows_object(ORCISH_SHIELD
);
859 knows_object(URUK_HAI_SHIELD
);
860 knows_object(ORCISH_CLOAK
);
863 default: /* impossible */
875 u
.umoney0
+= hidden_gold(); /* in case sack has gold in it */
877 find_ac(); /* get initial ac value */
878 init_attr(75); /* init attribute values */
879 max_rank_sz(); /* set max str size for class ranks */
881 * Do we really need this?
883 for (i
= 0; i
< A_MAX
; i
++)
885 register int xd
= rn2(7) - 2; /* biased variation */
887 (void) adjattrib(i
, xd
, TRUE
);
888 if (ABASE(i
) < AMAX(i
))
892 /* make sure you can carry all you have - especially for Tourists */
893 while (inv_weight() > 0) {
894 if (adjattrib(A_STR
, 1, TRUE
))
896 if (adjattrib(A_CON
, 1, TRUE
))
898 /* only get here when didn't boost strength or constitution */
905 /* skills aren't initialized, so we use the role-specific skill lists */
907 restricted_spell_discipline(otyp
)
910 const struct def_skill
*skills
;
911 int this_skill
= spell_skilltype(otyp
);
913 switch (Role_switch
) {
914 case PM_ARCHEOLOGIST
:
954 skills
= 0; /* lint suppression */
958 while (skills
&& skills
->skill
!= P_NONE
) {
959 if (skills
->skill
== this_skill
)
968 register struct trobj
*trop
;
973 while (trop
->trclass
) {
974 if (trop
->trotyp
!= UNDEF_TYP
) {
975 otyp
= (int) trop
->trotyp
;
976 if (urace
.malenum
!= PM_HUMAN
) {
977 /* substitute specific items for generic ones */
978 for (i
= 0; inv_subs
[i
].race_pm
!= NON_PM
; ++i
)
979 if (inv_subs
[i
].race_pm
== urace
.malenum
980 && otyp
== inv_subs
[i
].item_otyp
) {
981 otyp
= inv_subs
[i
].subs_otyp
;
985 obj
= mksobj(otyp
, TRUE
, FALSE
);
986 } else { /* UNDEF_TYP */
987 static NEARDATA
short nocreate
= STRANGE_OBJECT
;
988 static NEARDATA
short nocreate2
= STRANGE_OBJECT
;
989 static NEARDATA
short nocreate3
= STRANGE_OBJECT
;
990 static NEARDATA
short nocreate4
= STRANGE_OBJECT
;
992 * For random objects, do not create certain overly powerful
993 * items: wand of wishing, ring of levitation, or the
994 * polymorph/polymorph control combination. Specific objects,
995 * i.e. the discovery wishing, are still OK.
996 * Also, don't get a couple of really useless items. (Note:
997 * punishment isn't "useless". Some players who start out with
998 * one will immediately read it and use the iron ball as a
1001 obj
= mkobj(trop
->trclass
, FALSE
);
1003 while (otyp
== WAN_WISHING
|| otyp
== nocreate
1004 || otyp
== nocreate2
|| otyp
== nocreate3
1005 || otyp
== nocreate4
|| otyp
== RIN_LEVITATION
1006 /* 'useless' items */
1007 || otyp
== POT_HALLUCINATION
1009 || otyp
== SCR_AMNESIA
1011 || otyp
== SCR_BLANK_PAPER
1012 || otyp
== SPE_BLANK_PAPER
1013 || otyp
== RIN_AGGRAVATE_MONSTER
1014 || otyp
== RIN_HUNGER
1015 || otyp
== WAN_NOTHING
1016 /* Monks don't use weapons */
1017 || (otyp
== SCR_ENCHANT_WEAPON
&& Role_if(PM_MONK
))
1018 /* wizard patch -- they already have one */
1019 || (otyp
== SPE_FORCE_BOLT
&& Role_if(PM_WIZARD
))
1020 /* powerful spells are either useless to
1021 low level players or unbalancing; also
1022 spells in restricted skill categories */
1023 || (obj
->oclass
== SPBOOK_CLASS
1024 && (objects
[otyp
].oc_level
> 3
1025 || restricted_spell_discipline(otyp
)))) {
1027 obj
= mkobj(trop
->trclass
, FALSE
);
1031 /* Don't start with +0 or negative rings */
1032 if (objects
[otyp
].oc_charged
&& obj
->spe
<= 0)
1035 /* Heavily relies on the fact that 1) we create wands
1036 * before rings, 2) that we create rings before
1037 * spellbooks, and that 3) not more than 1 object of a
1038 * particular symbol is to be prohibited. (For more
1039 * objects, we need more nocreate variables...)
1045 nocreate
= RIN_POLYMORPH_CONTROL
;
1047 case RIN_POLYMORPH_CONTROL
:
1048 nocreate
= RIN_POLYMORPH
;
1049 nocreate2
= SPE_POLYMORPH
;
1050 nocreate3
= POT_POLYMORPH
;
1052 /* Don't have 2 of the same ring or spellbook */
1053 if (obj
->oclass
== RING_CLASS
|| obj
->oclass
== SPBOOK_CLASS
)
1057 /* nudist gets no armor */
1058 if (u
.uroleplay
.nudist
&& obj
->oclass
== ARMOR_CLASS
) {
1064 if (trop
->trclass
== COIN_CLASS
) {
1065 /* no "blessed" or "identified" money */
1066 obj
->quan
= u
.umoney0
;
1068 if (objects
[otyp
].oc_uses_known
)
1070 obj
->dknown
= obj
->bknown
= obj
->rknown
= 1;
1071 if (Is_container(obj
) || obj
->otyp
== STATUE
) {
1072 obj
->cknown
= obj
->lknown
= 1;
1076 if (obj
->opoisoned
&& u
.ualign
.type
!= A_CHAOTIC
)
1078 if (obj
->oclass
== WEAPON_CLASS
|| obj
->oclass
== TOOL_CLASS
) {
1079 obj
->quan
= (long) trop
->trquan
;
1081 } else if (obj
->oclass
== GEM_CLASS
&& is_graystone(obj
)
1082 && obj
->otyp
!= FLINT
) {
1085 if (trop
->trspe
!= UNDEF_SPE
)
1086 obj
->spe
= trop
->trspe
;
1087 if (trop
->trbless
!= UNDEF_BLESS
)
1088 obj
->blessed
= trop
->trbless
;
1090 /* defined after setting otyp+quan + blessedness */
1091 obj
->owt
= weight(obj
);
1094 /* Make the type known if necessary */
1095 if (OBJ_DESCR(objects
[otyp
]) && obj
->known
)
1096 discover_object(otyp
, TRUE
, FALSE
);
1097 if (otyp
== OIL_LAMP
)
1098 discover_object(POT_OIL
, TRUE
, FALSE
);
1100 if (obj
->oclass
== ARMOR_CLASS
) {
1101 if (is_shield(obj
) && !uarms
) {
1102 setworn(obj
, W_ARMS
);
1104 setuswapwep((struct obj
*) 0);
1105 } else if (is_helmet(obj
) && !uarmh
)
1106 setworn(obj
, W_ARMH
);
1107 else if (is_gloves(obj
) && !uarmg
)
1108 setworn(obj
, W_ARMG
);
1109 else if (is_shirt(obj
) && !uarmu
)
1110 setworn(obj
, W_ARMU
);
1111 else if (is_cloak(obj
) && !uarmc
)
1112 setworn(obj
, W_ARMC
);
1113 else if (is_boots(obj
) && !uarmf
)
1114 setworn(obj
, W_ARMF
);
1115 else if (is_suit(obj
) && !uarm
)
1116 setworn(obj
, W_ARM
);
1119 if (obj
->oclass
== WEAPON_CLASS
|| is_weptool(obj
)
1120 || otyp
== TIN_OPENER
|| otyp
== FLINT
|| otyp
== ROCK
) {
1121 if (is_ammo(obj
) || is_missile(obj
)) {
1129 if (obj
->oclass
== SPBOOK_CLASS
&& obj
->otyp
!= SPE_BLANK_PAPER
)
1132 #if !defined(PYRAMID_BUG) && !defined(MAC)
1134 continue; /* make a similar object */
1136 if (trop
->trquan
) { /* check if zero first */
1139 continue; /* make a similar object */