OSDN Git Service

update year to 2020
[jnethack/source.git] / src / read.c
1 /* NetHack 3.6  read.c  $NHDT-Date: 1561485713 2019/06/25 18:01:53 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.172 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2012. */
4 /* NetHack may be freely redistributed.  See license for details. */
5
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020            */
9 /* JNetHack may be freely redistributed.  See license for details. */
10
11 #include "hack.h"
12
13 #define Your_Own_Role(mndx)  \
14     ((mndx) == urole.malenum \
15      || (urole.femalenum != NON_PM && (mndx) == urole.femalenum))
16 #define Your_Own_Race(mndx)  \
17     ((mndx) == urace.malenum \
18      || (urace.femalenum != NON_PM && (mndx) == urace.femalenum))
19
20 boolean known;
21
22 static NEARDATA const char readable[] = { ALL_CLASSES, SCROLL_CLASS,
23                                           SPBOOK_CLASS, 0 };
24 static const char all_count[] = { ALLOW_COUNT, ALL_CLASSES, 0 };
25
26 STATIC_DCL boolean FDECL(learnscrolltyp, (SHORT_P));
27 STATIC_DCL char *FDECL(erode_obj_text, (struct obj *, char *));
28 STATIC_DCL char *FDECL(apron_text, (struct obj *, char *buf));
29 STATIC_DCL void FDECL(stripspe, (struct obj *));
30 STATIC_DCL void FDECL(p_glow1, (struct obj *));
31 STATIC_DCL void FDECL(p_glow2, (struct obj *, const char *));
32 STATIC_DCL void FDECL(forget_single_object, (int));
33 #if 0 /* not used */
34 STATIC_DCL void FDECL(forget_objclass, (int));
35 #endif
36 STATIC_DCL void FDECL(randomize, (int *, int));
37 STATIC_DCL void FDECL(forget, (int));
38 STATIC_DCL int FDECL(maybe_tame, (struct monst *, struct obj *));
39 STATIC_DCL boolean FDECL(get_valid_stinking_cloud_pos, (int, int));
40 STATIC_DCL boolean FDECL(is_valid_stinking_cloud_pos, (int, int, BOOLEAN_P));
41 STATIC_PTR void FDECL(display_stinking_cloud_positions, (int));
42 STATIC_PTR void FDECL(set_lit, (int, int, genericptr));
43 STATIC_DCL void NDECL(do_class_genocide);
44
45 STATIC_OVL boolean
46 learnscrolltyp(scrolltyp)
47 short scrolltyp;
48 {
49     if (!objects[scrolltyp].oc_name_known) {
50         makeknown(scrolltyp);
51         more_experienced(0, 10);
52         return TRUE;
53     } else
54         return FALSE;
55 }
56
57 /* also called from teleport.c for scroll of teleportation */
58 void
59 learnscroll(sobj)
60 struct obj *sobj;
61 {
62     /* it's implied that sobj->dknown is set;
63        we couldn't be reading this scroll otherwise */
64     if (sobj->oclass != SPBOOK_CLASS)
65         (void) learnscrolltyp(sobj->otyp);
66 }
67
68 STATIC_OVL char *
69 erode_obj_text(otmp, buf)
70 struct obj *otmp;
71 char *buf;
72 {
73     int erosion = greatest_erosion(otmp);
74
75     if (erosion)
76         wipeout_text(buf, (int) (strlen(buf) * erosion / (2 * MAX_ERODE)),
77                      otmp->o_id ^ (unsigned) ubirthday);
78     return buf;
79 }
80
81 char *
82 tshirt_text(tshirt, buf)
83 struct obj *tshirt;
84 char *buf;
85 {
86     static const char *shirt_msgs[] = {
87         /* Scott Bigham */
88 #if 0 /*JP:T*/
89       "I explored the Dungeons of Doom and all I got was this lousy T-shirt!",
90         "Is that Mjollnir in your pocket or are you just happy to see me?",
91       "It's not the size of your sword, it's how #enhance'd you are with it.",
92         "Madame Elvira's House O' Succubi Lifetime Customer",
93         "Madame Elvira's House O' Succubi Employee of the Month",
94         "Ludios Vault Guards Do It In Small, Dark Rooms",
95         "Yendor Military Soldiers Do It In Large Groups",
96         "I survived Yendor Military Boot Camp",
97         "Ludios Accounting School Intra-Mural Lacrosse Team",
98         "Oracle(TM) Fountains 10th Annual Wet T-Shirt Contest",
99         "Hey, black dragon!  Disintegrate THIS!",
100         "I'm With Stupid -->",
101         "Don't blame me, I voted for Izchak!",
102         "Don't Panic", /* HHGTTG */
103         "Furinkan High School Athletic Dept.",                /* Ranma 1/2 */
104         "Hel-LOOO, Nurse!",                                   /* Animaniacs */
105 #else
106         "\8e\84\82Í\89^\96½\82Ì\96À\8b{\82ð\92²\8d¸\82µ\82Ä\82¢\82½\82ª\81C\8eè\82É\93ü\82ê\82½\82Ì\82Í\82«\82½\82È\82¢\82s\83V\83\83\83c\82¾\82¯\82¾\82Á\82½\81I",
107         "\83|\83P\83b\83g\82É\83~\83\85\83\8b\83j\81[\83\8b\82ª\93ü\82Á\82Ä\82¢\82é\82Ì\81H\82»\82ê\82Æ\82à\8e\84\82É\89ï\82¦\82Ä\82¤\82ê\82µ\82¢\81H",
108         "\8c\95\82Ì\91å\82«\82³\82ª\96â\91è\82È\82Ì\82Å\82Í\82È\82¢\81D\82»\82ê\82ª\94@\89½\82É#enhance\82³\82ê\82Ä\82¢\82é\82©\82È\82Ì\82¾\81D",
109         "\83}\83_\83\80\81E\83G\83\8b\83o\83C\83\89\82Ì\83T\83L\83\85\83o\83X\8aÙ \89i\8bv\8cÚ\8bq",
110         "\83}\83_\83\80\81E\83G\83\8b\83o\83C\83\89\82Ì\83T\83L\83\85\83o\83X\8aÙ \8d¡\8c\8e\82Ì\8dÅ\97D\8fG\8c÷\98J\8eÒ",
111         "\83\8d\81[\83f\83B\83I\83X\8bà\8cÉ\82Ì\94Ô\90l\81C\82»\82ê\82Í\88Ã\82­\8f¬\82³\82¢\95\94\89®\82Ì\92\86",
112         "\83C\83F\83\93\83_\81[\8cR\95º\8em\81C\82»\82ê\82Í\8b\90\91å\82È\92c\91Ì\82Ì\92\86",
113         "\8e\84\82Í\83C\83F\83\93\83_\81[\8cR\82Ì\90V\95º\8cP\97û\8f\8a\82ð\8fæ\82è\89z\82¦\82Ü\82µ\82½",
114         "\83\8d\81[\83f\83B\83I\83X\89ï\8cv\8aw\8d\8eº\93à\83\89\83N\83\8d\83X\83`\81[\83\80",
115         "Oracle(TM) \82Ì\90ò \91æ\82P\82O\89ñ\94G\82ê\82s\83V\83\83\83c\83R\83\93\83e\83X\83g",
116         "\82¨\82¢\81C\8d\95\83h\83\89\83S\83\93\81I\82±\82¢\82Â\82ð\95ª\89ð\82µ\82ë\81I",
117         "\94n\8e­\82Æ\88ê\8f\8f\82É\82¢\82Ü\82· \81¨ ",
118         "\8e\84\82Í\88«\82­\82È\82¢\81IIzchak\82É\93\8a\95[\82µ\82½\82à\82Ì\81I",
119         "\82  \82í \82Ä \82é \82È", /* \8bâ\89Í\83q\83b\83`\83n\83C\83N\83K\83C\83h */
120         "\95\97\97Ñ\8aÙ\8d\82\8dZ\97¤\8fã\95\94",                                   /* Ranma 1/2 */
121         "\82g\82\85\82\8c\81|\82k\82n\82n\82n\81C\82m\82\95\82\92\82\93\82\85\81I",                     /* Animaniacs */
122 #endif
123         "=^.^=",
124 #if 0 /*JP:T*/
125         "100% goblin hair - do not wash",
126         "Aberzombie and Fitch",
127         "cK -- Cockatrice touches the Kop",
128         "Don't ask me, I only adventure here",
129         "Down with pants!",
130         "d, your dog or a killer?",
131         "FREE PUG AND NEWT!",
132         "Go team ant!",
133         "Got newt?",
134         "Hello, my darlings!", /* Charlie Drake */
135         "Hey!  Nymphs!  Steal This T-Shirt!",
136         "I <3 Dungeon of Doom",
137         "I <3 Maud",
138         "I am a Valkyrie.  If you see me running, try to keep up.",
139         "I am not a pack rat - I am a collector",
140         "I bounced off a rubber tree",         /* Monkey Island */
141         "Plunder Island Brimstone Beach Club", /* Monkey Island */
142 #else
143         "\83S\83u\83\8a\83\93\96Ñ100% - \90ô\82¦\82Ü\82¹\82ñ",
144         "\83A\83o\83]\83\93\83r&\83t\83B\83b\83`",
145         "cK -- \83R\83J\83g\83\8a\83X\82ª\8cx\8a¯\82É\83^\83b\83`",
146         "\8e¿\96â\82µ\82È\82¢\82Å; \8e\84\82Í\82±\82±\82ð\92T\8c\9f\82µ\82Ä\82¢\82é\82¾\82¯",
147         "Down with pants!",
148         "d\82Í\82 \82È\82½\82Ì\8c¢\82©\8eE\90l\8eÒ\82©\81H",
149         "FREE PUG AND NEWT!",
150         "Go team ant!",
151         "Got newt?",
152         "\82±\82ñ\82É\82¿\82Í\83_\81[\83\8a\83\93\81I", /* Charlie Drake */
153         "\82â\82 \81I\83j\83\93\83t\81I\82±\82Ì\82s\83V\83\83\83c\82ð\93\90\82ñ\82Å\81I",
154         "I <3 Dungeon of Doom",
155         "I <3 Maud",
156         "\8e\84\82Í\83o\83\8b\83L\83\8a\81[\82¾\81D\8e\84\82ª\91\96\82Á\82Ä\82¢\82é\82Ì\82ð\8c©\82½\82ç\81C\82Â\82¢\82Ä\82±\82¢\81D",
157         "\8e\84\82Í\83S\83~\8fW\82ß\82Å\82Í\82È\82¢\81D\8e\84\82Í\8eû\8fW\89Æ\82¾",
158         "\8e\84\82Í\83S\83\80\82Ì\96Ø\82É\92µ\82Ë\95Ô\82Á\82½",         /* Monkey Island */
159         "\97ª\92D\93\87\97°\89©\8aC\8aÝ\83N\83\89\83u", /* Monkey Island */
160 #endif
161 #if 0 /*JP:T*/
162         "If you can read this, I can hit you with my polearm",
163         "I'm confused!",
164         "I scored with the princess",
165         "I want to live forever or die in the attempt.",
166         "Lichen Park",
167         "LOST IN THOUGHT - please send search party",
168         "Meat is Mordor",
169         "Minetown Better Business Bureau",
170         "Minetown Watch",
171  "Ms. Palm's House of Negotiable Affection -- A Very Reputable House Of Disrepute",
172         "Protection Racketeer",
173         "Real men love Crom",
174         "Somebody stole my Mojo!",
175         "The Hellhound Gang",
176         "The Werewolves",
177 #else
178         "\82±\82ê\82ª\93Ç\82ß\82é\82È\82ç\81A\8e\84\82Ì\92·\95\80\82ª\93Í\82­\82Æ\82¢\82¤\82±\82Æ\82¾",
179         "\8e\84\82Í\8d¬\97\90\82µ\82Ä\82¢\82Ü\82·\81I",
180         "I scored with the princess",
181         "\8e\84\82Í\89i\89\93\82É\90\82«\82é\82©\81A\82»\82Ì\82½\82ß\82É\8e\80\82É\82½\82¢\81D",
182         "Lichen Park",
183         "\8dl\82¦\8d\9e\82ñ\82Å\82¢\82Ü\82· - \91{\8dõ\91à\82ð\8fo\82µ\82Ä\82­\82¾\82³\82¢",
184         "\93÷\82Í\83\82\83\8b\83h\81[\83\8b",
185         "\8dz\8eR\8aX\8f¤\8bÆ\89ü\91P\8b¦\89ï",
186         "\8dz\8eR\8aX\82Ì\8c©\92£\82è",
187  "\83p\81[\83\80\8f\97\8ej\82Ì\8cð\8fÂ\8bZ\8fp\82Ì\89Æ -- \82Æ\82Ä\82à\95]\94»\82Ì\88«\95]\82Ì\89Æ",
188         "\8dz\8eR\83_\83b\83V\83\85\92\86",
189         "\96{\95¨\82Ì\92j\82Í\83N\83\8d\83\80\82ð\88¤\82·\82é",
190         "\92N\82©\82ª\89´\82Ì\83A\83\8c\82ð\93\90\82ñ\82¾\81I",
191         "The Hellhound Gang",
192         "The Werewolves",
193 #endif
194 #if 0 /*JP:T*/
195         "They Might Be Storm Giants",
196         "Weapons don't kill people, I kill people",
197         "White Zombie",
198         "You're killing me!",
199         "Anhur State University - Home of the Fighting Fire Ants!",
200         "FREE HUGS",
201         "Serial Ascender",
202         "Real men are valkyries",
203         "Young Men's Cavedigging Association",
204         "Occupy Fort Ludios",
205         "I couldn't afford this T-shirt so I stole it!",
206         "Mind flayers suck",
207         "I'm not wearing any pants",
208         "Down with the living!",
209         "Pudding farmer",
210         "Vegetarian",
211         "Hello, I'm War!",
212         "It is better to light a candle than to curse the darkness",
213         "It is easier to curse the darkness than to light a candle",
214         /* expanded "rock--paper--scissors" featured in TV show "Big Bang
215            Theory" although they didn't create it (and an actual T-shirt
216            with pentagonal diagram showing which choices defeat which) */
217         "rock--paper--scissors--lizard--Spock!",
218         /* "All men must die -- all men must serve" challange and response
219            from book series _A_Song_of_Ice_and_Fire_ by George R.R. Martin,
220            TV show "Game of Thrones" (probably an actual T-shirt too...) */
221         "/Valar morghulis/ -- /Valar dohaeris/",
222 #else
223         "\83[\83C\81E\83}\83C\83g\81E\83r\81[\81E\83X\83g\81[\83\80\81E\83W\83\83\83C\83A\83\93\83c",
224         "\95\90\8aí\82ª\90l\82ð\8eE\82·\82Ì\82Å\82Í\82È\82¢\81C\8e\84\82ª\90l\82ð\8eE\82·\82Ì\82¾",
225         "White Zombie",
226         "\82¢\82¢\89Á\8c¸\82É\82µ\82Ä\81I",
227         "\83A\83\93\83t\83\8b\8fB\97§\91å\8aw - \89Î\8ba\82Æ\82Ì\90í\82¢\82Ì\96{\8b\92\92n\81I",
228         "FREE HUGS",
229         "\93Á\95Ê\8f¸\93V\8eÒ",
230         "\96{\93\96\82Ì\92j\82Í\83o\83\8b\83L\83\8a\81[\82¾",
231         "\90Â\94N\93´\8cA\8c@\8dí\98A\96¿",
232         "\83\8d\81[\83f\83B\83I\83X\8dÔ\82ð\90è\8b\92\82¹\82æ",
233         "\82±\82Ì\82s\83V\83\83\83c\82ð\94\83\82¤\82¨\8bà\82ª\82È\82©\82Á\82½\82Ì\82Å\82±\82ê\82Í\93\90\82ñ\82¾\81I",
234         "\83}\83C\83\93\83h\83t\83\8c\83\84\8e\81\82Ë",
235         "\8e\84\82Í\83p\83\93\83c\82ð\90ú\82¢\82Ä\82¢\82Ü\82¹\82ñ",
236         "\90\8a\88\82ð\82Ô\82Á\89ó\82¹\81I",
237         "\83v\83\8a\83\93\94_\89Æ",
238         "\83x\83W\83^\83\8a\83A\83\93",
239         "\82â\82 \81C\8e\84\82ª\81w\90í\91\88\81x\82¾\81I",
240         "\88Ã\82¢\82Æ\95s\95½\82ð\8c¾\82¤\82æ\82è\82à\81C\82·\82·\82ñ\82Å\82 \82©\82è\82ð\82Â\82¯\82Ü\82µ\82å\82¤",
241         "\82·\82·\82ñ\82Å\82 \82©\82è\82ð\82Â\82¯\82é\82æ\82è\81C\88Ã\82¢\82Æ\95s\95½\82ð\8c¾\82¤\95û\82ª\8aÈ\92P",
242         /* expanded "rock--paper--scissors" featured in TV show "Big Bang
243            Theory" although they didn't create it (and an actual T-shirt
244            with pentagonal diagram showing which choices defeat which) */
245         "rock--paper--scissors--lizard--Spock!",
246         /* "All men must die -- all men must serve" challange and response
247            from book series _A_Song_of_Ice_and_Fire_ by George R.R. Martin,
248            TV show "Game of Thrones" (probably an actual T-shirt too...) */
249         "/Valar morghulis/ -- /Valar dohaeris/",
250 #endif
251     };
252
253     Strcpy(buf, shirt_msgs[tshirt->o_id % SIZE(shirt_msgs)]);
254     return erode_obj_text(tshirt, buf);
255 }
256
257 STATIC_OVL char *
258 apron_text(apron, buf)
259 struct obj *apron;
260 char *buf;
261 {
262     static const char *apron_msgs[] = {
263         "Kiss the cook",
264         "I'm making SCIENCE!",
265         "Don't mess with the chef",
266         "Don't make me poison you",
267         "Gehennom's Kitchen",
268         "Rat: The other white meat",
269         "If you can't stand the heat, get out of Gehennom!",
270         "If we weren't meant to eat animals, why are they made out of meat?",
271         "If you don't like the food, I'll stab you",
272     };
273
274     Strcpy(buf, apron_msgs[apron->o_id % SIZE(apron_msgs)]);
275     return erode_obj_text(apron, buf);
276 }
277
278 int
279 doread()
280 {
281     register struct obj *scroll;
282     boolean confused, nodisappear;
283
284     known = FALSE;
285     if (check_capacity((char *) 0))
286         return 0;
287     scroll = getobj(readable, "read");
288     if (!scroll)
289         return 0;
290
291     /* outrumor has its own blindness check */
292     if (scroll->otyp == FORTUNE_COOKIE) {
293         if (flags.verbose)
294 /*JP
295             You("break up the cookie and throw away the pieces.");
296 */
297             You("\83N\83b\83L\81[\82ð\8a\84\82è\81C\82©\82¯\82ç\82ð\93\8a\82°\82·\82Ä\82½\81D");
298         outrumor(bcsign(scroll), BY_COOKIE);
299         if (!Blind)
300             u.uconduct.literate++;
301         useup(scroll);
302         return 1;
303     } else if (scroll->otyp == T_SHIRT || scroll->otyp == ALCHEMY_SMOCK) {
304         char buf[BUFSZ], *mesg;
305 #if 0 /*JP*/
306         const char *endpunct;
307 #endif
308
309         if (Blind) {
310 /*JP
311             You_cant("feel any Braille writing.");
312 */
313             You("\93_\8e\9a\82Í\82Ç\82¤\82à\8f\91\82¢\82Ä\82È\82¢\82æ\82¤\82¾\81D");
314             return 0;
315         }
316         /* can't read shirt worn under suit (under cloak is ok though) */
317         if (scroll->otyp == T_SHIRT && uarm && scroll == uarmu) {
318 #if 0 /*JP*/
319             pline("%s shirt is obscured by %s%s.",
320                   scroll->unpaid ? "That" : "Your", shk_your(buf, uarm),
321                   suit_simple_name(uarm));
322 #else
323             pline("\83V\83\83\83c\82Í%s\82Å\89B\82³\82ê\82Ä\82¢\82é\81D",
324                   suit_simple_name(uarm));
325 #endif
326             return 0;
327         }
328         u.uconduct.literate++;
329         /* populate 'buf[]' */
330         mesg = (scroll->otyp == T_SHIRT) ? tshirt_text(scroll, buf)
331                                          : apron_text(scroll, buf);
332 #if 0 /*JP*/
333         endpunct = "";
334 #endif
335         if (flags.verbose) {
336 #if 0 /*JP*/
337             int ln = (int) strlen(mesg);
338
339             /* we will be displaying a sentence; need ending punctuation */
340             if (ln > 0 && !index(".!?", mesg[ln - 1]))
341                 endpunct = ".";
342 #endif
343 /*JP
344             pline("It reads:");
345 */
346             pline("\82»\82ê\82ð\93Ç\82ñ\82¾\81F");
347         }
348 #if 0 /*JP*/
349         pline("\"%s\"%s", mesg, endpunct);
350 #else
351         pline("\81u%s\81v", mesg);
352 #endif
353         return 1;
354     } else if (scroll->otyp == CREDIT_CARD) {
355         static const char *card_msgs[] = {
356 #if 0 /*JP:T*/
357             "Leprechaun Gold Tru$t - Shamrock Card",
358             "Magic Memory Vault Charge Card",
359             "Larn National Bank",                /* Larn */
360             "First Bank of Omega",               /* Omega */
361             "Bank of Zork - Frobozz Magic Card", /* Zork */
362             "Ankh-Morpork Merchant's Guild Barter Card",
363             "Ankh-Morpork Thieves' Guild Unlimited Transaction Card",
364             "Ransmannsby Moneylenders Association",
365             "Bank of Gehennom - 99% Interest Card",
366             "Yendorian Express - Copper Card",
367             "Yendorian Express - Silver Card",
368             "Yendorian Express - Gold Card",
369             "Yendorian Express - Mithril Card",
370             "Yendorian Express - Platinum Card", /* must be last */
371 #else
372             "\83\8c\83v\83\89\83R\81[\83\93\90M\97p\8bà\8cÉ - \83N\83\8d\81[\83o\81[\83J\81[\83h",
373             "\96\82\96@\8bL\94O\91q\8cÉ\83N\83\8c\83W\83b\83g\83J\81[\83h", "\83\89\81[\83\93\8d\91\89c\8bâ\8ds", /* Larn */
374             "\83I\83\81\83K\91æ\88ê\8bâ\8ds",               /* Omega */
375             "\83]\81[\83N\8bâ\8ds - Bank of Zork - \83t\83\8d\83{\83Y\96\82\96@\83J\81[\83h", /* Zork */
376             "\83A\83\93\83N\83\82\83\8b\83|\81[\83N\8f¤\90l\83M\83\8b\83\8cð\88Õ\83J\81[\83h",
377             "\83A\83\93\83N\83\82\83\8b\83|\81[\83N\93\90\91¯\83M\83\8b\83\96³\90§\8cÀ\8eæ\88ø\83J\81[\83h",
378             "\83\89\83\93\83X\83}\83\93\83X\83x\83C\91Ý\8bà\8bÆ\8b¦\89ï",
379             "\83Q\83w\83i\8bâ\8ds - \97\98\8eq99%\83J\81[\83h",
380             "\83C\83F\83\93\83_\81[\88ó\83G\83L\83X\83v\83\8c\83X\83J\81[\83h - \83J\83b\83p\81[\83J\81[\83h",
381             "\83C\83F\83\93\83_\81[\88ó\83G\83L\83X\83v\83\8c\83X\83J\81[\83h - \83V\83\8b\83o\81[\83J\81[\83h",
382             "\83C\83F\83\93\83_\81[\88ó\83G\83L\83X\83v\83\8c\83X\83J\81[\83h - \83S\81[\83\8b\83h\83J\81[\83h",
383             "\83C\83F\83\93\83_\81[\88ó\83G\83L\83X\83v\83\8c\83X\83J\81[\83h - \83~\83X\83\8a\83\8b\83J\81[\83h",
384             "\83C\83F\83\93\83_\81[\88ó\83G\83L\83X\83v\83\8c\83X\83J\81[\83h - \83v\83\89\83`\83i\83J\81[\83h", /* must be last */
385 #endif
386         };
387
388         if (Blind) {
389 /*JP
390             You("feel the embossed numbers:");
391 */
392             You("\95\82\82«\92¤\82è\82É\82³\82ê\82Ä\82¢\82é\94Ô\8d\86\82ð\8a´\82\82½:");
393         } else {
394             if (flags.verbose)
395 /*JP
396                 pline("It reads:");
397 */
398                 pline("\82»\82ê\82ð\93Ç\82ñ\82¾\81F");
399 /*JP
400             pline("\"%s\"",
401 */
402             pline("\81u%s\81v",
403                   scroll->oartifact
404                       ? card_msgs[SIZE(card_msgs) - 1]
405                       : card_msgs[scroll->o_id % (SIZE(card_msgs) - 1)]);
406         }
407         /* Make a credit card number */
408         pline("\"%d0%d %ld%d1 0%d%d0\"%s",
409               (((int) scroll->o_id % 89) + 10),
410               ((int) scroll->o_id % 4),
411               ((((long) scroll->o_id * 499L) % 899999L) + 100000L),
412               ((int) scroll->o_id % 10),
413               (!((int) scroll->o_id % 3)),
414               (((int) scroll->o_id * 7) % 10),
415               (flags.verbose || Blind) ? "." : "");
416         u.uconduct.literate++;
417         return 1;
418     } else if (scroll->otyp == CAN_OF_GREASE) {
419 /*JP
420         pline("This %s has no label.", singular(scroll, xname));
421 */
422         pline("\82±\82Ì%s\82É\82Í\83\89\83x\83\8b\82ª\82È\82¢\81D", singular(scroll, xname));
423         return 0;
424     } else if (scroll->otyp == MAGIC_MARKER) {
425         if (Blind) {
426 /*JP
427             You_cant("feel any Braille writing.");
428 */
429             pline("\93_\8e\9a\82Í\82Ç\82¤\82à\8f\91\82¢\82Ä\82È\82¢\82æ\82¤\82¾\81D");
430             return 0;
431         }
432         if (flags.verbose)
433 /*JP
434             pline("It reads:");
435 */
436             pline("\82»\82ê\82ð\93Ç\82ñ\82¾\81F");
437 /*JP
438         pline("\"Magic Marker(TM) Red Ink Marker Pen.  Water Soluble.\"");
439 */
440         pline("\81u\96\82\96@\82Ì\83}\81[\83J(TM) \90Ô\83C\83\93\83N\83}\81[\83J\83y\83\93\81D\90\85\90«\81D\81v");
441         u.uconduct.literate++;
442         return 1;
443     } else if (scroll->oclass == COIN_CLASS) {
444         if (Blind)
445 /*JP
446             You("feel the embossed words:");
447 */
448             You("\95\82\82«\92¤\82è\82É\82³\82ê\82Ä\82¢\82é\95\8e\9a\82ð\8a´\82\82½:");
449         else if (flags.verbose)
450 /*JP
451             You("read:");
452 */
453             pline("\82»\82ê\82ð\93Ç\82ñ\82¾\81F");
454         pline("\"1 Zorkmid.  857 GUE.  In Frobs We Trust.\"");
455         u.uconduct.literate++;
456         return 1;
457     } else if (scroll->oartifact == ART_ORB_OF_FATE) {
458         if (Blind)
459 /*JP
460             You("feel the engraved signature:");
461 */
462             You("\92¤\82è\8d\9e\82Ü\82ê\82Ä\82¢\82é\83T\83C\83\93\82ð\8a´\82\82½\81F");
463         else
464 /*JP
465             pline("It is signed:");
466 */
467             pline("\83T\83C\83\93\82ª\82 \82é\81F");
468 /*JP
469         pline("\"Odin.\"");
470 */
471         pline("\81u\83I\81[\83f\83B\83\93\81v");
472         u.uconduct.literate++;
473         return 1;
474     } else if (scroll->otyp == CANDY_BAR) {
475         static const char *wrapper_msgs[] = {
476             "Apollo",       /* Lost */
477             "Moon Crunchy", /* South Park */
478             "Snacky Cake",    "Chocolate Nuggie", "The Small Bar",
479             "Crispy Yum Yum", "Nilla Crunchie",   "Berry Bar",
480             "Choco Nummer",   "Om-nom", /* Cat Macro */
481             "Fruity Oaty",              /* Serenity */
482             "Wonka Bar" /* Charlie and the Chocolate Factory */
483         };
484
485         if (Blind) {
486 /*JP
487             You_cant("feel any Braille writing.");
488 */
489             pline("\93_\8e\9a\82Í\82Ç\82¤\82à\8f\91\82¢\82Ä\82È\82¢\82æ\82¤\82¾\81D");
490             return 0;
491         }
492 #if 0 /*JP:T*/
493         pline("The wrapper reads: \"%s\".",
494               wrapper_msgs[scroll->o_id % SIZE(wrapper_msgs)]);
495 #else
496         pline("\95ï\82Ý\8e\86\82Ì\95\8e\9a\82ð\93Ç\82ñ\82¾\81F\81u%s\81v.",
497               wrapper_msgs[scroll->o_id % SIZE(wrapper_msgs)]);
498 #endif
499         u.uconduct.literate++;
500         return 1;
501     } else if (scroll->oclass != SCROLL_CLASS
502                && scroll->oclass != SPBOOK_CLASS) {
503 /*JP
504         pline(silly_thing_to, "read");
505 */
506         pline(silly_thing_to, "\93Ç\82Þ");
507         return 0;
508     } else if (Blind && (scroll->otyp != SPE_BOOK_OF_THE_DEAD)) {
509         const char *what = 0;
510
511         if (scroll->oclass == SPBOOK_CLASS)
512 /*JP
513             what = "mystic runes";
514 */
515             what = "\90_\94é\93I\82È\83\8b\81[\83\93\95\8e\9a";
516         else if (!scroll->dknown)
517 /*JP
518             what = "formula on the scroll";
519 */
520             what = "\8aª\95¨\82Ì\8eô\95¶";
521         if (what) {
522 /*JP
523             pline("Being blind, you cannot read the %s.", what);
524 */
525             pline("\96Ú\82ª\8c©\82¦\82È\82¢\82Ì\82Å\81C\82 \82È\82½\82Í%s\82ð\93Ç\82Þ\82±\82Æ\82ª\82Å\82«\82È\82¢\81D", what);
526             return 0;
527         }
528     }
529
530     confused = (Confusion != 0);
531 #ifdef MAIL
532     if (scroll->otyp == SCR_MAIL) {
533         confused = FALSE; /* override */
534         /* reading mail is a convenience for the player and takes
535            place outside the game, so shouldn't affect gameplay;
536            on the other hand, it starts by explicitly making the
537            hero actively read something, which is pretty hard
538            to simply ignore; as a compromise, if the player has
539            maintained illiterate conduct so far, and this mail
540            scroll didn't come from bones, ask for confirmation */
541         if (!u.uconduct.literate) {
542 #if 0 /*JP:T*/
543             if (!scroll->spe && yn(
544              "Reading mail will violate \"illiterate\" conduct.  Read anyway?"
545                                    ) != 'y')
546 #else
547             if (!scroll->spe && yn(
548              "\83\81\81[\83\8b\82ð\93Ç\82Þ\82Æ\81u\95\8e\9a\82ð\93Ç\82Ü\82È\82¢\81v\92§\90í\82É\88á\94½\82·\82é\82¯\82Ç\81C\82»\82ê\82Å\82à\93Ç\82Þ\81H"
549                                    ) != 'y')
550 #endif
551                 return 0;
552         }
553     }
554 #endif
555
556     /* Actions required to win the game aren't counted towards conduct */
557     /* Novel conduct is handled in read_tribute so exclude it too*/
558     if (scroll->otyp != SPE_BOOK_OF_THE_DEAD
559         && scroll->otyp != SPE_BLANK_PAPER && scroll->otyp != SCR_BLANK_PAPER
560         && scroll->otyp != SPE_NOVEL)
561         u.uconduct.literate++;
562
563     if (scroll->oclass == SPBOOK_CLASS) {
564         return study_book(scroll);
565     }
566     scroll->in_use = TRUE; /* scroll, not spellbook, now being read */
567     if (scroll->otyp != SCR_BLANK_PAPER) {
568         boolean silently = !can_chant(&youmonst);
569
570         /* a few scroll feedback messages describe something happening
571            to the scroll itself, so avoid "it disappears" for those */
572         nodisappear = (scroll->otyp == SCR_FIRE
573                        || (scroll->otyp == SCR_REMOVE_CURSE
574                            && scroll->cursed));
575         if (Blind)
576 #if 0 /*JP:T*/
577             pline(nodisappear
578                       ? "You %s the formula on the scroll."
579                       : "As you %s the formula on it, the scroll disappears.",
580                   silently ? "cogitate" : "pronounce");
581 #else
582             pline(nodisappear
583                       ? "\82 \82È\82½\82Í\8eô\95\82ð%s\82½\81D"
584                       : "\8eô\95\82ð%s\82é\82Æ\81C\8aª\95¨\82Í\8fÁ\82¦\82½\81D",
585                   silently ? "\94O\82¶" : "\8f¥\82¦");
586 #endif
587         else
588 #if 0 /*JP:T*/
589             pline(nodisappear ? "You read the scroll."
590                               : "As you read the scroll, it disappears.");
591 #else
592             pline(nodisappear ? "\82 \82È\82½\82Í\8aª\95¨\82ð\93Ç\82ñ\82¾\81D"
593                               : "\8aª\95¨\82ð\93Ç\82Þ\82Æ\81C\82»\82ê\82Í\8fÁ\82¦\82½\81D");
594 #endif
595         if (confused) {
596             if (Hallucination)
597 /*JP
598                 pline("Being so trippy, you screw up...");
599 */
600                 pline("\82Æ\82Ä\82à\82Ö\82ë\82Ö\82ë\82È\82Ì\82Å\81C\82­\82µ\82á\82­\82µ\82á\82É\82µ\82Ä\82µ\82Ü\82Á\82½\81D\81D\81D");
601             else
602 #if 0 /*JP:T*/
603                 pline("Being confused, you %s the magic words...",
604                       silently ? "misunderstand" : "mispronounce");
605 #else
606                 pline("\8d¬\97\90\82µ\82Ä\82¢\82é\82Ì\82Å\81C\8eô\95\82ð\8aÔ\88á\82Á\82Ä\82µ\82Ü\82Á\82½\81D\81D\81D");
607 #endif
608         }
609     }
610     if (!seffects(scroll)) {
611         if (!objects[scroll->otyp].oc_name_known) {
612             if (known)
613                 learnscroll(scroll);
614             else if (!objects[scroll->otyp].oc_uname)
615                 docall(scroll);
616         }
617         scroll->in_use = FALSE;
618         if (scroll->otyp != SCR_BLANK_PAPER)
619             useup(scroll);
620     }
621     return 1;
622 }
623
624 STATIC_OVL void
625 stripspe(obj)
626 register struct obj *obj;
627 {
628     if (obj->blessed || obj->spe <= 0) {
629         pline1(nothing_happens);
630     } else {
631         /* order matters: message, shop handling, actual transformation */
632 /*JP
633         pline("%s briefly.", Yobjnam2(obj, "vibrate"));
634 */
635         Your("%s\82Í\8f¬\8d\8f\82Ý\82É\90U\93®\82µ\82½\81D",xname(obj));
636         costly_alteration(obj, COST_UNCHRG);
637         obj->spe = 0;
638         if (obj->otyp == OIL_LAMP || obj->otyp == BRASS_LANTERN)
639             obj->age = 0;
640     }
641 }
642
643 STATIC_OVL void
644 p_glow1(otmp)
645 register struct obj *otmp;
646 {
647 /*JP
648     pline("%s briefly.", Yobjnam2(otmp, Blind ? "vibrate" : "glow"));
649 */
650     Your("%s\82Í\8f¬\8d\8f\82Ý\82É%s\81D", xname(otmp), Blind ? "\90U\93®\82µ\82½" : "\8bP\82¢\82½");
651 }
652
653 STATIC_OVL void
654 p_glow2(otmp, color)
655 register struct obj *otmp;
656 register const char *color;
657 {
658 #if 0 /*JP:T*/
659     pline("%s%s%s for a moment.", Yobjnam2(otmp, Blind ? "vibrate" : "glow"),
660           Blind ? "" : " ", Blind ? "" : hcolor(color));
661 #else
662     Your("%s\82Í\88ê\8fu%s%s\81D", xname(otmp),
663          Blind ? "" : jconj_adj(hcolor(color)),
664          Blind ? "\90U\93®\82µ\82½" : "\8bP\82¢\82½");
665 #endif
666 }
667
668 /* Is the object chargeable?  For purposes of inventory display; it is
669    possible to be able to charge things for which this returns FALSE. */
670 boolean
671 is_chargeable(obj)
672 struct obj *obj;
673 {
674     if (obj->oclass == WAND_CLASS)
675         return TRUE;
676     /* known && !oc_name_known is possible after amnesia/mind flayer */
677     if (obj->oclass == RING_CLASS)
678         return (boolean) (objects[obj->otyp].oc_charged
679                           && (obj->known
680                               || (obj->dknown
681                                   && objects[obj->otyp].oc_name_known)));
682     if (is_weptool(obj)) /* specific check before general tools */
683         return FALSE;
684     if (obj->oclass == TOOL_CLASS)
685         return (boolean) objects[obj->otyp].oc_charged;
686     return FALSE; /* why are weapons/armor considered charged anyway? */
687 }
688
689 /* recharge an object; curse_bless is -1 if the recharging implement
690    was cursed, +1 if blessed, 0 otherwise. */
691 void
692 recharge(obj, curse_bless)
693 struct obj *obj;
694 int curse_bless;
695 {
696     register int n;
697     boolean is_cursed, is_blessed;
698
699     is_cursed = curse_bless < 0;
700     is_blessed = curse_bless > 0;
701
702     if (obj->oclass == WAND_CLASS) {
703         int lim = (obj->otyp == WAN_WISHING)
704                       ? 3
705                       : (objects[obj->otyp].oc_dir != NODIR) ? 8 : 15;
706
707         /* undo any prior cancellation, even when is_cursed */
708         if (obj->spe == -1)
709             obj->spe = 0;
710
711         /*
712          * Recharging might cause wands to explode.
713          *      v = number of previous recharges
714          *            v = percentage chance to explode on this attempt
715          *                    v = cumulative odds for exploding
716          *      0 :   0       0
717          *      1 :   0.29    0.29
718          *      2 :   2.33    2.62
719          *      3 :   7.87   10.28
720          *      4 :  18.66   27.02
721          *      5 :  36.44   53.62
722          *      6 :  62.97   82.83
723          *      7 : 100     100
724          */
725         n = (int) obj->recharged;
726         if (n > 0 && (obj->otyp == WAN_WISHING
727                       || (n * n * n > rn2(7 * 7 * 7)))) { /* recharge_limit */
728             wand_explode(obj, rnd(lim));
729             return;
730         }
731         /* didn't explode, so increment the recharge count */
732         obj->recharged = (unsigned) (n + 1);
733
734         /* now handle the actual recharging */
735         if (is_cursed) {
736             stripspe(obj);
737         } else {
738             n = (lim == 3) ? 3 : rn1(5, lim + 1 - 5);
739             if (!is_blessed)
740                 n = rnd(n);
741
742             if (obj->spe < n)
743                 obj->spe = n;
744             else
745                 obj->spe++;
746             if (obj->otyp == WAN_WISHING && obj->spe > 3) {
747                 wand_explode(obj, 1);
748                 return;
749             }
750             if (obj->spe >= lim)
751                 p_glow2(obj, NH_BLUE);
752             else
753                 p_glow1(obj);
754 #if 0 /*[shop price doesn't vary by charge count]*/
755             /* update shop bill to reflect new higher price */
756             if (obj->unpaid)
757                 alter_cost(obj, 0L);
758 #endif
759         }
760
761     } else if (obj->oclass == RING_CLASS && objects[obj->otyp].oc_charged) {
762         /* charging does not affect ring's curse/bless status */
763         int s = is_blessed ? rnd(3) : is_cursed ? -rnd(2) : 1;
764         boolean is_on = (obj == uleft || obj == uright);
765
766         /* destruction depends on current state, not adjustment */
767         if (obj->spe > rn2(7) || obj->spe <= -5) {
768 #if 0 /*JP:T*/
769             pline("%s momentarily, then %s!", Yobjnam2(obj, "pulsate"),
770                   otense(obj, "explode"));
771 #else
772             Your("%s\82Í\88ê\8fu\96¬\93®\82µ\81C\94\9a\94­\82µ\82½\81I", xname(obj));
773 #endif
774             if (is_on)
775                 Ring_gone(obj);
776             s = rnd(3 * abs(obj->spe)); /* amount of damage */
777             useup(obj);
778 /*JP
779             losehp(Maybe_Half_Phys(s), "exploding ring", KILLED_BY_AN);
780 */
781             losehp(Maybe_Half_Phys(s), "\8ew\97Ö\82Ì\94\9a\94­\82Å", KILLED_BY_AN);
782         } else {
783             long mask = is_on ? (obj == uleft ? LEFT_RING : RIGHT_RING) : 0L;
784
785 #if 0 /*JP:T*/
786             pline("%s spins %sclockwise for a moment.", Yname2(obj),
787                   s < 0 ? "counter" : "");
788 #else
789             Your("%s\82Í\88ê\8fu%s\8e\9e\8cv\89ñ\82è\82É\89ñ\93]\82µ\82½\81D", xname(obj),
790                  s < 0 ? "\94½" : "");
791 #endif
792             if (s < 0)
793                 costly_alteration(obj, COST_DECHNT);
794             /* cause attributes and/or properties to be updated */
795             if (is_on)
796                 Ring_off(obj);
797             obj->spe += s; /* update the ring while it's off */
798             if (is_on)
799                 setworn(obj, mask), Ring_on(obj);
800             /* oartifact: if a touch-sensitive artifact ring is
801                ever created the above will need to be revised  */
802             /* update shop bill to reflect new higher price */
803             if (s > 0 && obj->unpaid)
804                 alter_cost(obj, 0L);
805         }
806
807     } else if (obj->oclass == TOOL_CLASS) {
808         int rechrg = (int) obj->recharged;
809
810         if (objects[obj->otyp].oc_charged) {
811             /* tools don't have a limit, but the counter used does */
812             if (rechrg < 7) /* recharge_limit */
813                 obj->recharged++;
814         }
815         switch (obj->otyp) {
816         case BELL_OF_OPENING:
817             if (is_cursed)
818                 stripspe(obj);
819             else if (is_blessed)
820                 obj->spe += rnd(3);
821             else
822                 obj->spe += 1;
823             if (obj->spe > 5)
824                 obj->spe = 5;
825             break;
826         case MAGIC_MARKER:
827         case TINNING_KIT:
828         case EXPENSIVE_CAMERA:
829             if (is_cursed)
830                 stripspe(obj);
831             else if (rechrg
832                      && obj->otyp
833                             == MAGIC_MARKER) { /* previously recharged */
834                 obj->recharged = 1; /* override increment done above */
835                 if (obj->spe < 3)
836 /*JP
837                     Your("marker seems permanently dried out.");
838 */
839                     Your("\83}\81[\83J\82Í\8a®\91S\82É\8a£\82«\82«\82Á\82Ä\82µ\82Ü\82Á\82½\81D");
840                 else
841                     pline1(nothing_happens);
842             } else if (is_blessed) {
843                 n = rn1(16, 15); /* 15..30 */
844                 if (obj->spe + n <= 50)
845                     obj->spe = 50;
846                 else if (obj->spe + n <= 75)
847                     obj->spe = 75;
848                 else {
849                     int chrg = (int) obj->spe;
850                     if ((chrg + n) > 127)
851                         obj->spe = 127;
852                     else
853                         obj->spe += n;
854                 }
855                 p_glow2(obj, NH_BLUE);
856             } else {
857                 n = rn1(11, 10); /* 10..20 */
858                 if (obj->spe + n <= 50)
859                     obj->spe = 50;
860                 else {
861                     int chrg = (int) obj->spe;
862                     if ((chrg + n) > 127)
863                         obj->spe = 127;
864                     else
865                         obj->spe += n;
866                 }
867                 p_glow2(obj, NH_WHITE);
868             }
869             break;
870         case OIL_LAMP:
871         case BRASS_LANTERN:
872             if (is_cursed) {
873                 stripspe(obj);
874                 if (obj->lamplit) {
875                     if (!Blind)
876 #if 0 /*JP:T*/
877                         pline("%s out!", Tobjnam(obj, "go"));
878 #else
879                         pline("%s\82Í\8fÁ\82¦\82½\81I", xname(obj));
880 #endif
881                     end_burn(obj, TRUE);
882                 }
883             } else if (is_blessed) {
884                 obj->spe = 1;
885                 obj->age = 1500;
886                 p_glow2(obj, NH_BLUE);
887             } else {
888                 obj->spe = 1;
889                 obj->age += 750;
890                 if (obj->age > 1500)
891                     obj->age = 1500;
892                 p_glow1(obj);
893             }
894             break;
895         case CRYSTAL_BALL:
896             if (is_cursed) {
897                 stripspe(obj);
898             } else if (is_blessed) {
899                 obj->spe = 6;
900                 p_glow2(obj, NH_BLUE);
901             } else {
902                 if (obj->spe < 5) {
903                     obj->spe++;
904                     p_glow1(obj);
905                 } else
906                     pline1(nothing_happens);
907             }
908             break;
909         case HORN_OF_PLENTY:
910         case BAG_OF_TRICKS:
911         case CAN_OF_GREASE:
912             if (is_cursed) {
913                 stripspe(obj);
914             } else if (is_blessed) {
915                 if (obj->spe <= 10)
916                     obj->spe += rn1(10, 6);
917                 else
918                     obj->spe += rn1(5, 6);
919                 if (obj->spe > 50)
920                     obj->spe = 50;
921                 p_glow2(obj, NH_BLUE);
922             } else {
923                 obj->spe += rnd(5);
924                 if (obj->spe > 50)
925                     obj->spe = 50;
926                 p_glow1(obj);
927             }
928             break;
929         case MAGIC_FLUTE:
930         case MAGIC_HARP:
931         case FROST_HORN:
932         case FIRE_HORN:
933         case DRUM_OF_EARTHQUAKE:
934             if (is_cursed) {
935                 stripspe(obj);
936             } else if (is_blessed) {
937                 obj->spe += d(2, 4);
938                 if (obj->spe > 20)
939                     obj->spe = 20;
940                 p_glow2(obj, NH_BLUE);
941             } else {
942                 obj->spe += rnd(4);
943                 if (obj->spe > 20)
944                     obj->spe = 20;
945                 p_glow1(obj);
946             }
947             break;
948         default:
949             goto not_chargable;
950             /*NOTREACHED*/
951             break;
952         } /* switch */
953
954     } else {
955     not_chargable:
956 /*JP
957         You("have a feeling of loss.");
958 */
959         You("\82È\82É\82©\91¹\82µ\82½\8bC\95ª\82É\82È\82Á\82½\81D");
960     }
961 }
962
963 /* Forget known information about this object type. */
964 STATIC_OVL void
965 forget_single_object(obj_id)
966 int obj_id;
967 {
968     objects[obj_id].oc_name_known = 0;
969     objects[obj_id].oc_pre_discovered = 0; /* a discovery when relearned */
970     if (objects[obj_id].oc_uname) {
971         free((genericptr_t) objects[obj_id].oc_uname);
972         objects[obj_id].oc_uname = 0;
973     }
974     undiscover_object(obj_id); /* after clearing oc_name_known */
975
976     /* clear & free object names from matching inventory items too? */
977 }
978
979 #if 0 /* here if anyone wants it.... */
980 /* Forget everything known about a particular object class. */
981 STATIC_OVL void
982 forget_objclass(oclass)
983 int oclass;
984 {
985     int i;
986
987     for (i = bases[oclass];
988          i < NUM_OBJECTS && objects[i].oc_class == oclass; i++)
989         forget_single_object(i);
990 }
991 #endif
992
993 /* randomize the given list of numbers  0 <= i < count */
994 STATIC_OVL void
995 randomize(indices, count)
996 int *indices;
997 int count;
998 {
999     int i, iswap, temp;
1000
1001     for (i = count - 1; i > 0; i--) {
1002         if ((iswap = rn2(i + 1)) == i)
1003             continue;
1004         temp = indices[i];
1005         indices[i] = indices[iswap];
1006         indices[iswap] = temp;
1007     }
1008 }
1009
1010 /* Forget % of known objects. */
1011 void
1012 forget_objects(percent)
1013 int percent;
1014 {
1015     int i, count;
1016     int indices[NUM_OBJECTS];
1017
1018     if (percent == 0)
1019         return;
1020     if (percent <= 0 || percent > 100) {
1021         impossible("forget_objects: bad percent %d", percent);
1022         return;
1023     }
1024
1025     indices[0] = 0; /* lint suppression */
1026     for (count = 0, i = 1; i < NUM_OBJECTS; i++)
1027         if (OBJ_DESCR(objects[i])
1028             && (objects[i].oc_name_known || objects[i].oc_uname))
1029             indices[count++] = i;
1030
1031     if (count > 0) {
1032         randomize(indices, count);
1033
1034         /* forget first % of randomized indices */
1035         count = ((count * percent) + rn2(100)) / 100;
1036         for (i = 0; i < count; i++)
1037             forget_single_object(indices[i]);
1038     }
1039 }
1040
1041 /* Forget some or all of map (depends on parameters). */
1042 void
1043 forget_map(howmuch)
1044 int howmuch;
1045 {
1046     register int zx, zy;
1047
1048     if (Sokoban)
1049         return;
1050
1051     known = TRUE;
1052     for (zx = 0; zx < COLNO; zx++)
1053         for (zy = 0; zy < ROWNO; zy++)
1054             if (howmuch & ALL_MAP || rn2(7)) {
1055                 /* Zonk all memory of this location. */
1056                 levl[zx][zy].seenv = 0;
1057                 levl[zx][zy].waslit = 0;
1058                 levl[zx][zy].glyph = cmap_to_glyph(S_stone);
1059                 lastseentyp[zx][zy] = STONE;
1060             }
1061     /* forget overview data for this level */
1062     forget_mapseen(ledger_no(&u.uz));
1063 }
1064
1065 /* Forget all traps on the level. */
1066 void
1067 forget_traps()
1068 {
1069     register struct trap *trap;
1070
1071     /* forget all traps (except the one the hero is in :-) */
1072     for (trap = ftrap; trap; trap = trap->ntrap)
1073         if ((trap->tx != u.ux || trap->ty != u.uy) && (trap->ttyp != HOLE))
1074             trap->tseen = 0;
1075 }
1076
1077 /*
1078  * Forget given % of all levels that the hero has visited and not forgotten,
1079  * except this one.
1080  */
1081 void
1082 forget_levels(percent)
1083 int percent;
1084 {
1085     int i, count;
1086     xchar maxl, this_lev;
1087     int indices[MAXLINFO];
1088
1089     if (percent == 0)
1090         return;
1091
1092     if (percent <= 0 || percent > 100) {
1093         impossible("forget_levels: bad percent %d", percent);
1094         return;
1095     }
1096
1097     this_lev = ledger_no(&u.uz);
1098     maxl = maxledgerno();
1099
1100     /* count & save indices of non-forgotten visited levels */
1101     /* Sokoban levels are pre-mapped for the player, and should stay
1102      * so, or they become nearly impossible to solve.  But try to
1103      * shift the forgetting elsewhere by fiddling with percent
1104      * instead of forgetting fewer levels.
1105      */
1106     indices[0] = 0; /* lint suppression */
1107     for (count = 0, i = 0; i <= maxl; i++)
1108         if ((level_info[i].flags & VISITED)
1109             && !(level_info[i].flags & FORGOTTEN) && i != this_lev) {
1110             if (ledger_to_dnum(i) == sokoban_dnum)
1111                 percent += 2;
1112             else
1113                 indices[count++] = i;
1114         }
1115
1116     if (percent > 100)
1117         percent = 100;
1118
1119     if (count > 0) {
1120         randomize(indices, count);
1121
1122         /* forget first % of randomized indices */
1123         count = ((count * percent) + 50) / 100;
1124         for (i = 0; i < count; i++) {
1125             level_info[indices[i]].flags |= FORGOTTEN;
1126             forget_mapseen(indices[i]);
1127         }
1128     }
1129 }
1130
1131 /*
1132  * Forget some things (e.g. after reading a scroll of amnesia).  When called,
1133  * the following are always forgotten:
1134  *      - felt ball & chain
1135  *      - traps
1136  *      - part (6 out of 7) of the map
1137  *
1138  * Other things are subject to flags:
1139  *      howmuch & ALL_MAP       = forget whole map
1140  *      howmuch & ALL_SPELLS    = forget all spells
1141  */
1142 STATIC_OVL void
1143 forget(howmuch)
1144 int howmuch;
1145 {
1146     if (Punished)
1147         u.bc_felt = 0; /* forget felt ball&chain */
1148
1149     forget_map(howmuch);
1150     forget_traps();
1151
1152     /* 1 in 3 chance of forgetting some levels */
1153     if (!rn2(3))
1154         forget_levels(rn2(25));
1155
1156     /* 1 in 3 chance of forgetting some objects */
1157     if (!rn2(3))
1158         forget_objects(rn2(25));
1159
1160     if (howmuch & ALL_SPELLS)
1161         losespells();
1162     /*
1163      * Make sure that what was seen is restored correctly.  To do this,
1164      * we need to go blind for an instant --- turn off the display,
1165      * then restart it.  All this work is needed to correctly handle
1166      * walls which are stone on one side and wall on the other.  Turning
1167      * off the seen bits above will make the wall revert to stone,  but
1168      * there are cases where we don't want this to happen.  The easiest
1169      * thing to do is to run it through the vision system again, which
1170      * is always correct.
1171      */
1172     docrt(); /* this correctly will reset vision */
1173 }
1174
1175 /* monster is hit by scroll of taming's effect */
1176 STATIC_OVL int
1177 maybe_tame(mtmp, sobj)
1178 struct monst *mtmp;
1179 struct obj *sobj;
1180 {
1181     int was_tame = mtmp->mtame;
1182     unsigned was_peaceful = mtmp->mpeaceful;
1183
1184     if (sobj->cursed) {
1185         setmangry(mtmp, FALSE);
1186         if (was_peaceful && !mtmp->mpeaceful)
1187             return -1;
1188     } else {
1189         if (mtmp->isshk)
1190             make_happy_shk(mtmp, FALSE);
1191         else if (!resist(mtmp, sobj->oclass, 0, NOTELL))
1192             (void) tamedog(mtmp, (struct obj *) 0);
1193         if ((!was_peaceful && mtmp->mpeaceful) || (!was_tame && mtmp->mtame))
1194             return 1;
1195     }
1196     return 0;
1197 }
1198
1199 STATIC_OVL boolean
1200 get_valid_stinking_cloud_pos(x,y)
1201 int x,y;
1202 {
1203     return (!(!isok(x,y) || !cansee(x, y)
1204               || !ACCESSIBLE(levl[x][y].typ)
1205               || distu(x, y) >= 32));
1206 }
1207
1208 STATIC_OVL boolean
1209 is_valid_stinking_cloud_pos(x, y, showmsg)
1210 int x, y;
1211 boolean showmsg;
1212 {
1213     if (!get_valid_stinking_cloud_pos(x,y)) {
1214         if (showmsg)
1215 /*JP
1216             You("smell rotten eggs.");
1217 */
1218             pline("\82­\82³\82Á\82½\97\91\82Ì\82É\82¨\82¢\82ª\82µ\82½\81D");
1219         return FALSE;
1220     }
1221     return TRUE;
1222 }
1223
1224 STATIC_PTR void
1225 display_stinking_cloud_positions(state)
1226 int state;
1227 {
1228     if (state == 0) {
1229         tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
1230     } else if (state == 1) {
1231         int x, y, dx, dy;
1232         int dist = 6;
1233
1234         for (dx = -dist; dx <= dist; dx++)
1235             for (dy = -dist; dy <= dist; dy++) {
1236                 x = u.ux + dx;
1237                 y = u.uy + dy;
1238                 if (get_valid_stinking_cloud_pos(x,y))
1239                     tmp_at(x, y);
1240             }
1241     } else {
1242         tmp_at(DISP_END, 0);
1243     }
1244 }
1245
1246 /* scroll effects; return 1 if we use up the scroll and possibly make it
1247    become discovered, 0 if caller should take care of those side-effects */
1248 int
1249 seffects(sobj)
1250 struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
1251 {
1252     int cval, otyp = sobj->otyp;
1253     boolean confused = (Confusion != 0), sblessed = sobj->blessed,
1254             scursed = sobj->cursed, already_known, old_erodeproof,
1255             new_erodeproof;
1256     struct obj *otmp;
1257
1258     if (objects[otyp].oc_magic)
1259         exercise(A_WIS, TRUE);                       /* just for trying */
1260     already_known = (sobj->oclass == SPBOOK_CLASS /* spell */
1261                      || objects[otyp].oc_name_known);
1262
1263     switch (otyp) {
1264 #ifdef MAIL
1265     case SCR_MAIL:
1266         known = TRUE;
1267         if (sobj->spe == 2)
1268             /* "stamped scroll" created via magic marker--without a stamp */
1269 /*JP
1270             pline("This scroll is marked \"postage due\".");
1271 */
1272             pline("\82±\82Ì\8aª\95¨\82É\82Í\81u\97¿\8bà\95s\91«\81v\82Æ\8f\91\82¢\82Ä\82 \82é\81D");
1273         else if (sobj->spe)
1274             /* scroll of mail obtained from bones file or from wishing;
1275              * note to the puzzled: the game Larn actually sends you junk
1276              * mail if you win!
1277              */
1278             pline(
1279 /*JP
1280     "This seems to be junk mail addressed to the finder of the Eye of Larn.");
1281 */
1282     "Eye of Larn\82Ì\94­\8c©\8eÒ\82É\88\82Ä\82ç\82ê\82½\83S\83~\83\81\83C\83\8b\82Ì\82æ\82¤\82¾\81D");
1283         else
1284             readmail(sobj);
1285         break;
1286 #endif
1287     case SCR_ENCHANT_ARMOR: {
1288         register schar s;
1289         boolean special_armor;
1290         boolean same_color;
1291
1292         otmp = some_armor(&youmonst);
1293         if (!otmp) {
1294 #if 0 /*JP:T*/
1295             strange_feeling(sobj, !Blind
1296                                       ? "Your skin glows then fades."
1297                                       : "Your skin feels warm for a moment.");
1298 #else
1299             strange_feeling(sobj, !Blind
1300                             ? "\82 \82È\82½\82Ì\91Ì\82Í\88ê\8fu\8bP\82¢\82½\81D"
1301                             : "\82 \82È\82½\82Ì\91Ì\82Í\88ê\8fu\92g\82©\82­\82È\82Á\82½\81D");
1302 #endif
1303             sobj = 0; /* useup() in strange_feeling() */
1304             exercise(A_CON, !scursed);
1305             exercise(A_STR, !scursed);
1306             break;
1307         }
1308         if (confused) {
1309             old_erodeproof = (otmp->oerodeproof != 0);
1310             new_erodeproof = !scursed;
1311             otmp->oerodeproof = 0; /* for messages */
1312             if (Blind) {
1313                 otmp->rknown = FALSE;
1314 /*JP
1315                 pline("%s warm for a moment.", Yobjnam2(otmp, "feel"));
1316 */
1317                 Your("%s\82Í\88ê\8fu\92g\82©\82­\82È\82Á\82½\81D", xname(otmp));
1318             } else {
1319                 otmp->rknown = TRUE;
1320 #if 0 /*JP:T*/
1321                 pline("%s covered by a %s %s %s!", Yobjnam2(otmp, "are"),
1322                       scursed ? "mottled" : "shimmering",
1323                       hcolor(scursed ? NH_BLACK : NH_GOLDEN),
1324                       scursed ? "glow"
1325                               : (is_shield(otmp) ? "layer" : "shield"));
1326 #else
1327                 Your("%s\82Í%s%s%s\82Å\95¢\82í\82ê\82½\81I", xname(otmp),
1328                      jconj_adj(hcolor(scursed ? NH_BLACK : NH_GOLDEN)),
1329                      scursed ? "\8cõ\82é\82Ü\82¾\82ç\82Ì" : "\82ä\82ç\82ß\82­",
1330                      scursed ? "\8bP\82«"
1331                              : "\83o\83\8a\83A");
1332 #endif
1333             }
1334             if (new_erodeproof && (otmp->oeroded || otmp->oeroded2)) {
1335                 otmp->oeroded = otmp->oeroded2 = 0;
1336 #if 0 /*JP:T*/
1337                 pline("%s as good as new!",
1338                       Yobjnam2(otmp, Blind ? "feel" : "look"));
1339 #else
1340                 Your("%s\82Í\90V\95i\93¯\97l\82É\82È\82Á\82½\81I",
1341                      xname(otmp));
1342 #endif
1343             }
1344             if (old_erodeproof && !new_erodeproof) {
1345                 /* restore old_erodeproof before shop charges */
1346                 otmp->oerodeproof = 1;
1347                 costly_alteration(otmp, COST_DEGRD);
1348             }
1349             otmp->oerodeproof = new_erodeproof ? 1 : 0;
1350             break;
1351         }
1352         /* elven armor vibrates warningly when enchanted beyond a limit */
1353         special_armor = is_elven_armor(otmp)
1354                         || (Role_if(PM_WIZARD) && otmp->otyp == CORNUTHAUM);
1355         if (scursed)
1356             same_color = (otmp->otyp == BLACK_DRAGON_SCALE_MAIL
1357                           || otmp->otyp == BLACK_DRAGON_SCALES);
1358         else
1359             same_color = (otmp->otyp == SILVER_DRAGON_SCALE_MAIL
1360                           || otmp->otyp == SILVER_DRAGON_SCALES
1361                           || otmp->otyp == SHIELD_OF_REFLECTION);
1362         if (Blind)
1363             same_color = FALSE;
1364
1365         /* KMH -- catch underflow */
1366         s = scursed ? -otmp->spe : otmp->spe;
1367         if (s > (special_armor ? 5 : 3) && rn2(s)) {
1368             otmp->in_use = TRUE;
1369 #if 0 /*JP:T*/
1370             pline("%s violently %s%s%s for a while, then %s.", Yname2(otmp),
1371                   otense(otmp, Blind ? "vibrate" : "glow"),
1372                   (!Blind && !same_color) ? " " : "",
1373                   (Blind || same_color) ? "" : hcolor(scursed ? NH_BLACK
1374                                                               : NH_SILVER),
1375                   otense(otmp, "evaporate"));
1376 #else
1377             Your("%s\82Í\82µ\82Î\82ç\82­\82Ì\8aÔ\8c\83\82µ\82­%s%s\81C\8fö\94­\82µ\82½\81D", xname(otmp),
1378                  (Blind || same_color) ? "" : jconj_adj(hcolor(scursed ? NH_BLACK : NH_SILVER)),
1379                  Blind ? "\90U\93®\82µ" : "\8bP\82«");
1380 #endif
1381             remove_worn_item(otmp, FALSE);
1382             useup(otmp);
1383             break;
1384         }
1385         s = scursed ? -1
1386                     : (otmp->spe >= 9)
1387                        ? (rn2(otmp->spe) == 0)
1388                        : sblessed
1389                           ? rnd(3 - otmp->spe / 3)
1390                           : 1;
1391         if (s >= 0 && Is_dragon_scales(otmp)) {
1392             /* dragon scales get turned into dragon scale mail */
1393 /*JP
1394             pline("%s merges and hardens!", Yname2(otmp));
1395 */
1396             Your("%s\82Í\97Z\8d\87\82µ\8cÅ\82­\82È\82Á\82½\81I", xname(otmp));
1397             setworn((struct obj *) 0, W_ARM);
1398             /* assumes same order */
1399             otmp->otyp += GRAY_DRAGON_SCALE_MAIL - GRAY_DRAGON_SCALES;
1400             if (sblessed) {
1401                 otmp->spe++;
1402                 if (!otmp->blessed)
1403                     bless(otmp);
1404             } else if (otmp->cursed)
1405                 uncurse(otmp);
1406             otmp->known = 1;
1407             setworn(otmp, W_ARM);
1408             if (otmp->unpaid)
1409                 alter_cost(otmp, 0L); /* shop bill */
1410             break;
1411         }
1412 #if 0 /*JP:T*/
1413         pline("%s %s%s%s%s for a %s.", Yname2(otmp),
1414               s == 0 ? "violently " : "",
1415               otense(otmp, Blind ? "vibrate" : "glow"),
1416               (!Blind && !same_color) ? " " : "",
1417               (Blind || same_color)
1418                  ? "" : hcolor(scursed ? NH_BLACK : NH_SILVER),
1419               (s * s > 1) ? "while" : "moment");
1420 #else
1421         Your("%s\82Í%s%s%s%s\81D", xname(otmp),
1422              (s * s > 1) ? "\82µ\82Î\82ç\82­\82Ì\8aÔ" : "\88ê\8fu",
1423              s == 0 ? "\8c\83\82µ\82­" : "",
1424              (Blind || same_color) ? ""
1425                                    : jconj_adj(hcolor(sobj->cursed ? NH_BLACK : NH_SILVER)),
1426              Blind ? "\90U\93®\82µ\82½" : "\8bP\82¢\82½");
1427 #endif
1428         /* [this cost handling will need updating if shop pricing is
1429            ever changed to care about curse/bless status of armor] */
1430         if (s < 0)
1431             costly_alteration(otmp, COST_DECHNT);
1432         if (scursed && !otmp->cursed)
1433             curse(otmp);
1434         else if (sblessed && !otmp->blessed)
1435             bless(otmp);
1436         else if (!scursed && otmp->cursed)
1437             uncurse(otmp);
1438         if (s) {
1439             otmp->spe += s;
1440             adj_abon(otmp, s);
1441             known = otmp->known;
1442             /* update shop bill to reflect new higher price */
1443             if (s > 0 && otmp->unpaid)
1444                 alter_cost(otmp, 0L);
1445         }
1446
1447         if ((otmp->spe > (special_armor ? 5 : 3))
1448             && (special_armor || !rn2(7)))
1449 #if 0 /*JP:T*/
1450             pline("%s %s.", Yobjnam2(otmp, "suddenly vibrate"),
1451                   Blind ? "again" : "unexpectedly");
1452 #else
1453             Your("%s\82Í\93Ë\91R%s\90U\93®\82µ\82½\81D", xname(otmp),
1454                  Blind ? "\82Ü\82½" : "\8ev\82¢\82à\82æ\82ç\82¸");
1455 #endif
1456         break;
1457     }
1458     case SCR_DESTROY_ARMOR: {
1459         otmp = some_armor(&youmonst);
1460         if (confused) {
1461             if (!otmp) {
1462 /*JP
1463                 strange_feeling(sobj, "Your bones itch.");
1464 */
1465                 strange_feeling(sobj, "\8d\9c\82ª\83\80\83Y\83\80\83Y\82·\82é\81D");
1466                 sobj = 0; /* useup() in strange_feeling() */
1467                 exercise(A_STR, FALSE);
1468                 exercise(A_CON, FALSE);
1469                 break;
1470             }
1471             old_erodeproof = (otmp->oerodeproof != 0);
1472             new_erodeproof = scursed;
1473             otmp->oerodeproof = 0; /* for messages */
1474             p_glow2(otmp, NH_PURPLE);
1475             if (old_erodeproof && !new_erodeproof) {
1476                 /* restore old_erodeproof before shop charges */
1477                 otmp->oerodeproof = 1;
1478                 costly_alteration(otmp, COST_DEGRD);
1479             }
1480             otmp->oerodeproof = new_erodeproof ? 1 : 0;
1481             break;
1482         }
1483         if (!scursed || !otmp || !otmp->cursed) {
1484             if (!destroy_arm(otmp)) {
1485 /*JP
1486                 strange_feeling(sobj, "Your skin itches.");
1487 */
1488                 strange_feeling(sobj,"\94ç\95\86\82ª\83\80\83Y\83\80\83Y\82·\82é\81D");
1489                 sobj = 0; /* useup() in strange_feeling() */
1490                 exercise(A_STR, FALSE);
1491                 exercise(A_CON, FALSE);
1492                 break;
1493             } else
1494                 known = TRUE;
1495         } else { /* armor and scroll both cursed */
1496 /*JP
1497             pline("%s.", Yobjnam2(otmp, "vibrate"));
1498 */
1499             Your("%s\82Í\90U\93®\82µ\82½\81D", xname(otmp));
1500             if (otmp->spe >= -6) {
1501                 otmp->spe += -1;
1502                 adj_abon(otmp, -1);
1503             }
1504             make_stunned((HStun & TIMEOUT) + (long) rn1(10, 10), TRUE);
1505         }
1506     } break;
1507     case SCR_CONFUSE_MONSTER:
1508     case SPE_CONFUSE_MONSTER:
1509         if (youmonst.data->mlet != S_HUMAN || scursed) {
1510             if (!HConfusion)
1511 /*JP
1512                 You_feel("confused.");
1513 */
1514                 You_feel("\8d¬\97\90\82µ\82½\81D");
1515             make_confused(HConfusion + rnd(100), FALSE);
1516         } else if (confused) {
1517             if (!sblessed) {
1518 #if 0 /*JP:T*/
1519                 Your("%s begin to %s%s.", makeplural(body_part(HAND)),
1520                      Blind ? "tingle" : "glow ",
1521                      Blind ? "" : hcolor(NH_PURPLE));
1522 #else
1523                 Your("%s\82Í%s%s\82Í\82\82ß\82½\81D", makeplural(body_part(HAND)),
1524                      Blind ? "" : jconj_adj(hcolor(NH_PURPLE)),
1525                      Blind ? "\83q\83\8a\83q\83\8a\82µ" : "\8bP\82«");
1526 #endif
1527                 make_confused(HConfusion + rnd(100), FALSE);
1528             } else {
1529 #if 0 /*JP:T*/
1530                 pline("A %s%s surrounds your %s.",
1531                       Blind ? "" : hcolor(NH_RED),
1532                       Blind ? "faint buzz" : " glow", body_part(HEAD));
1533 #else
1534                 pline("%s%s\82ª\82 \82È\82½\82Ì%s\82ð\8eæ\82è\8aª\82¢\82½\81D",
1535                       Blind ? "" : jconj_adj(hcolor(NH_RED)),
1536                       Blind ? "\82©\82·\82©\82É\83u\81[\83\93\82Æ\96Â\82é\82à\82Ì" : "\8bP\82­\82à\82Ì",
1537                       body_part(HEAD));
1538 #endif
1539                 make_confused(0L, TRUE);
1540             }
1541         } else {
1542             if (!sblessed) {
1543 #if 0 /*JP:T*/
1544                 Your("%s%s %s%s.", makeplural(body_part(HAND)),
1545                      Blind ? "" : " begin to glow",
1546                      Blind ? (const char *) "tingle" : hcolor(NH_RED),
1547                      u.umconf ? " even more" : "");
1548 #else
1549                 Your("%s\82Í%s%s%s\81D", makeplural(body_part(HAND)),
1550                      u.umconf ? "\8f­\82µ" : "",
1551                      Blind ? (const char *) "\83q\83\8a\83q\83\8a\82µ\82½" : jconj_adj(hcolor(NH_RED)),
1552                      Blind ? "" : "\8bP\82«\82Í\82\82ß\82½");
1553 #endif
1554                 u.umconf++;
1555             } else {
1556                 if (Blind)
1557 #if 0 /*JP:T*/
1558                     Your("%s tingle %s sharply.", makeplural(body_part(HAND)),
1559                          u.umconf ? "even more" : "very");
1560 #else
1561                     Your("%s\82Í%s\83s\83\8a\83s\83\8a\82·\82é\81D", makeplural(body_part(HAND)),
1562                          u.umconf ? "\8f­\82µ" : "\82Æ\82Ä\82à");
1563 #endif
1564                 else
1565 #if 0 /*JP:T*/
1566                     Your("%s glow a%s brilliant %s.",
1567                          makeplural(body_part(HAND)),
1568                          u.umconf ? "n even more" : "", hcolor(NH_RED));
1569 #else
1570                     Your("%s\82Í%s%s\96¾\82é\82­\8bP\82¢\82½\81D",
1571                          makeplural(body_part(HAND)),
1572                          u.umconf ? "\8f­\82µ" : "", jconj_adj(hcolor(NH_RED)));
1573 #endif
1574                 /* after a while, repeated uses become less effective */
1575                 if (u.umconf >= 40)
1576                     u.umconf++;
1577                 else
1578                     u.umconf += rn1(8, 2);
1579             }
1580         }
1581         break;
1582     case SCR_SCARE_MONSTER:
1583     case SPE_CAUSE_FEAR: {
1584         register int ct = 0;
1585         register struct monst *mtmp;
1586
1587         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1588             if (DEADMONSTER(mtmp))
1589                 continue;
1590             if (cansee(mtmp->mx, mtmp->my)) {
1591                 if (confused || scursed) {
1592                     mtmp->mflee = mtmp->mfrozen = mtmp->msleeping = 0;
1593                     mtmp->mcanmove = 1;
1594                 } else if (!resist(mtmp, sobj->oclass, 0, NOTELL))
1595                     monflee(mtmp, 0, FALSE, FALSE);
1596                 if (!mtmp->mtame)
1597                     ct++; /* pets don't laugh at you */
1598             }
1599         }
1600         if (otyp == SCR_SCARE_MONSTER || !ct)
1601 #if 0 /*JP:T*/
1602             You_hear("%s %s.", (confused || scursed) ? "sad wailing"
1603                                                      : "maniacal laughter",
1604                      !ct ? "in the distance" : "close by");
1605 #else
1606             You_hear("\89\93\82­\82Å%s\82ð\95·\82¢\82½\81D",
1607                      (confused || sobj->cursed) ? "\94ß\82µ\82­\8b\83\82«\8b©\82Ô\90º"
1608                                                 : "\8b\82Á\82½\82æ\82¤\82É\8fÎ\82¤\90º");
1609 #endif
1610         break;
1611     }
1612     case SCR_BLANK_PAPER:
1613         if (Blind)
1614 /*JP
1615             You("don't remember there being any magic words on this scroll.");
1616 */
1617             You("\8aª\95¨\82É\8eô\95\82ª\8f\91\82¢\82Ä\82È\82©\82Á\82½\82±\82Æ\82ð\8ev\82¢\82¾\82µ\82½\81D");
1618         else
1619 /*JP
1620             pline("This scroll seems to be blank.");
1621 */
1622             pline("\82±\82Ì\8aª\95¨\82É\82Í\89½\82à\8f\91\82¢\82Ä\82È\82¢\82æ\82¤\82É\8c©\82¦\82é\81D");
1623         known = TRUE;
1624         break;
1625     case SCR_REMOVE_CURSE:
1626     case SPE_REMOVE_CURSE: {
1627         register struct obj *obj;
1628
1629 #if 0 /*JP:T*/
1630         You_feel(!Hallucination
1631                      ? (!confused ? "like someone is helping you."
1632                                   : "like you need some help.")
1633                      : (!confused ? "in touch with the Universal Oneness."
1634                                   : "the power of the Force against you!"));
1635 #else
1636         You(!Hallucination
1637             ? (!confused ? "\92N\82©\82ª\82 \82È\82½\82ð\8f\95\82¯\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D"
1638                          : "\8e©\95ª\82ª\8f\95\82¯\82ð\95K\97v\82Æ\82µ\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D")
1639             : (!confused ? "\89F\92\88\92²\98a\82Ì\8c´\97\9d\82É\90G\82ê\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D"
1640                          : "\83t\83H\81[\83X\82Ì\97Í\82ª\82 \82È\82½\82É\82Í\82Þ\82©\82Á\82Ä\82¢\82é\82æ\82¤\82É\8a´\82\82½\81I"));
1641 #endif
1642
1643         if (scursed) {
1644 /*JP
1645             pline_The("scroll disintegrates.");
1646 */
1647             pline("\8aª\95¨\82Í\95²\81X\82É\82È\82Á\82½\81D");
1648         } else {
1649             for (obj = invent; obj; obj = obj->nobj) {
1650                 long wornmask;
1651
1652                 /* gold isn't subject to cursing and blessing */
1653                 if (obj->oclass == COIN_CLASS)
1654                     continue;
1655                 /* hide current scroll from itself so that perm_invent won't
1656                    show known blessed scroll losing bknown when confused */
1657                 if (obj == sobj && obj->quan == 1L)
1658                     continue;
1659                 wornmask = (obj->owornmask & ~(W_BALL | W_ART | W_ARTI));
1660                 if (wornmask && !sblessed) {
1661                     /* handle a couple of special cases; we don't
1662                        allow auxiliary weapon slots to be used to
1663                        artificially increase number of worn items */
1664                     if (obj == uswapwep) {
1665                         if (!u.twoweap)
1666                             wornmask = 0L;
1667                     } else if (obj == uquiver) {
1668                         if (obj->oclass == WEAPON_CLASS) {
1669                             /* mergeable weapon test covers ammo,
1670                                missiles, spears, daggers & knives */
1671                             if (!objects[obj->otyp].oc_merge)
1672                                 wornmask = 0L;
1673                         } else if (obj->oclass == GEM_CLASS) {
1674                             /* possibly ought to check whether
1675                                alternate weapon is a sling... */
1676                             if (!uslinging())
1677                                 wornmask = 0L;
1678                         } else {
1679                             /* weptools don't merge and aren't
1680                                reasonable quivered weapons */
1681                             wornmask = 0L;
1682                         }
1683                     }
1684                 }
1685                 if (sblessed || wornmask || obj->otyp == LOADSTONE
1686                     || (obj->otyp == LEASH && obj->leashmon)) {
1687                     /* water price varies by curse/bless status */
1688                     boolean shop_h2o = (obj->unpaid && obj->otyp == POT_WATER);
1689
1690                     if (confused) {
1691                         blessorcurse(obj, 2);
1692                         /* lose knowledge of this object's curse/bless
1693                            state (even if it didn't actually change) */
1694                         obj->bknown = 0;
1695                         /* blessorcurse() only affects uncursed items
1696                            so no need to worry about price of water
1697                            going down (hence no costly_alteration) */
1698                         if (shop_h2o && (obj->cursed || obj->blessed))
1699                             alter_cost(obj, 0L); /* price goes up */
1700                     } else if (obj->cursed) {
1701                         if (shop_h2o)
1702                             costly_alteration(obj, COST_UNCURS);
1703                         uncurse(obj);
1704                     }
1705                 }
1706             }
1707         }
1708         if (Punished && !confused)
1709             unpunish();
1710         if (u.utrap && u.utraptype == TT_BURIEDBALL) {
1711             buried_ball_to_freedom();
1712 /*JP
1713             pline_The("clasp on your %s vanishes.", body_part(LEG));
1714 */
1715             pline_The("%s\82Ì\8bà\8bï\82ª\8fÁ\82¦\82½\81D", body_part(LEG));
1716         }
1717         update_inventory();
1718         break;
1719     }
1720     case SCR_CREATE_MONSTER:
1721     case SPE_CREATE_MONSTER:
1722         if (create_critters(1 + ((confused || scursed) ? 12 : 0)
1723                                 + ((sblessed || rn2(73)) ? 0 : rnd(4)),
1724                             confused ? &mons[PM_ACID_BLOB]
1725                                      : (struct permonst *) 0,
1726                             FALSE))
1727             known = TRUE;
1728         /* no need to flush monsters; we ask for identification only if the
1729          * monsters are not visible
1730          */
1731         break;
1732     case SCR_ENCHANT_WEAPON:
1733         /* [What about twoweapon mode?  Proofing/repairing/enchanting both
1734            would be too powerful, but shouldn't we choose randomly between
1735            primary and secondary instead of always acting on primary?] */
1736         if (confused && uwep
1737             && erosion_matters(uwep) && uwep->oclass != ARMOR_CLASS) {
1738             old_erodeproof = (uwep->oerodeproof != 0);
1739             new_erodeproof = !scursed;
1740             uwep->oerodeproof = 0; /* for messages */
1741             if (Blind) {
1742                 uwep->rknown = FALSE;
1743 /*JP
1744                 Your("weapon feels warm for a moment.");
1745 */
1746                 pline("\95\90\8aí\82ª\88ê\8fu\92g\82©\82­\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
1747             } else {
1748                 uwep->rknown = TRUE;
1749 #if 0 /*JP:T*/
1750                 pline("%s covered by a %s %s %s!", Yobjnam2(uwep, "are"),
1751                       scursed ? "mottled" : "shimmering",
1752                       hcolor(scursed ? NH_PURPLE : NH_GOLDEN),
1753                       scursed ? "glow" : "shield");
1754 #else
1755                 Your("%s\82Í%s%s%s\82Å\95¢\82í\82ê\82½\81I", xname(uwep),
1756                      jconj_adj(hcolor(scursed ? NH_PURPLE : NH_GOLDEN)),
1757                      scursed ? "\8cõ\82é\82Ü\82¾\82ç\82Ì" : "\82ä\82ç\82ß\82­",
1758                      scursed ? "\8bP\82«" : "\83o\83\8a\83A");
1759 #endif
1760             }
1761             if (new_erodeproof && (uwep->oeroded || uwep->oeroded2)) {
1762                 uwep->oeroded = uwep->oeroded2 = 0;
1763 #if 0 /*JP:T*/
1764                 pline("%s as good as new!",
1765                       Yobjnam2(uwep, Blind ? "feel" : "look"));
1766 #else
1767                 pline("%s\82Í\90V\95i\93¯\97l\82É\82È\82Á\82½\81I", xname(uwep));
1768 #endif
1769             }
1770             if (old_erodeproof && !new_erodeproof) {
1771                 /* restore old_erodeproof before shop charges */
1772                 uwep->oerodeproof = 1;
1773                 costly_alteration(uwep, COST_DEGRD);
1774             }
1775             uwep->oerodeproof = new_erodeproof ? 1 : 0;
1776             break;
1777         }
1778         if (!chwepon(sobj, scursed ? -1
1779                              : !uwep ? 1
1780                                : (uwep->spe >= 9) ? !rn2(uwep->spe)
1781                                  : sblessed ? rnd(3 - uwep->spe / 3)
1782                                    : 1))
1783             sobj = 0; /* nothing enchanted: strange_feeling -> useup */
1784         break;
1785     case SCR_TAMING:
1786     case SPE_CHARM_MONSTER: {
1787         int candidates, res, results, vis_results;
1788
1789         if (u.uswallow) {
1790             candidates = 1;
1791             results = vis_results = maybe_tame(u.ustuck, sobj);
1792         } else {
1793             int i, j, bd = confused ? 5 : 1;
1794             struct monst *mtmp;
1795
1796             /* note: maybe_tame() can return either positive or
1797                negative values, but not both for the same scroll */
1798             candidates = results = vis_results = 0;
1799             for (i = -bd; i <= bd; i++)
1800                 for (j = -bd; j <= bd; j++) {
1801                     if (!isok(u.ux + i, u.uy + j))
1802                         continue;
1803                     if ((mtmp = m_at(u.ux + i, u.uy + j)) != 0
1804                         || (!i && !j && (mtmp = u.usteed) != 0)) {
1805                         ++candidates;
1806                         res = maybe_tame(mtmp, sobj);
1807                         results += res;
1808                         if (canspotmon(mtmp))
1809                             vis_results += res;
1810                     }
1811                 }
1812         }
1813         if (!results) {
1814 #if 0 /*JP:T*/
1815             pline("Nothing interesting %s.",
1816                   !candidates ? "happens" : "seems to happen");
1817 #else
1818             pline("\89½\82à\96Ê\94\92\82¢\82±\82Æ\82Í\82¨\82±\82ç\82È\82©\82Á\82½%s\81D",
1819                   !candidates ? "" : "\82æ\82¤\82¾");
1820 #endif
1821         } else {
1822 #if 0 /*JP:T*/
1823             pline_The("neighborhood %s %sfriendlier.",
1824                       vis_results ? "is" : "seems",
1825                       (results < 0) ? "un" : "");
1826 #else
1827             pline_The("\82¨\97×\82Æ\82Ì\92\87\82ª%s\82­\82È\82Á\82½%s\81D",
1828                       (results < 0) ? "\88«" : "\97Ç",
1829                       vis_results ? "" : "\82æ\82¤\82¾");
1830 #endif
1831             if (vis_results > 0)
1832                 known = TRUE;
1833         }
1834         break;
1835     }
1836     case SCR_GENOCIDE:
1837         if (!already_known)
1838 /*JP
1839             You("have found a scroll of genocide!");
1840 */
1841             pline("\82±\82ê\82Í\8bs\8eE\82Ì\8aª\95¨\82¾\81I");
1842         known = TRUE;
1843         if (sblessed)
1844             do_class_genocide();
1845         else
1846             do_genocide((!scursed) | (2 * !!Confusion));
1847         break;
1848     case SCR_LIGHT:
1849         if (!confused || rn2(5)) {
1850             if (!Blind)
1851                 known = TRUE;
1852             litroom(!confused && !scursed, sobj);
1853             if (!confused && !scursed) {
1854                 if (lightdamage(sobj, TRUE, 5))
1855                     known = TRUE;
1856             }
1857         } else {
1858             /* could be scroll of create monster, don't set known ...*/
1859             (void) create_critters(1, !scursed ? &mons[PM_YELLOW_LIGHT]
1860                                                : &mons[PM_BLACK_LIGHT],
1861                                    TRUE);
1862         }
1863         break;
1864     case SCR_TELEPORTATION:
1865         if (confused || scursed) {
1866             level_tele();
1867         } else {
1868             known = scrolltele(sobj);
1869         }
1870         break;
1871     case SCR_GOLD_DETECTION:
1872         if ((confused || scursed) ? trap_detect(sobj) : gold_detect(sobj))
1873             sobj = 0; /* failure: strange_feeling() -> useup() */
1874         break;
1875     case SCR_FOOD_DETECTION:
1876     case SPE_DETECT_FOOD:
1877         if (food_detect(sobj))
1878             sobj = 0; /* nothing detected: strange_feeling -> useup */
1879         break;
1880     case SCR_IDENTIFY:
1881         /* known = TRUE; -- handled inline here */
1882         /* use up the scroll first, before makeknown() performs a
1883            perm_invent update; also simplifies empty invent check */
1884         useup(sobj);
1885         sobj = 0; /* it's gone */
1886         if (confused)
1887 /*JP
1888             You("identify this as an identify scroll.");
1889 */
1890             You("\82±\82ê\82Í\8e¯\95Ê\82Ì\8aª\95¨\82¾\82Æ\8e¯\95Ê\82µ\82½\81D");
1891         else if (!already_known || !invent)
1892             /* force feedback now if invent became
1893                empty after using up this scroll */
1894 /*JP
1895             pline("This is an identify scroll.");
1896 */
1897             pline("\82±\82ê\82Í\8e¯\95Ê\82Ì\8aª\95¨\82¾\81D");
1898         if (!already_known)
1899             (void) learnscrolltyp(SCR_IDENTIFY);
1900         /*FALLTHRU*/
1901     case SPE_IDENTIFY:
1902         cval = 1;
1903         if (sblessed || (!scursed && !rn2(5))) {
1904             cval = rn2(5);
1905             /* note: if cval==0, identify all items */
1906             if (cval == 1 && sblessed && Luck > 0)
1907                 ++cval;
1908         }
1909         if (invent && !confused) {
1910             identify_pack(cval, !already_known);
1911         } else if (otyp == SPE_IDENTIFY) {
1912             /* when casting a spell we know we're not confused,
1913                so inventory must be empty (another message has
1914                already been given above if reading a scroll) */
1915 /*JP
1916             pline("You're not carrying anything to be identified.");
1917 */
1918             pline("\82 \82È\82½\82Í\8e¯\95Ê\82Å\82«\82é\82à\82Ì\82ð\82È\82É\82à\8e\9d\82Á\82Ä\82¢\82È\82¢\81D");
1919         }
1920         break;
1921     case SCR_CHARGING:
1922         if (confused) {
1923             if (scursed) {
1924 /*JP
1925                 You_feel("discharged.");
1926 */
1927                 You_feel("\95ú\8fo\82³\82ê\82½\8bC\82ª\82·\82é\81D");
1928                 u.uen = 0;
1929             } else {
1930 /*JP
1931                 You_feel("charged up!");
1932 */
1933                 You_feel("\8f[\93U\82³\82ê\82½\82æ\82¤\82È\8bC\82ª\82·\82é\81I");
1934                 u.uen += d(sblessed ? 6 : 4, 4);
1935                 if (u.uen > u.uenmax) /* if current energy is already at   */
1936                     u.uenmax = u.uen; /* or near maximum, increase maximum */
1937                 else
1938                     u.uen = u.uenmax; /* otherwise restore current to max  */
1939             }
1940             context.botl = 1;
1941             break;
1942         }
1943         /* known = TRUE; -- handled inline here */
1944         if (!already_known) {
1945 /*JP
1946             pline("This is a charging scroll.");
1947 */
1948             pline("\82±\82ê\82Í\8f[\93U\82Ì\8aª\95¨\82¾\81I");
1949             learnscroll(sobj);
1950         }
1951         /* use it up now to prevent it from showing in the
1952            getobj picklist because the "disappears" message
1953            was already delivered */
1954         useup(sobj);
1955         sobj = 0; /* it's gone */
1956         otmp = getobj(all_count, "charge");
1957         if (otmp)
1958             recharge(otmp, scursed ? -1 : sblessed ? 1 : 0);
1959         break;
1960     case SCR_MAGIC_MAPPING:
1961         if (level.flags.nommap) {
1962 /*JP
1963             Your("mind is filled with crazy lines!");
1964 */
1965             Your("\90S\82É\82½\82¾\82È\82ç\82Ê\90ü\81I\90ü\81I\90ü\81I\82ª\95\82\82Ñ\82 \82ª\82Á\82½\81I");
1966             if (Hallucination)
1967 /*JP
1968                 pline("Wow!  Modern art.");
1969 */
1970                 pline("\83\8f\83H\81I\83\82\83_\83\93\83A\81[\83g\82¾\81I");
1971             else
1972 /*JP
1973                 Your("%s spins in bewilderment.", body_part(HEAD));
1974 */
1975                 You("\93\96\98f\82µ\82Ä\96Ú\82ª\82Ü\82í\82Á\82½\81D");
1976             make_confused(HConfusion + rnd(30), FALSE);
1977             break;
1978         }
1979         if (sblessed) {
1980             register int x, y;
1981
1982             for (x = 1; x < COLNO; x++)
1983                 for (y = 0; y < ROWNO; y++)
1984                     if (levl[x][y].typ == SDOOR)
1985                         cvt_sdoor_to_door(&levl[x][y]);
1986             /* do_mapping() already reveals secret passages */
1987         }
1988         known = TRUE;
1989         /*FALLTHRU*/
1990     case SPE_MAGIC_MAPPING:
1991         if (level.flags.nommap) {
1992 #if 0 /*JP:T*/
1993             Your("%s spins as %s blocks the spell!", body_part(HEAD),
1994                  something);
1995 #else
1996             You("\89½\82©\82ª\8eô\95\82ð\82³\82¦\82¬\82è\81C\96Ú\82ª\82Ü\82í\82Á\82½\81I");
1997 #endif
1998             make_confused(HConfusion + rnd(30), FALSE);
1999             break;
2000         }
2001 /*JP
2002         pline("A map coalesces in your mind!");
2003 */
2004         pline("\92n\90}\82ª\82 \82È\82½\82Ì\90S\82É\97Z\8d\87\82µ\82½\81I");
2005         cval = (scursed && !confused);
2006         if (cval)
2007             HConfusion = 1; /* to screw up map */
2008         do_mapping();
2009         if (cval) {
2010             HConfusion = 0; /* restore */
2011 /*JP
2012             pline("Unfortunately, you can't grasp the details.");
2013 */
2014             pline("\8ec\94O\82È\82ª\82ç\81C\82 \82È\82½\82Í\8fÚ\8d×\82ð\93¾\82é\82±\82Æ\82ª\82Å\82«\82È\82©\82Á\82½\81D");
2015         }
2016         break;
2017     case SCR_AMNESIA:
2018         known = TRUE;
2019         forget((!sblessed ? ALL_SPELLS : 0)
2020                | (!confused || scursed ? ALL_MAP : 0));
2021         if (Hallucination) /* Ommmmmm! */
2022 /*JP
2023             Your("mind releases itself from mundane concerns.");
2024 */
2025             Your("\90S\82Í\95½\96}\82È\97\98\8aQ\8aÖ\8cW\82©\82ç\89ð\95ú\82³\82ê\82½\81D");
2026         else if (!strncmpi(plname, "Maud", 4))
2027             pline(
2028 /*JP
2029           "As your mind turns inward on itself, you forget everything else.");
2030 */
2031           "\82 \82È\82½\82Ì\90S\82Í\93à\91¤\82É\8cü\82«\81C\91S\82Ä\82ð\96Y\82ê\82Ä\82µ\82Ü\82Á\82½\81D");
2032         else if (rn2(2))
2033 /*JP
2034             pline("Who was that Maud person anyway?");
2035 */
2036             pline("Maud\82Á\82Ä\96º\82Í\82¢\82Á\82½\82¢\92N\82¾\82¢\81H");
2037         else
2038 /*JP
2039             pline("Thinking of Maud you forget everything else.");
2040 */
2041             pline("Maud\82ð\8dl\82¦\82é\82±\82Æ\88È\8aO\81C\82 \82È\82½\82Í\91S\82Ä\82ð\96Y\82ê\82Ä\82µ\82Ü\82Á\82½\81D");
2042         exercise(A_WIS, FALSE);
2043         break;
2044     case SCR_FIRE: {
2045         coord cc;
2046         int dam;
2047
2048         cc.x = u.ux;
2049         cc.y = u.uy;
2050         cval = bcsign(sobj);
2051         dam = (2 * (rn1(3, 3) + 2 * cval) + 1) / 3;
2052         useup(sobj);
2053         sobj = 0; /* it's gone */
2054         if (!already_known)
2055             (void) learnscrolltyp(SCR_FIRE);
2056         if (confused) {
2057             if (Fire_resistance) {
2058                 shieldeff(u.ux, u.uy);
2059                 if (!Blind)
2060 /*JP
2061                     pline("Oh, look, what a pretty fire in your %s.",
2062 */
2063                     pline("\82í\82\9f\82²\82ç\82ñ\81D\8f¬\82³\82È\89Î\82ª%s\82É\82 \82é\81D",
2064                           makeplural(body_part(HAND)));
2065                 else
2066 /*JP
2067                     You_feel("a pleasant warmth in your %s.",
2068 */
2069                     You_feel("%s\82Ì\92\86\82É\89õ\93K\82È\92g\82©\82³\82ð\8a´\82\82½\81D",
2070                              makeplural(body_part(HAND)));
2071             } else {
2072 /*JP
2073                 pline_The("scroll catches fire and you burn your %s.",
2074 */
2075                 pline("\8aª\95¨\82É\89Î\82ª\94R\82¦\82¤\82Â\82è\81C\82 \82È\82½\82Ì%s\82ð\8fÄ\82¢\82½\81D",
2076                           makeplural(body_part(HAND)));
2077 /*JP
2078                 losehp(1, "scroll of fire", KILLED_BY_AN);
2079 */
2080                 losehp(1, "\89\8a\82Ì\8aª\95¨\82Å", KILLED_BY_AN);
2081             }
2082             break;
2083         }
2084         if (Underwater) {
2085 /*JP
2086             pline_The("%s around you vaporizes violently!", hliquid("water"));
2087 */
2088             pline_The("\82 \82È\82½\82Ì\89ñ\82è\82Ì%s\82Í\82Í\82°\82µ\82­\95¦\93«\82µ\82½\81I", hliquid("\90\85"));
2089         } else {
2090             if (sblessed) {
2091                 if (!already_known)
2092 /*JP
2093                     pline("This is a scroll of fire!");
2094 */
2095                     pline("\82±\82ê\82Í\89Î\82Ì\8aª\95¨\82¾\81I");
2096                 dam *= 5;
2097 /*JP
2098                 pline("Where do you want to center the explosion?");
2099 */
2100                 pline("\82Ç\82±\82ð\94\9a\94­\82Ì\92\86\90S\82É\82µ\82Ü\82·\82©\81H");
2101                 getpos_sethilite(display_stinking_cloud_positions,
2102                                  get_valid_stinking_cloud_pos);
2103 /*JP
2104                 (void) getpos(&cc, TRUE, "the desired position");
2105 */
2106                 (void) getpos(&cc, TRUE, "\91_\82¢\82Ì\8fê\8f\8a");
2107                 if (!is_valid_stinking_cloud_pos(cc.x, cc.y, FALSE)) {
2108                     /* try to reach too far, get burned */
2109                     cc.x = u.ux;
2110                     cc.y = u.uy;
2111                 }
2112             }
2113             if (cc.x == u.ux && cc.y == u.uy) {
2114 /*JP
2115                 pline_The("scroll erupts in a tower of flame!");
2116 */
2117                 pline("\8aª\95¨\82©\82ç\89Î\92\8c\82ª\97§\82¿\8f¸\82Á\82½\81I");
2118                 iflags.last_msg = PLNMSG_TOWER_OF_FLAME; /* for explode() */
2119                 burn_away_slime();
2120             }
2121         }
2122         explode(cc.x, cc.y, 11, dam, SCROLL_CLASS, EXPL_FIERY);
2123         break;
2124     }
2125     case SCR_EARTH:
2126         /* TODO: handle steeds */
2127         if (!Is_rogue_level(&u.uz) && has_ceiling(&u.uz)
2128             && (!In_endgame(&u.uz) || Is_earthlevel(&u.uz))) {
2129             register int x, y;
2130             int nboulders = 0;
2131
2132             /* Identify the scroll */
2133             if (u.uswallow)
2134 /*JP
2135                 You_hear("rumbling.");
2136 */
2137                 You_hear("\83S\83\8d\83S\83\8d\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D");
2138             else
2139 #if 0 /*JP:T*/
2140                 pline_The("%s rumbles %s you!", ceiling(u.ux, u.uy),
2141                           sblessed ? "around" : "above");
2142 #else
2143                 pline("\82 \82È\82½\82Ì%s\82Ì%s\82©\82ç\83S\83\8d\83S\83\8d\82Æ\89¹\82ª\95·\82±\82¦\82Ä\82«\82½\81I",
2144                       sblessed ? "\82Ü\82í\82è" : "\90^\8fã", ceiling(u.ux,u.uy));
2145 #endif
2146             known = 1;
2147             sokoban_guilt();
2148
2149             /* Loop through the surrounding squares */
2150             if (!scursed)
2151                 for (x = u.ux - 1; x <= u.ux + 1; x++) {
2152                     for (y = u.uy - 1; y <= u.uy + 1; y++) {
2153                         /* Is this a suitable spot? */
2154                         if (isok(x, y) && !closed_door(x, y)
2155                             && !IS_ROCK(levl[x][y].typ)
2156                             && !IS_AIR(levl[x][y].typ)
2157                             && (x != u.ux || y != u.uy)) {
2158                             nboulders +=
2159                                 drop_boulder_on_monster(x, y, confused, TRUE);
2160                         }
2161                     }
2162                 }
2163             /* Attack the player */
2164             if (!sblessed) {
2165                 drop_boulder_on_player(confused, !scursed, TRUE, FALSE);
2166             } else if (!nboulders)
2167 /*JP
2168                 pline("But nothing else happens.");
2169 */
2170                 pline("\82µ\82©\82µ\91¼\82É\89½\82à\82¨\82±\82ç\82È\82©\82Á\82½\81D");
2171         }
2172         break;
2173     case SCR_PUNISHMENT:
2174         known = TRUE;
2175         if (confused || sblessed) {
2176 /*JP
2177             You_feel("guilty.");
2178 */
2179             You("\8dß\82ð\8a´\82\82½\81D");
2180             break;
2181         }
2182         punish(sobj);
2183         break;
2184     case SCR_STINKING_CLOUD: {
2185         coord cc;
2186
2187         if (!already_known)
2188 /*JP
2189             You("have found a scroll of stinking cloud!");
2190 */
2191             You("\88«\8fL\89_\82Ì\8aª\95¨\82ð\94­\8c©\82µ\82½\81I");
2192         known = TRUE;
2193 #if 0 /*JP:T*/
2194         pline("Where do you want to center the %scloud?",
2195               already_known ? "stinking " : "");
2196 #else
2197         pline("\89_\82Ì\92\86\90S\82ð\82Ç\82±\82É\82µ\82Ü\82·\82©\81H");
2198 #endif
2199         cc.x = u.ux;
2200         cc.y = u.uy;
2201         getpos_sethilite(display_stinking_cloud_positions,
2202                          get_valid_stinking_cloud_pos);
2203 /*JP
2204         if (getpos(&cc, TRUE, "the desired position") < 0) {
2205 */
2206         if (getpos(&cc, TRUE, "\91_\82¤\8fê\8f\8a") < 0) {
2207             pline1(Never_mind);
2208             break;
2209         }
2210         if (!is_valid_stinking_cloud_pos(cc.x, cc.y, TRUE))
2211             break;
2212         (void) create_gas_cloud(cc.x, cc.y, 3 + bcsign(sobj),
2213                                 8 + 4 * bcsign(sobj));
2214         break;
2215     }
2216     default:
2217         impossible("What weird effect is this? (%u)", otyp);
2218     }
2219     /* if sobj is gone, we've already called useup() above and the
2220        update_inventory() that it performs might have come too soon
2221        (before charging an item, for instance) */
2222     if (!sobj)
2223         update_inventory();
2224     return sobj ? 0 : 1;
2225 }
2226
2227 void
2228 drop_boulder_on_player(confused, helmet_protects, byu, skip_uswallow)
2229 boolean confused, helmet_protects, byu, skip_uswallow;
2230 {
2231     int dmg;
2232     struct obj *otmp2;
2233
2234     /* hit monster if swallowed */
2235     if (u.uswallow && !skip_uswallow) {
2236         drop_boulder_on_monster(u.ux, u.uy, confused, byu);
2237         return;
2238     }
2239
2240     otmp2 = mksobj(confused ? ROCK : BOULDER, FALSE, FALSE);
2241     if (!otmp2)
2242         return;
2243     otmp2->quan = confused ? rn1(5, 2) : 1;
2244     otmp2->owt = weight(otmp2);
2245     if (!amorphous(youmonst.data) && !Passes_walls
2246         && !noncorporeal(youmonst.data) && !unsolid(youmonst.data)) {
2247 /*JP
2248         You("are hit by %s!", doname(otmp2));
2249 */
2250         pline("%s\82ª\96½\92\86\82µ\82½\81I", doname(otmp2));
2251         dmg = dmgval(otmp2, &youmonst) * otmp2->quan;
2252         if (uarmh && helmet_protects) {
2253             if (is_metallic(uarmh)) {
2254 /*JP
2255                 pline("Fortunately, you are wearing a hard helmet.");
2256 */
2257                 pline("\8dK\89^\82É\82à\81C\82 \82È\82½\82Í\8cÅ\82¢\8a\95\82ð\90g\82É\82Â\82¯\82Ä\82¢\82é\81D");
2258                 if (dmg > 2)
2259                     dmg = 2;
2260             } else if (flags.verbose) {
2261 /*JP
2262                 pline("%s does not protect you.", Yname2(uarmh));
2263 */
2264                 Your("%s\82Å\82Í\8eç\82ê\82È\82¢\81D", xname(uarmh));
2265             }
2266         }
2267     } else
2268         dmg = 0;
2269     wake_nearto(u.ux, u.uy, 4 * 4);
2270     /* Must be before the losehp(), for bones files */
2271 /*JP
2272     if (!flooreffects(otmp2, u.ux, u.uy, "fall")) {
2273 */
2274     if (!flooreffects(otmp2, u.ux, u.uy, "\97\8e\82¿\82é")) {
2275         place_object(otmp2, u.ux, u.uy);
2276         stackobj(otmp2);
2277         newsym(u.ux, u.uy);
2278     }
2279     if (dmg)
2280 /*JP
2281         losehp(Maybe_Half_Phys(dmg), "scroll of earth", KILLED_BY_AN);
2282 */
2283         losehp(Maybe_Half_Phys(dmg), "\91å\92n\82Ì\8aª\95¨\82Å", KILLED_BY_AN);
2284 }
2285
2286 boolean
2287 drop_boulder_on_monster(x, y, confused, byu)
2288 int x, y;
2289 boolean confused, byu;
2290 {
2291     register struct obj *otmp2;
2292     register struct monst *mtmp;
2293
2294     /* Make the object(s) */
2295     otmp2 = mksobj(confused ? ROCK : BOULDER, FALSE, FALSE);
2296     if (!otmp2)
2297         return FALSE; /* Shouldn't happen */
2298     otmp2->quan = confused ? rn1(5, 2) : 1;
2299     otmp2->owt = weight(otmp2);
2300
2301     /* Find the monster here (won't be player) */
2302     mtmp = m_at(x, y);
2303     if (mtmp && !amorphous(mtmp->data) && !passes_walls(mtmp->data)
2304         && !noncorporeal(mtmp->data) && !unsolid(mtmp->data)) {
2305         struct obj *helmet = which_armor(mtmp, W_ARMH);
2306         int mdmg;
2307
2308         if (cansee(mtmp->mx, mtmp->my)) {
2309 /*JP
2310             pline("%s is hit by %s!", Monnam(mtmp), doname(otmp2));
2311 */
2312             pline("%s\82ª%s\82É\96½\92\86\82µ\82½\81I", doname(otmp2), Monnam(mtmp));
2313             if (mtmp->minvis && !canspotmon(mtmp))
2314                 map_invisible(mtmp->mx, mtmp->my);
2315         } else if (u.uswallow && mtmp == u.ustuck)
2316 #if 0 /*JP:T*/
2317             You_hear("something hit %s %s over your %s!",
2318                      s_suffix(mon_nam(mtmp)), mbodypart(mtmp, STOMACH),
2319                      body_part(HEAD));
2320 #else
2321             You_hear("\89½\82©\82ª\82 \82È\82½\82Ì%s\82Ì\8fã\82Ì%s\82Ì%s\82É\93\96\82½\82Á\82½\89¹\82ð\95·\82¢\82½\81I",
2322                      body_part(HEAD),
2323                      mon_nam(mtmp), mbodypart(mtmp, STOMACH));
2324 #endif
2325
2326         mdmg = dmgval(otmp2, mtmp) * otmp2->quan;
2327         if (helmet) {
2328             if (is_metallic(helmet)) {
2329                 if (canspotmon(mtmp))
2330 /*JP
2331                     pline("Fortunately, %s is wearing a hard helmet.",
2332 */
2333                     pline("\8dK\89^\82É\82à\81C%s\82Í\8cÅ\82¢\8a\95\82ð\90g\82É\82Â\82¯\82Ä\82¢\82é\81D",
2334                           mon_nam(mtmp));
2335                 else if (!Deaf)
2336 /*JP
2337                     You_hear("a clanging sound.");
2338 */
2339                     You_hear("\83K\83\89\83\93\83K\83\89\83\93\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D");
2340                 if (mdmg > 2)
2341                     mdmg = 2;
2342             } else {
2343                 if (canspotmon(mtmp))
2344 #if 0 /*JP:T*/
2345                     pline("%s's %s does not protect %s.", Monnam(mtmp),
2346                           xname(helmet), mhim(mtmp));
2347 #else
2348                     pline("%s\82Ì%s\82Å\82Í\8eç\82ê\82È\82¢\81D", Monnam(mtmp),
2349                           xname(helmet));
2350 #endif
2351             }
2352         }
2353         mtmp->mhp -= mdmg;
2354         if (DEADMONSTER(mtmp)) {
2355             if (byu) {
2356                 killed(mtmp);
2357             } else {
2358 /*JP
2359                 pline("%s is killed.", Monnam(mtmp));
2360 */
2361                 pline("%s\82Í\8e\80\82ñ\82¾\81D", Monnam(mtmp));
2362                 mondied(mtmp);
2363             }
2364         } else {
2365             wakeup(mtmp, byu);
2366         }
2367         wake_nearto(x, y, 4 * 4);
2368     } else if (u.uswallow && mtmp == u.ustuck) {
2369         obfree(otmp2, (struct obj *) 0);
2370         /* fall through to player */
2371         drop_boulder_on_player(confused, TRUE, FALSE, TRUE);
2372         return 1;
2373     }
2374     /* Drop the rock/boulder to the floor */
2375 /*JP
2376     if (!flooreffects(otmp2, x, y, "fall")) {
2377 */
2378     if (!flooreffects(otmp2, x, y, "\97\8e\82¿\82é")) {
2379         place_object(otmp2, x, y);
2380         stackobj(otmp2);
2381         newsym(x, y); /* map the rock */
2382     }
2383     return TRUE;
2384 }
2385
2386 /* overcharging any wand or zapping/engraving cursed wand */
2387 void
2388 wand_explode(obj, chg)
2389 struct obj *obj;
2390 int chg; /* recharging */
2391 {
2392 /*JP
2393     const char *expl = !chg ? "suddenly" : "vibrates violently and";
2394 */
2395     const char *expl = !chg ? "\93Ë\91R" : "\8c\83\82µ\82­\90U\93®\82µ\81C";
2396     int dmg, n, k;
2397
2398     /* number of damage dice */
2399     if (!chg)
2400         chg = 2; /* zap/engrave adjustment */
2401     n = obj->spe + chg;
2402     if (n < 2)
2403         n = 2; /* arbitrary minimum */
2404     /* size of damage dice */
2405     switch (obj->otyp) {
2406     case WAN_WISHING:
2407         k = 12;
2408         break;
2409     case WAN_CANCELLATION:
2410     case WAN_DEATH:
2411     case WAN_POLYMORPH:
2412     case WAN_UNDEAD_TURNING:
2413         k = 10;
2414         break;
2415     case WAN_COLD:
2416     case WAN_FIRE:
2417     case WAN_LIGHTNING:
2418     case WAN_MAGIC_MISSILE:
2419         k = 8;
2420         break;
2421     case WAN_NOTHING:
2422         k = 4;
2423         break;
2424     default:
2425         k = 6;
2426         break;
2427     }
2428     /* inflict damage and destroy the wand */
2429     dmg = d(n, k);
2430     obj->in_use = TRUE; /* in case losehp() is fatal (or --More--^C) */
2431 #if 0 /*JP:T*/
2432     pline("%s %s explodes!", Yname2(obj), expl);
2433 #else
2434     pline("%s\82Í%s\94\9a\94­\82µ\82½\81I", xname(obj), expl);
2435 #endif
2436 /*JP
2437     losehp(Maybe_Half_Phys(dmg), "exploding wand", KILLED_BY_AN);
2438 */
2439     losehp(Maybe_Half_Phys(dmg), "\8fñ\82Ì\94\9a\94­\82Å", KILLED_BY_AN);
2440     useup(obj);
2441     /* obscure side-effect */
2442     exercise(A_STR, FALSE);
2443 }
2444
2445 /* used to collect gremlins being hit by light so that they can be processed
2446    after vision for the entire lit area has been brought up to date */
2447 struct litmon {
2448     struct monst *mon;
2449     struct litmon *nxt;
2450 };
2451 STATIC_VAR struct litmon *gremlins = 0;
2452
2453 /*
2454  * Low-level lit-field update routine.
2455  */
2456 STATIC_PTR void
2457 set_lit(x, y, val)
2458 int x, y;
2459 genericptr_t val;
2460 {
2461     struct monst *mtmp;
2462     struct litmon *gremlin;
2463
2464     if (val) {
2465         levl[x][y].lit = 1;
2466         if ((mtmp = m_at(x, y)) != 0 && mtmp->data == &mons[PM_GREMLIN]) {
2467             gremlin = (struct litmon *) alloc(sizeof *gremlin);
2468             gremlin->mon = mtmp;
2469             gremlin->nxt = gremlins;
2470             gremlins = gremlin;
2471         }
2472     } else {
2473         levl[x][y].lit = 0;
2474         snuff_light_source(x, y);
2475     }
2476 }
2477
2478 void
2479 litroom(on, obj)
2480 register boolean on;
2481 struct obj *obj;
2482 {
2483     char is_lit; /* value is irrelevant; we use its address
2484                     as a `not null' flag for set_lit() */
2485
2486     /* first produce the text (provided you're not blind) */
2487     if (!on) {
2488         register struct obj *otmp;
2489
2490         if (!Blind) {
2491             if (u.uswallow) {
2492 /*JP
2493                 pline("It seems even darker in here than before.");
2494 */
2495                 pline("\91O\82æ\82è\88Ã\82­\82È\82Á\82½\82æ\82¤\82É\8c©\82¦\82é\81D");
2496             } else {
2497                 if (uwep && artifact_light(uwep) && uwep->lamplit)
2498 /*JP
2499                     pline("Suddenly, the only light left comes from %s!",
2500 */
2501                     pline("\93Ë\91R\81C\96¾\82©\82è\82ª%s\82¾\82¯\82É\82È\82Á\82½\81I",
2502                           the(xname(uwep)));
2503                 else
2504 /*JP
2505                     You("are surrounded by darkness!");
2506 */
2507                     You("\88Ã\88Å\82É\95¢\82í\82ê\82½\81I");
2508             }
2509         }
2510
2511         /* the magic douses lamps, et al, too */
2512         for (otmp = invent; otmp; otmp = otmp->nobj)
2513             if (otmp->lamplit)
2514                 (void) snuff_lit(otmp);
2515     } else { /* on */
2516         if (u.uswallow) {
2517             if (Blind)
2518                 ; /* no feedback */
2519             else if (is_animal(u.ustuck->data))
2520 #if 0 /*JP:T*/
2521                 pline("%s %s is lit.", s_suffix(Monnam(u.ustuck)),
2522                       mbodypart(u.ustuck, STOMACH));
2523 #else
2524                 pline("%s\82Ì%s\82Í\96¾\82é\82­\82È\82Á\82½\81D", Monnam(u.ustuck),
2525                       mbodypart(u.ustuck, STOMACH));
2526 #endif
2527             else if (is_whirly(u.ustuck->data))
2528 /*JP
2529                 pline("%s shines briefly.", Monnam(u.ustuck));
2530 */
2531                 pline("%s\82Í\82¿\82å\82Á\82Æ\8bP\82¢\82½\81D", Monnam(u.ustuck));
2532             else
2533 /*JP
2534                 pline("%s glistens.", Monnam(u.ustuck));
2535 */
2536                 pline("%s\82Í\82«\82ç\82«\82ç\8bP\82¢\82½\81D", Monnam(u.ustuck));
2537         } else if (!Blind)
2538 /*JP
2539             pline("A lit field surrounds you!");
2540 */
2541             pline("\93\94\82è\82ª\82 \82È\82½\82ð\8eæ\82è\88Í\82ñ\82¾\81I");
2542     }
2543
2544     /* No-op when swallowed or in water */
2545     if (u.uswallow || Underwater || Is_waterlevel(&u.uz))
2546         return;
2547     /*
2548      *  If we are darkening the room and the hero is punished but not
2549      *  blind, then we have to pick up and replace the ball and chain so
2550      *  that we don't remember them if they are out of sight.
2551      */
2552     if (Punished && !on && !Blind)
2553         move_bc(1, 0, uball->ox, uball->oy, uchain->ox, uchain->oy);
2554
2555     if (Is_rogue_level(&u.uz)) {
2556         /* Can't use do_clear_area because MAX_RADIUS is too small */
2557         /* rogue lighting must light the entire room */
2558         int rnum = levl[u.ux][u.uy].roomno - ROOMOFFSET;
2559         int rx, ry;
2560
2561         if (rnum >= 0) {
2562             for (rx = rooms[rnum].lx - 1; rx <= rooms[rnum].hx + 1; rx++)
2563                 for (ry = rooms[rnum].ly - 1; ry <= rooms[rnum].hy + 1; ry++)
2564                     set_lit(rx, ry,
2565                             (genericptr_t) (on ? &is_lit : (char *) 0));
2566             rooms[rnum].rlit = on;
2567         }
2568         /* hallways remain dark on the rogue level */
2569     } else
2570         do_clear_area(u.ux, u.uy,
2571                       (obj && obj->oclass == SCROLL_CLASS && obj->blessed)
2572                          ? 9 : 5,
2573                       set_lit, (genericptr_t) (on ? &is_lit : (char *) 0));
2574
2575     /*
2576      *  If we are not blind, then force a redraw on all positions in sight
2577      *  by temporarily blinding the hero.  The vision recalculation will
2578      *  correctly update all previously seen positions *and* correctly
2579      *  set the waslit bit [could be messed up from above].
2580      */
2581     if (!Blind) {
2582         vision_recalc(2);
2583
2584         /* replace ball&chain */
2585         if (Punished && !on)
2586             move_bc(0, 0, uball->ox, uball->oy, uchain->ox, uchain->oy);
2587     }
2588
2589     vision_full_recalc = 1; /* delayed vision recalculation */
2590     if (gremlins) {
2591         struct litmon *gremlin;
2592
2593         /* can't delay vision recalc after all */
2594         vision_recalc(0);
2595         /* after vision has been updated, monsters who are affected
2596            when hit by light can now be hit by it */
2597         do {
2598             gremlin = gremlins;
2599             gremlins = gremlin->nxt;
2600             light_hits_gremlin(gremlin->mon, rnd(5));
2601             free((genericptr_t) gremlin);
2602         } while (gremlins);
2603     }
2604 }
2605
2606 STATIC_OVL void
2607 do_class_genocide()
2608 {
2609     int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0;
2610     char buf[BUFSZ] = DUMMY;
2611     boolean gameover = FALSE; /* true iff killed self */
2612
2613     for (j = 0;; j++) {
2614         if (j >= 5) {
2615             pline1(thats_enough_tries);
2616             return;
2617         }
2618         do {
2619 /*JP
2620             getlin("What class of monsters do you wish to genocide?", buf);
2621 */
2622             getlin("\82Ç\82Ì\83N\83\89\83X\82É\91®\82·\82é\89ö\95¨\82ð\8bs\8eE\82µ\82Ü\82·\82©\81H[\95\8e\9a\82ð\93ü\82ê\82Ä\82Ë]", buf);
2623             (void) mungspaces(buf);
2624         } while (!*buf);
2625         /* choosing "none" preserves genocideless conduct */
2626 #if 0 /*JP:T*/
2627         if (*buf == '\033' || !strcmpi(buf, "none")
2628             || !strcmpi(buf, "nothing"))
2629 #else
2630         if (*buf == '\033' || !strcmpi(buf, "\82È\82µ")
2631             || !strcmpi(buf, "\96³\82µ"))
2632 #endif
2633             return;
2634
2635         class = name_to_monclass(buf, (int *) 0);
2636         if (class == 0 && (i = name_to_mon(buf)) != NON_PM)
2637             class = mons[i].mlet;
2638         immunecnt = gonecnt = goodcnt = 0;
2639         for (i = LOW_PM; i < NUMMONS; i++) {
2640             if (mons[i].mlet == class) {
2641                 if (!(mons[i].geno & G_GENO))
2642                     immunecnt++;
2643                 else if (mvitals[i].mvflags & G_GENOD)
2644                     gonecnt++;
2645                 else
2646                     goodcnt++;
2647             }
2648         }
2649         if (!goodcnt && class != mons[urole.malenum].mlet
2650             && class != mons[urace.malenum].mlet) {
2651             if (gonecnt)
2652 /*JP
2653                 pline("All such monsters are already nonexistent.");
2654 */
2655                 pline("\82»\82Ì\89ö\95¨\82Í\82à\82¤\82¢\82È\82¢\81D");
2656             else if (immunecnt || class == S_invisible)
2657 /*JP
2658                 You("aren't permitted to genocide such monsters.");
2659 */
2660                 You("\82»\82Ì\89ö\95¨\82ð\8bs\8eE\82·\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D");
2661             else if (wizard && buf[0] == '*') {
2662                 register struct monst *mtmp, *mtmp2;
2663
2664                 gonecnt = 0;
2665                 for (mtmp = fmon; mtmp; mtmp = mtmp2) {
2666                     mtmp2 = mtmp->nmon;
2667                     if (DEADMONSTER(mtmp))
2668                         continue;
2669                     mongone(mtmp);
2670                     gonecnt++;
2671                 }
2672 /*JP
2673                 pline("Eliminated %d monster%s.", gonecnt, plur(gonecnt));
2674 */
2675                 pline("%d\82Ì\89ö\95¨\82ð\8f\9c\82¢\82½\81D", gonecnt);
2676                 return;
2677             } else
2678 #if 0 /*JP*/
2679                 pline("That %s does not represent any monster.",
2680                       strlen(buf) == 1 ? "symbol" : "response");
2681 #else
2682                 pline("\82»\82Ì\82æ\82¤\82È\89ö\95¨\82Í\82¢\82È\82¢\81D");
2683 #endif
2684             continue;
2685         }
2686
2687         for (i = LOW_PM; i < NUMMONS; i++) {
2688             if (mons[i].mlet == class) {
2689                 char nam[BUFSZ];
2690
2691                 Strcpy(nam, makeplural(mons[i].mname));
2692                 /* Although "genus" is Latin for race, the hero benefits
2693                  * from both race and role; thus genocide affects either.
2694                  */
2695                 if (Your_Own_Role(i) || Your_Own_Race(i)
2696                     || ((mons[i].geno & G_GENO)
2697                         && !(mvitals[i].mvflags & G_GENOD))) {
2698                     /* This check must be first since player monsters might
2699                      * have G_GENOD or !G_GENO.
2700                      */
2701                     mvitals[i].mvflags |= (G_GENOD | G_NOCORPSE);
2702                     reset_rndmonst(i);
2703                     kill_genocided_monsters();
2704                     update_inventory(); /* eggs & tins */
2705 /*JP
2706                     pline("Wiped out all %s.", nam);
2707 */
2708                     pline("%s\82ð\91S\82Ä\94r\8f\9c\82µ\82½\81D", nam);
2709                     if (Upolyd && i == u.umonnum) {
2710                         u.mh = -1;
2711                         if (Unchanging) {
2712                             if (!feel_dead++)
2713 /*JP
2714                                 You("die.");
2715 */
2716                                 You("\8e\80\82É\82Ü\82µ\82½\81D\81D\81D");
2717                             /* finish genociding this class of
2718                                monsters before ultimately dying */
2719                             gameover = TRUE;
2720                         } else
2721                             rehumanize();
2722                     }
2723                     /* Self-genocide if it matches either your race
2724                        or role.  Assumption:  male and female forms
2725                        share same monster class. */
2726                     if (i == urole.malenum || i == urace.malenum) {
2727                         u.uhp = -1;
2728                         if (Upolyd) {
2729                             if (!feel_dead++)
2730 /*JP
2731                                 You_feel("%s inside.", udeadinside());
2732 */
2733                                 You("\8d°\82ª%s\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", udeadinside());
2734                         } else {
2735                             if (!feel_dead++)
2736 /*JP
2737                                 You("die.");
2738 */
2739                                 You("\8e\80\82É\82Ü\82µ\82½\81D\81D\81D");
2740                             gameover = TRUE;
2741                         }
2742                     }
2743                 } else if (mvitals[i].mvflags & G_GENOD) {
2744                     if (!gameover)
2745 /*JP
2746                         pline("All %s are already nonexistent.", nam);
2747 */
2748                         pline("%s\82Í\8aù\82É\82¢\82È\82¢\81D", nam);
2749                 } else if (!gameover) {
2750                     /* suppress feedback about quest beings except
2751                        for those applicable to our own role */
2752                     if ((mons[i].msound != MS_LEADER
2753                          || quest_info(MS_LEADER) == i)
2754                         && (mons[i].msound != MS_NEMESIS
2755                             || quest_info(MS_NEMESIS) == i)
2756                         && (mons[i].msound != MS_GUARDIAN
2757                             || quest_info(MS_GUARDIAN) == i)
2758                         /* non-leader/nemesis/guardian role-specific monster
2759                            */
2760                         && (i != PM_NINJA /* nuisance */
2761                             || Role_if(PM_SAMURAI))) {
2762                         boolean named, uniq;
2763
2764                         named = type_is_pname(&mons[i]) ? TRUE : FALSE;
2765                         uniq = (mons[i].geno & G_UNIQ) ? TRUE : FALSE;
2766                         /* one special case */
2767                         if (i == PM_HIGH_PRIEST)
2768                             uniq = FALSE;
2769
2770 #if 0 /*JP*/
2771                         You("aren't permitted to genocide %s%s.",
2772                             (uniq && !named) ? "the " : "",
2773                             (uniq || named) ? mons[i].mname : nam);
2774 #else
2775                         You("%s\82ð\8bs\8eE\82Å\82«\82È\82¢\81D",
2776                             (uniq || named) ? mons[i].mname : nam);
2777 #endif
2778                     }
2779                 }
2780             }
2781         }
2782         if (gameover || u.uhp == -1) {
2783             killer.format = KILLED_BY_AN;
2784 /*JP
2785             Strcpy(killer.name, "scroll of genocide");
2786 */
2787             Strcpy(killer.name, "\8bs\8eE\82Ì\8aª\95¨\82Å");
2788             if (gameover)
2789                 done(GENOCIDED);
2790         }
2791         return;
2792     }
2793 }
2794
2795 #define REALLY 1
2796 #define PLAYER 2
2797 #define ONTHRONE 4
2798 void
2799 do_genocide(how)
2800 int how;
2801 /* 0 = no genocide; create monsters (cursed scroll) */
2802 /* 1 = normal genocide */
2803 /* 3 = forced genocide of player */
2804 /* 5 (4 | 1) = normal genocide from throne */
2805 {
2806     char buf[BUFSZ] = DUMMY;
2807     register int i, killplayer = 0;
2808     register int mndx;
2809     register struct permonst *ptr;
2810     const char *which;
2811
2812     if (how & PLAYER) {
2813         mndx = u.umonster; /* non-polymorphed mon num */
2814         ptr = &mons[mndx];
2815         Strcpy(buf, ptr->mname);
2816         killplayer++;
2817     } else {
2818         for (i = 0;; i++) {
2819             if (i >= 5) {
2820                 /* cursed effect => no free pass (unless rndmonst() fails) */
2821                 if (!(how & REALLY) && (ptr = rndmonst()) != 0)
2822                     break;
2823
2824                 pline1(thats_enough_tries);
2825                 return;
2826             }
2827 /*JP
2828             getlin("What monster do you want to genocide? [type the name]",
2829 */
2830             getlin("\82Ç\82Ì\89ö\95¨\82ð\8bs\8eE\82µ\82Ü\82·\82©\81H[\96¼\91O\82ð\93ú\96{\8cê\82Å\93ü\82ê\82Ä\82Ë]",
2831                    buf);
2832             (void) mungspaces(buf);
2833             /* choosing "none" preserves genocideless conduct */
2834 #if 0 /*JP:T*/
2835             if (*buf == '\033' || !strcmpi(buf, "none")
2836                 || !strcmpi(buf, "nothing")) {
2837 #else
2838             if (*buf == '\033' || !strcmpi(buf, "\82È\82µ")
2839                 || !strcmpi(buf, "\96³\82µ")) {
2840 #endif
2841                 /* ... but no free pass if cursed */
2842                 if (!(how & REALLY) && (ptr = rndmonst()) != 0)
2843                     break; /* remaining checks don't apply */
2844
2845                 return;
2846             }
2847
2848             mndx = name_to_mon(buf);
2849             if (mndx == NON_PM || (mvitals[mndx].mvflags & G_GENOD)) {
2850 #if 0 /*JP*/
2851                 pline("Such creatures %s exist in this world.",
2852                       (mndx == NON_PM) ? "do not" : "no longer");
2853 #else
2854                 pline("\82»\82Ì\82æ\82¤\82È\90\82«\95¨\82Í%s\82±\82Ì\90¢\8aE\82É\91\8dÝ\82µ\82È\82¢\81D",
2855                       (mndx == NON_PM) ? "" : "\82à\82Í\82â");
2856 #endif
2857                 continue;
2858             }
2859             ptr = &mons[mndx];
2860             /* Although "genus" is Latin for race, the hero benefits
2861              * from both race and role; thus genocide affects either.
2862              */
2863             if (Your_Own_Role(mndx) || Your_Own_Race(mndx)) {
2864                 killplayer++;
2865                 break;
2866             }
2867             if (is_human(ptr))
2868                 adjalign(-sgn(u.ualign.type));
2869             if (is_demon(ptr))
2870                 adjalign(sgn(u.ualign.type));
2871
2872             if (!(ptr->geno & G_GENO)) {
2873                 if (!Deaf) {
2874                     /* FIXME: unconditional "caverns" will be silly in some
2875                      * circumstances.  Who's speaking?  Divine pronouncements
2876                      * aren't supposed to be hampered by deafness....
2877                      */
2878                     if (flags.verbose)
2879 /*JP
2880                         pline("A thunderous voice booms through the caverns:");
2881 */
2882                         pline("\97\8b\82Ì\82æ\82¤\82È\90º\82ª\93´\8cA\82É\8b¿\82¢\82½\81F");
2883 /*JP
2884                     verbalize("No, mortal!  That will not be done.");
2885 */
2886                     pline("\81u\92è\96½\82Ì\8eÒ\82æ\81I\82»\82Ì\96]\82Ý\82Í\82©\82È\82¤\82Ü\82¢\81D\81v");
2887                 }
2888                 continue;
2889             }
2890             /* KMH -- Unchanging prevents rehumanization */
2891             if (Unchanging && ptr == youmonst.data)
2892                 killplayer++;
2893             break;
2894         }
2895         mndx = monsndx(ptr); /* needed for the 'no free pass' cases */
2896     }
2897
2898 /*JP
2899     which = "all ";
2900 */
2901     which = "\91S\82Ä";
2902     if (Hallucination) {
2903         if (Upolyd)
2904             Strcpy(buf, youmonst.data->mname);
2905         else {
2906             Strcpy(buf, (flags.female && urole.name.f) ? urole.name.f
2907                                                        : urole.name.m);
2908             buf[0] = lowc(buf[0]);
2909         }
2910     } else {
2911         Strcpy(buf, ptr->mname); /* make sure we have standard singular */
2912         if ((ptr->geno & G_UNIQ) && ptr != &mons[PM_HIGH_PRIEST])
2913 #if 0 /*JP*/
2914             which = !type_is_pname(ptr) ? "the " : "";
2915 #else
2916             which = "";
2917 #endif
2918     }
2919     if (how & REALLY) {
2920         /* setting no-corpse affects wishing and random tin generation */
2921         mvitals[mndx].mvflags |= (G_GENOD | G_NOCORPSE);
2922 #if 0 /*JP:T*/
2923         pline("Wiped out %s%s.", which,
2924               (*which != 'a') ? buf : makeplural(buf));
2925 #else
2926         pline("%s\82ð%s\88ê\91|\82µ\82½\81D", buf, which);
2927 #endif
2928
2929         if (killplayer) {
2930             /* might need to wipe out dual role */
2931             if (urole.femalenum != NON_PM && mndx == urole.malenum)
2932                 mvitals[urole.femalenum].mvflags |= (G_GENOD | G_NOCORPSE);
2933             if (urole.femalenum != NON_PM && mndx == urole.femalenum)
2934                 mvitals[urole.malenum].mvflags |= (G_GENOD | G_NOCORPSE);
2935             if (urace.femalenum != NON_PM && mndx == urace.malenum)
2936                 mvitals[urace.femalenum].mvflags |= (G_GENOD | G_NOCORPSE);
2937             if (urace.femalenum != NON_PM && mndx == urace.femalenum)
2938                 mvitals[urace.malenum].mvflags |= (G_GENOD | G_NOCORPSE);
2939
2940             u.uhp = -1;
2941             if (how & PLAYER) {
2942                 killer.format = KILLED_BY;
2943 /*JP
2944                 Strcpy(killer.name, "genocidal confusion");
2945 */
2946                 Strcpy(killer.name, "\8d¬\97\90\82É\82æ\82é\8e©\8bs\93I\8bs\8eE\82Å");
2947             } else if (how & ONTHRONE) {
2948                 /* player selected while on a throne */
2949                 killer.format = KILLED_BY_AN;
2950 /*JP
2951                 Strcpy(killer.name, "imperious order");
2952 */
2953                 Strcpy(killer.name, "\98ü\96\9d\82È\96½\97ß\82Å");
2954             } else { /* selected player deliberately, not confused */
2955                 killer.format = KILLED_BY_AN;
2956 /*JP
2957                 Strcpy(killer.name, "scroll of genocide");
2958 */
2959                 Strcpy(killer.name, "\8bs\8eE\82Ì\8aª\95¨\82Å");
2960             }
2961
2962             /* Polymorphed characters will die as soon as they're rehumanized.
2963              */
2964             /* KMH -- Unchanging prevents rehumanization */
2965             if (Upolyd && ptr != youmonst.data) {
2966                 delayed_killer(POLYMORPH, killer.format, killer.name);
2967 /*JP
2968                 You_feel("%s inside.", udeadinside());
2969 */
2970                 You_feel("\8d°\82ª%s\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", udeadinside());
2971             } else
2972                 done(GENOCIDED);
2973         } else if (ptr == youmonst.data) {
2974             rehumanize();
2975         }
2976         reset_rndmonst(mndx);
2977         kill_genocided_monsters();
2978         update_inventory(); /* in case identified eggs were affected */
2979     } else {
2980         int cnt = 0, census = monster_census(FALSE);
2981
2982         if (!(mons[mndx].geno & G_UNIQ)
2983             && !(mvitals[mndx].mvflags & (G_GENOD | G_EXTINCT)))
2984             for (i = rn1(3, 4); i > 0; i--) {
2985                 if (!makemon(ptr, u.ux, u.uy, NO_MINVENT))
2986                     break; /* couldn't make one */
2987                 ++cnt;
2988                 if (mvitals[mndx].mvflags & G_EXTINCT)
2989                     break; /* just made last one */
2990             }
2991         if (cnt) {
2992             /* accumulated 'cnt' doesn't take groups into account;
2993                assume bringing in new mon(s) didn't remove any old ones */
2994             cnt = monster_census(FALSE) - census;
2995 #if 0 /*JP:T*/
2996             pline("Sent in %s%s.", (cnt > 1) ? "some " : "",
2997                   (cnt > 1) ? makeplural(buf) : an(buf));
2998 #else
2999             pline("%s\82ª\91\97\82ç\82ê\82Ä\82«\82½\81D", buf);
3000 #endif
3001         } else
3002             pline1(nothing_happens);
3003     }
3004 }
3005
3006 void
3007 punish(sobj)
3008 struct obj *sobj;
3009 {
3010     struct obj *reuse_ball = (sobj && sobj->otyp == HEAVY_IRON_BALL)
3011                                 ? sobj : (struct obj *) 0;
3012
3013     /* KMH -- Punishment is still okay when you are riding */
3014     if (!reuse_ball)
3015 /*JP
3016         You("are being punished for your misbehavior!");
3017 */
3018         You("\95s\8dì\96@\82Ì\82½\82ß\94±\82ð\8eó\82¯\82½\81I");
3019     if (Punished) {
3020 /*JP
3021         Your("iron ball gets heavier.");
3022 */
3023         Your("\93S\8b\85\82Í\82³\82ç\82É\8fd\82­\82È\82Á\82½\81D");
3024         uball->owt += IRON_BALL_W_INCR * (1 + sobj->cursed);
3025         return;
3026     }
3027     if (amorphous(youmonst.data) || is_whirly(youmonst.data)
3028         || unsolid(youmonst.data)) {
3029         if (!reuse_ball) {
3030 /*JP
3031             pline("A ball and chain appears, then falls away.");
3032 */
3033             pline("\93S\8b\85\82Æ\8d½\82ª\8c»\82í\82ê\82½\82ª\81C\82·\82é\82Á\82Æ\94²\82¯\82½\81D");
3034             dropy(mkobj(BALL_CLASS, TRUE));
3035         } else {
3036             dropy(reuse_ball);
3037         }
3038         return;
3039     }
3040     setworn(mkobj(CHAIN_CLASS, TRUE), W_CHAIN);
3041     if (!reuse_ball)
3042         setworn(mkobj(BALL_CLASS, TRUE), W_BALL);
3043     else
3044         setworn(reuse_ball, W_BALL);
3045     uball->spe = 1; /* special ball (see save) */
3046
3047     /*
3048      *  Place ball & chain if not swallowed.  If swallowed, the ball & chain
3049      *  variables will be set at the next call to placebc().
3050      */
3051     if (!u.uswallow) {
3052         placebc();
3053         if (Blind)
3054             set_bc(1);      /* set up ball and chain variables */
3055         newsym(u.ux, u.uy); /* see ball&chain if can't see self */
3056     }
3057 }
3058
3059 /* remove the ball and chain */
3060 void
3061 unpunish()
3062 {
3063     struct obj *savechain = uchain;
3064
3065     /* chain goes away */
3066     obj_extract_self(uchain);
3067     newsym(uchain->ox, uchain->oy);
3068     setworn((struct obj *) 0, W_CHAIN); /* sets 'uchain' to Null */
3069     dealloc_obj(savechain);
3070     /* ball persists */
3071     uball->spe = 0;
3072     setworn((struct obj *) 0, W_BALL); /* sets 'uball' to Null */
3073 }
3074
3075 /* some creatures have special data structures that only make sense in their
3076  * normal locations -- if the player tries to create one elsewhere, or to
3077  * revive one, the disoriented creature becomes a zombie
3078  */
3079 boolean
3080 cant_revive(mtype, revival, from_obj)
3081 int *mtype;
3082 boolean revival;
3083 struct obj *from_obj;
3084 {
3085     /* SHOPKEEPERS can be revived now */
3086     if (*mtype == PM_GUARD || (*mtype == PM_SHOPKEEPER && !revival)
3087         || *mtype == PM_HIGH_PRIEST || *mtype == PM_ALIGNED_PRIEST
3088         || *mtype == PM_ANGEL) {
3089         *mtype = PM_HUMAN_ZOMBIE;
3090         return TRUE;
3091     } else if (*mtype == PM_LONG_WORM_TAIL) { /* for create_particular() */
3092         *mtype = PM_LONG_WORM;
3093         return TRUE;
3094     } else if (unique_corpstat(&mons[*mtype])
3095                && (!from_obj || !has_omonst(from_obj))) {
3096         /* unique corpses (from bones or wizard mode wish) or
3097            statues (bones or any wish) end up as shapechangers */
3098         *mtype = PM_DOPPELGANGER;
3099         return TRUE;
3100     }
3101     return FALSE;
3102 }
3103
3104 struct _create_particular_data {
3105     int which;
3106     int fem;
3107     char monclass;
3108     boolean randmonst;
3109     boolean maketame, makepeaceful, makehostile;
3110     boolean sleeping, saddled, invisible, hidden;
3111 };
3112
3113 boolean
3114 create_particular_parse(str, d)
3115 char *str;
3116 struct _create_particular_data *d;
3117 {
3118     char *bufp = str;
3119     char *tmpp;
3120
3121     d->monclass = MAXMCLASSES;
3122     d->which = urole.malenum; /* an arbitrary index into mons[] */
3123     d->fem = -1; /* gender not specified */
3124     d->randmonst = FALSE;
3125     d->maketame = d->makepeaceful = d->makehostile = FALSE;
3126     d->sleeping = d->saddled = d->invisible = d->hidden = FALSE;
3127
3128     if ((tmpp = strstri(bufp, "saddled ")) != 0) {
3129         d->saddled = TRUE;
3130         (void) memset(tmpp, ' ', sizeof "saddled " - 1);
3131     }
3132     if ((tmpp = strstri(bufp, "sleeping ")) != 0) {
3133         d->sleeping = TRUE;
3134         (void) memset(tmpp, ' ', sizeof "sleeping " - 1);
3135     }
3136     if ((tmpp = strstri(bufp, "invisible ")) != 0) {
3137         d->invisible = TRUE;
3138         (void) memset(tmpp, ' ', sizeof "invisible " - 1);
3139     }
3140     if ((tmpp = strstri(bufp, "hidden ")) != 0) {
3141         d->hidden = TRUE;
3142         (void) memset(tmpp, ' ', sizeof "hidden " - 1);
3143     }
3144     /* check "female" before "male" to avoid false hit mid-word */
3145     if ((tmpp = strstri(bufp, "female ")) != 0) {
3146         d->fem = 1;
3147         (void) memset(tmpp, ' ', sizeof "female " - 1);
3148     }
3149     if ((tmpp = strstri(bufp, "male ")) != 0) {
3150         d->fem = 0;
3151         (void) memset(tmpp, ' ', sizeof "male " - 1);
3152     }
3153     bufp = mungspaces(bufp); /* after potential memset(' ') */
3154     /* allow the initial disposition to be specified */
3155 #if 0 /*JP:T*/
3156     if (!strncmpi(bufp, "tame ", 5)) {
3157         bufp += 5;
3158 #else
3159     if (!strncmpi(bufp, "\8eè\82È\82¸\82¯\82ç\82ê\82½", 14)) {
3160         bufp += 14;
3161 #endif
3162         d->maketame = TRUE;
3163 #if 0 /*JP:T*/
3164     } else if (!strncmpi(bufp, "peaceful ", 9)) {
3165         bufp += 9;
3166 #else
3167     } else if (!strncmpi(bufp, "\97F\8dD\93I\82È", 8)) {
3168         bufp += 8;
3169 #endif
3170         d->makepeaceful = TRUE;
3171 #if 0 /*JP:T*/
3172     } else if (!strncmpi(bufp, "hostile ", 8)) {
3173         bufp += 8;
3174 #else
3175     } else if (!strncmpi(bufp, "\93G\91Î\93I\82È", 8)) {
3176         bufp += 8;
3177 #endif
3178         d->makehostile = TRUE;
3179     }
3180     /* decide whether a valid monster was chosen */
3181 /*JP
3182     if (wizard && (!strcmp(bufp, "*") || !strcmp(bufp, "random"))) {
3183 */
3184     if (wizard && (!strcmp(bufp, "*") || !strcmp(bufp, "\83\89\83\93\83_\83\80"))) {
3185         d->randmonst = TRUE;
3186         return TRUE;
3187     }
3188     d->which = name_to_mon(bufp);
3189     if (d->which >= LOW_PM)
3190         return TRUE; /* got one */
3191     d->monclass = name_to_monclass(bufp, &d->which);
3192
3193     if (d->which >= LOW_PM) {
3194         d->monclass = MAXMCLASSES; /* matters below */
3195         return TRUE;
3196     } else if (d->monclass == S_invisible) { /* not an actual monster class */
3197         d->which = PM_STALKER;
3198         d->monclass = MAXMCLASSES;
3199         return TRUE;
3200     } else if (d->monclass == S_WORM_TAIL) { /* empty monster class */
3201         d->which = PM_LONG_WORM;
3202         d->monclass = MAXMCLASSES;
3203         return TRUE;
3204     } else if (d->monclass > 0) {
3205         d->which = urole.malenum; /* reset from NON_PM */
3206         return TRUE;
3207     }
3208     return FALSE;
3209 }
3210
3211 boolean
3212 create_particular_creation(d)
3213 struct _create_particular_data *d;
3214 {
3215     struct permonst *whichpm = NULL;
3216     int i, mx, my, firstchoice = NON_PM;
3217     struct monst *mtmp;
3218     boolean madeany = FALSE;
3219
3220     if (!d->randmonst) {
3221         firstchoice = d->which;
3222         if (cant_revive(&d->which, FALSE, (struct obj *) 0)
3223             && firstchoice != PM_LONG_WORM_TAIL) {
3224             /* wizard mode can override handling of special monsters */
3225             char buf[BUFSZ];
3226
3227 #if 0 /*JP:T*/
3228             Sprintf(buf, "Creating %s instead; force %s?",
3229                     mons[d->which].mname, mons[firstchoice].mname);
3230 #else
3231             Sprintf(buf, "\91ã\82í\82è\82É%s\82ª\8dì\82ç\82ê\82Ü\82·\81G%s\82É\82·\82é\81H",
3232                     mons[d->which].mname, mons[firstchoice].mname);
3233 #endif
3234             if (yn(buf) == 'y')
3235                 d->which = firstchoice;
3236         }
3237         whichpm = &mons[d->which];
3238     }
3239     for (i = 0; i <= multi; i++) {
3240         if (d->monclass != MAXMCLASSES)
3241             whichpm = mkclass(d->monclass, 0);
3242         else if (d->randmonst)
3243             whichpm = rndmonst();
3244         mtmp = makemon(whichpm, u.ux, u.uy, NO_MM_FLAGS);
3245         if (!mtmp) {
3246             /* quit trying if creation failed and is going to repeat */
3247             if (d->monclass == MAXMCLASSES && !d->randmonst)
3248                 break;
3249             /* otherwise try again */
3250             continue;
3251         }
3252         mx = mtmp->mx, my = mtmp->my;
3253         /* 'is_FOO()' ought to be called 'always_FOO()' */
3254         if (d->fem != -1 && !is_male(mtmp->data) && !is_female(mtmp->data))
3255             mtmp->female = d->fem; /* ignored for is_neuter() */
3256         if (d->maketame) {
3257             (void) tamedog(mtmp, (struct obj *) 0);
3258         } else if (d->makepeaceful || d->makehostile) {
3259             mtmp->mtame = 0; /* sanity precaution */
3260             mtmp->mpeaceful = d->makepeaceful ? 1 : 0;
3261             set_malign(mtmp);
3262         }
3263         if (d->saddled && can_saddle(mtmp) && !which_armor(mtmp, W_SADDLE)) {
3264             struct obj *otmp = mksobj(SADDLE, TRUE, FALSE);
3265
3266             put_saddle_on_mon(otmp, mtmp);
3267         }
3268         if (d->invisible) {
3269             mon_set_minvis(mtmp);
3270             if (does_block(mx, my, &levl[mx][my]))
3271                 block_point(mx, my);
3272             else
3273                 unblock_point(mx, my);
3274         }
3275        if (d->hidden
3276            && ((is_hider(mtmp->data) && mtmp->data->mlet != S_MIMIC)
3277                || (hides_under(mtmp->data) && OBJ_AT(mx, my))
3278                || (mtmp->data->mlet == S_EEL && is_pool(mx, my))))
3279             mtmp->mundetected = 1;
3280         if (d->sleeping)
3281             mtmp->msleeping = 1;
3282         /* iff asking for 'hidden', show locaton of every created monster
3283            that can't be seen--whether that's due to successfully hiding
3284            or vision issues (line-of-sight, invisibility, blindness) */
3285         if (d->hidden && !canspotmon(mtmp)) {
3286             int count = couldsee(mx, my) ? 8 : 4;
3287             char saveviz = viz_array[my][mx];
3288
3289             if (!flags.sparkle)
3290                 count /= 2;
3291             viz_array[my][mx] |= (IN_SIGHT | COULD_SEE);
3292             flash_glyph_at(mx, my, mon_to_glyph(mtmp, newsym_rn2), count);
3293             viz_array[my][mx] = saveviz;
3294             newsym(mx, my);
3295         }
3296         madeany = TRUE;
3297         /* in case we got a doppelganger instead of what was asked
3298            for, make it start out looking like what was asked for */
3299         if (mtmp->cham != NON_PM && firstchoice != NON_PM
3300             && mtmp->cham != firstchoice)
3301             (void) newcham(mtmp, &mons[firstchoice], FALSE, FALSE);
3302     }
3303     return madeany;
3304 }
3305
3306 /*
3307  * Make a new monster with the type controlled by the user.
3308  *
3309  * Note:  when creating a monster by class letter, specifying the
3310  * "strange object" (']') symbol produces a random monster rather
3311  * than a mimic.  This behavior quirk is useful so don't "fix" it
3312  * (use 'm'--or "mimic"--to create a random mimic).
3313  *
3314  * Used in wizard mode only (for ^G command and for scroll or spell
3315  * of create monster).  Once upon a time, an earlier incarnation of
3316  * this code was also used for the scroll/spell in explore mode.
3317  */
3318 boolean
3319 create_particular()
3320 {
3321     char buf[BUFSZ] = DUMMY, *bufp;
3322     int  tryct = 5;
3323     struct _create_particular_data d;
3324
3325     do {
3326 /*JP
3327         getlin("Create what kind of monster? [type the name or symbol]", buf);
3328 */
3329         getlin("\82Ç\82Ì\8eí\82Ì\89ö\95¨\82ð\8dì\82è\82Ü\82·\82©\81H[\96¼\91O\82ð\93ü\82ê\82Ä\82Ë]", buf);
3330         bufp = mungspaces(buf);
3331         if (*bufp == '\033')
3332             return FALSE;
3333
3334         if (create_particular_parse(bufp, &d))
3335             break;
3336
3337         /* no good; try again... */
3338 /*JP
3339         pline("I've never heard of such monsters.");
3340 */
3341         pline("\82»\82Ì\82æ\82¤\82È\89ö\95¨\82Í\95·\82¢\82½\82±\82Æ\82ª\82È\82¢\81D");
3342     } while (--tryct > 0);
3343
3344     if (!tryct)
3345         pline1(thats_enough_tries);
3346     else
3347         return create_particular_creation(&d);
3348
3349     return FALSE;
3350 }
3351
3352 /*read.c*/