3 * Summary: Monsters' starting equipment.
21 #include "mgen_enum.h"
22 #include "mon-place.h"
28 static void _give_monster_item(monster
* mon
, int thing
,
29 bool force_item
= false,
30 bool (monster::*pickupfn
)(item_def
&, int) = NULL
,
31 bool keep_ident
= false)
33 if (thing
== NON_ITEM
|| thing
== -1)
36 item_def
&mthing
= mitm
[thing
];
37 ASSERT(mthing
.defined());
39 #ifdef DEBUG_DIAGNOSTICS
40 mprf(MSGCH_DIAGNOSTICS
,
41 "Giving %s to %s...", mthing
.name(DESC_PLAIN
).c_str(),
42 mon
->name(DESC_PLAIN
, true).c_str());
46 mthing
.link
= NON_ITEM
;
49 unset_ident_flags(mthing
, ISFLAG_IDENT_MASK
);
51 if ((mon
->undead_or_demonic() || mon
->god
== GOD_YREDELEMNUL
)
52 && (is_blessed(mthing
)
53 || get_weapon_brand(mthing
) == SPWPN_HOLY_WRATH
))
55 if (is_blessed(mthing
))
57 if (get_weapon_brand(mthing
) == SPWPN_HOLY_WRATH
)
58 set_item_ego_type(mthing
, OBJ_WEAPONS
, SPWPN_NORMAL
);
61 unwind_var
<int> save_speedinc(mon
->speed_increment
);
62 if (!(pickupfn
? (mon
->*pickupfn
)(mthing
, false)
63 : mon
->pickup_item(mthing
, false, true)))
65 #ifdef DEBUG_DIAGNOSTICS
66 mprf(MSGCH_DIAGNOSTICS
, "Destroying %s because %s doesn't want it!",
67 mthing
.name(DESC_PLAIN
, false, true).c_str(),
68 mon
->name(DESC_PLAIN
, true).c_str());
70 destroy_item(thing
, true);
73 if (!mthing
.defined()) // missiles merged into an existing stack
75 ASSERT(mthing
.holding_monster() == mon
);
77 if (!force_item
|| mthing
.colour
== BLACK
)
81 void give_specific_item(monster
* mon
, const item_def
& tpl
)
83 int thing
= get_item_slot();
84 if (thing
== NON_ITEM
)
88 _give_monster_item(mon
, thing
, true, NULL
, true);
91 static void _give_scroll(monster
* mon
, int level
)
93 int thing_created
= NON_ITEM
;
95 if (mon
->type
== MONS_ROXANNE
)
97 // Not a scroll, but this comes closest.
98 int which_book
= (one_chance_in(3) ? BOOK_TRANSFIGURATIONS
101 thing_created
= items(0, OBJ_BOOKS
, which_book
, true, level
, 0);
103 if (thing_created
!= NON_ITEM
&& coinflip())
105 // Give Roxanne a random book containing Statue Form instead.
106 item_def
&item(mitm
[thing_created
]);
107 make_book_Roxanne_special(&item
);
108 _give_monster_item(mon
, thing_created
, true);
112 else if (mons_is_unique(mon
->type
) && one_chance_in(3))
113 thing_created
= items(0, OBJ_SCROLLS
, OBJ_RANDOM
, true, level
, 0);
115 if (thing_created
== NON_ITEM
)
118 mitm
[thing_created
].flags
= 0;
119 _give_monster_item(mon
, thing_created
, true);
122 static void _give_wand(monster
* mon
, int level
)
124 if (mons_is_unique(mon
->type
) && !mons_class_flag(mon
->type
, M_NO_WAND
)
126 || (mon
->type
== MONS_MAURICE
&& one_chance_in(3))))
128 const int idx
= items(0, OBJ_WANDS
, OBJ_RANDOM
, true, level
, 0);
133 item_def
& wand
= mitm
[idx
];
135 // Don't give top-tier wands before 5 HD.
136 if (mon
->hit_dice
< 5 || mons_class_flag(mon
->type
, M_NO_HT_WAND
))
138 // Technically these wands will be undercharged, but it
139 // doesn't really matter.
140 if (wand
.sub_type
== WAND_FIRE
)
141 wand
.sub_type
= WAND_FLAME
;
143 if (wand
.sub_type
== WAND_COLD
)
144 wand
.sub_type
= WAND_FROST
;
146 if (wand
.sub_type
== WAND_LIGHTNING
)
147 wand
.sub_type
= (coinflip() ? WAND_FLAME
: WAND_FROST
);
151 _give_monster_item(mon
, idx
);
155 static void _give_potion(monster
* mon
, int level
)
157 if (mons_species(mon
->type
) == MONS_VAMPIRE
158 && (one_chance_in(5) || mon
->type
== MONS_JORY
))
160 // This handles initialization of stack timer.
161 const int thing_created
=
162 items(0, OBJ_POTIONS
, POT_BLOOD
, true, level
, 0);
164 if (thing_created
== NON_ITEM
)
167 mitm
[thing_created
].flags
= 0;
168 _give_monster_item(mon
, thing_created
);
170 else if (mons_species(mon
->type
) == MONS_DEEP_DWARF
&& one_chance_in(3))
172 const int thing_created
=
173 items(0, OBJ_POTIONS
, coinflip() ? POT_HEAL_WOUNDS
174 : POT_HEALING
, true, level
, 0);
176 if (thing_created
== NON_ITEM
)
179 mitm
[thing_created
].flags
= 0;
180 _give_monster_item(mon
, thing_created
);
182 else if (mons_is_unique(mon
->type
) && one_chance_in(3))
184 const int thing_created
=
185 items(0, OBJ_POTIONS
, OBJ_RANDOM
, true, level
, 0);
187 if (thing_created
== NON_ITEM
)
190 mitm
[thing_created
].flags
= 0;
191 _give_monster_item(mon
, thing_created
, false,
192 &monster::pickup_potion
);
196 static item_make_species_type
_give_weapon(monster
* mon
, int level
,
197 bool melee_only
= false,
198 bool give_aux_melee
= true,
199 bool spectral_orcs
= false)
201 bool force_item
= false;
204 item_make_species_type item_race
= MAKE_ITEM_RANDOM_RACE
;
205 int type
= mon
->type
;
207 item
.base_type
= OBJ_UNASSIGNED
;
209 if (mon
->type
== MONS_DANCING_WEAPON
210 && player_in_branch(BRANCH_HALL_OF_BLADES
))
212 level
= MAKE_GOOD_ITEM
;
215 // moved setting of quantity here to keep it in mind {dlb}
224 // A few of the smarter kobolds have blowguns.
225 if (one_chance_in(10) && level
> 1)
227 item
.base_type
= OBJ_WEAPONS
;
228 item
.sub_type
= WPN_BLOWGUN
;
231 // intentional fallthrough
232 case MONS_BIG_KOBOLD
:
233 if (x_chance_in_y(3, 5)) // give hand weapon
235 item
.base_type
= OBJ_WEAPONS
;
236 item
.sub_type
= random_choose(WPN_DAGGER
, WPN_DAGGER
,
237 WPN_SHORT_SWORD
, WPN_SHORT_SWORD
,
238 WPN_CLUB
, WPN_WHIP
, -1);
245 if (one_chance_in(3))
246 item_race
= MAKE_ITEM_ORCISH
;
248 if (x_chance_in_y(3, 5)) // give hand weapon
250 item
.base_type
= OBJ_WEAPONS
;
251 item
.sub_type
= WPN_CLUB
;
258 if (one_chance_in(3))
259 item_race
= MAKE_ITEM_ORCISH
;
261 if (!melee_only
&& one_chance_in(12) && level
)
263 item
.base_type
= OBJ_WEAPONS
;
264 item
.sub_type
= WPN_SLING
;
267 // deliberate fall through {dlb}
270 if (x_chance_in_y(3, 5)) // give hand weapon
272 item
.base_type
= OBJ_WEAPONS
;
273 item
.sub_type
= (coinflip() ? WPN_DAGGER
: WPN_CLUB
);
281 item
.base_type
= OBJ_WEAPONS
;
283 if (one_chance_in(6))
285 item
.sub_type
= random_choose(WPN_SPIKED_FLAIL
, WPN_GREAT_MACE
,
286 WPN_WAR_AXE
, WPN_TRIDENT
, -1);
290 item
.sub_type
= random_choose(
291 WPN_MACE
, WPN_FLAIL
, WPN_MORNINGSTAR
,
292 WPN_DAGGER
, WPN_SHORT_SWORD
, WPN_LONG_SWORD
,
293 WPN_SCIMITAR
, WPN_GREAT_SWORD
, WPN_HAND_AXE
,
294 WPN_BATTLEAXE
, WPN_SPEAR
, WPN_HALBERD
,
301 item
.plus
+= 1 + random2(3);
302 item
.plus2
+= 1 + random2(3);
304 if (one_chance_in(5))
305 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_FREEZING
);
308 if (one_chance_in(3))
313 item_race
= MAKE_ITEM_NO_RACE
;
314 item
.base_type
= OBJ_WEAPONS
;
315 item
.sub_type
= random_choose_weighted (30, WPN_FLAIL
, 10, WPN_SPIKED_FLAIL
,
316 5, WPN_DIRE_FLAIL
, 0);
317 // "expensive" flail. {due}
318 if (item
.sub_type
== WPN_FLAIL
)
319 level
= MAKE_GOOD_ITEM
;
324 case MONS_DEEP_DWARF
:
325 item_race
= MAKE_ITEM_DWARVEN
;
326 if (one_chance_in(9))
328 item
.base_type
= OBJ_WEAPONS
;
329 item
.sub_type
= WPN_CROSSBOW
;
332 // deliberate fall through
333 case MONS_DEEP_DWARF_SCION
:
334 case MONS_DEEP_DWARF_DEATH_KNIGHT
:
335 case MONS_DEEP_DWARF_BERSERKER
:
336 item_race
= MAKE_ITEM_DWARVEN
;
337 item
.base_type
= OBJ_WEAPONS
;
339 if (one_chance_in(6))
341 item
.sub_type
= random_choose_weighted(5, WPN_SPIKED_FLAIL
, 5, WPN_GREAT_MACE
,
342 5, WPN_GREAT_SWORD
, 10, WPN_BROAD_AXE
,
343 15, WPN_BATTLEAXE
, 0);
347 item
.sub_type
= random_choose_weighted(5, WPN_FLAIL
, 5, WPN_MACE
,
348 5, WPN_SPEAR
, 5, WPN_HALBERD
,
349 5, WPN_GREAT_SWORD
, 10, WPN_WAR_AXE
,
350 15, WPN_HAND_AXE
, 0);
353 if (coinflip() || mon
->type
== MONS_DEEP_DWARF_BERSERKER
354 || mon
->type
== MONS_DEEP_DWARF_SCION
)
357 item
.plus
+= 1 + random2(4);
358 item
.plus2
+= 1 + random2(4);
360 if (one_chance_in(30) && (mon
->type
== MONS_DEEP_DWARF_BERSERKER
361 || mon
->type
== MONS_DEEP_DWARF_SCION
))
363 level
= MAKE_GOOD_ITEM
;
366 else if (one_chance_in(3) && mon
->type
!= MONS_DEEP_DWARF_BERSERKER
)
368 item
.plus
= -1 + (-1 * random2(4));
369 item
.plus2
= -1 + (-1 * random2(4));
376 case MONS_NAGA_WARRIOR
:
377 case MONS_GREATER_NAGA
:
378 item_race
= MAKE_ITEM_NO_RACE
;
379 if (!one_chance_in(5))
381 item
.base_type
= OBJ_WEAPONS
;
382 item
.sub_type
= random_choose(WPN_SPEAR
, WPN_SPEAR
, WPN_HALBERD
,
383 WPN_CLUB
, WPN_WHIP
, WPN_FLAIL
, -1);
388 force_item
= true; // guaranteed flaming or pain
389 item
.base_type
= OBJ_WEAPONS
;
390 item
.sub_type
= WPN_WHIP
;
391 set_item_ego_type(item
, OBJ_WEAPONS
, coinflip() ? SPWPN_PAIN
: SPWPN_FLAMING
);
392 item
.plus
+= random2(3);
393 item
.plus2
+= random2(3);
397 force_item
= true; // guaranteed reaching
398 item_race
= MAKE_ITEM_NO_RACE
;
399 item
.base_type
= OBJ_WEAPONS
;
400 item
.sub_type
= random_choose(WPN_WHIP
, WPN_WHIP
, WPN_SPEAR
,
401 WPN_HALBERD
, WPN_GLAIVE
, -1);
402 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_REACHING
);
403 item
.plus
+= -2 + random2(4);
404 item
.plus2
+= -1 + random2(2);
407 case MONS_CRAZY_YIUF
:
408 force_item
= true; // guaranteed chaos
409 item_race
= MAKE_ITEM_NO_RACE
;
410 item
.base_type
= OBJ_WEAPONS
;
411 item
.sub_type
= WPN_QUARTERSTAFF
;
412 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_CHAOS
);
413 item
.plus
+= 2 + random2(3);
414 item
.plus2
+= 2 + random2(3);
420 item
.base_type
= OBJ_WEAPONS
;
421 item
.sub_type
= WPN_SLING
;
424 item_race
= MAKE_ITEM_NO_RACE
;
425 item
.base_type
= OBJ_WEAPONS
;
426 item
.sub_type
= WPN_QUARTERSTAFF
;
430 force_item
= true; // guaranteed pain
431 item
.base_type
= OBJ_WEAPONS
;
432 item
.sub_type
= random_choose_weighted(
433 30, WPN_DAGGER
, 20, WPN_HAMMER
,
436 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_PAIN
);
442 case MONS_ORC_PRIEST
:
443 item_race
= MAKE_ITEM_ORCISH
;
444 // deliberate fall through {gdl}
447 case MONS_DRACONIAN_ZEALOT
:
448 if (!one_chance_in(5))
450 item
.base_type
= OBJ_WEAPONS
;
451 item
.sub_type
= random_choose_weighted(
452 30, WPN_DAGGER
, 30, WPN_CLUB
,
453 27, WPN_FLAIL
, 24, WPN_HAND_AXE
,
454 20, WPN_HAMMER
, 20, WPN_SHORT_SWORD
,
455 20, WPN_MACE
, 10, WPN_WHIP
,
456 10, WPN_TRIDENT
, 10, WPN_FALCHION
,
457 10, WPN_MORNINGSTAR
, 6, WPN_WAR_AXE
,
466 item
.base_type
= OBJ_WEAPONS
;
467 item
.sub_type
= random_choose_weighted(30, WPN_FLAIL
,
479 item_race
= MAKE_ITEM_ELVEN
;
480 item
.base_type
= OBJ_WEAPONS
;
481 item
.sub_type
= random_choose_weighted(30, WPN_SHORT_SWORD
,
487 item
.base_type
= OBJ_WEAPONS
;
488 item
.sub_type
= random_choose(WPN_DEMON_BLADE
, WPN_DEMON_TRIDENT
,
490 level
= MAKE_GOOD_ITEM
;
494 case MONS_DEEP_ELF_FIGHTER
:
495 case MONS_DEEP_ELF_HIGH_PRIEST
:
496 case MONS_DEEP_ELF_KNIGHT
:
497 case MONS_DEEP_ELF_PRIEST
:
498 case MONS_DEEP_ELF_SOLDIER
:
499 item_race
= MAKE_ITEM_ELVEN
;
500 item
.base_type
= OBJ_WEAPONS
;
501 item
.sub_type
= random_choose_weighted(
502 22, WPN_LONG_SWORD
, 22, WPN_SHORT_SWORD
, 17, WPN_SCIMITAR
,
503 17, WPN_BOW
, 5, WPN_LONGBOW
,
507 case MONS_DEEP_ELF_BLADEMASTER
:
509 item_race
= MAKE_ITEM_ELVEN
;
510 item
.base_type
= OBJ_WEAPONS
;
512 // If the blademaster already has a weapon, give him the exact same
513 // sub_type to match.
515 const item_def
*weap
= mon
->mslot_item(MSLOT_WEAPON
);
516 if (weap
&& weap
->base_type
== OBJ_WEAPONS
)
517 item
.sub_type
= weap
->sub_type
;
520 item
.sub_type
= random_choose_weighted(40, WPN_SABRE
,
528 case MONS_DEEP_ELF_MASTER_ARCHER
:
529 item_race
= MAKE_ITEM_ELVEN
;
530 item
.base_type
= OBJ_WEAPONS
;
531 item
.sub_type
= WPN_LONGBOW
;
534 case MONS_DEEP_ELF_ANNIHILATOR
:
535 case MONS_DEEP_ELF_CONJURER
:
536 case MONS_DEEP_ELF_DEATH_MAGE
:
537 case MONS_DEEP_ELF_DEMONOLOGIST
:
538 case MONS_DEEP_ELF_MAGE
:
539 case MONS_DEEP_ELF_SORCERER
:
540 case MONS_DEEP_ELF_SUMMONER
:
541 item_race
= MAKE_ITEM_ELVEN
;
542 item
.base_type
= OBJ_WEAPONS
;
543 item
.sub_type
= random_choose(WPN_LONG_SWORD
, WPN_LONG_SWORD
,
544 WPN_SHORT_SWORD
, WPN_SABRE
,
549 case MONS_DRACONIAN_SHIFTER
:
550 case MONS_DRACONIAN_SCORCHER
:
551 case MONS_DRACONIAN_ANNIHILATOR
:
552 case MONS_DRACONIAN_CALLER
:
553 item
.base_type
= OBJ_WEAPONS
;
554 item
.sub_type
= random_choose(WPN_LONG_SWORD
, WPN_LONG_SWORD
,
555 WPN_SHORT_SWORD
, WPN_SABRE
,
556 WPN_DAGGER
, WPN_WHIP
,
560 case MONS_ORC_WARRIOR
:
561 case MONS_ORC_HIGH_PRIEST
:
562 case MONS_BLORK_THE_ORC
:
563 item_race
= MAKE_ITEM_ORCISH
;
564 // deliberate fall-through {dlb}
566 case MONS_DANCING_WEAPON
: // give_level may have been adjusted above
572 case MONS_SKELETAL_WARRIOR
:
573 case MONS_PALE_DRACONIAN
:
574 case MONS_RED_DRACONIAN
:
575 case MONS_WHITE_DRACONIAN
:
576 case MONS_GREEN_DRACONIAN
:
577 case MONS_MOTTLED_DRACONIAN
:
578 case MONS_BLACK_DRACONIAN
:
579 case MONS_YELLOW_DRACONIAN
:
580 case MONS_PURPLE_DRACONIAN
:
581 case MONS_GREY_DRACONIAN
:
582 if (mons_genus(mon
->type
) == MONS_NAGA
)
583 item_race
= MAKE_ITEM_NO_RACE
;
585 item
.base_type
= OBJ_WEAPONS
;
586 item
.sub_type
= random_choose_weighted(
587 10, WPN_LONG_SWORD
, 10, WPN_SHORT_SWORD
,
588 10, WPN_SCIMITAR
, 10, WPN_BATTLEAXE
,
589 10, WPN_HAND_AXE
, 10, WPN_HALBERD
,
590 10, WPN_GLAIVE
, 10, WPN_MORNINGSTAR
,
591 10, WPN_GREAT_MACE
, 10, WPN_TRIDENT
,
592 9, WPN_WAR_AXE
, 9, WPN_FLAIL
,
593 1, WPN_BROAD_AXE
, 1, WPN_SPIKED_FLAIL
,
598 item
.base_type
= OBJ_WEAPONS
;
599 item
.sub_type
= random_choose(WPN_BARDICHE
, WPN_DEMON_TRIDENT
,
601 level
= MAKE_GOOD_ITEM
;
606 item
.base_type
= OBJ_WEAPONS
;
607 // Rupert favours big two-handers with visceral up-close
608 // effects, i.e. no polearms.
609 item
.sub_type
= random_choose_weighted(10, WPN_GREAT_MACE
,
613 2, WPN_EXECUTIONERS_AXE
,
615 level
= MAKE_GOOD_ITEM
;
619 item_race
= MAKE_ITEM_DWARVEN
;
621 item
.base_type
= OBJ_WEAPONS
;
622 // speech references an axe
623 item
.sub_type
= random_choose(WPN_WAR_AXE
, WPN_BROAD_AXE
,
627 case MONS_ORC_WARLORD
:
628 case MONS_SAINT_ROKA
:
629 // being at the top has its privileges
630 if (one_chance_in(3))
631 level
= MAKE_GOOD_ITEM
;
632 // deliberate fall-through
634 case MONS_ORC_KNIGHT
:
635 item_race
= MAKE_ITEM_ORCISH
;
636 // Occasionally get crossbows.
637 if (!melee_only
&& one_chance_in(9))
639 item
.base_type
= OBJ_WEAPONS
;
640 item
.sub_type
= WPN_CROSSBOW
;
643 // deliberate fall-through
646 item_race
= MAKE_ITEM_ORCISH
;
647 // deliberate fall-through
650 case MONS_VAULT_GUARD
:
651 case MONS_VAMPIRE_KNIGHT
:
652 case MONS_DRACONIAN_KNIGHT
:
655 item
.base_type
= OBJ_WEAPONS
;
657 item
.sub_type
= random_choose_weighted(
658 4, WPN_GREAT_SWORD
, 4, WPN_LONG_SWORD
,
659 4, WPN_BATTLEAXE
, 4, WPN_WAR_AXE
,
660 3, WPN_GREAT_MACE
, 2, WPN_DIRE_FLAIL
,
661 1, WPN_BARDICHE
, 1, WPN_GLAIVE
,
662 1, WPN_BROAD_AXE
, 1, WPN_HALBERD
,
665 if (one_chance_in(4))
666 item
.plus
+= 1 + random2(3);
670 case MONS_POLYPHEMUS
:
672 case MONS_STONE_GIANT
:
673 item
.base_type
= OBJ_MISSILES
;
674 item
.sub_type
= MI_LARGE_ROCK
;
677 case MONS_TWO_HEADED_OGRE
:
679 case MONS_IRON_GIANT
:
680 item_race
= MAKE_ITEM_NO_RACE
;
681 item
.base_type
= OBJ_WEAPONS
;
682 item
.sub_type
= (one_chance_in(3) ? WPN_GIANT_SPIKED_CLUB
685 if (one_chance_in(10) || mon
->type
== MONS_ETTIN
)
687 item
.sub_type
= (one_chance_in(10) ? WPN_DIRE_FLAIL
693 level
= MAKE_GOOD_ITEM
;
694 // intentional fall-through...
696 item
.base_type
= OBJ_WEAPONS
;
697 item
.sub_type
= WPN_SCYTHE
;
701 item
.base_type
= OBJ_WEAPONS
;
702 item
.sub_type
= WPN_DEMON_WHIP
;
706 if (!one_chance_in(3))
708 item_race
= MAKE_ITEM_NO_RACE
;
709 item
.base_type
= OBJ_WEAPONS
;
710 item
.sub_type
= (one_chance_in(3) ? WPN_DEMON_TRIDENT
716 case MONS_HILL_GIANT
:
718 item_race
= MAKE_ITEM_NO_RACE
;
719 item
.base_type
= OBJ_WEAPONS
;
720 item
.sub_type
= (one_chance_in(3) ? WPN_GIANT_SPIKED_CLUB
723 if (one_chance_in(10))
725 item
.sub_type
= (one_chance_in(10) ? WPN_DIRE_FLAIL
731 item_race
= MAKE_ITEM_NO_RACE
;
732 item
.base_type
= OBJ_WEAPONS
;
733 item
.sub_type
= WPN_TRIDENT
;
734 item
.special
= SPWPN_FREEZING
;
735 item
.plus
= random_range(-1, 6, 2);
736 item
.plus2
= random_range(-1, 6, 2);
737 item
.colour
= ETC_ICE
;
741 case MONS_MERFOLK_IMPALER
:
742 item_race
= MAKE_ITEM_NO_RACE
;
743 item
.base_type
= OBJ_WEAPONS
;
744 item
.sub_type
= random_choose_weighted(100, WPN_TRIDENT
,
745 15, WPN_DEMON_TRIDENT
,
748 level
= MAKE_GOOD_ITEM
;
751 // Per dpeg request :)
752 item
.special
= SPWPN_REACHING
;
753 item
.plus
= random_range(-1, 6, 2);
754 item
.plus2
= random_range(-1, 5, 2);
760 case MONS_MERFOLK_AQUAMANCER
:
761 item_race
= MAKE_ITEM_NO_RACE
;
762 item
.base_type
= OBJ_WEAPONS
;
763 item
.sub_type
= WPN_SABRE
;
765 level
= MAKE_GOOD_ITEM
;
768 case MONS_MERFOLK_JAVELINEER
:
769 item_race
= MAKE_ITEM_NO_RACE
;
770 item
.base_type
= OBJ_WEAPONS
;
771 item
.sub_type
= WPN_SPEAR
;
772 if (!one_chance_in(3))
773 level
= MAKE_GOOD_ITEM
;
777 if (active_monster_band
== BAND_MERFOLK_IMPALER
)
779 item_race
= MAKE_ITEM_NO_RACE
;
780 item
.base_type
= OBJ_WEAPONS
;
781 item
.sub_type
= random_choose_weighted(10, WPN_SPEAR
,
788 if (one_chance_in(3))
790 item_race
= MAKE_ITEM_NO_RACE
;
791 item
.base_type
= OBJ_WEAPONS
;
792 item
.sub_type
= WPN_TRIDENT
;
795 // intentionally fall through
798 if (one_chance_in(3))
800 item_race
= MAKE_ITEM_NO_RACE
;
801 item
.base_type
= OBJ_WEAPONS
;
802 item
.sub_type
= WPN_SPEAR
;
807 case MONS_CENTAUR_WARRIOR
:
808 item_race
= MAKE_ITEM_NO_RACE
;
809 item
.base_type
= OBJ_WEAPONS
;
810 item
.sub_type
= WPN_BOW
;
811 if (mon
->type
== MONS_CENTAUR_WARRIOR
&& one_chance_in(3))
812 item
.sub_type
= WPN_LONGBOW
;
816 item_race
= MAKE_ITEM_NO_RACE
;
817 item
.base_type
= OBJ_WEAPONS
;
818 item
.sub_type
= WPN_LONGBOW
;
819 item
.special
= SPWPN_FLAME
;
820 item
.plus
+= 1 + random2(3);
821 item
.plus2
+= 1 + random2(3);
822 item
.colour
= DARKGREY
;
827 case MONS_YAKTAUR_CAPTAIN
:
828 item_race
= MAKE_ITEM_NO_RACE
;
829 item
.base_type
= OBJ_WEAPONS
;
830 item
.sub_type
= WPN_CROSSBOW
;
837 item_race
= MAKE_ITEM_NO_RACE
;
838 item
.base_type
= OBJ_WEAPONS
;
839 item
.sub_type
= WPN_SCIMITAR
;
840 item
.plus
= random2(5);
841 item
.plus2
= random2(5);
842 item
.colour
= RED
; // forced by force_item above {dlb}
843 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_FLAMING
);
849 item_race
= MAKE_ITEM_NO_RACE
;
850 item
.base_type
= OBJ_WEAPONS
;
851 item
.colour
= YELLOW
; // forced by force_item above {dlb}
853 item
.sub_type
= (one_chance_in(4) ? WPN_SACRED_SCOURGE
856 set_equip_desc(item
, ISFLAG_GLOWING
);
857 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_HOLY_WRATH
);
858 item
.plus
= 1 + random2(3);
859 item
.plus2
= 1 + random2(3);
866 item_race
= MAKE_ITEM_NO_RACE
;
867 item
.base_type
= OBJ_WEAPONS
;
868 item
.colour
= YELLOW
; // forced by force_item above {dlb}
870 item
.sub_type
= (one_chance_in(4) ? WPN_EUDEMON_BLADE
873 set_equip_desc(item
, ISFLAG_GLOWING
);
874 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_HOLY_WRATH
);
875 item
.plus
= 1 + random2(3);
876 item
.plus2
= 1 + random2(3);
881 item
.base_type
= OBJ_WEAPONS
;
882 item
.sub_type
= random_choose_weighted(12, WPN_SCIMITAR
,
889 7, WPN_DEMON_TRIDENT
,
892 if (x_chance_in_y(5, 9))
894 set_item_ego_type(item
, OBJ_WEAPONS
,
895 random_choose_weighted(15, SPWPN_FLAMING
,
904 item
.plus
+= random2(6);
905 item
.plus2
+= random2(6);
907 item
.colour
= random_choose_weighted(1, CYAN
,
914 case MONS_HELL_KNIGHT
:
919 item
.base_type
= OBJ_WEAPONS
;
920 item
.sub_type
= random_choose_weighted(5, WPN_HALBERD
,
931 14, WPN_DEMON_TRIDENT
,
934 if (x_chance_in_y(5, 9))
936 set_item_ego_type(item
, OBJ_WEAPONS
,
937 random_choose_weighted(15, SPWPN_FLAMING
,
946 item
.plus
+= random2(6);
947 item
.plus2
+= random2(6);
949 item
.colour
= random_choose_weighted(3, CYAN
,
955 case MONS_FIRE_GIANT
:
957 item_race
= MAKE_ITEM_NO_RACE
;
958 item
.base_type
= OBJ_WEAPONS
;
959 item
.sub_type
= WPN_GREAT_SWORD
;
962 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_FLAMING
);
964 item
.colour
= random_choose_weighted(3, CYAN
,
971 case MONS_FROST_GIANT
:
973 item_race
= MAKE_ITEM_NO_RACE
;
974 item
.base_type
= OBJ_WEAPONS
;
975 item
.sub_type
= WPN_BATTLEAXE
;
978 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_FREEZING
);
980 // forced by force_item above {dlb}
981 item
.colour
= (one_chance_in(3) ? WHITE
: CYAN
);
984 case MONS_ORC_WIZARD
:
985 case MONS_ORC_SORCERER
:
987 item_race
= MAKE_ITEM_ORCISH
;
988 item
.base_type
= OBJ_WEAPONS
;
989 item
.sub_type
= WPN_DAGGER
;
992 case MONS_UNBORN_DEEP_DWARF
:
993 if (one_chance_in(6))
994 level
= MAKE_GOOD_ITEM
;
995 // deliberate fallthrough
997 case MONS_DEEP_DWARF_NECROMANCER
:
998 item_race
= MAKE_ITEM_DWARVEN
;
999 item
.base_type
= OBJ_WEAPONS
;
1000 item
.sub_type
= WPN_HAND_AXE
;
1003 case MONS_DEEP_DWARF_ARTIFICER
:
1006 item
.base_type
= OBJ_STAVES
;
1007 item
.sub_type
= STAFF_STRIKING
;
1009 else if (one_chance_in(100))
1011 dprf("generating a rare rod");
1012 const int rand_staff
= random2(NUM_STAVES
- STAFF_FIRST_ROD
)
1014 item
.base_type
= OBJ_STAVES
;
1015 item
.sub_type
= rand_staff
;
1019 item_race
= MAKE_ITEM_DWARVEN
;
1020 item
.base_type
= OBJ_WEAPONS
;
1021 item
.sub_type
= ((one_chance_in(3))? WPN_HAND_AXE
: WPN_BROAD_AXE
);
1026 item_race
= MAKE_ITEM_ELVEN
;
1027 item
.base_type
= OBJ_WEAPONS
;
1028 item
.sub_type
= WPN_DAGGER
;
1031 case MONS_KOBOLD_DEMONOLOGIST
:
1032 case MONS_NECROMANCER
:
1035 case MONS_JOSEPHINE
:
1036 item
.base_type
= OBJ_WEAPONS
;
1037 item
.sub_type
= WPN_DAGGER
;
1039 if (mon
->type
== MONS_PSYCHE
)
1042 set_item_ego_type(item
, OBJ_WEAPONS
,
1043 random_choose_weighted(3, SPWPN_CHAOS
,
1044 1, SPWPN_DISTORTION
,
1050 item
.base_type
= OBJ_WEAPONS
;
1051 item
.sub_type
= WPN_LAJATANG
;
1052 if (!one_chance_in(3))
1053 level
= MAKE_GOOD_ITEM
;
1059 item
.base_type
= OBJ_WEAPONS
;
1060 item
.sub_type
= WPN_BLOWGUN
;
1061 item_race
= MAKE_ITEM_NO_RACE
;
1065 item_race
= MAKE_ITEM_NO_RACE
;
1066 item
.base_type
= OBJ_WEAPONS
;
1067 item
.sub_type
= coinflip() ? WPN_DAGGER
: WPN_SHORT_SWORD
;
1068 set_item_ego_type(item
, OBJ_WEAPONS
,
1069 random_choose_weighted(3, SPWPN_DISTORTION
,
1076 item_race
= MAKE_ITEM_NO_RACE
;
1077 item
.base_type
= OBJ_WEAPONS
;
1078 item
.sub_type
= coinflip() ? WPN_DAGGER
: WPN_SHORT_SWORD
;
1081 case MONS_EUSTACHIO
:
1082 item_race
= MAKE_ITEM_NO_RACE
;
1083 item
.base_type
= OBJ_WEAPONS
;
1084 item
.sub_type
= (one_chance_in(3) ? WPN_FALCHION
: WPN_SABRE
);
1089 item_race
= MAKE_ITEM_NO_RACE
;
1090 item
.base_type
= OBJ_WEAPONS
;
1091 item
.sub_type
= WPN_SABRE
;
1092 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_ELECTROCUTION
);
1093 item
.plus
= random2(5);
1094 item
.plus2
= random2(5);
1099 make_item_unrandart(item
, UNRAND_CEREBOV
);
1104 make_item_unrandart(item
, UNRAND_DISPATER
);
1109 make_item_unrandart(item
, UNRAND_ASMODEUS
);
1113 // mv: Probably should be moved out of this switch, but it's not
1114 // worth it, unless we have more monsters with misc. items.
1115 item
.base_type
= OBJ_MISCELLANY
;
1116 item
.sub_type
= MISC_HORN_OF_GERYON
;
1119 case MONS_SALAMANDER
: // mv: new 8 Aug 2001
1120 // Yes, they've got really nice items, but
1121 // it's almost impossible to get them.
1123 item_race
= MAKE_ITEM_NO_RACE
;
1124 item
.base_type
= OBJ_WEAPONS
;
1125 item
.sub_type
= random_choose(WPN_GREAT_SWORD
, WPN_TRIDENT
,
1126 WPN_SPEAR
, WPN_GLAIVE
,
1127 WPN_BOW
, WPN_HALBERD
,
1130 set_item_ego_type(item
, OBJ_WEAPONS
, is_range_weapon(item
) ?
1131 SPWPN_FLAME
: SPWPN_FLAMING
);
1133 item
.plus
= random2(5);
1134 item
.plus2
= random2(5);
1135 item
.colour
= RED
; // forced by force_item above {dlb}
1139 item_race
= MAKE_ITEM_NO_RACE
;
1140 item
.base_type
= OBJ_WEAPONS
;
1141 // no quick blades for mooks
1142 item
.sub_type
= random_choose(WPN_DAGGER
, WPN_SHORT_SWORD
,
1146 case MONS_SPRIGGAN_RIDER
:
1147 if (!melee_only
&& one_chance_in(4))
1149 item
.base_type
= OBJ_WEAPONS
;
1150 item
.sub_type
= WPN_BLOWGUN
;
1151 item_race
= MAKE_ITEM_NO_RACE
;
1154 item_race
= MAKE_ITEM_NO_RACE
;
1155 item
.base_type
= OBJ_WEAPONS
;
1156 item
.sub_type
= WPN_SPEAR
;
1159 case MONS_SPRIGGAN_BERSERKER
:
1160 item_race
= MAKE_ITEM_NO_RACE
;
1161 item
.base_type
= OBJ_WEAPONS
;
1162 item
.sub_type
= random_choose(WPN_HAND_AXE
,
1168 case MONS_SPRIGGAN_DRUID
:
1169 item_race
= MAKE_ITEM_NO_RACE
;
1170 item
.base_type
= OBJ_WEAPONS
;
1171 item
.sub_type
= WPN_QUARTERSTAFF
;
1174 case MONS_SPRIGGAN_DEFENDER
:
1175 case MONS_THE_ENCHANTRESS
:
1176 // High end gear, but alas, with an extra chance for distortion.
1177 item_race
= MAKE_ITEM_NO_RACE
;
1178 item
.base_type
= OBJ_WEAPONS
;
1179 item
.sub_type
= random_choose(WPN_LAJATANG
, // best spriggan weapon
1180 WPN_QUICK_BLADE
, // overrated
1181 WPN_SABRE
, // ordinary but popular
1182 WPN_DEMON_WHIP
, // goodness
1183 WPN_FLAIL
, // best ordinary 1.5-handed
1185 level
= MAKE_GOOD_ITEM
;
1186 if (one_chance_in(mon
->type
== MONS_THE_ENCHANTRESS
? 4 : 10))
1189 set_item_ego_type(item
, OBJ_WEAPONS
, SPWPN_DISTORTION
);
1190 item
.plus
= random2(5);
1191 item
.plus2
= random2(5);
1199 // Only happens if something in above switch doesn't set it. {dlb}
1200 if (item
.base_type
== OBJ_UNASSIGNED
)
1203 if (!force_item
&& mons_is_unique(mon
->type
))
1205 if (x_chance_in_y(10 + mon
->hit_dice
, 100))
1206 level
= MAKE_GOOD_ITEM
;
1207 else if (level
!= MAKE_GOOD_ITEM
)
1211 const object_class_type xitc
= item
.base_type
;
1212 const int xitt
= item
.sub_type
;
1214 // Note this mess, all the work above doesn't mean much unless
1215 // force_item is set... otherwise we're just going to take the base
1216 // and subtype and create a new item. - bwr
1217 const int thing_created
=
1218 ((force_item
) ? get_item_slot() : items(0, xitc
, xitt
, true,
1221 if (thing_created
== NON_ITEM
)
1224 // Copy temporary item into the item array if were forcing it, since
1225 // items() won't have done it for us.
1227 mitm
[thing_created
] = item
;
1229 item_def
&i
= mitm
[thing_created
];
1230 if (melee_only
&& (i
.base_type
!= OBJ_WEAPONS
|| is_range_weapon(i
)))
1232 destroy_item(thing_created
);
1237 item_set_appearance(i
);
1239 _give_monster_item(mon
, thing_created
, force_item
);
1241 if (give_aux_melee
&& (i
.base_type
!= OBJ_WEAPONS
|| is_range_weapon(i
)))
1242 _give_weapon(mon
, level
, true, false);
1247 // Hands out ammunition fitting the monster's launcher (if any), or else any
1248 // throwable weapon depending on the monster type.
1249 static void _give_ammo(monster
* mon
, int level
,
1250 item_make_species_type item_race
,
1253 // Note that item_race is not reset for this section.
1254 if (const item_def
*launcher
= mon
->launcher())
1256 const object_class_type xitc
= OBJ_MISSILES
;
1257 int xitt
= fires_ammo_type(*launcher
);
1259 if (xitt
== MI_STONE
&& (one_chance_in(15) || mon
->type
== MONS_JOSEPH
))
1260 xitt
= MI_SLING_BULLET
;
1262 const int thing_created
= items(0, xitc
, xitt
, true, level
, item_race
);
1264 if (thing_created
== NON_ITEM
)
1267 if (xitt
== MI_NEEDLE
)
1269 if (mon
->type
== MONS_SONJA
)
1271 set_item_ego_type(mitm
[thing_created
], OBJ_MISSILES
,
1274 mitm
[thing_created
].quantity
= random_range(4, 10);
1278 set_item_ego_type(mitm
[thing_created
], OBJ_MISSILES
,
1279 got_curare_roll(level
) ? SPMSL_CURARE
1282 if (get_ammo_brand(mitm
[thing_created
]) == SPMSL_CURARE
)
1283 mitm
[thing_created
].quantity
= random_range(2, 8);
1288 // Sanity check to avoid useless brands.
1289 const int bow_brand
= get_weapon_brand(*launcher
);
1290 const int ammo_brand
= get_ammo_brand(mitm
[thing_created
]);
1291 if (ammo_brand
!= SPMSL_NORMAL
1292 && (bow_brand
== SPWPN_FLAME
|| bow_brand
== SPWPN_FROST
))
1294 mitm
[thing_created
].special
= SPMSL_NORMAL
;
1300 case MONS_DEEP_ELF_MASTER_ARCHER
:
1301 // Master archers get double ammo - archery is their only attack
1302 mitm
[thing_created
].quantity
*= 2;
1306 mitm
[thing_created
].special
= SPMSL_POISONED
;
1310 mitm
[thing_created
].quantity
+= 2 + random2(7);
1311 mitm
[thing_created
].plus
+= 2 + random2(2);
1312 if (mitm
[thing_created
].plus
> 6)
1313 mitm
[thing_created
].plus
= 6;
1320 _give_monster_item(mon
, thing_created
);
1324 // Give some monsters throwing weapons.
1326 object_class_type weap_class
= OBJ_WEAPONS
;
1331 case MONS_BIG_KOBOLD
:
1332 if (x_chance_in_y(2, 5))
1334 item_race
= MAKE_ITEM_NO_RACE
;
1335 weap_class
= OBJ_MISSILES
;
1336 weap_type
= MI_DART
;
1337 qty
= 1 + random2(5);
1341 case MONS_ORC_WARRIOR
:
1343 you
.where_are_you
== BRANCH_ORCISH_MINES
? 9 : 20))
1345 weap_type
= random_choose(WPN_HAND_AXE
, WPN_SPEAR
, -1);
1346 qty
= random_range(4, 8);
1347 item_race
= MAKE_ITEM_ORCISH
;
1352 if (one_chance_in(20))
1354 weap_type
= random_choose(WPN_HAND_AXE
, WPN_SPEAR
, -1);
1355 qty
= random_range(2, 5);
1356 item_race
= MAKE_ITEM_ORCISH
;
1361 weap_type
= MI_JAVELIN
;
1362 weap_class
= OBJ_MISSILES
;
1363 item_race
= MAKE_ITEM_ORCISH
;
1364 qty
= random_range(4, 7);
1368 weap_type
= MI_LARGE_ROCK
;
1369 weap_class
= OBJ_MISSILES
;
1373 case MONS_MERFOLK_JAVELINEER
:
1374 weap_class
= OBJ_MISSILES
;
1375 weap_type
= MI_JAVELIN
;
1376 item_race
= MAKE_ITEM_NO_RACE
;
1377 qty
= random_range(9, 23, 2);
1378 if (one_chance_in(3))
1379 level
= MAKE_GOOD_ITEM
;
1383 if (one_chance_in(3)
1384 || active_monster_band
== BAND_MERFOLK_JAVELINEER
)
1386 item_race
= MAKE_ITEM_NO_RACE
;
1387 weap_class
= OBJ_WEAPONS
;
1388 weap_type
= WPN_SPEAR
;
1389 qty
= random_range(4, 8);
1390 if (active_monster_band
== BAND_MERFOLK_JAVELINEER
)
1393 if (one_chance_in(6) && !mons_summoned
)
1395 weap_class
= OBJ_MISSILES
;
1396 weap_type
= MI_THROWING_NET
;
1398 if (one_chance_in(4))
1399 qty
+= random2(3); // up to three nets
1403 case MONS_DRACONIAN_KNIGHT
:
1405 case MONS_HILL_GIANT
:
1406 if (!one_chance_in(20))
1408 // deliberate fall-through
1410 case MONS_HAROLD
: // bounty hunters
1411 case MONS_JOZEF
: // up to 5 nets
1415 weap_class
= OBJ_MISSILES
;
1416 weap_type
= MI_THROWING_NET
;
1418 if (one_chance_in(3))
1420 if (mon
->type
== MONS_HAROLD
|| mon
->type
== MONS_JOZEF
)
1429 if (weap_type
== -1)
1432 const int thing_created
=
1433 items(0, weap_class
, weap_type
, true, level
, item_race
);
1435 if (thing_created
!= NON_ITEM
)
1437 item_def
& w(mitm
[thing_created
]);
1439 // Limit returning brand to only one.
1440 if (weap_type
== OBJ_WEAPONS
1441 && get_weapon_brand(w
) == SPWPN_RETURNING
)
1446 if (mon
->type
== MONS_CHUCK
)
1447 set_item_ego_type(w
, OBJ_MISSILES
, SPMSL_RETURNING
);
1450 _give_monster_item(mon
, thing_created
, false,
1451 (weap_class
== OBJ_WEAPONS
?
1452 &monster::pickup_melee_weapon
1453 : &monster::pickup_throwable_weapon
));
1458 static bool make_item_for_monster(
1460 object_class_type base
,
1463 item_make_species_type race
= MAKE_ITEM_NO_RACE
,
1464 int allow_uniques
= 0)
1466 const int bp
= get_item_slot();
1470 const int thing_created
=
1471 items(allow_uniques
, base
, subtype
, true, level
, race
);
1473 if (thing_created
== NON_ITEM
)
1476 _give_monster_item(mons
, thing_created
);
1480 void give_shield(monster
* mon
, int level
)
1482 const item_def
*main_weap
= mon
->mslot_item(MSLOT_WEAPON
);
1483 const item_def
*alt_weap
= mon
->mslot_item(MSLOT_ALT_WEAPON
);
1485 // If the monster is already wielding/carrying a two-handed weapon,
1486 // it doesn't get a shield. (Monsters always prefer raw damage to
1488 if (main_weap
&& hands_reqd(*main_weap
, mon
->body_size()) == HANDS_TWO
1489 || alt_weap
&& hands_reqd(*alt_weap
, mon
->body_size()) == HANDS_TWO
)
1499 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_LARGE_SHIELD
,
1500 level
* 2 + 1, MAKE_ITEM_NO_RACE
, 1);
1503 case MONS_DEEP_ELF_SOLDIER
:
1504 case MONS_DEEP_ELF_FIGHTER
:
1505 if (one_chance_in(6))
1507 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_BUCKLER
,
1508 level
, MAKE_ITEM_ELVEN
);
1511 case MONS_NAGA_WARRIOR
:
1512 case MONS_VAULT_GUARD
:
1513 if (one_chance_in(3))
1515 make_item_for_monster(mon
, OBJ_ARMOUR
,
1516 one_chance_in(3) ? ARM_LARGE_SHIELD
1518 level
, MAKE_ITEM_NO_RACE
);
1521 case MONS_DRACONIAN_KNIGHT
:
1524 make_item_for_monster(mon
, OBJ_ARMOUR
,
1525 coinflip()? ARM_LARGE_SHIELD
: ARM_SHIELD
,
1526 level
, MAKE_ITEM_NO_RACE
);
1529 case MONS_DEEP_ELF_KNIGHT
:
1530 if (one_chance_in(3))
1532 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_BUCKLER
,
1533 level
, MAKE_ITEM_ELVEN
);
1537 case MONS_SPRIGGAN_RIDER
:
1538 if (!one_chance_in(4))
1540 case MONS_SPRIGGAN_DEFENDER
:
1541 case MONS_THE_ENCHANTRESS
:
1542 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_BUCKLER
,
1543 mon
->type
== MONS_THE_ENCHANTRESS
? MAKE_GOOD_ITEM
:
1544 mon
->type
== MONS_SPRIGGAN_DEFENDER
? level
* 2 + 1 :
1545 level
, MAKE_ITEM_NO_RACE
);
1548 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_BUCKLER
,
1549 level
* 2 + 1, MAKE_ITEM_RANDOM_RACE
, 1);
1552 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_SHIELD
,
1553 level
* 2 + 1, MAKE_ITEM_DWARVEN
, 1);
1556 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_LARGE_SHIELD
,
1557 level
* 2 + 1, MAKE_ITEM_RANDOM_RACE
, 1);
1560 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_SHIELD
,
1561 level
* 2 + 1, MAKE_ITEM_RANDOM_RACE
, 1);
1565 item_def
*shield
= mon
->shield();
1567 set_item_ego_type(*shield
, OBJ_ARMOUR
, SPARM_REFLECTION
);
1573 make_item_for_monster(mon
, OBJ_ARMOUR
, ARM_GLOVES
,
1574 level
* 2 + 1, MAKE_ITEM_NO_RACE
, 1);
1576 item_def
*gaunt
= mon
->shield();
1579 if (get_armour_ego_type(*gaunt
) == SPARM_ARCHERY
)
1580 set_item_ego_type(*gaunt
, OBJ_ARMOUR
, SPARM_NORMAL
);
1581 gaunt
->plus2
= TGLOV_DESC_GAUNTLETS
;
1590 void give_armour(monster
* mon
, int level
, bool spectral_orcs
)
1593 item_make_species_type item_race
= MAKE_ITEM_RANDOM_RACE
;
1595 item
.base_type
= OBJ_UNASSIGNED
;
1598 int force_colour
= 0; // mv: Important!!! Items with force_colour = 0
1599 // are colored by default after following
1600 // switch. Others will get force_colour.
1602 bool force_item
= false;
1603 int type
= mon
->type
;
1612 case MONS_DEEP_ELF_BLADEMASTER
:
1613 case MONS_DEEP_ELF_MASTER_ARCHER
:
1614 item_race
= MAKE_ITEM_ELVEN
;
1615 item
.base_type
= OBJ_ARMOUR
;
1616 item
.sub_type
= ARM_LEATHER_ARMOUR
;
1621 case MONS_DEEP_ELF_ANNIHILATOR
:
1622 case MONS_DEEP_ELF_CONJURER
:
1623 case MONS_DEEP_ELF_DEATH_MAGE
:
1624 case MONS_DEEP_ELF_DEMONOLOGIST
:
1625 case MONS_DEEP_ELF_FIGHTER
:
1626 case MONS_DEEP_ELF_HIGH_PRIEST
:
1627 case MONS_DEEP_ELF_KNIGHT
:
1628 case MONS_DEEP_ELF_MAGE
:
1629 case MONS_DEEP_ELF_PRIEST
:
1630 case MONS_DEEP_ELF_SOLDIER
:
1631 case MONS_DEEP_ELF_SORCERER
:
1632 case MONS_DEEP_ELF_SUMMONER
:
1633 if (item_race
== MAKE_ITEM_RANDOM_RACE
)
1634 item_race
= MAKE_ITEM_ELVEN
;
1635 // deliberate fall through {dlb}
1639 case MONS_ORC_HIGH_PRIEST
:
1640 case MONS_ORC_PRIEST
:
1641 case MONS_ORC_SORCERER
:
1642 if (item_race
== MAKE_ITEM_RANDOM_RACE
)
1643 item_race
= MAKE_ITEM_ORCISH
;
1644 // deliberate fall through {dlb}
1648 case MONS_JOSEPHINE
:
1651 if (x_chance_in_y(2, 5))
1653 item
.base_type
= OBJ_ARMOUR
;
1655 const int temp_rand
= random2(8);
1656 item
.sub_type
= ((temp_rand
< 4) ? ARM_LEATHER_ARMOUR
:
1657 (temp_rand
< 6) ? ARM_RING_MAIL
:
1658 (temp_rand
== 6) ? ARM_SCALE_MAIL
1666 item
.base_type
= OBJ_ARMOUR
;
1667 item
.sub_type
= random_choose_weighted(3, ARM_LEATHER_ARMOUR
,
1673 item
.base_type
= OBJ_ARMOUR
;
1674 item
.sub_type
= random_choose_weighted(1, ARM_RING_MAIL
,
1682 case MONS_SPRIGGAN_BERSERKER
:
1683 item
.base_type
= OBJ_ARMOUR
;
1684 item
.sub_type
= ARM_ANIMAL_SKIN
;
1688 item_race
= MAKE_ITEM_ORCISH
;
1689 // deliberate fall through {dlb}
1694 item
.base_type
= OBJ_ARMOUR
;
1696 const int temp_rand
= random2(4);
1697 item
.sub_type
= ((temp_rand
== 0) ? ARM_LEATHER_ARMOUR
:
1698 (temp_rand
== 1) ? ARM_RING_MAIL
:
1699 (temp_rand
== 2) ? ARM_SCALE_MAIL
1705 item_race
= MAKE_ITEM_DWARVEN
;
1706 item
.base_type
= OBJ_ARMOUR
;
1707 if (one_chance_in(3))
1708 level
= MAKE_GOOD_ITEM
;
1710 item
.sub_type
= random_choose_weighted(3, ARM_CHAIN_MAIL
,
1711 3, ARM_BANDED_MAIL
, 3, ARM_SPLINT_MAIL
,
1712 10, ARM_PLATE_MAIL
, 1, ARM_CRYSTAL_PLATE_MAIL
,
1716 case MONS_ORC_WARLORD
:
1717 case MONS_SAINT_ROKA
:
1718 // Being at the top has its privileges. :)
1719 if (one_chance_in(3))
1720 level
= MAKE_GOOD_ITEM
;
1721 // deliberate fall through
1723 case MONS_ORC_KNIGHT
:
1724 case MONS_ORC_WARRIOR
:
1725 item_race
= MAKE_ITEM_ORCISH
;
1726 // deliberate fall through {dlb}
1729 case MONS_FREDERICK
:
1730 case MONS_HELL_KNIGHT
:
1735 case MONS_VAMPIRE_KNIGHT
:
1737 case MONS_VAULT_GUARD
:
1739 item
.base_type
= OBJ_ARMOUR
;
1741 const int temp_rand
= random2(4);
1742 item
.sub_type
= ((temp_rand
== 0) ? ARM_CHAIN_MAIL
:
1743 (temp_rand
== 1) ? ARM_SPLINT_MAIL
:
1744 (temp_rand
== 2) ? ARM_BANDED_MAIL
1749 case MONS_DEEP_DWARF_NECROMANCER
:
1750 force_colour
= MAGENTA
;
1751 // deliberate fall through
1753 case MONS_UNBORN_DEEP_DWARF
:
1754 if (mon
->type
== MONS_UNBORN_DEEP_DWARF
)
1756 force_colour
= WHITE
;
1757 if (one_chance_in(6))
1758 level
= MAKE_GOOD_ITEM
;
1760 // deliberate fall through
1762 case MONS_DEEP_DWARF_ARTIFICER
:
1763 item_race
= MAKE_ITEM_NO_RACE
;
1764 item
.base_type
= OBJ_ARMOUR
;
1765 item
.sub_type
= ARM_ROBE
;
1769 case MONS_DEEP_DWARF
:
1770 case MONS_DEEP_DWARF_SCION
:
1771 case MONS_DEEP_DWARF_DEATH_KNIGHT
:
1772 case MONS_DEEP_DWARF_BERSERKER
:
1773 item_race
= MAKE_ITEM_DWARVEN
;
1774 item
.base_type
= OBJ_ARMOUR
;
1775 item
.sub_type
= random_choose_weighted(5, ARM_CHAIN_MAIL
,
1782 case MONS_MERFOLK_IMPALER
:
1783 item_race
= MAKE_ITEM_NO_RACE
;
1784 item
.base_type
= OBJ_ARMOUR
;
1785 item
.sub_type
= random_choose_weighted(100, ARM_ROBE
,
1786 60, ARM_LEATHER_ARMOUR
,
1787 5, ARM_TROLL_LEATHER_ARMOUR
,
1788 5, ARM_STEAM_DRAGON_ARMOUR
,
1792 case MONS_MERFOLK_JAVELINEER
:
1793 item_race
= MAKE_ITEM_NO_RACE
;
1794 item
.base_type
= OBJ_ARMOUR
;
1795 item
.sub_type
= ARM_LEATHER_ARMOUR
;
1802 item_race
= MAKE_ITEM_NO_RACE
;
1803 item
.base_type
= OBJ_ARMOUR
;
1804 item
.sub_type
= ARM_ROBE
;
1805 force_colour
= WHITE
;
1808 // Centaurs sometimes wear barding.
1810 case MONS_CENTAUR_WARRIOR
:
1812 case MONS_YAKTAUR_CAPTAIN
:
1813 if (one_chance_in(mon
->type
== MONS_CENTAUR
? 1000 :
1814 mon
->type
== MONS_CENTAUR_WARRIOR
? 500 :
1815 mon
->type
== MONS_YAKTAUR
? 300
1816 /* mon->type == MONS_YAKTAUR_CAPTAIN ? */ : 200))
1818 item
.base_type
= OBJ_ARMOUR
;
1819 item
.sub_type
= ARM_CENTAUR_BARDING
;
1826 case MONS_NAGA_MAGE
:
1827 case MONS_NAGA_WARRIOR
:
1828 case MONS_GREATER_NAGA
:
1829 if (one_chance_in(mon
->type
== MONS_NAGA
? 800 :
1830 mon
->type
== MONS_NAGA_WARRIOR
? 300 :
1831 mon
->type
== MONS_NAGA_MAGE
? 200
1834 item_race
= MAKE_ITEM_NO_RACE
;
1835 item
.base_type
= OBJ_ARMOUR
;
1836 item
.sub_type
= ARM_NAGA_BARDING
;
1838 else if (mon
->type
== MONS_GREATER_NAGA
|| one_chance_in(3))
1840 item_race
= MAKE_ITEM_NO_RACE
;
1841 item
.base_type
= OBJ_ARMOUR
;
1842 item
.sub_type
= ARM_ROBE
;
1848 case MONS_GASTRONOK
:
1849 if (one_chance_in(10))
1852 make_item_unrandart(item
, UNRAND_PONDERING
);
1856 item_race
= MAKE_ITEM_NO_RACE
;
1857 item
.base_type
= OBJ_ARMOUR
;
1858 item
.sub_type
= ARM_WIZARD_HAT
;
1860 // Not as good as it sounds. Still just +0 a lot of the time.
1861 level
= MAKE_GOOD_ITEM
;
1866 force_colour
= DARKGREY
;
1867 // intentional fall-through
1868 case MONS_CRAZY_YIUF
:
1869 item_race
= MAKE_ITEM_NO_RACE
;
1870 item
.base_type
= OBJ_ARMOUR
;
1871 item
.sub_type
= ARM_CLOAK
;
1875 item_race
= MAKE_ITEM_ELVEN
;
1876 // intentional fall-through
1878 case MONS_KOBOLD_DEMONOLOGIST
:
1879 case MONS_OGRE_MAGE
:
1881 case MONS_DRACONIAN
:
1882 case MONS_RED_DRACONIAN
:
1883 case MONS_WHITE_DRACONIAN
:
1884 case MONS_GREEN_DRACONIAN
:
1885 case MONS_PALE_DRACONIAN
:
1886 case MONS_MOTTLED_DRACONIAN
:
1887 case MONS_BLACK_DRACONIAN
:
1888 case MONS_YELLOW_DRACONIAN
:
1889 case MONS_PURPLE_DRACONIAN
:
1890 case MONS_GREY_DRACONIAN
:
1891 case MONS_DRACONIAN_SHIFTER
:
1892 case MONS_DRACONIAN_SCORCHER
:
1893 case MONS_DRACONIAN_ANNIHILATOR
:
1894 case MONS_DRACONIAN_CALLER
:
1895 case MONS_DRACONIAN_MONK
:
1896 case MONS_DRACONIAN_ZEALOT
:
1897 case MONS_DRACONIAN_KNIGHT
:
1901 case MONS_MERFOLK_AQUAMANCER
:
1903 case MONS_SPRIGGAN_DEFENDER
:
1904 if (item_race
== MAKE_ITEM_RANDOM_RACE
)
1905 item_race
= MAKE_ITEM_NO_RACE
;
1906 item
.base_type
= OBJ_ARMOUR
;
1907 item
.sub_type
= ARM_ROBE
;
1910 case MONS_SPRIGGAN_DRUID
:
1911 item_race
= MAKE_ITEM_NO_RACE
;
1912 item
.base_type
= OBJ_ARMOUR
;
1913 item
.sub_type
= ARM_ROBE
;
1914 force_colour
= GREEN
;
1917 case MONS_THE_ENCHANTRESS
:
1919 make_item_unrandart(item
, UNRAND_FAERIE
);
1923 item_race
= MAKE_ITEM_NO_RACE
;
1924 item
.base_type
= OBJ_ARMOUR
;
1925 item
.sub_type
= ARM_GOLD_DRAGON_ARMOUR
;
1928 case MONS_ORC_WIZARD
:
1929 case MONS_BLORK_THE_ORC
:
1931 item_race
= MAKE_ITEM_ORCISH
;
1932 item
.base_type
= OBJ_ARMOUR
;
1933 item
.sub_type
= ARM_ROBE
;
1937 level
= MAKE_GOOD_ITEM
;
1941 case MONS_NECROMANCER
:
1942 case MONS_VAMPIRE_MAGE
:
1944 item
.base_type
= OBJ_ARMOUR
;
1945 item
.sub_type
= ARM_ROBE
;
1946 force_colour
= DARKGREY
;
1949 case MONS_EUSTACHIO
:
1950 item_race
= MAKE_ITEM_NO_RACE
;
1951 item
.base_type
= OBJ_ARMOUR
;
1952 item
.sub_type
= ARM_LEATHER_ARMOUR
;
1956 item_race
= MAKE_ITEM_NO_RACE
;
1957 item
.base_type
= OBJ_ARMOUR
;
1958 item
.sub_type
= ARM_CENTAUR_BARDING
;
1959 force_colour
= DARKGREY
;
1963 item_race
= MAKE_ITEM_NO_RACE
;
1964 item
.base_type
= OBJ_ARMOUR
;
1965 item
.sub_type
= ARM_CLOAK
;
1966 force_colour
= LIGHTCYAN
;
1973 // Only happens if something in above switch doesn't set it. {dlb}
1974 if (item
.base_type
== OBJ_UNASSIGNED
)
1977 const object_class_type xitc
= item
.base_type
;
1978 const int xitt
= item
.sub_type
;
1980 if (!force_item
&& mons_is_unique(mon
->type
) && level
!= MAKE_GOOD_ITEM
)
1982 if (x_chance_in_y(9 + mon
->hit_dice
, 100))
1983 level
= MAKE_GOOD_ITEM
;
1985 level
= level
* 2 + 5;
1988 // Note this mess, all the work above doesn't mean much unless
1989 // force_item is set... otherwise we're just going to take the base
1990 // and subtype and create a new item. - bwr
1991 const int thing_created
=
1992 ((force_item
) ? get_item_slot() : items(0, xitc
, xitt
, true,
1995 if (thing_created
== NON_ITEM
)
1998 // Copy temporary item into the item array if were forcing it, since
1999 // items() won't have done it for us.
2001 mitm
[thing_created
] = item
;
2003 item_def
&i
= mitm
[thing_created
];
2006 item_set_appearance(i
);
2008 _give_monster_item(mon
, thing_created
, force_item
);
2010 // mv: All items with force_colour = 0 are colored via items().
2012 mitm
[thing_created
].colour
= force_colour
;
2017 mitm
[thing_created
].plus2
= TGLOV_DESC_GAUNTLETS
;
2024 static void _give_gold(monster
* mon
, int level
)
2026 const int idx
= items(0, OBJ_GOLD
, 0, true, level
, 0);
2027 _give_monster_item(mon
, idx
);
2030 void give_weapon(int mid
, int level_number
, bool mons_summoned
, bool spectral_orcs
)
2032 monster
*mons
= &menv
[mid
];
2033 _give_weapon(mons
, level_number
, false, true, spectral_orcs
);
2036 void give_item(int mid
, int level_number
, bool mons_summoned
, bool spectral_orcs
)
2038 monster
* mons
= &menv
[mid
];
2040 if (mons
->type
== MONS_MAURICE
|| mons
->type
== MONS_DEEP_DWARF_SCION
)
2041 _give_gold(mons
, level_number
);
2043 _give_scroll(mons
, level_number
);
2044 _give_wand(mons
, level_number
);
2045 _give_potion(mons
, level_number
);
2047 const item_make_species_type item_race
= _give_weapon(mons
, level_number
, false, true, spectral_orcs
);
2049 _give_ammo(mons
, level_number
, item_race
, mons_summoned
);
2051 give_armour(mons
, 1 + level_number
/ 2, spectral_orcs
);
2052 give_shield(mons
, 1 + level_number
/ 2);