OSDN Git Service

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