OSDN Git Service

patch src/
[jnethack/source.git] / src / pray.c
1 /* NetHack 3.6  pray.c  $NHDT-Date: 1446854232 2015/11/06 23:57:12 $  $NHDT-Branch: master $:$NHDT-Revision: 1.87 $ */
2 /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
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 #include "hack.h"
11
12 STATIC_PTR int NDECL(prayer_done);
13 STATIC_DCL struct obj *NDECL(worst_cursed_item);
14 STATIC_DCL int NDECL(in_trouble);
15 STATIC_DCL void FDECL(fix_worst_trouble, (int));
16 STATIC_DCL void FDECL(angrygods, (ALIGNTYP_P));
17 STATIC_DCL void FDECL(at_your_feet, (const char *));
18 STATIC_DCL void NDECL(gcrownu);
19 STATIC_DCL void FDECL(pleased, (ALIGNTYP_P));
20 STATIC_DCL void FDECL(godvoice, (ALIGNTYP_P, const char *));
21 STATIC_DCL void FDECL(god_zaps_you, (ALIGNTYP_P));
22 STATIC_DCL void FDECL(fry_by_god, (ALIGNTYP_P, BOOLEAN_P));
23 STATIC_DCL void FDECL(gods_angry, (ALIGNTYP_P));
24 STATIC_DCL void FDECL(gods_upset, (ALIGNTYP_P));
25 STATIC_DCL void FDECL(consume_offering, (struct obj *));
26 STATIC_DCL boolean FDECL(water_prayer, (BOOLEAN_P));
27 STATIC_DCL boolean FDECL(blocked_boulder, (int, int));
28
29 /* simplify a few tests */
30 #define Cursed_obj(obj, typ) ((obj) && (obj)->otyp == (typ) && (obj)->cursed)
31
32 /*
33  * Logic behind deities and altars and such:
34  * + prayers are made to your god if not on an altar, and to the altar's god
35  *   if you are on an altar
36  * + If possible, your god answers all prayers, which is why bad things happen
37  *   if you try to pray on another god's altar
38  * + sacrifices work basically the same way, but the other god may decide to
39  *   accept your allegiance, after which they are your god.  If rejected,
40  *   your god takes over with your punishment.
41  * + if you're in Gehennom, all messages come from Moloch
42  */
43
44 /*
45  *      Moloch, who dwells in Gehennom, is the "renegade" cruel god
46  *      responsible for the theft of the Amulet from Marduk, the Creator.
47  *      Moloch is unaligned.
48  */
49 /*JP
50 static const char *Moloch = "Moloch";
51 */
52 static const char *Moloch = "\83\82\81[\83\8d\83b\83N";
53
54 static const char *godvoices[] = {
55 /*JP
56     "booms out", "thunders", "rings out", "booms",
57 */
58     "\8b¿\82«\82í\82½\82Á\82½", "\97\8b\82Ì\82æ\82¤\82É\8b¿\82¢\82½", "\82Æ\82Ç\82ë\82¢\82½", "\8b¿\82¢\82½",
59 };
60
61 /* values calculated when prayer starts, and used when completed */
62 static aligntyp p_aligntyp;
63 static int p_trouble;
64 static int p_type; /* (-1)-3: (-1)=really naughty, 3=really good */
65
66 #define PIOUS 20
67 #define DEVOUT 14
68 #define FERVENT 9
69 #define STRIDENT 4
70
71 /*
72  * The actual trouble priority is determined by the order of the
73  * checks performed in in_trouble() rather than by these numeric
74  * values, so keep that code and these values synchronized in
75  * order to have the values be meaningful.
76  */
77
78 #define TROUBLE_STONED 14
79 #define TROUBLE_SLIMED 13
80 #define TROUBLE_STRANGLED 12
81 #define TROUBLE_LAVA 11
82 #define TROUBLE_SICK 10
83 #define TROUBLE_STARVING 9
84 #define TROUBLE_REGION 8 /* stinking cloud */
85 #define TROUBLE_HIT 7
86 #define TROUBLE_LYCANTHROPE 6
87 #define TROUBLE_COLLAPSING 5
88 #define TROUBLE_STUCK_IN_WALL 4
89 #define TROUBLE_CURSED_LEVITATION 3
90 #define TROUBLE_UNUSEABLE_HANDS 2
91 #define TROUBLE_CURSED_BLINDFOLD 1
92
93 #define TROUBLE_PUNISHED (-1)
94 #define TROUBLE_FUMBLING (-2)
95 #define TROUBLE_CURSED_ITEMS (-3)
96 #define TROUBLE_SADDLE (-4)
97 #define TROUBLE_BLIND (-5)
98 #define TROUBLE_POISONED (-6)
99 #define TROUBLE_WOUNDED_LEGS (-7)
100 #define TROUBLE_HUNGRY (-8)
101 #define TROUBLE_STUNNED (-9)
102 #define TROUBLE_CONFUSED (-10)
103 #define TROUBLE_HALLUCINATION (-11)
104
105
106 #define ugod_is_angry() (u.ualign.record < 0)
107 #define on_altar() IS_ALTAR(levl[u.ux][u.uy].typ)
108 #define on_shrine() ((levl[u.ux][u.uy].altarmask & AM_SHRINE) != 0)
109 #define a_align(x, y) ((aligntyp) Amask2align(levl[x][y].altarmask & AM_MASK))
110
111 /* critically low hit points if hp <= 5 or hp <= maxhp/N for some N */
112 boolean
113 critically_low_hp(only_if_injured)
114 boolean only_if_injured; /* determines whether maxhp <= 5 matters */
115 {
116     int divisor, hplim, curhp = Upolyd ? u.mh : u.uhp,
117                         maxhp = Upolyd ? u.mhmax : u.uhpmax;
118
119     if (only_if_injured && !(curhp < maxhp))
120         return FALSE;
121     /* if maxhp is extremely high, use lower threshold for the division test
122        (golden glow cuts off at 11+5*lvl, nurse interaction at 25*lvl; this
123        ought to use monster hit dice--and a smaller multiplier--rather than
124        ulevel when polymorphed, but polyself doesn't maintain that) */
125     hplim = 15 * u.ulevel;
126     if (maxhp > hplim)
127         maxhp = hplim;
128     /* 7 used to be the unconditional divisor */
129     switch (xlev_to_rank(u.ulevel)) { /* maps 1..30 into 0..8 */
130     case 0:
131     case 1:
132         divisor = 5;
133         break; /* explvl 1 to 5 */
134     case 2:
135     case 3:
136         divisor = 6;
137         break; /* explvl 6 to 13 */
138     case 4:
139     case 5:
140         divisor = 7;
141         break; /* explvl 14 to 21 */
142     case 6:
143     case 7:
144         divisor = 8;
145         break; /* explvl 22 to 29 */
146     default:
147         divisor = 9;
148         break; /* explvl 30+ */
149     }
150     /* 5 is a magic number in TROUBLE_HIT handling below */
151     return (boolean) (curhp <= 5 || curhp * divisor <= maxhp);
152 }
153
154 /*
155  * Return 0 if nothing particular seems wrong, positive numbers for
156  * serious trouble, and negative numbers for comparative annoyances.
157  * This returns the worst problem. There may be others, and the gods
158  * may fix more than one.
159  *
160  * This could get as bizarre as noting surrounding opponents, (or
161  * hostile dogs), but that's really hard.
162  *
163  * We could force rehumanize of polyselfed people, but we can't tell
164  * unintentional shape changes from the other kind. Oh well.
165  * 3.4.2: make an exception if polymorphed into a form which lacks
166  * hands; that's a case where the ramifications override this doubt.
167  */
168 STATIC_OVL int
169 in_trouble()
170 {
171     struct obj *otmp;
172     int i, j, count = 0;
173
174     /*
175      * major troubles
176      */
177     if (Stoned)
178         return TROUBLE_STONED;
179     if (Slimed)
180         return TROUBLE_SLIMED;
181     if (Strangled)
182         return TROUBLE_STRANGLED;
183     if (u.utrap && u.utraptype == TT_LAVA)
184         return TROUBLE_LAVA;
185     if (Sick)
186         return TROUBLE_SICK;
187     if (u.uhs >= WEAK)
188         return TROUBLE_STARVING;
189     if (region_danger())
190         return TROUBLE_REGION;
191     if (critically_low_hp(FALSE))
192         return TROUBLE_HIT;
193     if (u.ulycn >= LOW_PM)
194         return TROUBLE_LYCANTHROPE;
195     if (near_capacity() >= EXT_ENCUMBER && AMAX(A_STR) - ABASE(A_STR) > 3)
196         return TROUBLE_COLLAPSING;
197
198     for (i = -1; i <= 1; i++)
199         for (j = -1; j <= 1; j++) {
200             if (!i && !j)
201                 continue;
202             if (!isok(u.ux + i, u.uy + j)
203                 || IS_ROCK(levl[u.ux + i][u.uy + j].typ)
204                 || (blocked_boulder(i, j) && !throws_rocks(youmonst.data)))
205                 count++;
206         }
207     if (count == 8 && !Passes_walls)
208         return TROUBLE_STUCK_IN_WALL;
209
210     if (Cursed_obj(uarmf, LEVITATION_BOOTS)
211         || stuck_ring(uleft, RIN_LEVITATION)
212         || stuck_ring(uright, RIN_LEVITATION))
213         return TROUBLE_CURSED_LEVITATION;
214     if (nohands(youmonst.data) || !freehand()) {
215         /* for bag/box access [cf use_container()]...
216            make sure it's a case that we know how to handle;
217            otherwise "fix all troubles" would get stuck in a loop */
218         if (welded(uwep))
219             return TROUBLE_UNUSEABLE_HANDS;
220         if (Upolyd && nohands(youmonst.data)
221             && (!Unchanging || ((otmp = unchanger()) != 0 && otmp->cursed)))
222             return TROUBLE_UNUSEABLE_HANDS;
223     }
224     if (Blindfolded && ublindf->cursed)
225         return TROUBLE_CURSED_BLINDFOLD;
226
227     /*
228      * minor troubles
229      */
230     if (Punished || (u.utrap && u.utraptype == TT_BURIEDBALL))
231         return TROUBLE_PUNISHED;
232     if (Cursed_obj(uarmg, GAUNTLETS_OF_FUMBLING)
233         || Cursed_obj(uarmf, FUMBLE_BOOTS))
234         return TROUBLE_FUMBLING;
235     if (worst_cursed_item())
236         return TROUBLE_CURSED_ITEMS;
237     if (u.usteed) { /* can't voluntarily dismount from a cursed saddle */
238         otmp = which_armor(u.usteed, W_SADDLE);
239         if (Cursed_obj(otmp, SADDLE))
240             return TROUBLE_SADDLE;
241     }
242
243     if (Blinded > 1 && haseyes(youmonst.data)
244         && (!u.uswallow
245             || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
246         return TROUBLE_BLIND;
247     for (i = 0; i < A_MAX; i++)
248         if (ABASE(i) < AMAX(i))
249             return TROUBLE_POISONED;
250     if (Wounded_legs && !u.usteed)
251         return TROUBLE_WOUNDED_LEGS;
252     if (u.uhs >= HUNGRY)
253         return TROUBLE_HUNGRY;
254     if (HStun & TIMEOUT)
255         return TROUBLE_STUNNED;
256     if (HConfusion & TIMEOUT)
257         return TROUBLE_CONFUSED;
258     if (HHallucination & TIMEOUT)
259         return TROUBLE_HALLUCINATION;
260     return 0;
261 }
262
263 /* select an item for TROUBLE_CURSED_ITEMS */
264 STATIC_OVL struct obj *
265 worst_cursed_item()
266 {
267     register struct obj *otmp;
268
269     /* if strained or worse, check for loadstone first */
270     if (near_capacity() >= HVY_ENCUMBER) {
271         for (otmp = invent; otmp; otmp = otmp->nobj)
272             if (Cursed_obj(otmp, LOADSTONE))
273                 return otmp;
274     }
275     /* weapon takes precedence if it is interfering
276        with taking off a ring or putting on a shield */
277     if (welded(uwep) && (uright || bimanual(uwep))) { /* weapon */
278         otmp = uwep;
279         /* gloves come next, due to rings */
280     } else if (uarmg && uarmg->cursed) { /* gloves */
281         otmp = uarmg;
282         /* then shield due to two handed weapons and spells */
283     } else if (uarms && uarms->cursed) { /* shield */
284         otmp = uarms;
285         /* then cloak due to body armor */
286     } else if (uarmc && uarmc->cursed) { /* cloak */
287         otmp = uarmc;
288     } else if (uarm && uarm->cursed) { /* suit */
289         otmp = uarm;
290     } else if (uarmh && uarmh->cursed) { /* helmet */
291         otmp = uarmh;
292     } else if (uarmf && uarmf->cursed) { /* boots */
293         otmp = uarmf;
294     } else if (uarmu && uarmu->cursed) { /* shirt */
295         otmp = uarmu;
296     } else if (uamul && uamul->cursed) { /* amulet */
297         otmp = uamul;
298     } else if (uleft && uleft->cursed) { /* left ring */
299         otmp = uleft;
300     } else if (uright && uright->cursed) { /* right ring */
301         otmp = uright;
302     } else if (ublindf && ublindf->cursed) { /* eyewear */
303         otmp = ublindf;                      /* must be non-blinding lenses */
304         /* if weapon wasn't handled above, do it now */
305     } else if (welded(uwep)) { /* weapon */
306         otmp = uwep;
307         /* active secondary weapon even though it isn't welded */
308     } else if (uswapwep && uswapwep->cursed && u.twoweap) {
309         otmp = uswapwep;
310         /* all worn items ought to be handled by now */
311     } else {
312         for (otmp = invent; otmp; otmp = otmp->nobj) {
313             if (!otmp->cursed)
314                 continue;
315             if (otmp->otyp == LOADSTONE || confers_luck(otmp))
316                 break;
317         }
318     }
319     return otmp;
320 }
321
322 STATIC_OVL void
323 fix_worst_trouble(trouble)
324 int trouble;
325 {
326     int i;
327     struct obj *otmp = 0;
328     const char *what = (const char *) 0;
329 #if 0 /*JP*/
330     static NEARDATA const char leftglow[] = "Your left ring softly glows",
331                                rightglow[] = "Your right ring softly glows";
332 #else
333     static NEARDATA const char leftglow[] = "\8d\82Ì\8ew\97Ö",
334                                rightglow[] = "\89E\82Ì\8ew\97Ö";
335 #endif
336
337     switch (trouble) {
338     case TROUBLE_STONED:
339 /*JP
340         make_stoned(0L, "You feel more limber.", 0, (char *) 0);
341 */
342         make_stoned(0L, "\93î\82ç\82©\82­\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", 0, (char *) 0);
343         break;
344     case TROUBLE_SLIMED:
345 /*JP
346         make_slimed(0L, "The slime disappears.");
347 */
348         make_slimed(0L, "\82Ç\82ë\82Ç\82ë\8a´\82Í\8fÁ\82¦\82½\81D");
349         break;
350     case TROUBLE_STRANGLED:
351         if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) {
352 /*JP
353             Your("amulet vanishes!");
354 */
355             Your("\96\82\8f\9c\82¯\82Í\8fÁ\82¦\82³\82Á\82½\81I");
356             useup(uamul);
357         }
358 /*JP
359         You("can breathe again.");
360 */
361         You("\82Ü\82½\8cÄ\8bz\82Å\82«\82é\82æ\82¤\82É\82È\82Á\82½\81D");
362         Strangled = 0;
363         context.botl = 1;
364         break;
365     case TROUBLE_LAVA:
366 /*JP
367         You("are back on solid ground.");
368 */
369         You("\8cÅ\82¢\92n\96Ê\82É\96ß\82Á\82½\81D");
370         /* teleport should always succeed, but if not,
371          * just untrap them.
372          */
373         if (!safe_teleds(FALSE))
374             u.utrap = 0;
375         break;
376     case TROUBLE_STARVING:
377         losestr(-1);
378         /*FALLTHRU*/
379     case TROUBLE_HUNGRY:
380 /*JP
381         Your("%s feels content.", body_part(STOMACH));
382 */
383         Your("\90H\97~\82Í\96\9e\82½\82³\82ê\82½\81D");
384         init_uhunger();
385         context.botl = 1;
386         break;
387     case TROUBLE_SICK:
388 /*JP
389         You_feel("better.");
390 */
391         You("\8bC\95ª\82ª\97Ç\82­\82È\82Á\82½\81D");
392         make_sick(0L, (char *) 0, FALSE, SICK_ALL);
393         break;
394     case TROUBLE_REGION:
395         /* stinking cloud, with hero vulnerable to HP loss */
396         region_safety();
397         break;
398     case TROUBLE_HIT:
399         /* "fix all troubles" will keep trying if hero has
400            5 or less hit points, so make sure they're always
401            boosted to be more than that */
402 /*JP
403         You_feel("much better.");
404 */
405         You("\82Æ\82Ä\82à\8bC\95ª\82ª\97Ç\82­\82È\82Á\82½\81D");
406         if (Upolyd) {
407             u.mhmax += rnd(5);
408             if (u.mhmax <= 5)
409                 u.mhmax = 5 + 1;
410             u.mh = u.mhmax;
411         }
412         if (u.uhpmax < u.ulevel * 5 + 11)
413             u.uhpmax += rnd(5);
414         if (u.uhpmax <= 5)
415             u.uhpmax = 5 + 1;
416         u.uhp = u.uhpmax;
417         context.botl = 1;
418         break;
419     case TROUBLE_COLLAPSING:
420         /* override Fixed_abil; uncurse that if feasible */
421 #if 0 /*JP*/
422         You_feel("%sstronger.",
423                  (AMAX(A_STR) - ABASE(A_STR) > 6) ? "much " : "");
424 #else
425         You_feel("%s\8b­\82­\82È\82Á\82½\82æ\82¤\82¾\81D",
426                  (AMAX(A_STR) - ABASE(A_STR) > 6) ? "\82Æ\82Ä\82à" : "");
427 #endif
428         ABASE(A_STR) = AMAX(A_STR);
429         context.botl = 1;
430         if (Fixed_abil) {
431             if ((otmp = stuck_ring(uleft, RIN_SUSTAIN_ABILITY)) != 0) {
432                 if (otmp == uleft)
433                     what = leftglow;
434             } else if ((otmp = stuck_ring(uright, RIN_SUSTAIN_ABILITY))
435                        != 0) {
436                 if (otmp == uright)
437                     what = rightglow;
438             }
439             if (otmp)
440                 goto decurse;
441         }
442         break;
443     case TROUBLE_STUCK_IN_WALL:
444 /*JP
445         Your("surroundings change.");
446 */
447         Your("\8aÂ\8b«\82ª\95Ï\89»\82µ\82½\81D");
448         /* no control, but works on no-teleport levels */
449         (void) safe_teleds(FALSE);
450         break;
451     case TROUBLE_CURSED_LEVITATION:
452         if (Cursed_obj(uarmf, LEVITATION_BOOTS)) {
453             otmp = uarmf;
454         } else if ((otmp = stuck_ring(uleft, RIN_LEVITATION)) != 0) {
455             if (otmp == uleft)
456                 what = leftglow;
457         } else if ((otmp = stuck_ring(uright, RIN_LEVITATION)) != 0) {
458             if (otmp == uright)
459                 what = rightglow;
460         }
461         goto decurse;
462     case TROUBLE_UNUSEABLE_HANDS:
463         if (welded(uwep)) {
464             otmp = uwep;
465             goto decurse;
466         }
467         if (Upolyd && nohands(youmonst.data)) {
468             if (!Unchanging) {
469 /*JP
470                 Your("shape becomes uncertain.");
471 */
472                 Your("\91Ì\8c^\82Í\95s\96¾\8am\82É\82È\82Á\82½\81D");
473                 rehumanize(); /* "You return to {normal} form." */
474             } else if ((otmp = unchanger()) != 0 && otmp->cursed) {
475                 /* otmp is an amulet of unchanging */
476                 goto decurse;
477             }
478         }
479         if (nohands(youmonst.data) || !freehand())
480             impossible("fix_worst_trouble: couldn't cure hands.");
481         break;
482     case TROUBLE_CURSED_BLINDFOLD:
483         otmp = ublindf;
484         goto decurse;
485     case TROUBLE_LYCANTHROPE:
486         you_unwere(TRUE);
487         break;
488     /*
489      */
490     case TROUBLE_PUNISHED:
491 /*JP
492         Your("chain disappears.");
493 */
494         Your("\8d½\82Í\8fÁ\82¦\82½\81D");
495         if (u.utrap && u.utraptype == TT_BURIEDBALL)
496             buried_ball_to_freedom();
497         else
498             unpunish();
499         break;
500     case TROUBLE_FUMBLING:
501         if (Cursed_obj(uarmg, GAUNTLETS_OF_FUMBLING))
502             otmp = uarmg;
503         else if (Cursed_obj(uarmf, FUMBLE_BOOTS))
504             otmp = uarmf;
505         goto decurse;
506         /*NOTREACHED*/
507         break;
508     case TROUBLE_CURSED_ITEMS:
509         otmp = worst_cursed_item();
510         if (otmp == uright)
511             what = rightglow;
512         else if (otmp == uleft)
513             what = leftglow;
514     decurse:
515         if (!otmp) {
516             impossible("fix_worst_trouble: nothing to uncurse.");
517             return;
518         }
519         if (!Blind || (otmp == ublindf && Blindfolded_only)) {
520 #if 0 /*JP*/
521             pline("%s %s.",
522                   what ? what : (const char *) Yobjnam2(otmp, "softly glow"),
523                   hcolor(NH_AMBER));
524 #else
525             Your("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D",
526                  what ? what : (const char *)xname(otmp),
527                  jconj_adj(hcolor(NH_AMBER)));
528 #endif
529             iflags.last_msg = PLNMSG_OBJ_GLOWS;
530             otmp->bknown = TRUE;
531         }
532         uncurse(otmp);
533         update_inventory();
534         break;
535     case TROUBLE_POISONED:
536         /* override Fixed_abil; ignore items which confer that */
537         if (Hallucination)
538 /*JP
539             pline("There's a tiger in your tank.");
540 */
541             pline("\82 \82È\82½\82Ì\83^\83\93\83N\82Ì\92\86\82É\83g\83\89\82ª\82¢\82é\81D");
542         else
543 /*JP
544             You_feel("in good health again.");
545 */
546             You("\82Ü\82½\8c\92\8dN\82É\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
547         for (i = 0; i < A_MAX; i++) {
548             if (ABASE(i) < AMAX(i)) {
549                 ABASE(i) = AMAX(i);
550                 context.botl = 1;
551             }
552         }
553         (void) encumber_msg();
554         break;
555     case TROUBLE_BLIND: {
556 #if 0 /*JP*/
557         const char *eyes = body_part(EYE);
558
559         if (eyecount(youmonst.data) != 1)
560             eyes = makeplural(eyes);
561         Your("%s %s better.", eyes, vtense(eyes, "feel"));
562 #else
563         pline("%s\82ª\89ñ\95\9c\82µ\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", body_part(EYE));
564 #endif
565         u.ucreamed = 0;
566         make_blinded(0L, FALSE);
567         break;
568     }
569     case TROUBLE_WOUNDED_LEGS:
570         heal_legs();
571         break;
572     case TROUBLE_STUNNED:
573         make_stunned(0L, TRUE);
574         break;
575     case TROUBLE_CONFUSED:
576         make_confused(0L, TRUE);
577         break;
578     case TROUBLE_HALLUCINATION:
579 /*JP
580         pline("Looks like you are back in Kansas.");
581 */
582         pline("\8c©\82Ä\81I\83J\83\93\83U\83X\82É\96ß\82Á\82Ä\82«\82½\82ñ\82¾\82í\81D");
583         (void) make_hallucinated(0L, FALSE, 0L);
584         break;
585     case TROUBLE_SADDLE:
586         otmp = which_armor(u.usteed, W_SADDLE);
587         if (!Blind) {
588 /*JP
589             pline("%s %s.", Yobjnam2(otmp, "softly glow"), hcolor(NH_AMBER));
590 */
591             pline("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D", y_monnam(u.usteed), hcolor(NH_AMBER));
592             otmp->bknown = TRUE;
593         }
594         uncurse(otmp);
595         break;
596     }
597 }
598
599 /* "I am sometimes shocked by...  the nuns who never take a bath without
600  * wearing a bathrobe all the time.  When asked why, since no man can see
601  * them,
602  * they reply 'Oh, but you forget the good God'.  Apparently they conceive of
603  * the Deity as a Peeping Tom, whose omnipotence enables Him to see through
604  * bathroom walls, but who is foiled by bathrobes." --Bertrand Russell, 1943
605  * Divine wrath, dungeon walls, and armor follow the same principle.
606  */
607 STATIC_OVL void
608 god_zaps_you(resp_god)
609 aligntyp resp_god;
610 {
611     if (u.uswallow) {
612         pline(
613 /*JP
614           "Suddenly a bolt of lightning comes down at you from the heavens!");
615 */
616           "\93Ë\91R\8bó\82©\82ç\88î\8dÈ\82ª\97\8e\82¿\82Ä\82«\82½\81I");
617 /*JP
618         pline("It strikes %s!", mon_nam(u.ustuck));
619 */
620         pline("\88î\8dÈ\82Í%s\82É\96½\92\86\82µ\82½\81I", mon_nam(u.ustuck));
621         if (!resists_elec(u.ustuck)) {
622 /*JP
623             pline("%s fries to a crisp!", Monnam(u.ustuck));
624 */
625             pline("%s\82Í\83p\83\8a\83p\83\8a\82É\82È\82Á\82½\81I", Monnam(u.ustuck));
626             /* Yup, you get experience.  It takes guts to successfully
627              * pull off this trick on your god, anyway.
628              */
629             xkilled(u.ustuck, 0);
630         } else
631 /*JP
632             pline("%s seems unaffected.", Monnam(u.ustuck));
633 */
634             pline("%s\82Í\89e\8b¿\82ð\8eó\82¯\82È\82¢\82æ\82¤\82¾\81D", Monnam(u.ustuck));
635     } else {
636 /*JP
637         pline("Suddenly, a bolt of lightning strikes you!");
638 */
639         pline("\93Ë\91R\81C\88î\8dÈ\82ª\82 \82È\82½\82É\96½\92\86\82µ\82½\81I");
640         if (Reflecting) {
641             shieldeff(u.ux, u.uy);
642             if (Blind)
643 /*JP
644                 pline("For some reason you're unaffected.");
645 */
646                 pline("\82È\82º\82©\82 \82È\82½\82Í\89e\8b¿\82ð\8eó\82¯\82È\82¢\81D");
647             else
648 /*JP
649                 (void) ureflects("%s reflects from your %s.", "It");
650 */
651                 (void) ureflects("%s\82Í%s\82É\82æ\82Á\82Ä\94½\8eË\82³\82ê\82½\81D", "\89½\82©");
652         } else if (Shock_resistance) {
653             shieldeff(u.ux, u.uy);
654 /*JP
655             pline("It seems not to affect you.");
656 */
657             pline("\88î\8dÈ\82Í\89e\8b¿\82ð\97^\82¦\82È\82¢\82æ\82¤\82¾\81D");
658         } else
659             fry_by_god(resp_god, FALSE);
660     }
661
662 /*JP
663     pline("%s is not deterred...", align_gname(resp_god));
664 */
665     pline("%s\82Í\82 \82«\82ç\82ß\82È\82©\82Á\82½\81D\81D\81D", align_gname(resp_god));
666     if (u.uswallow) {
667 /*JP
668         pline("A wide-angle disintegration beam aimed at you hits %s!",
669 */
670         pline("\82 \82È\82½\82ð\91_\82Á\82½\8dL\8ap\95²\8dÓ\8cõ\90ü\82ª%s\82É\96½\92\86\82µ\82½\81I",
671               mon_nam(u.ustuck));
672         if (!resists_disint(u.ustuck)) {
673 /*JP
674             pline("%s disintegrates into a pile of dust!", Monnam(u.ustuck));
675 */
676             pline("%s\82Í\82¿\82è\82Ì\8eR\82É\82È\82Á\82½\81I", Monnam(u.ustuck));
677             xkilled(u.ustuck, 2); /* no corpse */
678         } else
679 /*JP
680             pline("%s seems unaffected.", Monnam(u.ustuck));
681 */
682             pline("%s\82Í\89e\8b¿\82ð\8eó\82¯\82È\82¢\82æ\82¤\82¾\81D", Monnam(u.ustuck));
683     } else {
684 /*JP
685         pline("A wide-angle disintegration beam hits you!");
686 */
687         pline("\8dL\8ap\95²\8dÓ\8cõ\90ü\82ª\82 \82È\82½\82É\96½\92\86\82µ\82½\81I");
688
689         /* disintegrate shield and body armor before disintegrating
690          * the impudent mortal, like black dragon breath -3.
691          */
692         if (uarms && !(EReflecting & W_ARMS)
693             && !(EDisint_resistance & W_ARMS))
694             (void) destroy_arm(uarms);
695         if (uarmc && !(EReflecting & W_ARMC)
696             && !(EDisint_resistance & W_ARMC))
697             (void) destroy_arm(uarmc);
698         if (uarm && !(EReflecting & W_ARM) && !(EDisint_resistance & W_ARM)
699             && !uarmc)
700             (void) destroy_arm(uarm);
701         if (uarmu && !uarm && !uarmc)
702             (void) destroy_arm(uarmu);
703         if (!Disint_resistance)
704             fry_by_god(resp_god, TRUE);
705         else {
706 /*JP
707             You("bask in its %s glow for a minute...", NH_BLACK);
708 */
709             You("\82µ\82Î\82ç\82­\81C\82»\82Ì%s\8bP\82«\82Å\92g\82Ü\82Á\82½\81D\81D\81D", NH_BLACK);
710 /*JP
711             godvoice(resp_god, "I believe it not!");
712 */
713             godvoice(resp_god, "\90M\82\82ç\82ê\82Ê\81I");
714         }
715         if (Is_astralevel(&u.uz) || Is_sanctum(&u.uz)) {
716             /* one more try for high altars */
717 /*JP
718             verbalize("Thou cannot escape my wrath, mortal!");
719 */
720             verbalize("\92è\96½\82Ì\8eÒ\82æ\81C\93ð\89ä\82ª\93{\82è\82©\82ç\93¦\82ª\82ê\82é\82±\82Æ\82È\82ç\82ñ\81I");
721             summon_minion(resp_god, FALSE);
722             summon_minion(resp_god, FALSE);
723             summon_minion(resp_god, FALSE);
724 /*JP
725             verbalize("Destroy %s, my servants!", uhim());
726 */
727             verbalize("%s\82ð\8eE\82¹\81C\82í\82ª\89º\96l\82æ\81I", uhim());
728         }
729     }
730 }
731
732 STATIC_OVL void
733 fry_by_god(resp_god, via_disintegration)
734 aligntyp resp_god;
735 boolean via_disintegration;
736 {
737 #if 0 /*JP*/
738     You("%s!", !via_disintegration ? "fry to a crisp"
739                                    : "disintegrate into a pile of dust");
740 #else
741     You("%s\81I", !via_disintegration ? "\83p\83\8a\83p\83\8a\82É\82È\82Á\82½"
742                                     : "\82¿\82è\82Ì\8eR\82É\82È\82Á\82½");
743 #endif
744     killer.format = KILLED_BY;
745 /*JP
746     Sprintf(killer.name, "the wrath of %s", align_gname(resp_god));
747 */
748     Sprintf(killer.name, "%s\82Ì\93{\82è\82É\90G\82ê", align_gname(resp_god));
749     done(DIED);
750 }
751
752 STATIC_OVL void
753 angrygods(resp_god)
754 aligntyp resp_god;
755 {
756     int maxanger;
757
758     if (Inhell)
759         resp_god = A_NONE;
760     u.ublessed = 0;
761
762     /* changed from tmp = u.ugangr + abs (u.uluck) -- rph */
763     /* added test for alignment diff -dlc */
764     if (resp_god != u.ualign.type)
765         maxanger = u.ualign.record / 2 + (Luck > 0 ? -Luck / 3 : -Luck);
766     else
767         maxanger = 3 * u.ugangr + ((Luck > 0 || u.ualign.record >= STRIDENT)
768                                    ? -Luck / 3
769                                    : -Luck);
770     if (maxanger < 1)
771         maxanger = 1; /* possible if bad align & good luck */
772     else if (maxanger > 15)
773         maxanger = 15; /* be reasonable */
774
775     switch (rn2(maxanger)) {
776     case 0:
777     case 1:
778 #if 0 /*JP*/
779         You_feel("that %s is %s.", align_gname(resp_god),
780                  Hallucination ? "bummed" : "displeased");
781 #else
782         You("%s\82ª%s\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", align_gname(resp_god),
783             Hallucination ? "\82Ë\82¾\82Á\82Ä" : "\97§\95 \82µ\82Ä");
784 #endif
785         break;
786     case 2:
787     case 3:
788         godvoice(resp_god, (char *) 0);
789 #if 0 /*JP*/
790         pline("\"Thou %s, %s.\"",
791               (ugod_is_angry() && resp_god == u.ualign.type)
792                   ? "hast strayed from the path"
793                   : "art arrogant",
794               youmonst.data->mlet == S_HUMAN ? "mortal" : "creature");
795 #else
796         pline("\81u\93ð%s\81C%s\82æ\81D\81v",
797               (ugod_is_angry() && resp_god == u.ualign.type)
798               ? "\82»\82Ì\93¹\82©\82ç\93¥\82Ý\8fo\82Ä\82¨\82é"
799               : "\98ü\96\9d\82È\82è",
800               youmonst.data->mlet == S_HUMAN ? "\92è\96½\82Ì\82à\82Ì" : "\90\95¨");
801 #endif
802 /*JP
803         verbalize("Thou must relearn thy lessons!");
804 */
805         verbalize("\93ð\82¢\82Ü\88ê\93x\8aw\82Ô\82×\82µ\81I");
806         (void) adjattrib(A_WIS, -1, FALSE);
807         losexp((char *) 0);
808         break;
809     case 6:
810         if (!Punished) {
811             gods_angry(resp_god);
812             punish((struct obj *) 0);
813             break;
814         } /* else fall thru */
815     case 4:
816     case 5:
817         gods_angry(resp_god);
818         if (!Blind && !Antimagic)
819 /*JP
820             pline("%s glow surrounds you.", An(hcolor(NH_BLACK)));
821 */
822             pline("%s\8cõ\82ª\82 \82È\82½\82ð\8eæ\82è\8aª\82¢\82½\81D", An(hcolor(NH_BLACK)));
823         rndcurse();
824         break;
825     case 7:
826     case 8:
827         godvoice(resp_god, (char *) 0);
828 #if 0 /*JP*/
829         verbalize("Thou durst %s me?",
830                   (on_altar() && (a_align(u.ux, u.uy) != resp_god))
831                       ? "scorn"
832                       : "call upon");
833 #else
834         verbalize("\93ð\81C\89ä%s\81H",
835                   (on_altar() && (a_align(u.ux,u.uy) != resp_god))
836                   ? "\82ð\82³\82°\82·\82Ý\82µ\82©\81H"
837                   : "\82É\8bF\82è\82ð\8b\81\82ß\82µ\82©\81H");
838 #endif
839 #if 0 /*JP*/
840         pline("\"Then die, %s!\"",
841               youmonst.data->mlet == S_HUMAN ? "mortal" : "creature");
842 #else
843         pline("\81u\8e\80\82Ë\81C%s\82æ\81I\81v",
844               youmonst.data->mlet == S_HUMAN ? "\92è\96½\82Ì\82à\82Ì" : "\90\95¨");
845 #endif
846         summon_minion(resp_god, FALSE);
847         break;
848
849     default:
850         gods_angry(resp_god);
851         god_zaps_you(resp_god);
852         break;
853     }
854     u.ublesscnt = rnz(300);
855     return;
856 }
857
858 /* helper to print "str appears at your feet", or appropriate */
859 static void
860 at_your_feet(str)
861 const char *str;
862 {
863     if (Blind)
864         str = Something;
865     if (u.uswallow) {
866         /* barrier between you and the floor */
867 #if 0 /*JP*/
868         pline("%s %s into %s %s.", str, vtense(str, "drop"),
869               s_suffix(mon_nam(u.ustuck)), mbodypart(u.ustuck, STOMACH));
870 #else
871         pline("%s\82ª%s\82Ì%s\82É\97\8e\82¿\82½\81D", str,
872               mon_nam(u.ustuck), mbodypart(u.ustuck, STOMACH));
873 #endif
874     } else {
875 #if 0 /*JP*/
876         pline("%s %s %s your %s!", str,
877               Blind ? "lands" : vtense(str, "appear"),
878               Levitation ? "beneath" : "at", makeplural(body_part(FOOT)));
879 #else
880         pline("%s\82ª\82 \82È\82½\82Ì%s\82É%s\81I", str,
881               Levitation ? "\89º\95û" : "\91«\8c³",
882               Blind ? "\92\85\92n\82µ\82½" : "\8c»\82í\82ê\82½");
883 #endif
884     }
885 }
886
887 STATIC_OVL void
888 gcrownu()
889 {
890     struct obj *obj;
891     boolean already_exists, in_hand;
892     short class_gift;
893     int sp_no;
894 #define ok_wep(o) ((o) && ((o)->oclass == WEAPON_CLASS || is_weptool(o)))
895
896     HSee_invisible |= FROMOUTSIDE;
897     HFire_resistance |= FROMOUTSIDE;
898     HCold_resistance |= FROMOUTSIDE;
899     HShock_resistance |= FROMOUTSIDE;
900     HSleep_resistance |= FROMOUTSIDE;
901     HPoison_resistance |= FROMOUTSIDE;
902     godvoice(u.ualign.type, (char *) 0);
903
904     obj = ok_wep(uwep) ? uwep : 0;
905     already_exists = in_hand = FALSE; /* lint suppression */
906     switch (u.ualign.type) {
907     case A_LAWFUL:
908         u.uevent.uhand_of_elbereth = 1;
909 /*JP
910         verbalize("I crown thee...  The Hand of Elbereth!");
911 */
912         verbalize("\93ð\82É\81D\81D\81D\83G\83\8b\83x\83\8c\83X\82Ì\8cä\8eè\82Ì\89h\97_\82ð\82³\82¸\82¯\82æ\82¤\81I");
913         break;
914     case A_NEUTRAL:
915         u.uevent.uhand_of_elbereth = 2;
916         in_hand = (uwep && uwep->oartifact == ART_VORPAL_BLADE);
917         already_exists =
918             exist_artifact(LONG_SWORD, artiname(ART_VORPAL_BLADE));
919 /*JP
920         verbalize("Thou shalt be my Envoy of Balance!");
921 */
922         verbalize("\93ð\81C\89ä\82ª\92²\98a\82Ì\8eg\8eÒ\82È\82è\81I");
923         break;
924     case A_CHAOTIC:
925         u.uevent.uhand_of_elbereth = 3;
926         in_hand = (uwep && uwep->oartifact == ART_STORMBRINGER);
927         already_exists =
928             exist_artifact(RUNESWORD, artiname(ART_STORMBRINGER));
929 #if 0 /*JP*/
930         verbalize("Thou art chosen to %s for My Glory!",
931                   already_exists && !in_hand ? "take lives" : "steal souls");
932 #else
933         verbalize("\93ð\81C\89ä\82ª\89h\8cõ\82Ì\82½\82ß%s\8eÒ\82Æ\82µ\82Ä\91I\82Î\82ê\82ñ\81I",
934                   already_exists && !in_hand ?
935                               "\90\82«\82È\82ª\82ç\82¦\82ñ" : "\8d°\82ð\92D\82¢\82µ\82½\82ß\82é");
936 #endif
937         break;
938     }
939
940     class_gift = STRANGE_OBJECT;
941     /* 3.3.[01] had this in the A_NEUTRAL case below,
942        preventing chaotic wizards from receiving a spellbook */
943     if (Role_if(PM_WIZARD)
944         && (!uwep || (uwep->oartifact != ART_VORPAL_BLADE
945                       && uwep->oartifact != ART_STORMBRINGER))
946         && !carrying(SPE_FINGER_OF_DEATH)) {
947         class_gift = SPE_FINGER_OF_DEATH;
948     make_splbk:
949         obj = mksobj(class_gift, TRUE, FALSE);
950         bless(obj);
951         obj->bknown = TRUE;
952 /*JP
953         at_your_feet("A spellbook");
954 */
955         at_your_feet("\96\82\96@\8f\91");
956         dropy(obj);
957         u.ugifts++;
958         /* when getting a new book for known spell, enhance
959            currently wielded weapon rather than the book */
960         for (sp_no = 0; sp_no < MAXSPELL; sp_no++)
961             if (spl_book[sp_no].sp_id == class_gift) {
962                 if (ok_wep(uwep))
963                     obj = uwep; /* to be blessed,&c */
964                 break;
965             }
966     } else if (Role_if(PM_MONK) && (!uwep || !uwep->oartifact)
967                && !carrying(SPE_RESTORE_ABILITY)) {
968         /* monks rarely wield a weapon */
969         class_gift = SPE_RESTORE_ABILITY;
970         goto make_splbk;
971     }
972
973     switch (u.ualign.type) {
974     case A_LAWFUL:
975         if (class_gift != STRANGE_OBJECT) {
976             ; /* already got bonus above */
977         } else if (obj && obj->otyp == LONG_SWORD && !obj->oartifact) {
978             if (!Blind)
979 /*JP
980                 Your("sword shines brightly for a moment.");
981 */
982                 Your("\8c\95\82Í\82µ\82Î\82ç\82­\82Ì\8aÔ\96¾\82é\82­\8bP\82¢\82½\81D");
983             obj = oname(obj, artiname(ART_EXCALIBUR));
984             if (obj && obj->oartifact == ART_EXCALIBUR)
985                 u.ugifts++;
986         }
987         /* acquire Excalibur's skill regardless of weapon or gift */
988         unrestrict_weapon_skill(P_LONG_SWORD);
989         if (obj && obj->oartifact == ART_EXCALIBUR)
990             discover_artifact(ART_EXCALIBUR);
991         break;
992     case A_NEUTRAL:
993         if (class_gift != STRANGE_OBJECT) {
994             ; /* already got bonus above */
995         } else if (obj && in_hand) {
996 /*JP
997             Your("%s goes snicker-snack!", xname(obj));
998 */
999             Your("%s\82Í\83T\83N\83T\83N\82É\82È\82Á\82½\81I", xname(obj));
1000             obj->dknown = TRUE;
1001         } else if (!already_exists) {
1002             obj = mksobj(LONG_SWORD, FALSE, FALSE);
1003             obj = oname(obj, artiname(ART_VORPAL_BLADE));
1004             obj->spe = 1;
1005 /*JP
1006             at_your_feet("A sword");
1007 */
1008             at_your_feet("\8c\95");
1009             dropy(obj);
1010             u.ugifts++;
1011         }
1012         /* acquire Vorpal Blade's skill regardless of weapon or gift */
1013         unrestrict_weapon_skill(P_LONG_SWORD);
1014         if (obj && obj->oartifact == ART_VORPAL_BLADE)
1015             discover_artifact(ART_VORPAL_BLADE);
1016         break;
1017     case A_CHAOTIC: {
1018         char swordbuf[BUFSZ];
1019
1020 /*JP
1021         Sprintf(swordbuf, "%s sword", hcolor(NH_BLACK));
1022 */
1023         Sprintf(swordbuf, "%s\8c\95", hcolor(NH_BLACK));
1024         if (class_gift != STRANGE_OBJECT) {
1025             ; /* already got bonus above */
1026         } else if (obj && in_hand) {
1027 /*JP
1028             Your("%s hums ominously!", swordbuf);
1029 */
1030             Your("%s\82Í\8bC\96¡\82Ì\88«\82¢\89¹\82ð\97§\82Ä\82½\81I", swordbuf);
1031             obj->dknown = TRUE;
1032         } else if (!already_exists) {
1033             obj = mksobj(RUNESWORD, FALSE, FALSE);
1034             obj = oname(obj, artiname(ART_STORMBRINGER));
1035             obj->spe = 1;
1036             at_your_feet(An(swordbuf));
1037             dropy(obj);
1038             u.ugifts++;
1039         }
1040         /* acquire Stormbringer's skill regardless of weapon or gift */
1041         unrestrict_weapon_skill(P_BROAD_SWORD);
1042         if (obj && obj->oartifact == ART_STORMBRINGER)
1043             discover_artifact(ART_STORMBRINGER);
1044         break;
1045     }
1046     default:
1047         obj = 0; /* lint */
1048         break;
1049     }
1050
1051     /* enhance weapon regardless of alignment or artifact status */
1052     if (ok_wep(obj)) {
1053         bless(obj);
1054         obj->oeroded = obj->oeroded2 = 0;
1055         obj->oerodeproof = TRUE;
1056         obj->bknown = obj->rknown = TRUE;
1057         if (obj->spe < 1)
1058             obj->spe = 1;
1059         /* acquire skill in this weapon */
1060         unrestrict_weapon_skill(weapon_type(obj));
1061     } else if (class_gift == STRANGE_OBJECT) {
1062         /* opportunity knocked, but there was nobody home... */
1063 /*JP
1064         You_feel("unworthy.");
1065 */
1066         You("\89¿\92l\82ª\82È\82¢\82Æ\8ev\82Á\82½\81D");
1067     }
1068     update_inventory();
1069
1070     /* lastly, confer an extra skill slot/credit beyond the
1071        up-to-29 you can get from gaining experience levels */
1072     add_weapon_skill(1);
1073     return;
1074 }
1075
1076 STATIC_OVL void
1077 pleased(g_align)
1078 aligntyp g_align;
1079 {
1080     /* don't use p_trouble, worst trouble may get fixed while praying */
1081     int trouble = in_trouble(); /* what's your worst difficulty? */
1082     int pat_on_head = 0, kick_on_butt;
1083
1084 #if 0 /*JP*/
1085     You_feel("that %s is %s.", align_gname(g_align),
1086              (u.ualign.record >= DEVOUT)
1087                  ? Hallucination ? "pleased as punch" : "well-pleased"
1088                  : (u.ualign.record >= STRIDENT)
1089                        ? Hallucination ? "ticklish" : "pleased"
1090                        : Hallucination ? "full" : "satisfied");
1091 #else
1092         pline("%s\82ª%s\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", align_gname(g_align),
1093               (u.ualign.record >= DEVOUT)
1094                   ? Hallucination ? "\82­\82»\8b@\8c\99\82¢\82¢" : "\82²\8b@\8c\99\97í\82µ\82¢"
1095                   : (u.ualign.record >= STRIDENT)
1096                         ? Hallucination ? "\82­\82·\82®\82Á\82½\82ª\82Á\82Ä\82¢\82é" : "\8fã\8b@\8c\99\82Å\82 \82é"
1097                         : Hallucination ? "\95 \82¢\82Á\82Ï\82¢\82Å\82 \82é" : "\96\9e\91«\82µ\82Ä\82¢\82é");
1098 #endif
1099
1100     /* not your deity */
1101     if (on_altar() && p_aligntyp != u.ualign.type) {
1102         adjalign(-1);
1103         return;
1104     } else if (u.ualign.record < 2 && trouble <= 0)
1105         adjalign(1);
1106
1107     /*
1108      * Depending on your luck & align level, the god you prayed to will:
1109      *  - fix your worst problem if it's major;
1110      *  - fix all your major problems;
1111      *  - fix your worst problem if it's minor;
1112      *  - fix all of your problems;
1113      *  - do you a gratuitous favor.
1114      *
1115      * If you make it to the the last category, you roll randomly again
1116      * to see what they do for you.
1117      *
1118      * If your luck is at least 0, then you are guaranteed rescued from
1119      * your worst major problem.
1120      */
1121     if (!trouble && u.ualign.record >= DEVOUT) {
1122         /* if hero was in trouble, but got better, no special favor */
1123         if (p_trouble == 0)
1124             pat_on_head = 1;
1125     } else {
1126         int action, prayer_luck;
1127         int tryct = 0;
1128
1129         /* Negative luck is normally impossible here (can_pray() forces
1130            prayer failure in that situation), but it's possible for
1131            Luck to drop during the period of prayer occupation and
1132            become negative by the time we get here.  [Reported case
1133            was lawful character whose stinking cloud caused a delayed
1134            killing of a peaceful human, triggering the "murderer"
1135            penalty while successful prayer was in progress.  It could
1136            also happen due to inconvenient timing on Friday 13th, but
1137            the magnitude there (-1) isn't big enough to cause trouble.]
1138            We don't bother remembering start-of-prayer luck, just make
1139            sure it's at least -1 so that Luck+2 is big enough to avoid
1140            a divide by zero crash when generating a random number.  */
1141         prayer_luck = max(Luck, -1); /* => (prayer_luck + 2 > 0) */
1142         action = rn1(prayer_luck + (on_altar() ? 3 + on_shrine() : 2), 1);
1143         if (!on_altar())
1144             action = min(action, 3);
1145         if (u.ualign.record < STRIDENT)
1146             action = (u.ualign.record > 0 || !rnl(2)) ? 1 : 0;
1147
1148         switch (min(action, 5)) {
1149         case 5:
1150             pat_on_head = 1;
1151         case 4:
1152             do
1153                 fix_worst_trouble(trouble);
1154             while ((trouble = in_trouble()) != 0);
1155             break;
1156
1157         case 3:
1158             fix_worst_trouble(trouble);
1159         case 2:
1160             /* arbitrary number of tries */
1161             while ((trouble = in_trouble()) > 0 && (++tryct < 10))
1162                 fix_worst_trouble(trouble);
1163             break;
1164
1165         case 1:
1166             if (trouble > 0)
1167                 fix_worst_trouble(trouble);
1168         case 0:
1169             break; /* your god blows you off, too bad */
1170         }
1171     }
1172
1173     /* note: can't get pat_on_head unless all troubles have just been
1174        fixed or there were no troubles to begin with; hallucination
1175        won't be in effect so special handling for it is superfluous */
1176     if (pat_on_head)
1177         switch (rn2((Luck + 6) >> 1)) {
1178         case 0:
1179             break;
1180         case 1:
1181             if (uwep && (welded(uwep) || uwep->oclass == WEAPON_CLASS
1182                          || is_weptool(uwep))) {
1183                 char repair_buf[BUFSZ];
1184
1185                 *repair_buf = '\0';
1186                 if (uwep->oeroded || uwep->oeroded2)
1187 #if 0 /*JP*/
1188                     Sprintf(repair_buf, " and %s now as good as new",
1189                             otense(uwep, "are"));
1190 #else
1191                     Sprintf(repair_buf, "\82³\82ç\82É\90V\95i\93¯\97l\82É\82È\82Á\82½\81D");
1192 #endif
1193
1194                 if (uwep->cursed) {
1195                     if (!Blind) {
1196 #if 0 /*JP*/
1197                         pline("%s %s%s.", Yobjnam2(uwep, "softly glow"),
1198                               hcolor(NH_AMBER), repair_buf);
1199 #else
1200                         Your("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D%s", xname(uwep), 
1201                              jconj_adj(hcolor(NH_AMBER)), repair_buf);
1202 #endif
1203                         iflags.last_msg = PLNMSG_OBJ_GLOWS;
1204                     } else
1205 #if 0 /*JP*/
1206                         You_feel("the power of %s over %s.", u_gname(),
1207                                  yname(uwep));
1208 #else
1209                         pline("%s\82Ì\97Í\82ª%s\82É\92\8d\82ª\82ê\82Ä\82¢\82é\82Ì\82ð\8a´\82\82½\81D", u_gname(),
1210                               xname(uwep));
1211 #endif
1212                     uncurse(uwep);
1213                     uwep->bknown = TRUE;
1214                     *repair_buf = '\0';
1215                 } else if (!uwep->blessed) {
1216                     if (!Blind) {
1217 #if 0 /*JP*/
1218                         pline("%s with %s aura%s.",
1219                               Yobjnam2(uwep, "softly glow"),
1220                               an(hcolor(NH_LIGHT_BLUE)), repair_buf);
1221 #else
1222                         Your("%s\82Í%s\82â\82í\82ç\82©\82È\83I\81[\83\89\82É\82Â\82Â\82Ü\82ê\82½\81D%s",
1223                              xname(uwep), 
1224                              an(hcolor(NH_LIGHT_BLUE)), repair_buf);
1225 #endif
1226                         iflags.last_msg = PLNMSG_OBJ_GLOWS;
1227                     } else
1228 #if 0 /*JP*/
1229                         You_feel("the blessing of %s over %s.", u_gname(),
1230                                  yname(uwep));
1231 #else
1232                         pline("%s\82Ì\8fj\95\9f\82ª%s\82É\92\8d\82ª\82ê\82Ä\82¢\82é\82Ì\82ð\8a´\82\82½\81D", u_gname(),
1233                               xname(uwep));
1234 #endif
1235                     bless(uwep);
1236                     uwep->bknown = TRUE;
1237                     *repair_buf = '\0';
1238                 }
1239
1240                 /* fix any rust/burn/rot damage, but don't protect
1241                    against future damage */
1242                 if (uwep->oeroded || uwep->oeroded2) {
1243                     uwep->oeroded = uwep->oeroded2 = 0;
1244                     /* only give this message if we didn't just bless
1245                        or uncurse (which has already given a message) */
1246                     if (*repair_buf)
1247 #if 0 /*JP*/
1248                         pline("%s as good as new!",
1249                               Yobjnam2(uwep, Blind ? "feel" : "look"));
1250 #else
1251                         Your("%s\82Í\90V\95i\93¯\97l\82É\82È\82Á\82½%s\81I",
1252                              xname(uwep), Blind ? "\82æ\82¤\82È\8bC\82ª\82·\82é" : "");
1253 #endif
1254                 }
1255                 update_inventory();
1256             }
1257             break;
1258         case 3:
1259             /* takes 2 hints to get the music to enter the stronghold;
1260                skip if you've solved it via mastermind or destroyed the
1261                drawbridge (both set uopened_dbridge) or if you've already
1262                travelled past the Valley of the Dead (gehennom_entered) */
1263             if (!u.uevent.uopened_dbridge && !u.uevent.gehennom_entered) {
1264                 if (u.uevent.uheard_tune < 1) {
1265                     godvoice(g_align, (char *) 0);
1266 #if 0 /*JP*/
1267                     verbalize("Hark, %s!", youmonst.data->mlet == S_HUMAN
1268                                                ? "mortal"
1269                                                : "creature");
1270 #else
1271                     verbalize("%s\82æ\81C\95·\82¯\81I", youmonst.data->mlet == S_HUMAN
1272                                                   ? "\92è\96½\82Ì\8eÒ"
1273                                                   : "\90\95¨");
1274 #endif
1275                     verbalize(
1276 /*JP
1277                        "To enter the castle, thou must play the right tune!");
1278 */
1279                         "\93ð\8fé\82É\93ü\82ç\82ñ\82Æ\97~\82·\82é\82È\82ç\82Î\81C\90³\82µ\82«\92²\82×\82ð\91t\82Å\82é\82×\82µ\81I");
1280                     u.uevent.uheard_tune++;
1281                     break;
1282                 } else if (u.uevent.uheard_tune < 2) {
1283 /*JP
1284                     You_hear("a divine music...");
1285 */
1286                     You_hear("\90_\82Ì\89¹\8ay\82ð\95·\82¢\82½\81D\81D\81D");
1287 /*JP
1288                     pline("It sounds like:  \"%s\".", tune);
1289 */
1290                     pline("\82»\82ê\82Í\8e\9f\82Ì\82æ\82¤\82É\95·\82±\82¦\82½:  \81u%s\81v", tune);
1291                     u.uevent.uheard_tune++;
1292                     break;
1293                 }
1294             }
1295         /* Otherwise, falls into next case */
1296         case 2:
1297             if (!Blind)
1298 /*JP
1299                 You("are surrounded by %s glow.", an(hcolor(NH_GOLDEN)));
1300 */
1301                 You("%s\8bP\82«\82É\82Â\82Â\82Ü\82ê\82½\81D", hcolor(NH_GOLDEN));
1302             /* if any levels have been lost (and not yet regained),
1303                treat this effect like blessed full healing */
1304             if (u.ulevel < u.ulevelmax) {
1305                 u.ulevelmax -= 1; /* see potion.c */
1306                 pluslvl(FALSE);
1307             } else {
1308                 u.uhpmax += 5;
1309                 if (Upolyd)
1310                     u.mhmax += 5;
1311             }
1312             u.uhp = u.uhpmax;
1313             if (Upolyd)
1314                 u.mh = u.mhmax;
1315             ABASE(A_STR) = AMAX(A_STR);
1316             if (u.uhunger < 900)
1317                 init_uhunger();
1318             if (u.uluck < 0)
1319                 u.uluck = 0;
1320             make_blinded(0L, TRUE);
1321             context.botl = 1;
1322             break;
1323         case 4: {
1324             register struct obj *otmp;
1325             int any = 0;
1326
1327             if (Blind)
1328 /*JP
1329                 You_feel("the power of %s.", u_gname());
1330 */
1331                 You("%s\82Ì\97Í\82ð\8a´\82\82½\81D", u_gname());
1332             else
1333 /*JP
1334                 You("are surrounded by %s aura.", an(hcolor(NH_LIGHT_BLUE)));
1335 */
1336                 You("%s\83I\81[\83\89\82É\82Â\82Â\82Ü\82ê\82½\81D", an(hcolor(NH_LIGHT_BLUE)));
1337             for (otmp = invent; otmp; otmp = otmp->nobj) {
1338                 if (otmp->cursed) {
1339                     if (!Blind) {
1340 #if 0 /*JP*/
1341                         pline("%s %s.", Yobjnam2(otmp, "softly glow"),
1342                               hcolor(NH_AMBER));
1343 #else
1344                         Your("%s\82Í%s\82â\82í\82ç\82©\82­\8bP\82¢\82½\81D", xname(otmp),
1345                              jconj_adj(hcolor(NH_AMBER)));
1346 #endif
1347                         iflags.last_msg = PLNMSG_OBJ_GLOWS;
1348                         otmp->bknown = TRUE;
1349                         ++any;
1350                     }
1351                     uncurse(otmp);
1352                 }
1353             }
1354             if (any)
1355                 update_inventory();
1356             break;
1357         }
1358         case 5: {
1359             static NEARDATA const char msg[] =
1360 /*JP
1361                 "\"and thus I grant thee the gift of %s!\"";
1362 */
1363                 "\81u\82³\82ç\82É\93ð\82É%s\82ð\82³\82¸\82¯\82æ\82¤\81I\81v";
1364
1365             godvoice(u.ualign.type,
1366 /*JP
1367                      "Thou hast pleased me with thy progress,");
1368 */
1369                      "\93ð\82Ì\90¬\92·\82Í\94ñ\8fí\82É\96]\82Ü\82µ\82¢\81C");
1370             if (!(HTelepat & INTRINSIC)) {
1371                 HTelepat |= FROMOUTSIDE;
1372 /*JP
1373                 pline(msg, "Telepathy");
1374 */
1375                 pline(msg, "\83e\83\8c\83p\83V\81[");
1376                 if (Blind)
1377                     see_monsters();
1378             } else if (!(HFast & INTRINSIC)) {
1379                 HFast |= FROMOUTSIDE;
1380 /*JP
1381                 pline(msg, "Speed");
1382 */
1383                 pline(msg, "\91¬\82³");
1384             } else if (!(HStealth & INTRINSIC)) {
1385                 HStealth |= FROMOUTSIDE;
1386 /*JP
1387                 pline(msg, "Stealth");
1388 */
1389                 pline(msg, "\94E\82Ì\97Í");
1390             } else {
1391                 if (!(HProtection & INTRINSIC)) {
1392                     HProtection |= FROMOUTSIDE;
1393                     if (!u.ublessed)
1394                         u.ublessed = rn1(3, 2);
1395                 } else
1396                     u.ublessed++;
1397 /*JP
1398                 pline(msg, "my protection");
1399 */
1400                 pline(msg, "\89ä\82ª\8cì\82è");
1401             }
1402 /*JP
1403             verbalize("Use it wisely in my name!");
1404 */
1405             verbalize("\89ä\82ª\96¼\82É\89\97\82¢\82Ä\97L\8cø\82É\8eg\82¤\82ª\82æ\82¢\81I");
1406             break;
1407         }
1408         case 7:
1409         case 8:
1410             if (u.ualign.record >= PIOUS && !u.uevent.uhand_of_elbereth) {
1411                 gcrownu();
1412                 break;
1413             } /* else FALLTHRU */
1414         case 6: {
1415             struct obj *otmp;
1416             int sp_no, trycnt = u.ulevel + 1;
1417
1418             /* not yet known spells given preference over already known ones
1419              */
1420             /* Also, try to grant a spell for which there is a skill slot */
1421             otmp = mkobj(SPBOOK_CLASS, TRUE);
1422             while (--trycnt > 0) {
1423                 if (otmp->otyp != SPE_BLANK_PAPER) {
1424                     for (sp_no = 0; sp_no < MAXSPELL; sp_no++)
1425                         if (spl_book[sp_no].sp_id == otmp->otyp)
1426                             break;
1427                     if (sp_no == MAXSPELL
1428                         && !P_RESTRICTED(spell_skilltype(otmp->otyp)))
1429                         break; /* usable, but not yet known */
1430                 } else {
1431                     if (!objects[SPE_BLANK_PAPER].oc_name_known
1432                         || carrying(MAGIC_MARKER))
1433                         break;
1434                 }
1435                 otmp->otyp = rnd_class(bases[SPBOOK_CLASS], SPE_BLANK_PAPER);
1436             }
1437             bless(otmp);
1438 /*JP
1439             at_your_feet("A spellbook");
1440 */
1441             at_your_feet("\96\82\96@\8f\91");
1442             place_object(otmp, u.ux, u.uy);
1443             newsym(u.ux, u.uy);
1444             break;
1445         }
1446         default:
1447             impossible("Confused deity!");
1448             break;
1449         }
1450
1451     u.ublesscnt = rnz(350);
1452     kick_on_butt = u.uevent.udemigod ? 1 : 0;
1453     if (u.uevent.uhand_of_elbereth)
1454         kick_on_butt++;
1455     if (kick_on_butt)
1456         u.ublesscnt += kick_on_butt * rnz(1000);
1457
1458     return;
1459 }
1460
1461 /* either blesses or curses water on the altar,
1462  * returns true if it found any water here.
1463  */
1464 STATIC_OVL boolean
1465 water_prayer(bless_water)
1466 boolean bless_water;
1467 {
1468     register struct obj *otmp;
1469     register long changed = 0;
1470     boolean other = FALSE, bc_known = !(Blind || Hallucination);
1471
1472     for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) {
1473         /* turn water into (un)holy water */
1474         if (otmp->otyp == POT_WATER
1475             && (bless_water ? !otmp->blessed : !otmp->cursed)) {
1476             otmp->blessed = bless_water;
1477             otmp->cursed = !bless_water;
1478             otmp->bknown = bc_known;
1479             changed += otmp->quan;
1480         } else if (otmp->oclass == POTION_CLASS)
1481             other = TRUE;
1482     }
1483     if (!Blind && changed) {
1484 #if 0 /*JP*/
1485         pline("%s potion%s on the altar glow%s %s for a moment.",
1486               ((other && changed > 1L) ? "Some of the"
1487                                        : (other ? "One of the" : "The")),
1488               ((other || changed > 1L) ? "s" : ""), (changed > 1L ? "" : "s"),
1489               (bless_water ? hcolor(NH_LIGHT_BLUE) : hcolor(NH_BLACK)));
1490 #else
1491         pline("%s\8dÕ\92d\82Ì\96ò\82Í\88ê\8fu%s\8bP\82¢\82½\81D",
1492               (other && changed > 1L) ? "\82¢\82­\82Â\82©\82Ì"
1493                                       : "",
1494               jconj_adj(bless_water ? hcolor(NH_LIGHT_BLUE) : hcolor(NH_BLACK)));
1495 #endif
1496     }
1497     return (boolean) (changed > 0L);
1498 }
1499
1500 STATIC_OVL void
1501 godvoice(g_align, words)
1502 aligntyp g_align;
1503 const char *words;
1504 {
1505 #if 0 /*JP*/
1506     const char *quot = "";
1507
1508     if (words)
1509         quot = "\"";
1510     else
1511         words = "";
1512
1513     pline_The("voice of %s %s: %s%s%s", align_gname(g_align),
1514               godvoices[rn2(SIZE(godvoices))], quot, words, quot);
1515 #else
1516     if (words)
1517         pline("%s\82Ì\90º\82ª%s: \81u%s\81v", align_gname(g_align),
1518               godvoices[rn2(SIZE(godvoices))], words);
1519     else
1520         pline("%s\82Ì\90º\82ª%s\81F", align_gname(g_align),
1521               godvoices[rn2(SIZE(godvoices))]);
1522 #endif
1523 }
1524
1525 STATIC_OVL void
1526 gods_angry(g_align)
1527 aligntyp g_align;
1528 {
1529 /*JP
1530     godvoice(g_align, "Thou hast angered me.");
1531 */
1532     godvoice(g_align, "\93ð\81C\89ä\82ð\93{\82ç\82µ\82ß\82½\82è\81D");
1533 }
1534
1535 /* The g_align god is upset with you. */
1536 STATIC_OVL void
1537 gods_upset(g_align)
1538 aligntyp g_align;
1539 {
1540     if (g_align == u.ualign.type)
1541         u.ugangr++;
1542     else if (u.ugangr)
1543         u.ugangr--;
1544     angrygods(g_align);
1545 }
1546
1547 STATIC_OVL void
1548 consume_offering(otmp)
1549 register struct obj *otmp;
1550 {
1551     if (Hallucination)
1552         switch (rn2(3)) {
1553         case 0:
1554 /*JP
1555             Your("sacrifice sprouts wings and a propeller and roars away!");
1556 */
1557             Your("\8c£\8fã\95¨\82Í\89H\82ð\82Í\82â\82µ\81C\83v\83\8d\83y\83\89\82ª\82Ü\82í\82è\81C\94ò\82ñ\82Å\82Á\82½\81I");
1558             break;
1559         case 1:
1560 /*JP
1561             Your("sacrifice puffs up, swelling bigger and bigger, and pops!");
1562 */
1563             Your("\8c£\8fã\95¨\82Í\95¬\89\8c\82ð\82 \82°\81C\82Ç\82ñ\82Ç\82ñ\96c\82ê\81C\82»\82µ\82Ä\82Í\82\82¯\82½\81I");
1564             break;
1565         case 2:
1566             Your(
1567 /*JP
1568      "sacrifice collapses into a cloud of dancing particles and fades away!");
1569 */
1570      "\8c£\8fã\95¨\82Í\8d×\82©\82­\8dÓ\82¯\81C\97x\82è\8fo\82µ\81C\82Ç\82±\82©\82É\8ds\82Á\82Ä\82µ\82Ü\82Á\82½\81I");
1571             break;
1572         }
1573     else if (Blind && u.ualign.type == A_LAWFUL)
1574 /*JP
1575         Your("sacrifice disappears!");
1576 */
1577         Your("\8c£\8fã\95¨\82Í\8fÁ\82¦\82½\81I");
1578     else
1579 #if 0 /*JP*/
1580         Your("sacrifice is consumed in a %s!",
1581              u.ualign.type == A_LAWFUL ? "flash of light" : "burst of flame");
1582 #else
1583         Your("\8c£\8fã\95¨\82Í%s\8fÁ\82¦\82³\82Á\82½\81I",
1584              u.ualign.type == A_LAWFUL ? "\82Ü\82Î\82ä\82¢\8cõ\82ð\95ú\82¿" : "\89\8a\82ð\8fã\82°");
1585 #endif
1586     if (carried(otmp))
1587         useup(otmp);
1588     else
1589         useupf(otmp, 1L);
1590     exercise(A_WIS, TRUE);
1591 }
1592
1593 int
1594 dosacrifice()
1595 {
1596     static NEARDATA const char cloud_of_smoke[] =
1597 /*JP
1598         "A cloud of %s smoke surrounds you...";
1599 */
1600         "%s\89\8c\82ª\82 \82È\82½\82ð\8eæ\82è\88Í\82ñ\82¾\81D\81D\81D";
1601     register struct obj *otmp;
1602     int value = 0, pm;
1603     boolean highaltar;
1604     aligntyp altaralign = a_align(u.ux, u.uy);
1605
1606     if (!on_altar() || u.uswallow) {
1607 /*JP
1608         You("are not standing on an altar.");
1609 */
1610         You("\8dÕ\92d\82Ì\8fã\82É\97§\82Á\82Ä\82¢\82È\82¢\81D");
1611         return 0;
1612     }
1613     highaltar = ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz))
1614                  && (levl[u.ux][u.uy].altarmask & AM_SHRINE));
1615
1616     otmp = floorfood("sacrifice", 1);
1617     if (!otmp)
1618         return 0;
1619     /*
1620      * Was based on nutritional value and aging behavior (< 50 moves).
1621      * Sacrificing a food ration got you max luck instantly, making the
1622      * gods as easy to please as an angry dog!
1623      *
1624      * Now only accepts corpses, based on the game's evaluation of their
1625      * toughness.  Human and pet sacrifice, as well as sacrificing unicorns
1626      * of your alignment, is strongly discouraged.
1627      */
1628 #define MAXVALUE 24 /* Highest corpse value (besides Wiz) */
1629
1630     if (otmp->otyp == CORPSE) {
1631         register struct permonst *ptr = &mons[otmp->corpsenm];
1632         struct monst *mtmp;
1633         extern const int monstr[];
1634
1635         /* KMH, conduct */
1636         u.uconduct.gnostic++;
1637
1638         /* you're handling this corpse, even if it was killed upon the altar
1639          */
1640         feel_cockatrice(otmp, TRUE);
1641         if (rider_corpse_revival(otmp, FALSE))
1642             return 1;
1643
1644         if (otmp->corpsenm == PM_ACID_BLOB
1645             || (monstermoves <= peek_at_iced_corpse_age(otmp) + 50)) {
1646             value = monstr[otmp->corpsenm] + 1;
1647             if (otmp->oeaten)
1648                 value = eaten_stat(value, otmp);
1649         }
1650
1651         if (your_race(ptr)) {
1652             if (is_demon(youmonst.data)) {
1653 /*JP
1654                 You("find the idea very satisfying.");
1655 */
1656                 You("\82»\82Ì\8dl\82¦\82Í\91f\90°\82µ\82¢\82Æ\8ev\82Á\82½\81D");
1657                 exercise(A_WIS, TRUE);
1658             } else if (u.ualign.type != A_CHAOTIC) {
1659 /*JP
1660                 pline("You'll regret this infamous offense!");
1661 */
1662                 pline("\93ð\81C\82±\82Ì\95\8e\90J\82Ì\8ds\82È\82¢\82ð\8cã\89÷\82·\82é\82×\82µ\81I");
1663                 exercise(A_WIS, FALSE);
1664             }
1665
1666             if (highaltar
1667                 && (altaralign != A_CHAOTIC || u.ualign.type != A_CHAOTIC)) {
1668                 goto desecrate_high_altar;
1669             } else if (altaralign != A_CHAOTIC && altaralign != A_NONE) {
1670                 /* curse the lawful/neutral altar */
1671 /*JP
1672                 pline_The("altar is stained with %s blood.", urace.adj);
1673 */
1674                 pline("\8dÕ\92d\82Í%s\82Ì\8c\8c\82Å\89\98\82ê\82Ä\82¢\82é\81D", urace.adj);
1675                 levl[u.ux][u.uy].altarmask = AM_CHAOTIC;
1676                 angry_priest();
1677             } else {
1678                 struct monst *dmon;
1679                 const char *demonless_msg;
1680
1681                 /* Human sacrifice on a chaotic or unaligned altar */
1682                 /* is equivalent to demon summoning */
1683                 if (altaralign == A_CHAOTIC && u.ualign.type != A_CHAOTIC) {
1684                     pline(
1685 /*JP
1686                     "The blood floods the altar, which vanishes in %s cloud!",
1687 */
1688                     "\8c\8c\82ª\8dÕ\92d\82©\82ç\82 \82Ó\82ê\81C\8dÕ\92d\82Í%s\89_\82Æ\82È\82è\8fÁ\82¦\82½\81I",
1689                           an(hcolor(NH_BLACK)));
1690                     levl[u.ux][u.uy].typ = ROOM;
1691                     levl[u.ux][u.uy].altarmask = 0;
1692                     newsym(u.ux, u.uy);
1693                     angry_priest();
1694 /*JP
1695                     demonless_msg = "cloud dissipates";
1696 */
1697                     demonless_msg = "\89_\82Í\8fÁ\82¦\82½\81D";
1698                 } else {
1699                     /* either you're chaotic or altar is Moloch's or both */
1700 /*JP
1701                     pline_The("blood covers the altar!");
1702 */
1703                     pline("\8c\8c\82ª\8dÕ\92d\82ð\95¢\82Á\82½\81I");
1704                     change_luck(altaralign == A_NONE ? -2 : 2);
1705 /*JP
1706                     demonless_msg = "blood coagulates";
1707 */
1708                     demonless_msg = "\8c\8c\82ª\82±\82Ñ\82è\82Â\82¢\82½";
1709                 }
1710                 if ((pm = dlord(altaralign)) != NON_PM
1711                     && (dmon = makemon(&mons[pm], u.ux, u.uy, NO_MM_FLAGS))
1712                            != 0) {
1713                     char dbuf[BUFSZ];
1714
1715                     Strcpy(dbuf, a_monnam(dmon));
1716 /*JP
1717                     if (!strcmpi(dbuf, "it"))
1718 */
1719                     if (!strcmpi(dbuf, "\89½\8eÒ\82©"))
1720 /*JP
1721                         Strcpy(dbuf, "something dreadful");
1722 */
1723                         Strcpy(dbuf, "\89½\82©\8b°\82ë\82µ\82¢\82à\82Ì");
1724                     else
1725                         dmon->mstrategy &= ~STRAT_APPEARMSG;
1726 /*JP
1727                     You("have summoned %s!", dbuf);
1728 */
1729                     You("%s\82ð\8f¢\8a«\82µ\82½\81I", dbuf);
1730                     if (sgn(u.ualign.type) == sgn(dmon->data->maligntyp))
1731                         dmon->mpeaceful = TRUE;
1732 /*JP
1733                     You("are terrified, and unable to move.");
1734 */
1735                     You("\8b°\95|\82Å\93®\82¯\82È\82­\82È\82Á\82½\81D");
1736                     nomul(-3);
1737                     multi_reason = "being terrified of a demon";
1738                     nomovemsg = 0;
1739                 } else
1740 /*JP
1741                     pline_The("%s.", demonless_msg);
1742 */
1743                     pline("%s\81D", demonless_msg);
1744             }
1745
1746             if (u.ualign.type != A_CHAOTIC) {
1747                 adjalign(-5);
1748                 u.ugangr += 3;
1749                 (void) adjattrib(A_WIS, -1, TRUE);
1750                 if (!Inhell)
1751                     angrygods(u.ualign.type);
1752                 change_luck(-5);
1753             } else
1754                 adjalign(5);
1755             if (carried(otmp))
1756                 useup(otmp);
1757             else
1758                 useupf(otmp, 1L);
1759             return 1;
1760         } else if (has_omonst(otmp)
1761                    && (mtmp = get_mtraits(otmp, FALSE)) != 0
1762                    && mtmp->mtame) {
1763                 /* mtmp is a temporary pointer to a tame monster's attributes,
1764                  * not a real monster */
1765 /*JP
1766             pline("So this is how you repay loyalty?");
1767 */
1768             pline("\82»\82ê\82Å\82±\82ê\82ª\82 \82È\82½\82Ì\92\89\8b`\82É\95ñ\82¢\82é\82à\82Ì\82©\81H");
1769             adjalign(-3);
1770             value = -1;
1771             HAggravate_monster |= FROMOUTSIDE;
1772         } else if (is_undead(ptr)) { /* Not demons--no demon corpses */
1773             if (u.ualign.type != A_CHAOTIC)
1774                 value += 1;
1775         } else if (is_unicorn(ptr)) {
1776             int unicalign = sgn(ptr->maligntyp);
1777
1778             if (unicalign == altaralign) {
1779                 /* When same as altar, always a very bad action.
1780                  */
1781 #if 0 /*JP*/
1782                 pline("Such an action is an insult to %s!",
1783                       (unicalign == A_CHAOTIC) ? "chaos"
1784                          : unicalign ? "law" : "balance");
1785 #else
1786                 pline("\82»\82Ì\82æ\82¤\82È\8ds\93®\82Í\81w%s\81x\82É\94½\82·\82é\81I",
1787                       (unicalign == A_CHAOTIC) ? "\8d¬\93×"
1788                          : unicalign ? "\92\81\8f\98" : "\92²\98a");
1789 #endif
1790                 (void) adjattrib(A_WIS, -1, TRUE);
1791                 value = -5;
1792             } else if (u.ualign.type == altaralign) {
1793                 /* When different from altar, and altar is same as yours,
1794                  * it's a very good action.
1795                  */
1796                 if (u.ualign.record < ALIGNLIM)
1797 /*JP
1798                     You_feel("appropriately %s.", align_str(u.ualign.type));
1799 */
1800                     You("%s\82É\82Ó\82³\82í\82µ\82¢\82Æ\8a´\82\82½\81D", align_str(u.ualign.type));
1801                 else
1802 /*JP
1803                     You_feel("you are thoroughly on the right path.");
1804 */
1805                     You("\8a®\91S\82É\90³\82µ\82¢\93¹\82ð\95à\82ñ\82Å\82¢\82é\82Ì\82ð\8a´\82\82½\81D");
1806                 adjalign(5);
1807                 value += 3;
1808             } else if (unicalign == u.ualign.type) {
1809                 /* When sacrificing unicorn of your alignment to altar not of
1810                  * your alignment, your god gets angry and it's a conversion.
1811                  */
1812                 u.ualign.record = -1;
1813                 value = 1;
1814             } else {
1815                 /* Otherwise, unicorn's alignment is different from yours
1816                  * and different from the altar's.  It's an ordinary (well,
1817                  * with a bonus) sacrifice on a cross-aligned altar.
1818                  */
1819                 value += 3;
1820             }
1821         }
1822     } /* corpse */
1823
1824     if (otmp->otyp == AMULET_OF_YENDOR) {
1825         if (!highaltar) {
1826         too_soon:
1827             if (altaralign == A_NONE && Inhell)
1828                 /* hero has left Moloch's Sanctum so is in the process
1829                    of getting away with the Amulet (outside of Gehennom,
1830                    fall through to the "ashamed" feedback) */
1831                 gods_upset(A_NONE);
1832             else
1833 #if 0 /*JP*/
1834                 You_feel("%s.",
1835                          Hallucination
1836                             ? "homesick"
1837                             /* if on track, give a big hint */
1838                             : (altaralign == u.ualign.type)
1839                                ? "an urge to return to the surface"
1840                                /* else headed towards celestial disgrace */
1841                                : "ashamed");
1842 #else
1843                 You_feel("%s\81D",
1844                          Hallucination
1845                             ? "\8cÌ\8b½\82ª\97ö\82µ\82­\82È\82Á\82½"
1846                             /* if on track, give a big hint */
1847                             : (altaralign == u.ualign.type)
1848                                ? "\92n\8fã\82É\8bA\82è\82½\82¢\8bC\8e\9d\82É\8bì\82è\97§\82Ä\82ç\82ê\82½"
1849                                /* else headed towards celestial disgrace */
1850                                : "\92p\82¸\82©\82µ\82¢\8ev\82¢\82ª\82µ\82½");
1851 #endif
1852             return 1;
1853         } else {
1854             /* The final Test.  Did you win? */
1855             if (uamul == otmp)
1856                 Amulet_off();
1857             u.uevent.ascended = 1;
1858             if (carried(otmp))
1859                 useup(otmp); /* well, it's gone now */
1860             else
1861                 useupf(otmp, 1L);
1862 /*JP
1863             You("offer the Amulet of Yendor to %s...", a_gname());
1864 */
1865             You("\83C\83F\83\93\83_\81[\82Ì\96\82\8f\9c\82¯\82ð%s\82É\8c£\8fã\82µ\82½\81D\81D\81D",a_gname());
1866             if (altaralign == A_NONE) {
1867                 /* Moloch's high altar */
1868                 if (u.ualign.record > -99)
1869                     u.ualign.record = -99;
1870                 /*[apparently shrug/snarl can be sensed without being seen]*/
1871                 pline("%s shrugs and retains dominion over %s,", Moloch,
1872                       u_gname());
1873                 pline("then mercilessly snuffs out your life.");
1874                 Sprintf(killer.name, "%s indifference", s_suffix(Moloch));
1875                 killer.format = KILLED_BY;
1876                 done(DIED);
1877                 /* life-saved (or declined to die in wizard/explore mode) */
1878                 pline("%s snarls and tries again...", Moloch);
1879                 fry_by_god(A_NONE, TRUE); /* wrath of Moloch */
1880                 /* declined to die in wizard or explore mode */
1881                 pline(cloud_of_smoke, hcolor(NH_BLACK));
1882                 done(ESCAPED);
1883             } else if (u.ualign.type != altaralign) {
1884                 /* And the opposing team picks you up and
1885                    carries you off on their shoulders */
1886                 adjalign(-99);
1887 #if 0 /*JP*/
1888                 pline("%s accepts your gift, and gains dominion over %s...",
1889                       a_gname(), u_gname());
1890 #else
1891                 pline("%s\82Í\82 \82È\82½\82Ì\91\97\82è\95¨\82ð\8eó\82¯\82Æ\82è\81C%s\82Ì\8c \97Í\82ð\93¾\82½\81D\81D\81D",
1892                       a_gname(), u_gname());
1893 #endif
1894 /*JP
1895                 pline("%s is enraged...", u_gname());
1896 */
1897                 pline("%s\82Í\8c\83\93{\82µ\82½\81D\81D\81D", u_gname());
1898 /*JP
1899                 pline("Fortunately, %s permits you to live...", a_gname());
1900 */
1901                 pline("\8dK\89^\82É\82à\81C%s\82Í\82 \82È\82½\82Ì\91\8dÝ\82ð\8b\96\82µ\82Ä\82¢\82é\81D\81D\81D",a_gname());
1902                 pline(cloud_of_smoke, hcolor(NH_ORANGE));
1903                 done(ESCAPED);
1904             } else { /* super big win */
1905                 adjalign(10);
1906                 u.uachieve.ascended = 1;
1907                 pline(
1908 /*JP
1909                "An invisible choir sings, and you are bathed in radiance...");
1910 */
1911                 "\82Ç\82±\82©\82ç\82Æ\82à\82È\82­\90¹\89Ì\91à\82Ì\89Ì\82ª\95·\82±\82¦\81C\82 \82È\82½\82Í\8cõ\82É\95ï\82Ü\82ê\82½\81D\81D\81D");
1912 /*JP
1913                 godvoice(altaralign, "Congratulations, mortal!");
1914 */
1915                 godvoice(altaralign, "\82æ\82­\82â\82Á\82½\81I\92è\96½\82Ì\8eÒ\82æ\81I");
1916                 display_nhwindow(WIN_MESSAGE, FALSE);
1917                 verbalize(
1918 /*JP
1919           "In return for thy service, I grant thee the gift of Immortality!");
1920 */
1921           "\93ð\82Ì\88Ì\8bÆ\82É\91Î\82µ\81C\95s\8e\80\82Ì\91Ì\82ð\95ù\82°\82æ\82¤\82¼\81I");
1922 #if 0 /*JP*/
1923                 You("ascend to the status of Demigod%s...",
1924                     flags.female ? "dess" : "");
1925 #else
1926                 You("\8f¸\93V\82µ\81C%s\90_\82Æ\82È\82Á\82½\81D\81D\81D",
1927                     flags.female ? "\8f\97" : "");
1928 #endif
1929                 done(ASCENDED);
1930             }
1931         }
1932     } /* real Amulet */
1933
1934     if (otmp->otyp == FAKE_AMULET_OF_YENDOR) {
1935         if (!highaltar && !otmp->known)
1936             goto too_soon;
1937 /*JP
1938         You_hear("a nearby thunderclap.");
1939 */
1940         You("\8bß\82­\82É\97\8b\82ª\97\8e\82¿\82½\89¹\82ð\95·\82¢\82½\81D");
1941         if (!otmp->known) {
1942 #if 0 /*JP*/
1943             You("realize you have made a %s.",
1944                 Hallucination ? "boo-boo" : "mistake");
1945 #else
1946             You("%s\82±\82Æ\82É\8bC\82ª\82Â\82¢\82½\81D",
1947                 Hallucination ? "\81u\83n\83Y\83\8c\81v\82¾\82Á\82½" : "\8aÔ\88á\82¢\82ð\94Æ\82µ\82½");
1948 #endif
1949             otmp->known = TRUE;
1950             change_luck(-1);
1951             return 1;
1952         } else {
1953             /* don't you dare try to fool the gods */
1954             if (Deaf)
1955 #if 0 /*JP*/
1956                 pline("Oh, no."); /* didn't hear thunderclap */
1957 #else
1958                 pline("\82È\82ñ\82Ä\82±\82Á\82½\81D"); /* didn't hear thunderclap */
1959 #endif
1960             change_luck(-3);
1961             adjalign(-1);
1962             u.ugangr += 3;
1963             value = -3;
1964         }
1965     } /* fake Amulet */
1966
1967     if (value == 0) {
1968         pline1(nothing_happens);
1969         return 1;
1970     }
1971
1972     if (altaralign != u.ualign.type && highaltar) {
1973     desecrate_high_altar:
1974         /*
1975          * REAL BAD NEWS!!! High altars cannot be converted.  Even an attempt
1976          * gets the god who owns it truly pissed off.
1977          */
1978 /*JP
1979         You_feel("the air around you grow charged...");
1980 */
1981         You("\89ñ\82è\82Ì\8bó\8bC\82É\83G\83l\83\8b\83M\81[\82ª\96\9e\82¿\82Ä\82¢\82­\82æ\82¤\82È\8bC\82ª\82µ\82½\81D\81D\81D");
1982 /*JP
1983         pline("Suddenly, you realize that %s has noticed you...", a_gname());
1984 */
1985         pline("\93Ë\91R\81C%s\82ª\82 \82È\82½\82ð\82\82Á\82Æ\8c©\82Ä\82¢\82é\82Ì\82É\8bC\82ª\82Â\82¢\82½\81D\81D\81D",a_gname());
1986         godvoice(altaralign,
1987 /*JP
1988                  "So, mortal!  You dare desecrate my High Temple!");
1989 */
1990                  "\92è\96½\82Ì\8eÒ\82æ\81I\82¨\82Ü\82¦\82Í\89ä\82ª\90_\90¹\82È\82é\8e\9b\89@\82ð\89\98\82·\82Ì\82©\81I");
1991         /* Throw everything we have at the player */
1992         god_zaps_you(altaralign);
1993     } else if (value
1994                < 0) { /* I don't think the gods are gonna like this... */
1995         gods_upset(altaralign);
1996     } else {
1997         int saved_anger = u.ugangr;
1998         int saved_cnt = u.ublesscnt;
1999         int saved_luck = u.uluck;
2000
2001         /* Sacrificing at an altar of a different alignment */
2002         if (u.ualign.type != altaralign) {
2003             /* Is this a conversion ? */
2004             /* An unaligned altar in Gehennom will always elicit rejection. */
2005             if (ugod_is_angry() || (altaralign == A_NONE && Inhell)) {
2006                 if (u.ualignbase[A_CURRENT] == u.ualignbase[A_ORIGINAL]
2007                     && altaralign != A_NONE) {
2008 /*JP
2009                     You("have a strong feeling that %s is angry...",
2010 */
2011                     You("%s\82ª\93{\82Á\82Ä\82¢\82é\82Ì\82ð\8am\90M\82µ\82½\81D\81D\81D",
2012                         u_gname());
2013                     consume_offering(otmp);
2014 /*JP
2015                     pline("%s accepts your allegiance.", a_gname());
2016 */
2017                     pline("%s\82Í\82 \82È\82½\82Ì\91®\90«\82ð\8eó\82¯\82¢\82ê\82½\81D", a_gname());
2018
2019                     uchangealign(altaralign, 0);
2020                     /* Beware, Conversion is costly */
2021                     change_luck(-3);
2022                     u.ublesscnt += 300;
2023                 } else {
2024                     u.ugangr += 3;
2025                     adjalign(-5);
2026 /*JP
2027                     pline("%s rejects your sacrifice!", a_gname());
2028 */
2029                     pline("%s\82Í\82 \82È\82½\82Ì\8c£\8fã\95¨\82ð\8eó\82¯\82¢\82ê\82È\82¢\81I", a_gname());
2030 /*JP
2031                     godvoice(altaralign, "Suffer, infidel!");
2032 */
2033                     godvoice(altaralign, "\88Ù\92[\8eÒ\82æ\81I\8e¸\82¹\82ë\81I\81I");
2034                     change_luck(-5);
2035                     (void) adjattrib(A_WIS, -2, TRUE);
2036                     if (!Inhell)
2037                         angrygods(u.ualign.type);
2038                 }
2039                 return 1;
2040             } else {
2041                 consume_offering(otmp);
2042 #if 0 /*JP*/
2043                 You("sense a conflict between %s and %s.", u_gname(),
2044                     a_gname());
2045 #else
2046                 You("%s\82Æ%s\8aÔ\82Ì\91\88\82¢\82ð\8a´\82\82½\81D", u_gname(),
2047                     a_gname());
2048 #endif
2049                 if (rn2(8 + u.ulevel) > 5) {
2050                     struct monst *pri;
2051 /*JP
2052                     You_feel("the power of %s increase.", u_gname());
2053 */
2054                     You("%s\82Ì\97Í\82ª\91\9d\91å\82µ\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", u_gname());
2055                     exercise(A_WIS, TRUE);
2056                     change_luck(1);
2057                     /* Yes, this is supposed to be &=, not |= */
2058                     levl[u.ux][u.uy].altarmask &= AM_SHRINE;
2059                     /* the following accommodates stupid compilers */
2060                     levl[u.ux][u.uy].altarmask =
2061                         levl[u.ux][u.uy].altarmask
2062                         | (Align2amask(u.ualign.type));
2063                     if (!Blind)
2064 #if 0 /*JP*/
2065                         pline_The("altar glows %s.",
2066                                   hcolor((u.ualign.type == A_LAWFUL)
2067                                             ? NH_WHITE
2068                                             : u.ualign.type
2069                                                ? NH_BLACK
2070                                                : (const char *) "gray"));
2071 #else
2072                         pline("\8dÕ\92d\82Í%s\8bP\82¢\82½\81D",
2073                               jconj_adj(hcolor((u.ualign.type == A_LAWFUL)
2074                                             ? NH_WHITE
2075                                             : u.ualign.type
2076                                                ? NH_BLACK
2077                                                : (const char *)"\8aD\90F\82Ì")));
2078 #endif
2079
2080                     if (rnl(u.ulevel) > 6 && u.ualign.record > 0
2081                         && rnd(u.ualign.record) > (3 * ALIGNLIM) / 4)
2082                         summon_minion(altaralign, TRUE);
2083                     /* anger priest; test handles bones files */
2084                     if ((pri = findpriest(temple_occupied(u.urooms)))
2085                         && !p_coaligned(pri))
2086                         angry_priest();
2087                 } else {
2088 /*JP
2089                     pline("Unluckily, you feel the power of %s decrease.",
2090 */
2091                     pline("\95s\8dK\82É\82à\81C%s\82Ì\97Í\82ª\8c¸\8f­\82µ\82½\82Ì\82ð\8a´\82\82½\81D",
2092                           u_gname());
2093                     change_luck(-1);
2094                     exercise(A_WIS, FALSE);
2095                     if (rnl(u.ulevel) > 6 && u.ualign.record > 0
2096                         && rnd(u.ualign.record) > (7 * ALIGNLIM) / 8)
2097                         summon_minion(altaralign, TRUE);
2098                 }
2099                 return 1;
2100             }
2101         }
2102
2103         consume_offering(otmp);
2104         /* OK, you get brownie points. */
2105         if (u.ugangr) {
2106             u.ugangr -= ((value * (u.ualign.type == A_CHAOTIC ? 2 : 3))
2107                          / MAXVALUE);
2108             if (u.ugangr < 0)
2109                 u.ugangr = 0;
2110             if (u.ugangr != saved_anger) {
2111                 if (u.ugangr) {
2112 #if 0 /*JP*/
2113                     pline("%s seems %s.", u_gname(),
2114                           Hallucination ? "groovy" : "slightly mollified");
2115 #else
2116                     pline("%s\82Í%s\82É\8c©\82¦\82é\81D", u_gname(),
2117                           Hallucination ? "\91f\93G" : "\82¿\82å\82Á\82Æ\98a\82ç\82¢\82¾\82æ\82¤");
2118 #endif
2119
2120                     if ((int) u.uluck < 0)
2121                         change_luck(1);
2122                 } else {
2123 #if 0 /*JP*/
2124                     pline("%s seems %s.", u_gname(),
2125                           Hallucination ? "cosmic (not a new fact)"
2126                                         : "mollified");
2127 #else
2128                     pline("%s\82Í%s\82É\8c©\82¦\82é\81D", u_gname(),
2129                           Hallucination ? "\93ø\90F(\90V\8e\96\8eÀ\82Å\82Í\82È\82¢)"
2130                                         : "\8cy\95Ì\82µ\82½\82æ\82¤");
2131 #endif
2132
2133                     if ((int) u.uluck < 0)
2134                         u.uluck = 0;
2135                 }
2136             } else { /* not satisfied yet */
2137                 if (Hallucination)
2138 /*JP
2139                     pline_The("gods seem tall.");
2140 */
2141                     pline("\90_\82Í\82¨\8d\82\82­\82Æ\82Ü\82Á\82Ä\82¢\82é\82æ\82¤\82É\8c©\82¦\82é\81D");
2142                 else
2143 /*JP
2144                     You("have a feeling of inadequacy.");
2145 */
2146                     You("\82Ü\82¾\82Ü\82¾\82¾\82Æ\8a´\82\82½\81D");
2147             }
2148         } else if (ugod_is_angry()) {
2149             if (value > MAXVALUE)
2150                 value = MAXVALUE;
2151             if (value > -u.ualign.record)
2152                 value = -u.ualign.record;
2153             adjalign(value);
2154 /*JP
2155             You_feel("partially absolved.");
2156 */
2157             You("\8f­\82µ\82¾\82¯\82ä\82é\82µ\82Ä\82à\82ç\82¦\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
2158         } else if (u.ublesscnt > 0) {
2159             u.ublesscnt -= ((value * (u.ualign.type == A_CHAOTIC ? 500 : 300))
2160                             / MAXVALUE);
2161             if (u.ublesscnt < 0)
2162                 u.ublesscnt = 0;
2163             if (u.ublesscnt != saved_cnt) {
2164                 if (u.ublesscnt) {
2165                     if (Hallucination)
2166 /*JP
2167                         You("realize that the gods are not like you and I.");
2168 */
2169                         You("\90_\82Æ\83c\81[\83J\81[\82Ì\92\87\82Å\82Í\82È\82¢\82±\82Æ\82ð\8cå\82Á\82½\81D");
2170                     else
2171 /*JP
2172                         You("have a hopeful feeling.");
2173 */
2174                         pline("\8aó\96]\82ª\8c©\82¦\82Ä\82«\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
2175                     if ((int) u.uluck < 0)
2176                         change_luck(1);
2177                 } else {
2178                     if (Hallucination)
2179 /*JP
2180                         pline("Overall, there is a smell of fried onions.");
2181 */
2182                         pline("\82½\82Ü\82Ë\82¬\82ð\97g\82°\82½\93õ\82¢\82ª\82µ\82½\81D");
2183                     else
2184 /*JP
2185                         You("have a feeling of reconciliation.");
2186 */
2187                         You("\8b\96\82³\82ê\82½\8bC\82ª\82µ\82½\81D");
2188                     if ((int) u.uluck < 0)
2189                         u.uluck = 0;
2190                 }
2191             }
2192         } else {
2193             int nartifacts = nartifact_exist();
2194
2195             /* you were already in pretty good standing */
2196             /* The player can gain an artifact */
2197             /* The chance goes down as the number of artifacts goes up */
2198             if (u.ulevel > 2 && u.uluck >= 0
2199                 && !rn2(10 + (2 * u.ugifts * nartifacts))) {
2200                 otmp = mk_artifact((struct obj *) 0, a_align(u.ux, u.uy));
2201                 if (otmp) {
2202                     if (otmp->spe < 0)
2203                         otmp->spe = 0;
2204                     if (otmp->cursed)
2205                         uncurse(otmp);
2206                     otmp->oerodeproof = TRUE;
2207 /*JP
2208                     at_your_feet("An object");
2209 */
2210                     at_your_feet("\89½\82©");
2211                     dropy(otmp);
2212 /*JP
2213                     godvoice(u.ualign.type, "Use my gift wisely!");
2214 */
2215                     godvoice(u.ualign.type, "\89ä\82ª\97^\82¦\82µ\82à\82Ì\8c«\82­\8eg\82¤\82×\82µ\81I");
2216                     u.ugifts++;
2217                     u.ublesscnt = rnz(300 + (50 * nartifacts));
2218                     exercise(A_WIS, TRUE);
2219                     /* make sure we can use this weapon */
2220                     unrestrict_weapon_skill(weapon_type(otmp));
2221                     if (!Hallucination && !Blind) {
2222                         otmp->dknown = 1;
2223                         makeknown(otmp->otyp);
2224                         discover_artifact(otmp->oartifact);
2225                     }
2226                     return 1;
2227                 }
2228             }
2229             change_luck((value * LUCKMAX) / (MAXVALUE * 2));
2230             if ((int) u.uluck < 0)
2231                 u.uluck = 0;
2232             if (u.uluck != saved_luck) {
2233                 if (Blind)
2234 #if 0 /*JP*/
2235                     You("think %s brushed your %s.", something,
2236                         body_part(FOOT));
2237 #else
2238                     pline("%s\82ª\82 \82È\82½\82Ì%s\82ð\82­\82·\82®\82Á\82½\82æ\82¤\82¾\81D", something,
2239                           body_part(FOOT));
2240 #endif
2241                 else
2242 #if 0 /*JP*/
2243                     You(Hallucination
2244                     ? "see crabgrass at your %s.  A funny thing in a dungeon."
2245                             : "glimpse a four-leaf clover at your %s.",
2246                         makeplural(body_part(FOOT)));
2247 #else
2248                     You(Hallucination
2249                     ? "\91«\8c³\82É\83y\83\93\83y\83\93\91\90\82ð\82Ý\82Â\82¯\82½\81D\96À\8b{\82É\82µ\82Ä\82Í\92¿\82µ\82¢\81D"
2250                             : "\8el\97t\82Ì\83N\83\8d\81[\83o\81[\82ð\91«\8c³\82É\8c©\82Â\82¯\82½\81D");
2251 #endif
2252             }
2253         }
2254     }
2255     return 1;
2256 }
2257
2258 /* determine prayer results in advance; also used for enlightenment */
2259 boolean
2260 can_pray(praying)
2261 boolean praying; /* false means no messages should be given */
2262 {
2263     int alignment;
2264
2265     p_aligntyp = on_altar() ? a_align(u.ux, u.uy) : u.ualign.type;
2266     p_trouble = in_trouble();
2267
2268     if (is_demon(youmonst.data) && (p_aligntyp != A_CHAOTIC)) {
2269         if (praying)
2270 #if 0 /*JP*/
2271             pline_The("very idea of praying to a %s god is repugnant to you.",
2272                       p_aligntyp ? "lawful" : "neutral");
2273 #else
2274             pline("%s\82Ì\90_\82É\8bF\82è\82ð\82³\82³\82°\82é\82Ì\82Í\8fí\8e¯\82É\94w\82­\81D",
2275                 p_aligntyp ? "\92\81\8f\98" : "\92\86\97§");
2276 #endif
2277         return FALSE;
2278     }
2279
2280     if (praying)
2281 /*JP
2282         You("begin praying to %s.", align_gname(p_aligntyp));
2283 */
2284         You("%s\82É\8bF\82è\82ð\95ù\82°\82½\81D", align_gname(p_aligntyp));
2285
2286     if (u.ualign.type && u.ualign.type == -p_aligntyp)
2287         alignment = -u.ualign.record; /* Opposite alignment altar */
2288     else if (u.ualign.type != p_aligntyp)
2289         alignment = u.ualign.record / 2; /* Different alignment altar */
2290     else
2291         alignment = u.ualign.record;
2292
2293     if ((p_trouble > 0) ? (u.ublesscnt > 200)      /* big trouble */
2294            : (p_trouble < 0) ? (u.ublesscnt > 100) /* minor difficulties */
2295               : (u.ublesscnt > 0))                 /* not in trouble */
2296         p_type = 0;                     /* too soon... */
2297     else if ((int) Luck < 0 || u.ugangr || alignment < 0)
2298         p_type = 1; /* too naughty... */
2299     else /* alignment >= 0 */ {
2300         if (on_altar() && u.ualign.type != p_aligntyp)
2301             p_type = 2;
2302         else
2303             p_type = 3;
2304     }
2305
2306     if (is_undead(youmonst.data) && !Inhell
2307         && (p_aligntyp == A_LAWFUL || (p_aligntyp == A_NEUTRAL && !rn2(10))))
2308         p_type = -1;
2309     /* Note:  when !praying, the random factor for neutrals makes the
2310        return value a non-deterministic approximation for enlightenment.
2311        This case should be uncommon enough to live with... */
2312
2313     return !praying ? (boolean) (p_type == 3 && !Inhell) : TRUE;
2314 }
2315
2316 /* #pray commmand */
2317 int
2318 dopray()
2319 {
2320     /* Confirm accidental slips of Alt-P */
2321 /*JP
2322     if (ParanoidPray && yn("Are you sure you want to pray?") != 'y')
2323 */
2324     if (ParanoidPray && yn("\8bF\82è\82Ü\82·\82©\81H") != 'y')
2325         return 0;
2326
2327     u.uconduct.gnostic++;
2328
2329     /* set up p_type and p_alignment */
2330     if (!can_pray(TRUE))
2331         return 0;
2332
2333     if (wizard && p_type >= 0) {
2334 /*JP
2335         if (yn("Force the gods to be pleased?") == 'y') {
2336 */
2337         if (yn("\96³\97\9d\96î\97\9d\90_\82É\94÷\8fÎ\82ñ\82Å\82à\82ç\82¢\82Ü\82·\82©\81H") == 'y') {
2338             u.ublesscnt = 0;
2339             if (u.uluck < 0)
2340                 u.uluck = 0;
2341             if (u.ualign.record <= 0)
2342                 u.ualign.record = 1;
2343             u.ugangr = 0;
2344             if (p_type < 2)
2345                 p_type = 3;
2346         }
2347     }
2348     nomul(-3);
2349     multi_reason = "praying";
2350 /*JP
2351     nomovemsg = "You finish your prayer.";
2352 */
2353     nomovemsg = "\8bF\82è\8fI\82¦\82½\81D";
2354     afternmv = prayer_done;
2355
2356     if (p_type == 3 && !Inhell) {
2357         /* if you've been true to your god you can't die while you pray */
2358         if (!Blind)
2359 /*JP
2360             You("are surrounded by a shimmering light.");
2361 */
2362             You("\82©\82·\82©\82È\8cõ\82É\82Â\82Â\82Ü\82ê\82½\81D");
2363         u.uinvulnerable = TRUE;
2364     }
2365
2366     return 1;
2367 }
2368
2369 STATIC_PTR int
2370 prayer_done() /* M. Stephenson (1.0.3b) */
2371 {
2372     aligntyp alignment = p_aligntyp;
2373
2374     u.uinvulnerable = FALSE;
2375     if (p_type == -1) {
2376 #if 0 /*JP*/
2377         godvoice(alignment,
2378                  (alignment == A_LAWFUL)
2379                     ? "Vile creature, thou durst call upon me?"
2380                     : "Walk no more, perversion of nature!");
2381 #else
2382         godvoice(alignment,
2383                  (alignment == A_LAWFUL)
2384                     ? "\94Ú\97ò\82È\90\95¨\82æ\81C\93ð\81C\89ä\82É\8bF\82è\82ð\8b\81\82ß\82½\82©\81H"
2385                     : "\93®\82­\82È\81I\8e\80\82É\82¼\82±\82È\82¢\82Ì\90\95¨\82æ\81I");
2386 #endif
2387 /*JP
2388         You_feel("like you are falling apart.");
2389 */
2390         You("\83o\83\89\83o\83\89\82É\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
2391         /* KMH -- Gods have mastery over unchanging */
2392         rehumanize();
2393         /* no Half_physical_damage adjustment here */
2394 /*JP
2395         losehp(rnd(20), "residual undead turning effect", KILLED_BY_AN);
2396 */
2397         losehp(rnd(20), "\95s\8e\80\82Ì\90\95¨\82ð\93y\82É\95Ô\82·\97Í\82Å", KILLED_BY_AN);
2398         exercise(A_CON, FALSE);
2399         return 1;
2400     }
2401     if (Inhell) {
2402 /*JP
2403         pline("Since you are in Gehennom, %s won't help you.",
2404 */
2405         pline("\83Q\83w\83i\82É%s\82Ì\97Í\82Í\93Í\82©\82È\82¢\81D",
2406               align_gname(alignment));
2407         /* haltingly aligned is least likely to anger */
2408         if (u.ualign.record <= 0 || rnl(u.ualign.record))
2409             angrygods(u.ualign.type);
2410         return 0;
2411     }
2412
2413     if (p_type == 0) {
2414         if (on_altar() && u.ualign.type != alignment)
2415             (void) water_prayer(FALSE);
2416         u.ublesscnt += rnz(250);
2417         change_luck(-3);
2418         gods_upset(u.ualign.type);
2419     } else if (p_type == 1) {
2420         if (on_altar() && u.ualign.type != alignment)
2421             (void) water_prayer(FALSE);
2422         angrygods(u.ualign.type); /* naughty */
2423     } else if (p_type == 2) {
2424         if (water_prayer(FALSE)) {
2425             /* attempted water prayer on a non-coaligned altar */
2426             u.ublesscnt += rnz(250);
2427             change_luck(-3);
2428             gods_upset(u.ualign.type);
2429         } else
2430             pleased(alignment);
2431     } else {
2432         /* coaligned */
2433         if (on_altar())
2434             (void) water_prayer(TRUE);
2435         pleased(alignment); /* nice */
2436     }
2437     return 1;
2438 }
2439
2440 /* #turn command */
2441 int
2442 doturn()
2443 {
2444     /* Knights & Priest(esse)s only please */
2445     struct monst *mtmp, *mtmp2;
2446     int once, range, xlev;
2447
2448     if (!Role_if(PM_PRIEST) && !Role_if(PM_KNIGHT)) {
2449         /* Try to use the "turn undead" spell.
2450          *
2451          * This used to be based on whether hero knows the name of the
2452          * turn undead spellbook, but it's possible to know--and be able
2453          * to cast--the spell while having lost the book ID to amnesia.
2454          * (It also used to tell spelleffects() to cast at self?)
2455          */
2456         int sp_no;
2457
2458         for (sp_no = 0; sp_no < MAXSPELL; ++sp_no) {
2459             if (spl_book[sp_no].sp_id == NO_SPELL)
2460                 break;
2461             else if (spl_book[sp_no].sp_id == SPE_TURN_UNDEAD)
2462                 return spelleffects(sp_no, FALSE);
2463         }
2464 /*JP
2465         You("don't know how to turn undead!");
2466 */
2467         You("\95s\8e\80\82Ì\90\82«\95¨\82ð\93y\82É\96ß\82·\95û\96@\82ð\92m\82ç\82È\82¢\81I");
2468         return 0;
2469     }
2470     u.uconduct.gnostic++;
2471
2472     if ((u.ualign.type != A_CHAOTIC
2473          && (is_demon(youmonst.data) || is_undead(youmonst.data)))
2474         || u.ugangr > 6) { /* "Die, mortal!" */
2475 /*JP
2476         pline("For some reason, %s seems to ignore you.", u_gname());
2477 */
2478         pline("\82È\82º\82©\81C%s\82Í\82 \82È\82½\82ð\96³\8e\8b\82µ\82½\82æ\82¤\82¾\81D", u_gname());
2479         aggravate();
2480         exercise(A_WIS, FALSE);
2481         return 0;
2482     }
2483     if (Inhell) {
2484 /*JP
2485         pline("Since you are in Gehennom, %s won't help you.", u_gname());
2486 */
2487         pline("\83Q\83w\83i\82É%s\82Ì\97Í\82Í\93Í\82©\82È\82¢\81D", u_gname());
2488         aggravate();
2489         return 0;
2490     }
2491 /*JP
2492     pline("Calling upon %s, you chant an arcane formula.", u_gname());
2493 */
2494     pline("%s\82É\8bF\82è\82ð\8b\81\82ß\82é\82Æ\81C\82 \82È\82½\82Í\95s\89Â\8ev\8bc\82È\8c¾\97t\82Ì\90¹\89Ì\82ð\95·\82¢\82½\81D", u_gname());
2495     exercise(A_WIS, TRUE);
2496
2497     /* note: does not perform unturn_dead() on victims' inventories */
2498     range = BOLT_LIM + (u.ulevel / 5); /* 5 to 11 */
2499     range *= range;
2500     once = 0;
2501     for (mtmp = fmon; mtmp; mtmp = mtmp2) {
2502         mtmp2 = mtmp->nmon;
2503
2504         if (DEADMONSTER(mtmp))
2505             continue;
2506         if (!cansee(mtmp->mx, mtmp->my) || distu(mtmp->mx, mtmp->my) > range)
2507             continue;
2508
2509         if (!mtmp->mpeaceful
2510             && (is_undead(mtmp->data) || is_vampshifter(mtmp)
2511                 || (is_demon(mtmp->data) && (u.ulevel > (MAXULEV / 2))))) {
2512             mtmp->msleeping = 0;
2513             if (Confusion) {
2514                 if (!once++)
2515 /*JP
2516                     pline("Unfortunately, your voice falters.");
2517 */
2518                     pline("\8ec\94O\82È\82ª\82ç\81C\82 \82È\82½\82Ì\90º\82Í\82Ç\82à\82Á\82Ä\82µ\82Ü\82Á\82½\81D");
2519                 mtmp->mflee = 0;
2520                 mtmp->mfrozen = 0;
2521                 mtmp->mcanmove = 1;
2522             } else if (!resist(mtmp, '\0', 0, TELL)) {
2523                 xlev = 6;
2524                 switch (mtmp->data->mlet) {
2525                 /* this is intentional, lichs are tougher
2526                    than zombies. */
2527                 case S_LICH:
2528                     xlev += 2; /*FALLTHRU*/
2529                 case S_GHOST:
2530                     xlev += 2; /*FALLTHRU*/
2531                 case S_VAMPIRE:
2532                     xlev += 2; /*FALLTHRU*/
2533                 case S_WRAITH:
2534                     xlev += 2; /*FALLTHRU*/
2535                 case S_MUMMY:
2536                     xlev += 2; /*FALLTHRU*/
2537                 case S_ZOMBIE:
2538                     if (u.ulevel >= xlev && !resist(mtmp, '\0', 0, NOTELL)) {
2539                         if (u.ualign.type == A_CHAOTIC) {
2540                             mtmp->mpeaceful = 1;
2541                             set_malign(mtmp);
2542                         } else { /* damn them */
2543                             killed(mtmp);
2544                         }
2545                         break;
2546                     } /* else flee */
2547                 /*FALLTHRU*/
2548                 default:
2549                     monflee(mtmp, 0, FALSE, TRUE);
2550                     break;
2551                 }
2552             }
2553         }
2554     }
2555     nomul(-5);
2556     multi_reason = "trying to turn the monsters";
2557     nomovemsg = You_can_move_again;
2558     return 1;
2559 }
2560
2561 const char *
2562 a_gname()
2563 {
2564     return a_gname_at(u.ux, u.uy);
2565 }
2566
2567 /* returns the name of an altar's deity */
2568 const char *
2569 a_gname_at(x, y)
2570 xchar x, y;
2571 {
2572     if (!IS_ALTAR(levl[x][y].typ))
2573         return (char *) 0;
2574
2575     return align_gname(a_align(x, y));
2576 }
2577
2578 /* returns the name of the hero's deity */
2579 const char *
2580 u_gname()
2581 {
2582     return align_gname(u.ualign.type);
2583 }
2584
2585 const char *
2586 align_gname(alignment)
2587 aligntyp alignment;
2588 {
2589     const char *gnam;
2590
2591     switch (alignment) {
2592     case A_NONE:
2593         gnam = Moloch;
2594         break;
2595     case A_LAWFUL:
2596         gnam = urole.lgod;
2597         break;
2598     case A_NEUTRAL:
2599         gnam = urole.ngod;
2600         break;
2601     case A_CHAOTIC:
2602         gnam = urole.cgod;
2603         break;
2604     default:
2605         impossible("unknown alignment.");
2606 /*JP
2607         gnam = "someone";
2608 */
2609         gnam = "\92N\82©";
2610         break;
2611     }
2612     if (*gnam == '_')
2613         ++gnam;
2614     return gnam;
2615 }
2616
2617 static const char *hallu_gods[] = {
2618     "the Flying Spaghetti Monster", /* Church of the FSM */
2619     "Eris",                         /* Discordianism */
2620     "the Martians",                 /* every science fiction ever */
2621     "Xom",                          /* Crawl */
2622     "AnDoR dRaKoN",                 /* ADOM */
2623     "the Central Bank of Yendor",   /* economics */
2624     "Tooth Fairy",                  /* real world(?) */
2625     "Om",                           /* Discworld */
2626     "Yawgmoth",                     /* Magic: the Gathering */
2627     "Morgoth",                      /* LoTR */
2628     "Cthulhu",                      /* Lovecraft */
2629     "the Ori",                      /* Stargate */
2630     "destiny",                      /* why not? */
2631     "your Friend the Computer",     /* Paranoia */
2632 };
2633
2634 /* hallucination handling for priest/minion names: select a random god
2635    iff character is hallucinating */
2636 const char *
2637 halu_gname(alignment)
2638 aligntyp alignment;
2639 {
2640     const char *gnam = NULL;
2641     int which;
2642
2643     if (!Hallucination)
2644         return align_gname(alignment);
2645
2646     /* The priest may not have initialized god names. If this is the
2647      * case, and we roll priest, we need to try again. */
2648     do
2649         which = randrole();
2650     while (!roles[which].lgod);
2651
2652     switch (rn2(9)) {
2653     case 0:
2654     case 1:
2655         gnam = roles[which].lgod;
2656         break;
2657     case 2:
2658     case 3:
2659         gnam = roles[which].ngod;
2660         break;
2661     case 4:
2662     case 5:
2663         gnam = roles[which].cgod;
2664         break;
2665     case 6:
2666     case 7:
2667         gnam = hallu_gods[rn2(sizeof hallu_gods / sizeof *hallu_gods)];
2668         break;
2669     case 8:
2670         gnam = Moloch;
2671         break;
2672     default:
2673         impossible("rn2 broken in halu_gname?!?");
2674     }
2675     if (!gnam) {
2676         impossible("No random god name?");
2677 #if 0 /*JP*/
2678         gnam = "your Friend the Computer"; /* Paranoia */
2679 #else
2680         gnam = "\90e\88¤\82È\82é\83R\83\93\83s\83\85\81[\83^"; /* Paranoia */
2681 #endif
2682     }
2683     if (*gnam == '_')
2684         ++gnam;
2685     return gnam;
2686 }
2687
2688 /* deity's title */
2689 const char *
2690 align_gtitle(alignment)
2691 aligntyp alignment;
2692 {
2693 /*JP
2694     const char *gnam, *result = "god";
2695 */
2696     const char *gnam, *result = "\8eå\90_";
2697
2698     switch (alignment) {
2699     case A_LAWFUL:
2700         gnam = urole.lgod;
2701         break;
2702     case A_NEUTRAL:
2703         gnam = urole.ngod;
2704         break;
2705     case A_CHAOTIC:
2706         gnam = urole.cgod;
2707         break;
2708     default:
2709         gnam = 0;
2710         break;
2711     }
2712     if (gnam && *gnam == '_')
2713 /*JP
2714         result = "goddess";
2715 */
2716         result = "\8f\97\90_";
2717     return result;
2718 }
2719
2720 void
2721 altar_wrath(x, y)
2722 register int x, y;
2723 {
2724     aligntyp altaralign = a_align(x, y);
2725
2726     if (!strcmp(align_gname(altaralign), u_gname())) {
2727 /*JP
2728         godvoice(altaralign, "How darest thou desecrate my altar!");
2729 */
2730         godvoice(altaralign, "\93ð\81C\89ä\82ª\8dÕ\92d\82ð\89\98\82·\82©\81I");
2731         (void) adjattrib(A_WIS, -1, FALSE);
2732     } else {
2733 /*JP
2734         pline("A voice (could it be %s?) whispers:", align_gname(altaralign));
2735 */
2736         pline("\82³\82³\82â\82«\90º(\82½\82Ô\82ñ%s\81H)\82ª\95·\82±\82¦\82é:", align_gname(altaralign));
2737 /*JP
2738         verbalize("Thou shalt pay, infidel!");
2739 */
2740         verbalize("\88Ù\92[\8eÒ\82æ\81I\95ñ\82¢\82ð\8eó\82¯\82æ\81I");
2741         change_luck(-1);
2742     }
2743 }
2744
2745 /* assumes isok() at one space away, but not necessarily at two */
2746 STATIC_OVL boolean
2747 blocked_boulder(dx, dy)
2748 int dx, dy;
2749 {
2750     register struct obj *otmp;
2751     long count = 0L;
2752
2753     for (otmp = level.objects[u.ux + dx][u.uy + dy]; otmp;
2754          otmp = otmp->nexthere) {
2755         if (otmp->otyp == BOULDER)
2756             count += otmp->quan;
2757     }
2758
2759     switch (count) {
2760     case 0:
2761         /* no boulders--not blocked */
2762         return FALSE;
2763     case 1:
2764         /* possibly blocked depending on if it's pushable */
2765         break;
2766     default:
2767         /* more than one boulder--blocked after they push the top one;
2768            don't force them to push it first to find out */
2769         return TRUE;
2770     }
2771
2772     if (!isok(u.ux + 2 * dx, u.uy + 2 * dy))
2773         return TRUE;
2774     if (IS_ROCK(levl[u.ux + 2 * dx][u.uy + 2 * dy].typ))
2775         return TRUE;
2776     if (sobj_at(BOULDER, u.ux + 2 * dx, u.uy + 2 * dy))
2777         return TRUE;
2778
2779     return FALSE;
2780 }
2781
2782 /*pray.c*/