OSDN Git Service

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