OSDN Git Service

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