1 /* NetHack 3.6 mplayer.c $NHDT-Date: 1550524564 2019/02/18 21:16:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.26 $ */
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 "Alex", "Dave", "Dean", "Derek", "Eric", "Izchak",
20 "Janet", "Jessie", "Ken", "Kevin", "Michael", "Mike",
21 "Pasi", "Pat", "Patric", "Paul", "Sean", "Steve",
24 "Bill", "Eric", "Keizo", "Ken", "Kevin", "Michael",
25 "Mike", "Paul", "Stephen", "Steve", "Timo", "Yitzhak",
27 "Andy", "Gregg", "Janne", "Keni", "Mike", "Olaf",
30 "Andy", "Chris", "Dean", "Jon", "Jonathan", "Kevin",
33 "Eric", "Marvin", "Warwick",
35 "Alex", "Dion", "Michael",
37 "Helge", "Ron", "Timo",
42 /* return a randomly chosen developer name */
43 STATIC_OVL const char *
46 register int i, m = 0, n = SIZE(developers);
47 register struct monst *mtmp;
48 register boolean match;
53 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
54 if (!is_mplayer(mtmp->data))
56 if (!strncmp(developers[i], (has_mname(mtmp)) ? MNAME(mtmp) : "",
57 strlen(developers[i]))) {
63 } while (match && m < 100); /* m for insurance */
66 return (const char *) 0;
67 return (developers[i]);
71 get_mplname(mtmp, nam)
72 register struct monst *mtmp;
75 boolean fmlkind = is_female(mtmp->data);
78 char tmp_nam[PL_NSIZ];
83 Strcpy(nam, fmlkind ? "Eve" : "Adam");
84 else if (fmlkind && !!strcmp(devnam, "Janet"))
85 Strcpy(nam, rn2(2) ? "Maud" : "Eve");
89 if (fmlkind || !strcmp(nam, "Janet"))
95 Strcat(nam, rank_of((int) mtmp->m_lev, monsndx(mtmp->data),
96 (boolean) mtmp->female));
97 #else /*
\8fÌ
\8d\86\82ð
\91O
\82É
\95t
\82¯
\82½
\82¢
\82Ì
\82Åtmp_nam
\82É
\88ê
\92U
\8d\
\92z
\82µ
\82Änam
\82É
\96ß
\82·*/
98 Strcpy(tmp_nam, rank_of((int) mtmp->m_lev, monsndx(mtmp->data),
99 (boolean)mtmp->female));
100 Strcat(tmp_nam, "
\82Ì");
101 Strcat(tmp_nam, nam);
102 Strcpy(nam, tmp_nam);
107 mk_mplayer_armor(mon, typ)
113 if (typ == STRANGE_OBJECT)
115 obj = mksobj(typ, FALSE, FALSE);
117 obj->oerodeproof = 1;
122 /* Most players who get to the endgame who have cursed equipment
123 * have it because the wizard or other monsters cursed it, so its
124 * chances of having plusses is the same as usual....
126 obj->spe = rn2(10) ? (rn2(3) ? rn2(5) : rn1(4, 4)) : -rnd(3);
127 (void) mpickobj(mon, obj);
131 mk_mplayer(ptr, x, y, special)
132 register struct permonst *ptr;
134 register boolean special;
136 register struct monst *mtmp;
139 if (!is_mplayer(ptr))
140 return ((struct monst *) 0);
143 (void) rloc(m_at(x, y), FALSE); /* insurance */
145 if (!In_endgame(&u.uz))
148 if ((mtmp = makemon(ptr, x, y, NO_MM_FLAGS)) != 0) {
149 short weapon, armor, cloak, helm, shield;
153 mtmp->m_lev = (special ? rn1(16, 15) : rnd(16));
154 mtmp->mhp = mtmp->mhpmax = d((int) mtmp->m_lev, 10)
155 + (special ? (30 + rnd(30)) : 30);
157 get_mplname(mtmp, nam);
158 mtmp = christen_monst(mtmp, nam);
159 /* that's why they are "stuck" in the endgame :-) */
160 (void) mongets(mtmp, FAKE_AMULET_OF_YENDOR);
163 set_malign(mtmp); /* peaceful may have changed again */
165 /* default equipment; much of it will be overridden below */
166 weapon = !rn2(2) ? LONG_SWORD : rnd_class(SPEAR, BULLWHIP);
167 armor = rnd_class(GRAY_DRAGON_SCALE_MAIL, YELLOW_DRAGON_SCALE_MAIL);
168 cloak = !rn2(8) ? STRANGE_OBJECT
169 : rnd_class(OILSKIN_CLOAK, CLOAK_OF_DISPLACEMENT);
170 helm = !rn2(8) ? STRANGE_OBJECT
171 : rnd_class(ELVEN_LEATHER_HELM, HELM_OF_TELEPATHY);
172 shield = !rn2(8) ? STRANGE_OBJECT
173 : rnd_class(ELVEN_SHIELD, SHIELD_OF_REFLECTION);
175 switch (monsndx(ptr)) {
176 case PM_ARCHEOLOGIST:
182 weapon = rn2(2) ? TWO_HANDED_SWORD : BATTLE_AXE;
183 shield = STRANGE_OBJECT;
186 armor = rnd_class(PLATE_MAIL, CHAIN_MAIL);
187 if (helm == HELM_OF_BRILLIANCE)
188 helm = STRANGE_OBJECT;
196 if (helm == HELM_OF_BRILLIANCE)
197 helm = STRANGE_OBJECT;
201 weapon = QUARTERSTAFF;
203 weapon = rn2(2) ? UNICORN_HORN : SCALPEL;
205 helm = rn2(2) ? HELM_OF_BRILLIANCE : HELM_OF_TELEPATHY;
207 shield = STRANGE_OBJECT;
213 armor = rnd_class(PLATE_MAIL, CHAIN_MAIL);
216 weapon = !rn2(3) ? SHURIKEN : STRANGE_OBJECT;
217 armor = STRANGE_OBJECT;
220 shield = STRANGE_OBJECT;
227 armor = rnd_class(PLATE_MAIL, CHAIN_MAIL);
231 helm = rn2(2) ? HELM_OF_BRILLIANCE : HELM_OF_TELEPATHY;
233 shield = STRANGE_OBJECT;
237 weapon = ELVEN_DAGGER;
241 weapon = rn2(2) ? SHORT_SWORD : ORCISH_DAGGER;
248 /* Defaults are just fine */
254 armor = rnd_class(PLATE_MAIL, CHAIN_MAIL);
258 weapon = rn2(2) ? QUARTERSTAFF : ATHAME;
260 armor = rn2(2) ? BLACK_DRAGON_SCALE_MAIL
261 : SILVER_DRAGON_SCALE_MAIL;
262 cloak = CLOAK_OF_MAGIC_RESISTANCE;
265 helm = HELM_OF_BRILLIANCE;
266 shield = STRANGE_OBJECT;
269 impossible("bad mplayer monster");
274 if (weapon != STRANGE_OBJECT) {
275 otmp = mksobj(weapon, TRUE, FALSE);
276 otmp->spe = (special ? rn1(5, 4) : rn2(4));
278 otmp->oerodeproof = 1;
281 if (special && rn2(2))
282 otmp = mk_artifact(otmp, A_NONE);
283 /* usually increase stack size if stackable weapon */
284 if (objects[otmp->otyp].oc_merge && !otmp->oartifact
285 && monmightthrowwep(otmp))
286 otmp->quan += (long) rn2(is_spear(otmp) ? 4 : 8);
287 /* mplayers knew better than to overenchant Magicbane */
288 if (otmp->oartifact == ART_MAGICBANE)
290 (void) mpickobj(mtmp, otmp);
295 (void) mongets(mtmp, rn2(3) ? LUCKSTONE : LOADSTONE);
296 mk_mplayer_armor(mtmp, armor);
297 mk_mplayer_armor(mtmp, cloak);
298 mk_mplayer_armor(mtmp, helm);
299 mk_mplayer_armor(mtmp, shield);
300 if (weapon == WAR_HAMMER) /* valkyrie: wimpy weapon or Mjollnir */
301 mk_mplayer_armor(mtmp, GAUNTLETS_OF_POWER);
303 mk_mplayer_armor(mtmp, rnd_class(LEATHER_GLOVES,
304 GAUNTLETS_OF_DEXTERITY));
306 mk_mplayer_armor(mtmp, rnd_class(LOW_BOOTS,
308 m_dowear(mtmp, TRUE);
310 quan = rn2(3) ? rn2(3) : rn2(16);
312 (void) mongets(mtmp, rnd_class(DILITHIUM_CRYSTAL, JADE));
313 /* To get the gold "right" would mean a player can double his
314 gold supply by killing one mplayer. Not good. */
315 mkmonmoney(mtmp, rn2(1000));
318 (void) mpickobj(mtmp, mkobj(RANDOM_CLASS, FALSE));
322 (void) mongets(mtmp, rnd_offensive_item(mtmp));
325 (void) mongets(mtmp, rnd_defensive_item(mtmp));
328 (void) mongets(mtmp, rnd_misc_item(mtmp));
334 /* create the indicated number (num) of monster-players,
335 * randomly chosen, and in randomly chosen (free) locations
336 * on the level. If "special", the size of num should not
337 * be bigger than the number of _non-repeated_ names in the
338 * developers array, otherwise a bunch of Adams and Eves will
339 * fill up the overflow.
342 create_mplayers(num, special)
347 struct monst fakemon;
353 /* roll for character class */
354 pm = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
355 set_mon_data(&fakemon, &mons[pm]);
357 /* roll for an available location */
359 x = rn1(COLNO - 4, 2);
361 } while (!goodpos(x, y, &fakemon, 0) && tryct++ <= 50);
363 /* if pos not found in 50 tries, don't bother to continue */
367 (void) mk_mplayer(&mons[pm], (xchar) x, (xchar) y, special);
374 register struct monst *mtmp;
378 *same_class_msg[3] = {
379 "I can't win, and neither will you!",
380 "You don't deserve to win!",
381 "Mine should be the honor, not yours!",
383 #else /*
\93ú
\96{
\8cê
\82Å
\82Í
\92j
\8f\97\82Å
\91ä
\8e\8c\82ð
\95Ï
\82¦
\82½
\95û
\82ª
\8e©
\91R */
384 *same_class_msg[2][3] = {
386 "
\8e\84\82Å
\82·
\82ç
\92B
\90¬
\82Å
\82«
\82È
\82¢
\82Ì
\82É
\81C
\82¨
\91O
\82É
\92B
\90¬
\82Å
\82«
\82é
\82Ì
\82©
\81H",
387 "
\82¨
\91O
\82ª
\90¬
\8c÷
\82·
\82é
\82È
\82ñ
\82Ä
\82±
\82Æ
\82Í
\82È
\82¢
\82È
\81D",
388 "
\96¼
\97_
\82ð
\89ä
\82É
\81I
\82¨
\91O
\82¶
\82á
\82È
\82¢
\81I",
391 "
\8e\84\82Å
\82·
\82ç
\92B
\90¬
\82Å
\82«
\82È
\82¢
\82Ì
\82É
\81C
\82 \82È
\82½
\82É
\92B
\90¬
\82Å
\82«
\82Ä
\81H",
392 "
\82 \82È
\82½
\82ª
\90¬
\8c÷
\82·
\82é
\82È
\82ñ
\82Ä
\82 \82è
\82¦
\82Ü
\82¹
\82ñ
\82í
\81D",
393 "
\96¼
\97_
\82Í
\8e\84\82É
\81I
\82 \82È
\82½
\82É
\82È
\82ñ
\82Ä
\82Æ
\82ñ
\82Å
\82à
\82È
\82¢
\81D",
398 *other_class_msg[3] = {
399 "The low-life wants to talk, eh?",
401 "Here is what I have to say!",
404 *other_class_msg[2][3] = {
406 "
\89º
\8fO
\82ª
\98b
\82µ
\82©
\82¯
\82é
\82©
\81H
\82Í
\82Í
\81[
\82ñ
\81H",
407 "
\90í
\82¦
\81I
\82±
\82Ì
\96ì
\98Y
\81I",
408 "
\82¨
\91O
\82Æ
\98b
\82·
\82±
\82Æ
\82È
\82Ç
\82È
\82É
\82à
\82È
\82¢
\81I",
411 "
\8e\84\82Æ
\98b
\82µ
\82½
\82¢
\82Å
\82·
\82Á
\82Ä
\81H",
412 "
\8c\95\82ð
\8eæ
\82è
\82È
\82³
\82¢
\81I",
413 "
\82 \82È
\82½
\82Æ
\98b
\82·
\82±
\82Æ
\82È
\82Ç
\82 \82è
\82Ü
\82¹
\82ñ
\82í
\81I",
422 return; /* will drop to humanoid talk */
425 pline("Talk? -- %s", (mtmp->data == &mons[urole.malenum]
426 || mtmp->data == &mons[urole.femalenum])
427 ? same_class_msg[rn2(3)]
428 : other_class_msg[rn2(3)]);
430 female = (mtmp->female ? 1 : 0);
431 pline("
\98b
\82·
\81H -- %s", (mtmp->data == &mons[urole.malenum]
432 || mtmp->data == &mons[urole.femalenum])
433 ? same_class_msg[female][rn2(3)]
434 : other_class_msg[female][rn2(3)]);