OSDN Git Service

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