OSDN Git Service

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