OSDN Git Service

patch src/
[jnethack/source.git] / src / wizard.c
1 /* NetHack 3.6  wizard.c        $NHDT-Date: 1446078768 2015/10/29 00:32:48 $  $NHDT-Branch: master $:$NHDT-Revision: 1.42 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016            */
8 /* JNetHack may be freely redistributed.  See license for details. */
9
10 /* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */
11 /*             - heavily modified to give the wiz balls.  (genat!mike)   */
12 /*             - dewimped and given some maledictions. -3. */
13 /*             - generalized for 3.1 (mike@bullns.on01.bull.ca) */
14
15 #include "hack.h"
16 #include "qtext.h"
17
18 extern const int monstr[];
19
20 STATIC_DCL short FDECL(which_arti, (int));
21 STATIC_DCL boolean FDECL(mon_has_arti, (struct monst *, SHORT_P));
22 STATIC_DCL struct monst *FDECL(other_mon_has_arti, (struct monst *, SHORT_P));
23 STATIC_DCL struct obj *FDECL(on_ground, (SHORT_P));
24 STATIC_DCL boolean FDECL(you_have, (int));
25 STATIC_DCL unsigned long FDECL(target_on, (int, struct monst *));
26 STATIC_DCL unsigned long FDECL(strategy, (struct monst *));
27
28 static NEARDATA const int nasties[] = {
29     PM_COCKATRICE, PM_ETTIN, PM_STALKER, PM_MINOTAUR, PM_RED_DRAGON,
30     PM_BLACK_DRAGON, PM_GREEN_DRAGON, PM_OWLBEAR, PM_PURPLE_WORM,
31     PM_ROCK_TROLL, PM_XAN, PM_GREMLIN, PM_UMBER_HULK, PM_VAMPIRE_LORD,
32     PM_XORN, PM_ZRUTY, PM_ELF_LORD, PM_ELVENKING, PM_YELLOW_DRAGON,
33     PM_LEOCROTTA, PM_BALUCHITHERIUM, PM_CARNIVOROUS_APE, PM_FIRE_GIANT,
34     PM_COUATL, PM_CAPTAIN, PM_WINGED_GARGOYLE, PM_MASTER_MIND_FLAYER,
35     PM_FIRE_ELEMENTAL, PM_JABBERWOCK, PM_ARCH_LICH, PM_OGRE_KING, PM_OLOG_HAI,
36     PM_IRON_GOLEM, PM_OCHRE_JELLY, PM_GREEN_SLIME, PM_DISENCHANTER
37 };
38
39 static NEARDATA const unsigned wizapp[] = {
40     PM_HUMAN,      PM_WATER_DEMON,  PM_VAMPIRE,       PM_RED_DRAGON,
41     PM_TROLL,      PM_UMBER_HULK,   PM_XORN,          PM_XAN,
42     PM_COCKATRICE, PM_FLOATING_EYE, PM_GUARDIAN_NAGA, PM_TRAPPER
43 };
44
45 /* If you've found the Amulet, make the Wizard appear after some time */
46 /* Also, give hints about portal locations, if amulet is worn/wielded -dlc */
47 void
48 amulet()
49 {
50     struct monst *mtmp;
51     struct trap *ttmp;
52     struct obj *amu;
53
54 #if 0 /* caller takes care of this check */
55     if (!u.uhave.amulet)
56         return;
57 #endif
58     if ((((amu = uamul) != 0 && amu->otyp == AMULET_OF_YENDOR)
59          || ((amu = uwep) != 0 && amu->otyp == AMULET_OF_YENDOR))
60         && !rn2(15)) {
61         for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) {
62             if (ttmp->ttyp == MAGIC_PORTAL) {
63                 int du = distu(ttmp->tx, ttmp->ty);
64                 if (du <= 9)
65 /*JP
66                     pline("%s hot!", Tobjnam(amu, "feel"));
67 */
68                         pline("%s\82Í\94M\82­\8a´\82\82½\81I", xname(amu));
69                 else if (du <= 64)
70 /*JP
71                     pline("%s very warm.", Tobjnam(amu, "feel"));
72 */
73                         pline("%s\82Í\82Æ\82Ä\82à\92g\82©\82­\8a´\82\82½\81D", xname(amu));
74                 else if (du <= 144)
75 /*JP
76                     pline("%s warm.", Tobjnam(amu, "feel"));
77 */
78                         pline("%s\82Í\92g\82©\82­\8a´\82\82½\81D", xname(amu));
79                 /* else, the amulet feels normal */
80                 break;
81             }
82         }
83     }
84
85     if (!context.no_of_wizards)
86         return;
87     /* find Wizard, and wake him if necessary */
88     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
89         if (DEADMONSTER(mtmp))
90             continue;
91         if (mtmp->iswiz && mtmp->msleeping && !rn2(40)) {
92             mtmp->msleeping = 0;
93             if (distu(mtmp->mx, mtmp->my) > 2)
94                 You(
95 /*JP
96       "get the creepy feeling that somebody noticed your taking the Amulet.");
97 */
98       "\82 \82È\82½\82ª\96\82\8f\9c\82¯\82ð\8e\9d\82Á\82Ä\82¢\82é\82±\82Æ\82ª\92N\82©\82É\92m\82ç\82ê\82½\82Æ\8a´\82\82Ä\82¼\82Á\82Æ\82µ\82½\81D");
99             return;
100         }
101     }
102 }
103
104 int
105 mon_has_amulet(mtmp)
106 register struct monst *mtmp;
107 {
108     register struct obj *otmp;
109
110     for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
111         if (otmp->otyp == AMULET_OF_YENDOR)
112             return 1;
113     return 0;
114 }
115
116 int
117 mon_has_special(mtmp)
118 register struct monst *mtmp;
119 {
120     register struct obj *otmp;
121
122     for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
123         if (otmp->otyp == AMULET_OF_YENDOR || is_quest_artifact(otmp)
124             || otmp->otyp == BELL_OF_OPENING
125             || otmp->otyp == CANDELABRUM_OF_INVOCATION
126             || otmp->otyp == SPE_BOOK_OF_THE_DEAD)
127             return 1;
128     return 0;
129 }
130
131 /*
132  *      New for 3.1  Strategy / Tactics for the wiz, as well as other
133  *      monsters that are "after" something (defined via mflag3).
134  *
135  *      The strategy section decides *what* the monster is going
136  *      to attempt, the tactics section implements the decision.
137  */
138 #define STRAT(w, x, y, typ)                            \
139     ((unsigned long) (w) | ((unsigned long) (x) << 16) \
140      | ((unsigned long) (y) << 8) | (unsigned long) (typ))
141
142 #define M_Wants(mask) (mtmp->data->mflags3 & (mask))
143
144 STATIC_OVL short
145 which_arti(mask)
146 register int mask;
147 {
148     switch (mask) {
149     case M3_WANTSAMUL:
150         return AMULET_OF_YENDOR;
151     case M3_WANTSBELL:
152         return BELL_OF_OPENING;
153     case M3_WANTSCAND:
154         return CANDELABRUM_OF_INVOCATION;
155     case M3_WANTSBOOK:
156         return SPE_BOOK_OF_THE_DEAD;
157     default:
158         break; /* 0 signifies quest artifact */
159     }
160     return 0;
161 }
162
163 /*
164  *      If "otyp" is zero, it triggers a check for the quest_artifact,
165  *      since bell, book, candle, and amulet are all objects, not really
166  *      artifacts right now.  [MRS]
167  */
168 STATIC_OVL boolean
169 mon_has_arti(mtmp, otyp)
170 register struct monst *mtmp;
171 register short otyp;
172 {
173     register struct obj *otmp;
174
175     for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
176         if (otyp) {
177             if (otmp->otyp == otyp)
178                 return 1;
179         } else if (is_quest_artifact(otmp))
180             return 1;
181     }
182     return 0;
183 }
184
185 STATIC_OVL struct monst *
186 other_mon_has_arti(mtmp, otyp)
187 register struct monst *mtmp;
188 register short otyp;
189 {
190     register struct monst *mtmp2;
191
192     for (mtmp2 = fmon; mtmp2; mtmp2 = mtmp2->nmon)
193         /* no need for !DEADMONSTER check here since they have no inventory */
194         if (mtmp2 != mtmp)
195             if (mon_has_arti(mtmp2, otyp))
196                 return mtmp2;
197
198     return (struct monst *) 0;
199 }
200
201 STATIC_OVL struct obj *
202 on_ground(otyp)
203 register short otyp;
204 {
205     register struct obj *otmp;
206
207     for (otmp = fobj; otmp; otmp = otmp->nobj)
208         if (otyp) {
209             if (otmp->otyp == otyp)
210                 return otmp;
211         } else if (is_quest_artifact(otmp))
212             return otmp;
213     return (struct obj *) 0;
214 }
215
216 STATIC_OVL boolean
217 you_have(mask)
218 register int mask;
219 {
220     switch (mask) {
221     case M3_WANTSAMUL:
222         return (boolean) u.uhave.amulet;
223     case M3_WANTSBELL:
224         return (boolean) u.uhave.bell;
225     case M3_WANTSCAND:
226         return (boolean) u.uhave.menorah;
227     case M3_WANTSBOOK:
228         return (boolean) u.uhave.book;
229     case M3_WANTSARTI:
230         return (boolean) u.uhave.questart;
231     default:
232         break;
233     }
234     return 0;
235 }
236
237 STATIC_OVL unsigned long
238 target_on(mask, mtmp)
239 register int mask;
240 register struct monst *mtmp;
241 {
242     register short otyp;
243     register struct obj *otmp;
244     register struct monst *mtmp2;
245
246     if (!M_Wants(mask))
247         return (unsigned long) STRAT_NONE;
248
249     otyp = which_arti(mask);
250     if (!mon_has_arti(mtmp, otyp)) {
251         if (you_have(mask))
252             return STRAT(STRAT_PLAYER, u.ux, u.uy, mask);
253         else if ((otmp = on_ground(otyp)))
254             return STRAT(STRAT_GROUND, otmp->ox, otmp->oy, mask);
255         else if ((mtmp2 = other_mon_has_arti(mtmp, otyp)) != 0
256                  /* when seeking the Amulet, avoid targetting the Wizard
257                     or temple priests (to protect Moloch's high priest) */
258                  && (otyp != AMULET_OF_YENDOR
259                      || (!mtmp2->iswiz && !inhistemple(mtmp2))))
260             return STRAT(STRAT_MONSTR, mtmp2->mx, mtmp2->my, mask);
261     }
262     return (unsigned long) STRAT_NONE;
263 }
264
265 STATIC_OVL unsigned long
266 strategy(mtmp)
267 register struct monst *mtmp;
268 {
269     unsigned long strat, dstrat;
270
271     if (!is_covetous(mtmp->data)
272         /* perhaps a shopkeeper has been polymorphed into a master
273            lich; we don't want it teleporting to the stairs to heal
274            because that will leave its shop untended */
275         || (mtmp->isshk && inhishop(mtmp))
276         /* likewise for temple priests */
277         || (mtmp->ispriest && inhistemple(mtmp)))
278         return (unsigned long) STRAT_NONE;
279
280     switch ((mtmp->mhp * 3) / mtmp->mhpmax) { /* 0-3 */
281
282     default:
283     case 0: /* panic time - mtmp is almost snuffed */
284         return (unsigned long) STRAT_HEAL;
285
286     case 1: /* the wiz is less cautious */
287         if (mtmp->data != &mons[PM_WIZARD_OF_YENDOR])
288             return (unsigned long) STRAT_HEAL;
289     /* else fall through */
290
291     case 2:
292         dstrat = STRAT_HEAL;
293         break;
294
295     case 3:
296         dstrat = STRAT_NONE;
297         break;
298     }
299
300     if (context.made_amulet)
301         if ((strat = target_on(M3_WANTSAMUL, mtmp)) != STRAT_NONE)
302             return strat;
303
304     if (u.uevent.invoked) { /* priorities change once gate opened */
305         if ((strat = target_on(M3_WANTSARTI, mtmp)) != STRAT_NONE)
306             return strat;
307         if ((strat = target_on(M3_WANTSBOOK, mtmp)) != STRAT_NONE)
308             return strat;
309         if ((strat = target_on(M3_WANTSBELL, mtmp)) != STRAT_NONE)
310             return strat;
311         if ((strat = target_on(M3_WANTSCAND, mtmp)) != STRAT_NONE)
312             return strat;
313     } else {
314         if ((strat = target_on(M3_WANTSBOOK, mtmp)) != STRAT_NONE)
315             return strat;
316         if ((strat = target_on(M3_WANTSBELL, mtmp)) != STRAT_NONE)
317             return strat;
318         if ((strat = target_on(M3_WANTSCAND, mtmp)) != STRAT_NONE)
319             return strat;
320         if ((strat = target_on(M3_WANTSARTI, mtmp)) != STRAT_NONE)
321             return strat;
322     }
323     return dstrat;
324 }
325
326 int
327 tactics(mtmp)
328 register struct monst *mtmp;
329 {
330     unsigned long strat = strategy(mtmp);
331
332     mtmp->mstrategy =
333         (mtmp->mstrategy & (STRAT_WAITMASK | STRAT_APPEARMSG)) | strat;
334
335     switch (strat) {
336     case STRAT_HEAL: /* hide and recover */
337         /* if wounded, hole up on or near the stairs (to block them) */
338         /* unless, of course, there are no stairs (e.g. endlevel) */
339         mtmp->mavenge = 1; /* covetous monsters attack while fleeing */
340         if (In_W_tower(mtmp->mx, mtmp->my, &u.uz)
341             || (mtmp->iswiz && !xupstair && !mon_has_amulet(mtmp))) {
342             if (!rn2(3 + mtmp->mhp / 10))
343                 (void) rloc(mtmp, TRUE);
344         } else if (xupstair
345                    && (mtmp->mx != xupstair || mtmp->my != yupstair)) {
346             (void) mnearto(mtmp, xupstair, yupstair, TRUE);
347         }
348         /* if you're not around, cast healing spells */
349         if (distu(mtmp->mx, mtmp->my) > (BOLT_LIM * BOLT_LIM))
350             if (mtmp->mhp <= mtmp->mhpmax - 8) {
351                 mtmp->mhp += rnd(8);
352                 return 1;
353             }
354     /* fall through :-) */
355
356     case STRAT_NONE: /* harass */
357         if (!rn2(!mtmp->mflee ? 5 : 33))
358             mnexto(mtmp);
359         return 0;
360
361     default: /* kill, maim, pillage! */
362     {
363         long where = (strat & STRAT_STRATMASK);
364         xchar tx = STRAT_GOALX(strat), ty = STRAT_GOALY(strat);
365         int targ = (int) (strat & STRAT_GOAL);
366         struct obj *otmp;
367
368         if (!targ) { /* simply wants you to close */
369             return 0;
370         }
371         if ((u.ux == tx && u.uy == ty) || where == STRAT_PLAYER) {
372             /* player is standing on it (or has it) */
373             mnexto(mtmp);
374             return 0;
375         }
376         if (where == STRAT_GROUND) {
377             if (!MON_AT(tx, ty) || (mtmp->mx == tx && mtmp->my == ty)) {
378                 /* teleport to it and pick it up */
379                 rloc_to(mtmp, tx, ty); /* clean old pos */
380
381                 if ((otmp = on_ground(which_arti(targ))) != 0) {
382                     if (cansee(mtmp->mx, mtmp->my))
383 #if 0 /*JP*/
384                         pline("%s picks up %s.", Monnam(mtmp),
385                               (distu(mtmp->mx, mtmp->my) <= 5)
386                                   ? doname(otmp)
387                                   : distant_name(otmp, doname));
388 #else
389                         pline("%s\82Í%s\82ð\8fE\82Á\82½\81D", Monnam(mtmp),
390                               (distu(mtmp->mx, mtmp->my) <= 5)
391                                   ? doname(otmp)
392                                   : distant_name(otmp, doname));
393 #endif
394                     obj_extract_self(otmp);
395                     (void) mpickobj(mtmp, otmp);
396                     return 1;
397                 } else
398                     return 0;
399             } else {
400                 /* a monster is standing on it - cause some trouble */
401                 if (!rn2(5))
402                     mnexto(mtmp);
403                 return 0;
404             }
405         } else { /* a monster has it - 'port beside it. */
406             (void) mnearto(mtmp, tx, ty, FALSE);
407             return 0;
408         }
409     }
410     }
411     /*NOTREACHED*/
412     return 0;
413 }
414
415 void
416 aggravate()
417 {
418     register struct monst *mtmp;
419
420     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
421         if (DEADMONSTER(mtmp))
422             continue;
423         mtmp->mstrategy &= ~(STRAT_WAITFORU | STRAT_APPEARMSG);
424         mtmp->msleeping = 0;
425         if (!mtmp->mcanmove && !rn2(5)) {
426             mtmp->mfrozen = 0;
427             mtmp->mcanmove = 1;
428         }
429     }
430 }
431
432 void
433 clonewiz()
434 {
435     register struct monst *mtmp2;
436
437     if ((mtmp2 = makemon(&mons[PM_WIZARD_OF_YENDOR], u.ux, u.uy, NO_MM_FLAGS))
438         != 0) {
439         mtmp2->msleeping = mtmp2->mtame = mtmp2->mpeaceful = 0;
440         if (!u.uhave.amulet && rn2(2)) { /* give clone a fake */
441             (void) add_to_minv(mtmp2,
442                                mksobj(FAKE_AMULET_OF_YENDOR, TRUE, FALSE));
443         }
444         mtmp2->m_ap_type = M_AP_MONSTER;
445         mtmp2->mappearance = wizapp[rn2(SIZE(wizapp))];
446         newsym(mtmp2->mx, mtmp2->my);
447     }
448 }
449
450 /* also used by newcham() */
451 int
452 pick_nasty()
453 {
454     int res = nasties[rn2(SIZE(nasties))];
455
456     /* To do?  Possibly should filter for appropriate forms when
457      * in the elemental planes or surrounded by water or lava.
458      *
459      * We want monsters represented by uppercase on rogue level,
460      * but we don't try very hard.
461      */
462     if (Is_rogue_level(&u.uz)
463         && !('A' <= mons[res].mlet && mons[res].mlet <= 'Z'))
464         res = nasties[rn2(SIZE(nasties))];
465
466     return res;
467 }
468
469 /* create some nasty monsters, aligned or neutral with the caster */
470 /* a null caster defaults to a chaotic caster (e.g. the wizard) */
471 int
472 nasty(mcast)
473 struct monst *mcast;
474 {
475     register struct monst *mtmp;
476     register int i, j, tmp;
477     int castalign = (mcast ? sgn(mcast->data->maligntyp) : -1);
478     coord bypos;
479     int count, census;
480
481     /* some candidates may be created in groups, so simple count
482        of non-null makemon() return is inadequate */
483     census = monster_census(FALSE);
484
485     if (!rn2(10) && Inhell) {
486         count = msummon((struct monst *) 0); /* summons like WoY */
487     } else {
488         count = 0;
489         tmp = (u.ulevel > 3) ? u.ulevel / 3 : 1; /* just in case -- rph */
490         /* if we don't have a casting monster, the nasties appear around you
491          */
492         bypos.x = u.ux;
493         bypos.y = u.uy;
494         for (i = rnd(tmp); i > 0; --i)
495             for (j = 0; j < 20; j++) {
496                 int makeindex;
497
498                 /* Don't create more spellcasters of the monsters' level or
499                  * higher--avoids chain summoners filling up the level.
500                  */
501                 do {
502                     makeindex = pick_nasty();
503                 } while (mcast && attacktype(&mons[makeindex], AT_MAGC)
504                          && monstr[makeindex] >= monstr[mcast->mnum]);
505                 /* do this after picking the monster to place */
506                 if (mcast
507                     && !enexto(&bypos, mcast->mux, mcast->muy,
508                                &mons[makeindex]))
509                     continue;
510                 if ((mtmp = makemon(&mons[makeindex], bypos.x, bypos.y,
511                                     NO_MM_FLAGS)) != 0) {
512                     mtmp->msleeping = mtmp->mpeaceful = mtmp->mtame = 0;
513                     set_malign(mtmp);
514                 } else /* GENOD? */
515                     mtmp = makemon((struct permonst *) 0, bypos.x, bypos.y,
516                                    NO_MM_FLAGS);
517                 if (mtmp) {
518                     count++;
519                     if (mtmp->data->maligntyp == 0
520                         || sgn(mtmp->data->maligntyp) == castalign)
521                         break;
522                 }
523             }
524     }
525
526     if (count)
527         count = monster_census(FALSE) - census;
528     return count;
529 }
530
531 /* Let's resurrect the wizard, for some unexpected fun. */
532 void
533 resurrect()
534 {
535     struct monst *mtmp, **mmtmp;
536     long elapsed;
537     const char *verb;
538
539     if (!context.no_of_wizards) {
540         /* make a new Wizard */
541 /*JP
542         verb = "kill";
543 */
544         verb = "\82ð\93¢\82Ä\82µ";
545         mtmp = makemon(&mons[PM_WIZARD_OF_YENDOR], u.ux, u.uy, MM_NOWAIT);
546         /* affects experience; he's not coming back from a corpse
547            but is subject to repeated killing like a revived corpse */
548         if (mtmp) mtmp->mrevived = 1;
549     } else {
550         /* look for a migrating Wizard */
551 /*JP
552         verb = "elude";
553 */
554         verb = "\82æ\82è\93¦\82ê\82ñ";
555         mmtmp = &migrating_mons;
556         while ((mtmp = *mmtmp) != 0) {
557             if (mtmp->iswiz
558                 /* if he has the Amulet, he won't bring it to you */
559                 && !mon_has_amulet(mtmp)
560                 && (elapsed = monstermoves - mtmp->mlstmv) > 0L) {
561                 mon_catchup_elapsed_time(mtmp, elapsed);
562                 if (elapsed >= LARGEST_INT)
563                     elapsed = LARGEST_INT - 1;
564                 elapsed /= 50L;
565                 if (mtmp->msleeping && rn2((int) elapsed + 1))
566                     mtmp->msleeping = 0;
567                 if (mtmp->mfrozen == 1) /* would unfreeze on next move */
568                     mtmp->mfrozen = 0, mtmp->mcanmove = 1;
569                 if (mtmp->mcanmove && !mtmp->msleeping) {
570                     *mmtmp = mtmp->nmon;
571                     mon_arrive(mtmp, TRUE);
572                     /* note: there might be a second Wizard; if so,
573                        he'll have to wait til the next resurrection */
574                     break;
575                 }
576             }
577             mmtmp = &mtmp->nmon;
578         }
579     }
580
581     if (mtmp) {
582         mtmp->mtame = mtmp->mpeaceful = 0; /* paranoia */
583         set_malign(mtmp);
584         if (!Deaf) {
585 /*JP
586             pline("A voice booms out...");
587 */
588             pline("\90º\82ª\8d\82\82­\96Â\82è\8b¿\82¢\82½\81D\81D\81D");
589 /*JP
590             verbalize("So thou thought thou couldst %s me, fool.", verb);
591 */
592             verbalize("\97]%s\82Æ\8ev\82¢\82µ\82©\81C\92s\82ê\8eÒ\82ª\81D", verb);
593         }
594     }
595 }
596
597 /* Here, we make trouble for the poor shmuck who actually
598    managed to do in the Wizard. */
599 void
600 intervene()
601 {
602     int which = Is_astralevel(&u.uz) ? rnd(4) : rn2(6);
603     /* cases 0 and 5 don't apply on the Astral level */
604     switch (which) {
605     case 0:
606     case 1:
607 /*JP
608         You_feel("vaguely nervous.");
609 */
610         You("\89½\82Æ\82È\82­\95s\88À\82É\82È\82Á\82½\81D");
611         break;
612     case 2:
613         if (!Blind)
614 /*JP
615             You("notice a %s glow surrounding you.", hcolor(NH_BLACK));
616 */
617             pline("%s\8cõ\82ª\82 \82È\82½\82ð\82Æ\82è\82Ü\82¢\82Ä\82¢\82é\82Ì\82É\8bC\82ª\82Â\82¢\82½\81D", hcolor(NH_BLACK));
618         rndcurse();
619         break;
620     case 3:
621         aggravate();
622         break;
623     case 4:
624         (void) nasty((struct monst *) 0);
625         break;
626     case 5:
627         resurrect();
628         break;
629     }
630 }
631
632 void
633 wizdead()
634 {
635     context.no_of_wizards--;
636     if (!u.uevent.udemigod) {
637         u.uevent.udemigod = TRUE;
638         u.udg_cnt = rn1(250, 50);
639     }
640 }
641
642 const char *const random_insult[] = {
643 #if 0 /*JP*/
644     "antic",      "blackguard",   "caitiff",    "chucklehead",
645     "coistrel",   "craven",       "cretin",     "cur",
646     "dastard",    "demon fodder", "dimwit",     "dolt",
647     "fool",       "footpad",      "imbecile",   "knave",
648     "maledict",   "miscreant",    "niddering",  "poltroon",
649     "rattlepate", "reprobate",    "scapegrace", "varlet",
650     "villein", /* (sic.) */
651     "wittol",     "worm",         "wretch",
652 #else
653     "\82Ó\82´\82¯\82½\96ì\98Y", "\88«\93}",       "\82­\82»\82Á\82½\82ê", "\82Ì\82ë\82Ü",
654     "\82 \82ñ\82Û\82ñ\82½\82ñ", "\89°\95a\8eÒ",     "\94\92\92s",       "\82ë\82­\82Å\82È\82µ",
655     "\82¤\82Â\82¯",       "\88«\96\82\82Ì\89a\90H", "\82¤\82·\82Ì\82ë",   "\82Ü\82Ê\82¯",
656     "\94n\8e­",         "\82¨\82¢\82Í\82¬",   "\8bð\82©\8eÒ",     "\82È\82ç\82¸\8eÒ",
657     "\88«\90l",         "\8bÉ\88«\90l",     "\94n\8e­\82½\82ê",   "\94Ú\8b¯\8eÒ",
658     "\95\97\91D\93ª",       "\93¹\8ay\8eÒ",     "\96ï\89î\8eÒ",     "\89º\98Y",
659     "\93z\97ê", /* (sic.) */
660     "\82Ó\82È\82Þ\82µ",     "åv\92\8e",       "\90l\82Å\82È\82µ",
661 #endif
662 };
663
664 const char *const random_malediction[] = {
665 #if 0 /*JP*/
666     "Hell shall soon claim thy remains,", "I chortle at thee, thou pathetic",
667     "Prepare to die, thou", "Resistance is useless,",
668     "Surrender or die, thou", "There shall be no mercy, thou",
669     "Thou shalt repent of thy cunning,", "Thou art as a flea to me,",
670     "Thou art doomed,", "Thy fate is sealed,",
671     "Verily, thou shalt be one dead"
672 #else
673     "\92n\8d\96\82Í\82¢\82Ã\82ê\81C\93ð\82Ì\96S\8a[\82ð\97v\8b\81\82·\82é\82Å\82 \82ë\82¤\81C",
674     "\88£\82ê\82È\82â\82Â\82æ\82Ì\82¤\81D\97]\82Í\96\9e\91«\82\82á",
675     "\93ð\81C\8e\80\82É\94õ\82¦\82æ",
676     "\92ï\8dR\82µ\82Ä\82à\96³\91Ê\82\82á\81C",
677     "\8d~\8eQ\82¹\82æ\81D\82³\82à\82È\82­\82Î\8e\80\82\82á\81D",
678     "\8e\9c\94ß\82Í\96³\82©\82ç\82ñ",
679     "\93ð\81C\82¸\82é\82ð\8cã\89÷\82·\82×\82µ\81C",
680     "\93ð\82Í\97]\82É\82Æ\82Á\82Ä\83m\83~\82Ì\82æ\82¤\82È\82à\82Ì\82\82á\81C",
681     "\93ð\82Í\8eô\82í\82ê\82Ä\82¨\82é\81C",
682     "\93ð\82Ì\89^\96½\82Í\95\95\88ó\82³\82ê\82Ä\82¨\82é\81C",
683     "\82Ü\82±\82Æ\82É\93ð\82Í\8e\80\82É\82½\82é\8eÒ\82È\82è"
684 #endif
685 };
686
687 /* Insult or intimidate the player */
688 void
689 cuss(mtmp)
690 register struct monst *mtmp;
691 {
692     if (Deaf)
693         return;
694     if (mtmp->iswiz) {
695         if (!rn2(5)) /* typical bad guy action */
696 /*JP
697             pline("%s laughs fiendishly.", Monnam(mtmp));
698 */
699             pline("%s\82Í\88«\96\82\82Ì\82æ\82¤\82É\8fÎ\82Á\82½\81D", Monnam(mtmp));
700         else if (u.uhave.amulet && !rn2(SIZE(random_insult)))
701 /*JP
702             verbalize("Relinquish the amulet, %s!",
703 */
704             verbalize("\96\82\82æ\82¯\82ð\8eè\95ú\82¹\81C%s\81I",
705                       random_insult[rn2(SIZE(random_insult))]);
706         else if (u.uhp < 5 && !rn2(2)) /* Panic */
707 #if 0 /*JP*/
708             verbalize(rn2(2) ? "Even now thy life force ebbs, %s!"
709                              : "Savor thy breath, %s, it be thy last!",
710                       random_insult[rn2(SIZE(random_insult))]);
711 #else
712             verbalize(rn2(2) ? "\8d¡\82Æ\82È\82Á\82Ä\82à\82È\82¨\93ð\82Ì\96½\82Í\82 \82¦\82Ä\90\8a\82¦\82é\82Ì\82¾\81C%s\81I"
713                              : "\91§\82ð\96¡\82í\82Á\82Ä\82¨\82¯\81C%s\81C\93ð\82Ì\8dÅ\8aú\82Ì\8e\9e\82¾\81I",
714                       random_insult[rn2(SIZE(random_insult))]);
715 #endif
716         else if (mtmp->mhp < 5 && !rn2(2)) /* Parthian shot */
717 /*JP
718             verbalize(rn2(2) ? "I shall return." : "I'll be back.");
719 */
720             verbalize(rn2(2) ? "\97]\82Í\95K\82¸\8bA\82Á\82Ä\82­\82é\81D" : "\97]\82Í\96ß\82Á\82Ä\82­\82é\81D");
721         else
722 #if 0 /*JP*/
723             verbalize("%s %s!",
724                       random_malediction[rn2(SIZE(random_malediction))],
725                       random_insult[rn2(SIZE(random_insult))]);
726 #else
727             verbalize("%s\81C%s\81I",
728                       random_malediction[rn2(SIZE(random_malediction))],
729                       random_insult[rn2(SIZE(random_insult))]);
730 #endif
731     } else if (is_lminion(mtmp)) {
732         com_pager(rn2(QTN_ANGELIC - 1 + (Hallucination ? 1 : 0))
733                   + QT_ANGELIC);
734     } else {
735         if (!rn2(5))
736 /*JP
737             pline("%s casts aspersions on your ancestry.", Monnam(mtmp));
738 */
739                 pline("%s\82Í\82 \82È\82½\82Ì\89Æ\95¿\82ð\92\86\8f\9d\82µ\82½\81D", Monnam(mtmp));
740         else
741             com_pager(rn2(QTN_DEMONIC) + QT_DEMONIC);
742     }
743 }
744
745 /*wizard.c*/