OSDN Git Service

fix #36659
[jnethack/source.git] / src / fountain.c
1 /* NetHack 3.6  fountain.c      $NHDT-Date: 1444937416 2015/10/15 19:30:16 $  $NHDT-Branch: master $:$NHDT-Revision: 1.55 $ */
2 /*      Copyright Scott R. Turner, srt@ucla, 10/27/86 */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016            */
8 /* JNetHack may be freely redistributed.  See license for details. */
9
10 /* Code for drinking from fountains. */
11
12 #include "hack.h"
13
14 STATIC_DCL void NDECL(dowatersnakes);
15 STATIC_DCL void NDECL(dowaterdemon);
16 STATIC_DCL void NDECL(dowaternymph);
17 STATIC_PTR void FDECL(gush, (int, int, genericptr_t));
18 STATIC_DCL void NDECL(dofindgem);
19
20 /* used when trying to dip in or drink from fountain or sink or pool while
21    levitating above it, or when trying to move downwards in that state */
22 void
23 floating_above(what)
24 const char *what;
25 {
26 /*JP
27     const char *umsg = "are floating high above the %s.";
28 */
29     const char *umsg = "%s\82Ì\97y\82©\8fã\95û\82É\95\82\82¢\82Ä\82¢\82é\81D";
30
31     if (u.utrap && (u.utraptype == TT_INFLOOR || u.utraptype == TT_LAVA)) {
32         /* when stuck in floor (not possible at fountain or sink location,
33            so must be attempting to move down), override the usual message */
34 /*JP
35         umsg = "are trapped in the %s.";
36 */
37         umsg = "%s\82É\82Â\82©\82Ü\82Á\82Ä\82¢\82é\81D";
38         what = surface(u.ux, u.uy); /* probably redundant */
39     }
40     You(umsg, what);
41 }
42
43 /* Fountain of snakes! */
44 STATIC_OVL void
45 dowatersnakes()
46 {
47     register int num = rn1(5, 2);
48     struct monst *mtmp;
49
50     if (!(mvitals[PM_WATER_MOCCASIN].mvflags & G_GONE)) {
51         if (!Blind)
52 #if 0 /*JP*/
53             pline("An endless stream of %s pours forth!",
54                   Hallucination ? makeplural(rndmonnam(NULL)) : "snakes");
55 #else
56             pline("%s\82ª\82Ç\82Ç\82Á\82Æ\97¬\82ê\8fo\82Ä\82«\82½\81I",
57                   Hallucination ? rndmonnam(NULL) : "\8eÖ");
58 #endif
59         else
60 /*JP
61             You_hear("%s hissing!", something);
62 */
63             You_hear("\83V\81[\83b\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I");
64         while (num-- > 0)
65             if ((mtmp = makemon(&mons[PM_WATER_MOCCASIN], u.ux, u.uy,
66                                 NO_MM_FLAGS)) != 0
67                 && t_at(mtmp->mx, mtmp->my))
68                 (void) mintrap(mtmp);
69     } else
70 /*JP
71         pline_The("fountain bubbles furiously for a moment, then calms.");
72 */
73         pline("\90ò\82Í\93Ë\91R\8c\83\82µ\82­\96A\82¾\82¿\81C\82â\82ª\82Ä\90Ã\82©\82É\82È\82Á\82½\81D");
74 }
75
76 /* Water demon */
77 STATIC_OVL void
78 dowaterdemon()
79 {
80     struct monst *mtmp;
81
82     if (!(mvitals[PM_WATER_DEMON].mvflags & G_GONE)) {
83         if ((mtmp = makemon(&mons[PM_WATER_DEMON], u.ux, u.uy,
84                             NO_MM_FLAGS)) != 0) {
85             if (!Blind)
86 /*JP
87                 You("unleash %s!", a_monnam(mtmp));
88 */
89                 You("%s\82ð\89ð\82«\95ú\82µ\82½\81I", a_monnam(mtmp));
90             else
91 /*JP
92                 You_feel("the presence of evil.");
93 */
94                 You_feel("\8e×\88«\82È\91\8dÝ\82ð\8a´\82\82½\81I");
95
96             /* Give those on low levels a (slightly) better chance of survival
97              */
98             if (rnd(100) > (80 + level_difficulty())) {
99 #if 0 /*JP*/
100                 pline("Grateful for %s release, %s grants you a wish!",
101                       mhis(mtmp), mhe(mtmp));
102 #else
103                 pline("%s\82Í\89ð\95ú\82ð\82Æ\82Ä\82à\8a´\8eÓ\82µ\81C\82Ì\82¼\82Ý\82ð\82©\82È\82¦\82Ä\82­\82ê\82é\82æ\82¤\82¾\81I",
104                       mhe(mtmp));
105 #endif
106                 /* give a wish and discard the monster (mtmp set to null) */
107                 mongrantswish(&mtmp);
108             } else if (t_at(mtmp->mx, mtmp->my))
109                 (void) mintrap(mtmp);
110         }
111     } else
112 /*JP
113         pline_The("fountain bubbles furiously for a moment, then calms.");
114 */
115         pline("\90ò\82Í\93Ë\91R\8c\83\82µ\82­\96A\82¾\82¿\81C\82â\82ª\82Ä\90Ã\82©\82É\82È\82Á\82½\81D");
116 }
117
118 /* Water Nymph */
119 STATIC_OVL void
120 dowaternymph()
121 {
122     register struct monst *mtmp;
123
124     if (!(mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
125         && (mtmp = makemon(&mons[PM_WATER_NYMPH], u.ux, u.uy,
126                            NO_MM_FLAGS)) != 0) {
127         if (!Blind)
128 /*JP
129             You("attract %s!", a_monnam(mtmp));
130 */
131             pline("%s\82ª\8c»\82í\82ê\82½\81I", a_monnam(mtmp));
132         else
133 /*JP
134             You_hear("a seductive voice.");
135 */
136             You_hear("\96£\98f\93I\82È\90º\82ð\95·\82¢\82½\81D");
137         mtmp->msleeping = 0;
138         if (t_at(mtmp->mx, mtmp->my))
139             (void) mintrap(mtmp);
140     } else if (!Blind)
141 /*JP
142         pline("A large bubble rises to the surface and pops.");
143 */
144         pline("\91å\82«\82È\96A\82ª\95¦\82«\8fo\82Ä\82Í\82\82¯\82½\81D");
145     else
146 /*JP
147         You_hear("a loud pop.");
148 */
149         You_hear("\91å\82«\82È\82à\82Ì\82ª\82Í\82\82¯\82é\89¹\82ð\95·\82¢\82½\81D");
150 }
151
152 /* Gushing forth along LOS from (u.ux, u.uy) */
153 void
154 dogushforth(drinking)
155 int drinking;
156 {
157     int madepool = 0;
158
159     do_clear_area(u.ux, u.uy, 7, gush, (genericptr_t) &madepool);
160     if (!madepool) {
161         if (drinking)
162 /*JP
163             Your("thirst is quenched.");
164 */
165             Your("\8a\89\82«\82Í\96ü\82³\82ê\82½\81D");
166         else
167 /*JP
168             pline("Water sprays all over you.");
169 */
170             pline("\90\85\82µ\82Ô\82«\82ª\82 \82È\82½\82É\82©\82©\82Á\82½\81D");
171     }
172 }
173
174 STATIC_PTR void
175 gush(x, y, poolcnt)
176 int x, y;
177 genericptr_t poolcnt;
178 {
179     register struct monst *mtmp;
180     register struct trap *ttmp;
181
182     if (((x + y) % 2) || (x == u.ux && y == u.uy)
183         || (rn2(1 + distmin(u.ux, u.uy, x, y))) || (levl[x][y].typ != ROOM)
184         || (sobj_at(BOULDER, x, y)) || nexttodoor(x, y))
185         return;
186
187     if ((ttmp = t_at(x, y)) != 0 && !delfloortrap(ttmp))
188         return;
189
190     if (!((*(int *) poolcnt)++))
191 /*JP
192         pline("Water gushes forth from the overflowing fountain!");
193 */
194         pline("\90ò\82©\82ç\90\85\82ª\82Ç\82Ç\82Á\82Æ\88ì\82ê\8fo\82½\81I");
195
196     /* Put a pool at x, y */
197     levl[x][y].typ = POOL;
198     /* No kelp! */
199     del_engr_at(x, y);
200     water_damage_chain(level.objects[x][y], TRUE);
201
202     if ((mtmp = m_at(x, y)) != 0)
203         (void) minliquid(mtmp);
204     else
205         newsym(x, y);
206 }
207
208 /* Find a gem in the sparkling waters. */
209 STATIC_OVL void
210 dofindgem()
211 {
212     if (!Blind)
213 /*JP
214         You("spot a gem in the sparkling waters!");
215 */
216         pline("\82«\82ç\82ß\82­\90\85\82Ì\92\86\82É\95ó\90Î\82ð\8c©\82Â\82¯\82½\81I");
217     else
218 /*JP
219         You_feel("a gem here!");
220 */
221         You_feel("\95ó\90Î\82ª\82 \82é\82æ\82¤\82¾\81I");
222     (void) mksobj_at(rnd_class(DILITHIUM_CRYSTAL, LUCKSTONE - 1), u.ux, u.uy,
223                      FALSE, FALSE);
224     SET_FOUNTAIN_LOOTED(u.ux, u.uy);
225     newsym(u.ux, u.uy);
226     exercise(A_WIS, TRUE); /* a discovery! */
227 }
228
229 void
230 dryup(x, y, isyou)
231 xchar x, y;
232 boolean isyou;
233 {
234     if (IS_FOUNTAIN(levl[x][y].typ)
235         && (!rn2(3) || FOUNTAIN_IS_WARNED(x, y))) {
236         if (isyou && in_town(x, y) && !FOUNTAIN_IS_WARNED(x, y)) {
237             struct monst *mtmp;
238
239             SET_FOUNTAIN_WARNED(x, y);
240             /* Warn about future fountain use. */
241             for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
242                 if (DEADMONSTER(mtmp))
243                     continue;
244                 if (is_watch(mtmp->data) && couldsee(mtmp->mx, mtmp->my)
245                     && mtmp->mpeaceful) {
246 /*JP
247                     pline("%s yells:", Amonnam(mtmp));
248 */
249                     pline("%s\82Í\8b©\82ñ\82¾\81F", Amonnam(mtmp));
250 /*JP
251                     verbalize("Hey, stop using that fountain!");
252 */
253                     verbalize("\82¨\82¢\81C\90ò\82ð\89\98\82·\82È\81I");
254                     break;
255                 }
256             }
257             /* You can see or hear this effect */
258             if (!mtmp)
259 /*JP
260                 pline_The("flow reduces to a trickle.");
261 */
262                 pline("\97¬\82ê\82Í\82¿\82å\82ë\82¿\82å\82ë\82É\82È\82Á\82½\81D");
263             return;
264         }
265         if (isyou && wizard) {
266 /*JP
267             if (yn("Dry up fountain?") == 'n')
268 */
269             if (yn("\90ò\82ð\8a±\8fã\82ª\82ç\82¹\82Ü\82·\82©\81H") == 'n')
270                 return;
271         }
272         /* replace the fountain with ordinary floor */
273         levl[x][y].typ = ROOM;
274         levl[x][y].looted = 0;
275         levl[x][y].blessedftn = 0;
276         if (cansee(x, y))
277 /*JP
278             pline_The("fountain dries up!");
279 */
280             pline("\90ò\82Í\8a±\8fã\82ª\82Á\82½\81I");
281         /* The location is seen if the hero/monster is invisible
282            or felt if the hero is blind. */
283         newsym(x, y);
284         level.flags.nfountains--;
285         if (isyou && in_town(x, y))
286             (void) angry_guards(FALSE);
287     }
288 }
289
290 void
291 drinkfountain()
292 {
293     /* What happens when you drink from a fountain? */
294     register boolean mgkftn = (levl[u.ux][u.uy].blessedftn == 1);
295     register int fate = rnd(30);
296
297     if (Levitation) {
298 /*JP
299         floating_above("fountain");
300 */
301         floating_above("\90ò");
302         return;
303     }
304
305     if (mgkftn && u.uluck >= 0 && fate >= 10) {
306         int i, ii, littleluck = (u.uluck < 4);
307
308 /*JP
309         pline("Wow!  This makes you feel great!");
310 */
311         pline("\83\8f\83H\81I\82Æ\82Ä\82à\8bC\8e\9d\82¿\82æ\82­\82È\82Á\82½\81I");
312         /* blessed restore ability */
313         for (ii = 0; ii < A_MAX; ii++)
314             if (ABASE(ii) < AMAX(ii)) {
315                 ABASE(ii) = AMAX(ii);
316                 context.botl = 1;
317             }
318         /* gain ability, blessed if "natural" luck is high */
319         i = rn2(A_MAX); /* start at a random attribute */
320         for (ii = 0; ii < A_MAX; ii++) {
321             if (adjattrib(i, 1, littleluck ? -1 : 0) && littleluck)
322                 break;
323             if (++i >= A_MAX)
324                 i = 0;
325         }
326         display_nhwindow(WIN_MESSAGE, FALSE);
327 /*JP
328         pline("A wisp of vapor escapes the fountain...");
329 */
330         pline("\89\8c\82Ì\82©\82½\82Ü\82è\82ª\90ò\82©\82ç\93¦\82°\82½\81D\81D\81D");
331         exercise(A_WIS, TRUE);
332         levl[u.ux][u.uy].blessedftn = 0;
333         return;
334     }
335
336     if (fate < 10) {
337 /*JP
338         pline_The("cool draught refreshes you.");
339 */
340         pline("\97â\82½\82¢\88ê\94t\82Å\82³\82Á\82Ï\82è\82µ\82½\81D");
341         u.uhunger += rnd(10); /* don't choke on water */
342         newuhs(FALSE);
343         if (mgkftn)
344             return;
345     } else {
346         switch (fate) {
347         case 19: /* Self-knowledge */
348 /*JP
349             You_feel("self-knowledgeable...");
350 */
351             You("\8e©\95ª\8e©\90g\82ª\94»\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D\81D\81D");
352             display_nhwindow(WIN_MESSAGE, FALSE);
353             enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS);
354             exercise(A_WIS, TRUE);
355 /*JP
356             pline_The("feeling subsides.");
357 */
358             pline("\82»\82Ì\8a´\82\82Í\82È\82­\82È\82Á\82½\81D");
359             break;
360         case 20: /* Foul water */
361 /*JP
362             pline_The("water is foul!  You gag and vomit.");
363 */
364             pline("\90\85\82Í\82Ð\82Ç\82­\95s\89õ\82È\96¡\82ª\82µ\82½\81I\82 \82È\82½\82Í\93f\82«\96ß\82µ\82½\81D");
365             morehungry(rn1(20, 11));
366             vomit();
367             break;
368         case 21: /* Poisonous */
369 /*JP
370             pline_The("water is contaminated!");
371 */
372             pline("\90\85\82Í\89\98\90õ\82³\82ê\82Ä\82¢\82é\81I");
373             if (Poison_resistance) {
374 /*JP
375                 pline("Perhaps it is runoff from the nearby %s farm.",
376 */
377                 pline("\82½\82Ô\82ñ\81C\82±\82ê\82Í\8bß\82­\82Ì%s\82Ì\94_\8fê\82©\82ç\97¬\82ê\82Ä\82¢\82é\81D",
378                       fruitname(FALSE));
379 /*JP
380                 losehp(rnd(4), "unrefrigerated sip of juice", KILLED_BY_AN);
381 */
382                 losehp(rnd(4),"\95\85\82Á\82½\89Ê\8f`\82Ì\82µ\82½\82½\82è\82Å", KILLED_BY_AN);
383                 break;
384             }
385             losestr(rn1(4, 3));
386 /*JP
387             losehp(rnd(10), "contaminated water", KILLED_BY);
388 */
389             losehp(rnd(10),"\89\98\90õ\82³\82ê\82½\90\85\82Å", KILLED_BY);
390             exercise(A_CON, FALSE);
391             break;
392         case 22: /* Fountain of snakes! */
393             dowatersnakes();
394             break;
395         case 23: /* Water demon */
396             dowaterdemon();
397             break;
398         case 24: /* Curse an item */ {
399             register struct obj *obj;
400
401 /*JP
402             pline("This water's no good!");
403 */
404             pline("\82±\82Ì\90\85\82Í\82Æ\82Ä\82à\82Ü\82¸\82¢\81I");
405             morehungry(rn1(20, 11));
406             exercise(A_CON, FALSE);
407             for (obj = invent; obj; obj = obj->nobj)
408                 if (!rn2(5))
409                     curse(obj);
410             break;
411         }
412         case 25: /* See invisible */
413             if (Blind) {
414                 if (Invisible) {
415 /*JP
416                     You("feel transparent.");
417 */
418                     You("\93§\96¾\82É\82È\82Á\82½\8bC\82ª\82·\82é\81D");
419                 } else {
420 /*JP
421                     You("feel very self-conscious.");
422 */
423                     You("\8e©\88Ó\8e¯\89ß\8fè\82É\8a´\82\82½\81D");
424 /*JP
425                     pline("Then it passes.");
426 */
427                     pline("\82»\82Ì\8a´\82\82Í\8fÁ\82¦\82½\81D");
428                 }
429             } else {
430 /*JP
431                 You_see("an image of someone stalking you.");
432 */
433                 You("\89½\82©\82ª\8e©\95ª\82Ì\8cã\82ð\82Â\82¯\82Ä\82¢\82é\89f\91\9c\82ð\8c©\82½\81D");
434 /*JP
435                 pline("But it disappears.");
436 */
437                 pline("\82µ\82©\82µ\81C\82»\82ê\82Í\8fÁ\82¦\82Ä\82µ\82Ü\82Á\82½\81D");
438             }
439             HSee_invisible |= FROMOUTSIDE;
440             newsym(u.ux, u.uy);
441             exercise(A_WIS, TRUE);
442             break;
443         case 26: /* See Monsters */
444             (void) monster_detect((struct obj *) 0, 0);
445             exercise(A_WIS, TRUE);
446             break;
447         case 27: /* Find a gem in the sparkling waters. */
448             if (!FOUNTAIN_IS_LOOTED(u.ux, u.uy)) {
449                 dofindgem();
450                 break;
451             }
452         case 28: /* Water Nymph */
453             dowaternymph();
454             break;
455         case 29: /* Scare */
456         {
457             register struct monst *mtmp;
458
459 /*JP
460             pline("This water gives you bad breath!");
461 */
462             pline("\90\85\82ð\88ù\82ñ\82¾\82ç\91§\82ª\8fL\82­\82È\82Á\82½\81I");
463             for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
464                 if (DEADMONSTER(mtmp))
465                     continue;
466                 monflee(mtmp, 0, FALSE, FALSE);
467             }
468             break;
469         }
470         case 30: /* Gushing forth in this room */
471             dogushforth(TRUE);
472             break;
473         default:
474 /*JP
475             pline("This tepid water is tasteless.");
476 */
477             pline("\82±\82Ì\82È\82Ü\82Ê\82é\82¢\90\85\82Í\96¡\82ª\82È\82¢\81D");
478             break;
479         }
480     }
481     dryup(u.ux, u.uy, TRUE);
482 }
483
484 void
485 dipfountain(obj)
486 register struct obj *obj;
487 {
488     if (Levitation) {
489 /*JP
490         floating_above("fountain");
491 */
492         floating_above("\90ò");
493         return;
494     }
495
496     /* Don't grant Excalibur when there's more than one object.  */
497     /* (quantity could be > 1 if merged daggers got polymorphed) */
498     if (obj->otyp == LONG_SWORD && obj->quan == 1L && u.ulevel >= 5 && !rn2(6)
499         && !obj->oartifact
500         && !exist_artifact(LONG_SWORD, artiname(ART_EXCALIBUR))) {
501         if (u.ualign.type != A_LAWFUL) {
502             /* Ha!  Trying to cheat her. */
503             pline(
504 /*JP
505              "A freezing mist rises from the water and envelopes the sword.");
506 */
507              "\95X\82Ì\96\82ª\90\85\82©\82ç\97§\82¿\8f¸\82è\81C\8c\95\82ð\82Â\82Â\82ñ\82¾\81D");
508 /*JP
509             pline_The("fountain disappears!");
510 */
511             pline("\90ò\82Í\8fÁ\82¦\82Ä\82µ\82Ü\82Á\82½\81I");
512             curse(obj);
513             if (obj->spe > -6 && !rn2(3))
514                 obj->spe--;
515             obj->oerodeproof = FALSE;
516             exercise(A_WIS, FALSE);
517         } else {
518             /* The lady of the lake acts! - Eric Backus */
519             /* Be *REAL* nice */
520             pline(
521 /*JP
522               "From the murky depths, a hand reaches up to bless the sword.");
523 */
524               "\82É\82²\82Á\82½\90[\82Ý\82©\82ç\81C\8c\95\82ð\8fj\95\9f\82¹\82ñ\82Æ\8eè\82ª\90L\82Ñ\82Ä\82«\82½\81D");
525 /*JP
526             pline("As the hand retreats, the fountain disappears!");
527 */
528             pline("\8eè\82ª\91Þ\82­\82Æ\81C\90ò\82Í\8fÁ\82¦\82Ä\82µ\82Ü\82Á\82½\81I");
529             obj = oname(obj, artiname(ART_EXCALIBUR));
530             discover_artifact(ART_EXCALIBUR);
531             bless(obj);
532             obj->oeroded = obj->oeroded2 = 0;
533             obj->oerodeproof = TRUE;
534             exercise(A_WIS, TRUE);
535         }
536         update_inventory();
537         levl[u.ux][u.uy].typ = ROOM;
538         levl[u.ux][u.uy].looted = 0;
539         newsym(u.ux, u.uy);
540         level.flags.nfountains--;
541         if (in_town(u.ux, u.uy))
542             (void) angry_guards(FALSE);
543         return;
544     } else {
545         int er = water_damage(obj, NULL, TRUE);
546
547         if (obj->otyp == POT_ACID
548             && er != ER_DESTROYED) { /* Acid and water don't mix */
549             useup(obj);
550             return;
551         } else if (er != ER_NOTHING && !rn2(2)) { /* no further effect */
552             return;
553         }
554     }
555
556     switch (rnd(30)) {
557     case 16: /* Curse the item */
558         curse(obj);
559         break;
560     case 17:
561     case 18:
562     case 19:
563     case 20: /* Uncurse the item */
564         if (obj->cursed) {
565             if (!Blind)
566 /*JP
567                 pline_The("water glows for a moment.");
568 */
569                 pline("\90\85\82Í\8bP\82«\82¾\82µ\82½\81D");
570             uncurse(obj);
571         } else {
572 /*JP
573             pline("A feeling of loss comes over you.");
574 */
575             pline("\8aï\96­\82È\92E\97Í\8a´\82ª\82 \82È\82½\82ð\82¨\82»\82Á\82½\81D");
576         }
577         break;
578     case 21: /* Water Demon */
579         dowaterdemon();
580         break;
581     case 22: /* Water Nymph */
582         dowaternymph();
583         break;
584     case 23: /* an Endless Stream of Snakes */
585         dowatersnakes();
586         break;
587     case 24: /* Find a gem */
588         if (!FOUNTAIN_IS_LOOTED(u.ux, u.uy)) {
589             dofindgem();
590             break;
591         }
592     case 25: /* Water gushes forth */
593         dogushforth(FALSE);
594         break;
595     case 26: /* Strange feeling */
596 /*JP
597         pline("A strange tingling runs up your %s.", body_part(ARM));
598 */
599         pline("\8aï\96­\82È\82µ\82Ñ\82ê\82ª\82 \82È\82½\82Ì%s\82É\91\96\82Á\82½\81D", body_part(ARM));
600         break;
601     case 27: /* Strange feeling */
602 /*JP
603         You_feel("a sudden chill.");
604 */
605         You("\93Ë\91R\8a¦\82¯\82ð\8a´\82\82½\81D");
606         break;
607     case 28: /* Strange feeling */
608 /*JP
609         pline("An urge to take a bath overwhelms you.");
610 */
611         pline("\95\97\98C\82É\93ü\82è\82½\82¢\82Æ\82¢\82¤\97~\96]\82É\82©\82ç\82ê\82½\81D");
612         {
613             long money = money_cnt(invent);
614             struct obj *otmp;
615             if (money > 10) {
616                 /* Amount to lose.  Might get rounded up as fountains don't
617                  * pay change... */
618                 money = somegold(money) / 10;
619                 for (otmp = invent; otmp && money > 0; otmp = otmp->nobj)
620                     if (otmp->oclass == COIN_CLASS) {
621                         int denomination = objects[otmp->otyp].oc_cost;
622                         long coin_loss =
623                             (money + denomination - 1) / denomination;
624                         coin_loss = min(coin_loss, otmp->quan);
625                         otmp->quan -= coin_loss;
626                         money -= coin_loss * denomination;
627                         if (!otmp->quan)
628                             delobj(otmp);
629                     }
630 /*JP
631                 You("lost some of your money in the fountain!");
632 */
633                 You("\8bà\89Ý\82ð\90\94\96\87\81C\90ò\82É\97\8e\82Æ\82µ\82Ä\82µ\82Ü\82Á\82½\81I");
634                 CLEAR_FOUNTAIN_LOOTED(u.ux, u.uy);
635                 exercise(A_WIS, FALSE);
636             }
637         }
638         break;
639     case 29: /* You see coins */
640         /* We make fountains have more coins the closer you are to the
641          * surface.  After all, there will have been more people going
642          * by.  Just like a shopping mall!  Chris Woodbury  */
643
644         if (FOUNTAIN_IS_LOOTED(u.ux, u.uy))
645             break;
646         SET_FOUNTAIN_LOOTED(u.ux, u.uy);
647         (void) mkgold((long) (rnd((dunlevs_in_dungeon(&u.uz) - dunlev(&u.uz)
648                                    + 1) * 2) + 5),
649                       u.ux, u.uy);
650         if (!Blind)
651 /*JP
652             pline("Far below you, you see coins glistening in the water.");
653 */
654             You("\97y\82©\89º\82Ì\90\85\92\86\82É\8bà\89Ý\82Ì\8bP\82«\82ð\82Ý\82Â\82¯\82½\81D");
655         exercise(A_WIS, TRUE);
656         newsym(u.ux, u.uy);
657         break;
658     }
659     update_inventory();
660     dryup(u.ux, u.uy, TRUE);
661 }
662
663 void
664 breaksink(x, y)
665 int x, y;
666 {
667     if (cansee(x, y) || (x == u.ux && y == u.uy))
668 /*JP
669         pline_The("pipes break!  Water spurts out!");
670 */
671         pline("\94z\8aÇ\82ª\89ó\82ê\90\85\82ª\95¬\8fo\82µ\82½\81I");
672     level.flags.nsinks--;
673     levl[x][y].doormask = 0;
674     levl[x][y].typ = FOUNTAIN;
675     level.flags.nfountains++;
676     newsym(x, y);
677 }
678
679 void
680 drinksink()
681 {
682     struct obj *otmp;
683     struct monst *mtmp;
684
685     if (Levitation) {
686 /*JP
687         floating_above("sink");
688 */
689         floating_above("\97¬\82µ\91ä");
690         return;
691     }
692     switch (rn2(20)) {
693     case 0:
694 /*JP
695         You("take a sip of very cold water.");
696 */
697         You("\82Æ\82Ä\82à\97â\82½\82¢\90\85\82ð\88ê\8cû\88ù\82ñ\82¾\81D");
698         break;
699     case 1:
700 /*JP
701         You("take a sip of very warm water.");
702 */
703         You("\82Æ\82Ä\82à\82 \82½\82½\82©\82¢\90\85\82ð\88ê\8cû\88ù\82ñ\82¾\81D");
704         break;
705     case 2:
706 /*JP
707         You("take a sip of scalding hot water.");
708 */
709         You("\82Æ\82Ä\82à\94M\82¢\90\85\82ð\88ê\8cû\88ù\82ñ\82¾\81D");
710         if (Fire_resistance)
711 /*JP
712             pline("It seems quite tasty.");
713 */
714             pline("\82Æ\82Ä\82à\82¨\82¢\82µ\82¢\90\85\82¾\81D");
715         else
716 /*JP
717             losehp(rnd(6), "sipping boiling water", KILLED_BY);
718 */
719             losehp(rnd(6), "\95¦\93«\82µ\82½\90\85\82ð\88ù\82ñ\82Å", KILLED_BY);
720         /* boiling water burns considered fire damage */
721         break;
722     case 3:
723         if (mvitals[PM_SEWER_RAT].mvflags & G_GONE)
724 /*JP
725             pline_The("sink seems quite dirty.");
726 */
727             pline("\97¬\82µ\91ä\82Í\82Æ\82Ä\82à\89\98\82È\82ç\82µ\82¢\81D");
728         else {
729             mtmp = makemon(&mons[PM_SEWER_RAT], u.ux, u.uy, NO_MM_FLAGS);
730             if (mtmp)
731 #if 0 /*JP*/
732                 pline("Eek!  There's %s in the sink!",
733                       (Blind || !canspotmon(mtmp)) ? "something squirmy"
734                                                    : a_monnam(mtmp));
735 #else
736                 pline("\82°\81I\97¬\82µ\91ä\82É%s\82ª\82¢\82é\81I",
737                       (Blind || !canspotmon(mtmp)) ? "\90g\82à\82¾\82¦\82·\82é\82æ\82¤\82È\82à\82Ì"
738                                                    : a_monnam(mtmp));
739 #endif
740         }
741         break;
742     case 4:
743         do {
744             otmp = mkobj(POTION_CLASS, FALSE);
745             if (otmp->otyp == POT_WATER) {
746                 obfree(otmp, (struct obj *) 0);
747                 otmp = (struct obj *) 0;
748             }
749         } while (!otmp);
750         otmp->cursed = otmp->blessed = 0;
751 #if 0 /*JP*/
752         pline("Some %s liquid flows from the faucet.",
753               Blind ? "odd" : hcolor(OBJ_DESCR(objects[otmp->otyp])));
754 #else
755         pline("\8eÖ\8cû\82©\82ç%s\89t\91Ì\82ª\97¬\82ê\82½\81D",
756               Blind ? "\8aï\96­\82È" :
757               hcolor(OBJ_DESCR(objects[otmp->otyp])));
758 #endif
759         otmp->dknown = !(Blind || Hallucination);
760         otmp->quan++;       /* Avoid panic upon useup() */
761         otmp->fromsink = 1; /* kludge for docall() */
762         (void) dopotion(otmp);
763         obfree(otmp, (struct obj *) 0);
764         break;
765     case 5:
766         if (!(levl[u.ux][u.uy].looted & S_LRING)) {
767 /*JP
768             You("find a ring in the sink!");
769 */
770             You("\97¬\82µ\91ä\82É\8ew\97Ö\82ð\82Ý\82Â\82¯\82½\81I");
771             (void) mkobj_at(RING_CLASS, u.ux, u.uy, TRUE);
772             levl[u.ux][u.uy].looted |= S_LRING;
773             exercise(A_WIS, TRUE);
774             newsym(u.ux, u.uy);
775         } else
776 /*JP
777             pline("Some dirty water backs up in the drain.");
778 */
779             pline("\89\98\90\85\82ª\94r\90\85\8cû\82©\82ç\8bt\97¬\82µ\82Ä\82«\82½\81D");
780         break;
781     case 6:
782         breaksink(u.ux, u.uy);
783         break;
784     case 7:
785 /*JP
786         pline_The("water moves as though of its own will!");
787 */
788         pline("\90\85\82ª\88Ó\8ev\82ð\8e\9d\82Á\82Ä\82¢\82é\82©\82Ì\82æ\82¤\82É\93®\82¢\82½\81I");
789         if ((mvitals[PM_WATER_ELEMENTAL].mvflags & G_GONE)
790             || !makemon(&mons[PM_WATER_ELEMENTAL], u.ux, u.uy, NO_MM_FLAGS))
791 /*JP
792             pline("But it quiets down.");
793 */
794             pline("\82µ\82©\82µ\81C\90Ã\82©\82É\82È\82Á\82½\81D");
795         break;
796     case 8:
797 /*JP
798         pline("Yuk, this water tastes awful.");
799 */
800         pline("\83I\83F\81C\82Æ\82Ä\82à\82Ð\82Ç\82¢\96¡\82ª\82·\82é\81D");
801         more_experienced(1, 0);
802         newexplevel();
803         break;
804     case 9:
805 /*JP
806         pline("Gaggg... this tastes like sewage!  You vomit.");
807 */
808         pline("\83Q\83F\81[\81D\89º\90\85\82Ì\82æ\82¤\82È\96¡\82ª\82·\82é\81I\82 \82È\82½\82Í\93f\82«\96ß\82µ\82½\81D");
809         morehungry(rn1(30 - ACURR(A_CON), 11));
810         vomit();
811         break;
812     case 10:
813 /*JP
814         pline("This water contains toxic wastes!");
815 */
816         pline("\82±\82Ì\90\85\82Í\97L\93Å\82È\94r\90\85\82ð\8aÜ\82ñ\82Å\82¢\82é\81I");
817         if (!Unchanging) {
818 /*JP
819             You("undergo a freakish metamorphosis!");
820 */
821             You("\8aï\8c`\82È\95Ï\89»\82ð\82µ\82Í\82\82ß\82½\81I");
822             polyself(0);
823         }
824         break;
825     /* more odd messages --JJB */
826     case 11:
827 /*JP
828         You_hear("clanking from the pipes...");
829 */
830         You_hear("\94z\8aÇ\82Ì\83J\83`\83\93\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D\81D\81D");
831         break;
832     case 12:
833 /*JP
834         You_hear("snatches of song from among the sewers...");
835 */
836         You_hear("\89º\90\85\82Ì\92\86\82©\82ç\82Æ\82¬\82ê\82Æ\82¬\82ê\82Ì\89Ì\82ð\95·\82¢\82½\81D\81D\81D");
837         break;
838     case 19:
839         if (Hallucination) {
840 /*JP
841             pline("From the murky drain, a hand reaches up... --oops--");
842 */
843             pline("\88Ã\82¢\94r\90\85\8cû\82©\82ç\81C\8eè\82ª\90L\82Ñ\82Ä\82«\82½\81D\81D--\82¨\82Á\82Æ--");
844             break;
845         }
846     default:
847 #if 0 /*JP*/
848         You("take a sip of %s water.",
849             rn2(3) ? (rn2(2) ? "cold" : "warm") : "hot");
850 #else
851         You("%s\90\85\82ð\88ê\8cû\88ù\82ñ\82¾\81D",
852             rn2(3) ? (rn2(2) ? "\97â\82½\82¢" : "\82 \82½\82½\82©\82¢") : "\94M\82¢");
853 #endif
854     }
855 }
856
857 /*fountain.c*/