1 /* NetHack 3.6 mplayer.c $NHDT-Date: 1432512774 2015/05/25 00:12:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.19 $ */
2 /* Copyright (c) Izchak Miller, 1992. */
3 /* NetHack may be freely redistributed. See license for details. */
7 STATIC_DCL const char *NDECL(dev_name);
8 STATIC_DCL void FDECL(get_mplname, (struct monst *, char *));
9 STATIC_DCL void FDECL(mk_mplayer_armor, (struct monst *, SHORT_P));
11 /* These are the names of those who
12 * contributed to the development of NetHack 3.2/3.3/3.4/3.6.
14 * Keep in alphabetical order within teams.
15 * Same first name is entered once within each team.
17 static const char *developers[] = {
19 "Dave", "Dean", "Eric", "Izchak", "Janet", "Jessie",
20 "Ken", "Kevin", "Michael", "Mike", "Pat", "Paul",
21 "Steve", "Timo", "Warwick",
23 "Bill", "Eric", "Keizo", "Ken", "Kevin", "Michael",
24 "Mike", "Paul", "Stephen", "Steve", "Timo", "Yitzhak",
26 "Andy", "Gregg", "Janne", "Keni", "Mike", "Olaf",
29 "Andy", "Chris", "Dean", "Jon", "Jonathan", "Kevin",
32 "Eric", "Marvin", "Warwick",
34 "Alex", "Dion", "Michael",
36 "Helge", "Ron", "Timo",
41 /* return a randomly chosen developer name */
42 STATIC_OVL const char *
45 register int i, m = 0, n = SIZE(developers);
46 register struct monst *mtmp;
47 register boolean match;
52 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
53 if (!is_mplayer(mtmp->data))
55 if (!strncmp(developers[i], (has_mname(mtmp)) ? MNAME(mtmp) : "",
56 strlen(developers[i]))) {
62 } while (match && m < 100); /* m for insurance */
65 return (const char *) 0;
66 return (developers[i]);
70 get_mplname(mtmp, nam)
71 register struct monst *mtmp;
74 boolean fmlkind = is_female(mtmp->data);
79 Strcpy(nam, fmlkind ? "Eve" : "Adam");
80 else if (fmlkind && !!strcmp(devnam, "Janet"))
81 Strcpy(nam, rn2(2) ? "Maud" : "Eve");
85 if (fmlkind || !strcmp(nam, "Janet"))
90 Strcat(nam, rank_of((int) mtmp->m_lev, monsndx(mtmp->data),
91 (boolean) mtmp->female));
95 mk_mplayer_armor(mon, typ)
101 if (typ == STRANGE_OBJECT)
103 obj = mksobj(typ, FALSE, FALSE);
105 obj->oerodeproof = 1;
110 /* Most players who get to the endgame who have cursed equipment
111 * have it because the wizard or other monsters cursed it, so its
112 * chances of having plusses is the same as usual....
114 obj->spe = rn2(10) ? (rn2(3) ? rn2(5) : rn1(4, 4)) : -rnd(3);
115 (void) mpickobj(mon, obj);
119 mk_mplayer(ptr, x, y, special)
120 register struct permonst *ptr;
122 register boolean special;
124 register struct monst *mtmp;
127 if (!is_mplayer(ptr))
128 return ((struct monst *) 0);
131 (void) rloc(m_at(x, y), FALSE); /* insurance */
133 if (!In_endgame(&u.uz))
136 if ((mtmp = makemon(ptr, x, y, NO_MM_FLAGS)) != 0) {
137 short weapon = rn2(2) ? LONG_SWORD : rnd_class(SPEAR, BULLWHIP);
139 rnd_class(GRAY_DRAGON_SCALE_MAIL, YELLOW_DRAGON_SCALE_MAIL);
140 short cloak = !rn2(8)
142 : rnd_class(OILSKIN_CLOAK, CLOAK_OF_DISPLACEMENT);
143 short helm = !rn2(8) ? STRANGE_OBJECT : rnd_class(ELVEN_LEATHER_HELM,
145 short shield = !rn2(8)
147 : rnd_class(ELVEN_SHIELD, SHIELD_OF_REFLECTION);
151 mtmp->m_lev = (special ? rn1(16, 15) : rnd(16));
152 mtmp->mhp = mtmp->mhpmax =
153 d((int) mtmp->m_lev, 10) + (special ? (30 + rnd(30)) : 30);
155 get_mplname(mtmp, nam);
156 mtmp = christen_monst(mtmp, nam);
157 /* that's why they are "stuck" in the endgame :-) */
158 (void) mongets(mtmp, FAKE_AMULET_OF_YENDOR);
161 set_malign(mtmp); /* peaceful may have changed again */
163 switch (monsndx(ptr)) {
164 case PM_ARCHEOLOGIST:
170 weapon = rn2(2) ? TWO_HANDED_SWORD : BATTLE_AXE;
171 shield = STRANGE_OBJECT;
174 armor = rnd_class(PLATE_MAIL, CHAIN_MAIL);
175 if (helm == HELM_OF_BRILLIANCE)
176 helm = STRANGE_OBJECT;
184 if (helm == HELM_OF_BRILLIANCE)
185 helm = STRANGE_OBJECT;
189 weapon = QUARTERSTAFF;
191 weapon = rn2(2) ? UNICORN_HORN : SCALPEL;
193 helm = rn2(2) ? HELM_OF_BRILLIANCE : HELM_OF_TELEPATHY;
195 shield = STRANGE_OBJECT;
201 armor = rnd_class(PLATE_MAIL, CHAIN_MAIL);
204 weapon = !rn2(3) ? SHURIKEN : STRANGE_OBJECT;
205 armor = STRANGE_OBJECT;
208 shield = STRANGE_OBJECT;
215 armor = rnd_class(PLATE_MAIL, CHAIN_MAIL);
219 helm = rn2(2) ? HELM_OF_BRILLIANCE : HELM_OF_TELEPATHY;
221 shield = STRANGE_OBJECT;
225 weapon = ELVEN_DAGGER;
229 weapon = rn2(2) ? SHORT_SWORD : ORCISH_DAGGER;
236 /* Defaults are just fine */
242 armor = rnd_class(PLATE_MAIL, CHAIN_MAIL);
246 weapon = rn2(2) ? QUARTERSTAFF : ATHAME;
248 armor = rn2(2) ? BLACK_DRAGON_SCALE_MAIL
249 : SILVER_DRAGON_SCALE_MAIL;
250 cloak = CLOAK_OF_MAGIC_RESISTANCE;
253 helm = HELM_OF_BRILLIANCE;
254 shield = STRANGE_OBJECT;
257 impossible("bad mplayer monster");
262 if (weapon != STRANGE_OBJECT) {
263 otmp = mksobj(weapon, TRUE, FALSE);
264 otmp->spe = (special ? rn1(5, 4) : rn2(4));
266 otmp->oerodeproof = 1;
269 if (special && rn2(2))
270 otmp = mk_artifact(otmp, A_NONE);
271 /* usually increase stack size if stackable weapon */
272 if (objects[otmp->otyp].oc_merge && !otmp->oartifact)
273 otmp->quan += (long) rn2(is_spear(otmp) ? 4 : 8);
274 /* mplayers knew better than to overenchant Magicbane */
275 if (otmp->oartifact == ART_MAGICBANE)
277 (void) mpickobj(mtmp, otmp);
282 (void) mongets(mtmp, rn2(3) ? LUCKSTONE : LOADSTONE);
283 mk_mplayer_armor(mtmp, armor);
284 mk_mplayer_armor(mtmp, cloak);
285 mk_mplayer_armor(mtmp, helm);
286 mk_mplayer_armor(mtmp, shield);
289 mtmp, rnd_class(LEATHER_GLOVES, GAUNTLETS_OF_DEXTERITY));
291 mk_mplayer_armor(mtmp,
292 rnd_class(LOW_BOOTS, LEVITATION_BOOTS));
293 m_dowear(mtmp, TRUE);
295 quan = rn2(3) ? rn2(3) : rn2(16);
297 (void) mongets(mtmp, rnd_class(DILITHIUM_CRYSTAL, JADE));
298 /* To get the gold "right" would mean a player can double his */
299 /* gold supply by killing one mplayer. Not good. */
300 mkmonmoney(mtmp, rn2(1000));
303 (void) mpickobj(mtmp, mkobj(RANDOM_CLASS, FALSE));
307 (void) mongets(mtmp, rnd_offensive_item(mtmp));
310 (void) mongets(mtmp, rnd_defensive_item(mtmp));
313 (void) mongets(mtmp, rnd_misc_item(mtmp));
319 /* create the indicated number (num) of monster-players,
320 * randomly chosen, and in randomly chosen (free) locations
321 * on the level. If "special", the size of num should not
322 * be bigger than the number of _non-repeated_ names in the
323 * developers array, otherwise a bunch of Adams and Eves will
324 * fill up the overflow.
327 create_mplayers(num, special)
332 struct monst fakemon;
337 /* roll for character class */
338 pm = PM_ARCHEOLOGIST + rn2(PM_WIZARD - PM_ARCHEOLOGIST + 1);
339 fakemon.data = &mons[pm];
341 /* roll for an available location */
343 x = rn1(COLNO - 4, 2);
345 } while (!goodpos(x, y, &fakemon, 0) && tryct++ <= 50);
347 /* if pos not found in 50 tries, don't bother to continue */
351 (void) mk_mplayer(&mons[pm], (xchar) x, (xchar) y, special);
358 register struct monst *mtmp;
360 static const char *same_class_msg[3] =
362 "I can't win, and neither will you!", "You don't deserve to win!",
363 "Mine should be the honor, not yours!",
365 *other_class_msg[3] = {
366 "The low-life wants to talk, eh?", "Fight, scum!",
367 "Here is what I have to say!",
371 return; /* will drop to humanoid talk */
373 pline("Talk? -- %s", (mtmp->data == &mons[urole.malenum]
374 || mtmp->data == &mons[urole.femalenum])
375 ? same_class_msg[rn2(3)]
376 : other_class_msg[rn2(3)]);