OSDN Git Service

fix2r3における、hogeさんの変更をマージ。
[hengband/hengband.git] / src / cmd6.c
1 /* File: cmd6.c */
2
3 /* Purpose: Object commands */
4
5 /*
6  * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
7  *
8  * This software may be copied and distributed for educational, research, and
9  * not for profit purposes provided that this copyright and statement are
10  * included in all such copies.
11  */
12
13 #include "angband.h"
14
15
16 /*
17  * This file includes code for eating food, drinking potions,
18  * reading scrolls, aiming wands, using staffs, zapping rods,
19  * and activating artifacts.
20  *
21  * In all cases, if the player becomes "aware" of the item's use
22  * by testing it, mark it as "aware" and reward some experience
23  * based on the object's level, always rounding up.  If the player
24  * remains "unaware", mark that object "kind" as "tried".
25  *
26  * This code now correctly handles the unstacking of wands, staffs,
27  * and rods.  Note the overly paranoid warning about potential pack
28  * overflow, which allows the player to use and drop a stacked item.
29  *
30  * In all "unstacking" scenarios, the "used" object is "carried" as if
31  * the player had just picked it up.  In particular, this means that if
32  * the use of an item induces pack overflow, that item will be dropped.
33  *
34  * For simplicity, these routines induce a full "pack reorganization"
35  * which not only combines similar items, but also reorganizes various
36  * items to obey the current "sorting" method.  This may require about
37  * 400 item comparisons, but only occasionally.
38  *
39  * There may be a BIG problem with any "effect" that can cause "changes"
40  * to the inventory.  For example, a "scroll of recharging" can cause
41  * a wand/staff to "disappear", moving the inventory up.  Luckily, the
42  * scrolls all appear BEFORE the staffs/wands, so this is not a problem.
43  * But, for example, a "staff of recharging" could cause MAJOR problems.
44  * In such a case, it will be best to either (1) "postpone" the effect
45  * until the end of the function, or (2) "change" the effect, say, into
46  * giving a staff "negative" charges, or "turning a staff into a stick".
47  * It seems as though a "rod of recharging" might in fact cause problems.
48  * The basic problem is that the act of recharging (and destroying) an
49  * item causes the inducer of that action to "move", causing "o_ptr" to
50  * no longer point at the correct item, with horrifying results.
51  *
52  * Note that food/potions/scrolls no longer use bit-flags for effects,
53  * but instead use the "sval" (which is also used to sort the objects).
54  */
55
56
57 static void do_cmd_eat_food_aux(int item)
58 {
59         int ident, lev;
60         object_type *o_ptr;
61
62         /* Get the item (in the pack) */
63         if (item >= 0)
64         {
65                 o_ptr = &inventory[item];
66         }
67
68         /* Get the item (on the floor) */
69         else
70         {
71                 o_ptr = &o_list[0 - item];
72         }
73
74         /* Sound */
75         sound(SOUND_EAT);
76
77         /* Take a turn */
78         energy_use = 100;
79
80         /* Identity not known yet */
81         ident = FALSE;
82
83         /* Object level */
84         lev = get_object_level(o_ptr);
85
86 #ifdef USE_SCRIPT
87         eat_callback(o_ptr->sval);
88
89         if (!object_eat_callback(o_ptr))
90 #endif /* USE_SCRIPT */
91
92         {
93                 if (o_ptr->tval == TV_FOOD)
94                 {
95                 /* Analyze the food */
96                 switch (o_ptr->sval)
97                 {
98                         case SV_FOOD_POISON:
99                         {
100                                 if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
101                                 {
102                                         if (set_poisoned(p_ptr->poisoned + rand_int(10) + 10))
103                                         {
104                                                 ident = TRUE;
105                                         }
106                                 }
107                                 break;
108                         }
109
110                         case SV_FOOD_BLINDNESS:
111                         {
112                                 if (!p_ptr->resist_blind)
113                                 {
114                                         if (set_blind(p_ptr->blind + rand_int(200) + 200))
115                                         {
116                                                 ident = TRUE;
117                                         }
118                                 }
119                                 break;
120                         }
121
122                         case SV_FOOD_PARANOIA:
123                         {
124                                 if (!p_ptr->resist_fear)
125                                 {
126                                         if (set_afraid(p_ptr->afraid + rand_int(10) + 10))
127                                         {
128                                                 ident = TRUE;
129                                         }
130                                 }
131                                 break;
132                         }
133
134                         case SV_FOOD_CONFUSION:
135                         {
136                                 if (!p_ptr->resist_conf)
137                                 {
138                                         if (set_confused(p_ptr->confused + rand_int(10) + 10))
139                                         {
140                                                 ident = TRUE;
141                                         }
142                                 }
143                                 break;
144                         }
145
146                         case SV_FOOD_HALLUCINATION:
147                         {
148                                 if (!p_ptr->resist_chaos)
149                                 {
150                                         if (set_image(p_ptr->image + rand_int(250) + 250))
151                                         {
152                                                 ident = TRUE;
153                                         }
154                                 }
155                                 break;
156                         }
157
158                         case SV_FOOD_PARALYSIS:
159                         {
160                                 if (!p_ptr->free_act)
161                                 {
162                                         if (set_paralyzed(p_ptr->paralyzed + rand_int(10) + 10))
163                                         {
164                                                 ident = TRUE;
165                                         }
166                                 }
167                                 break;
168                         }
169
170                         case SV_FOOD_WEAKNESS:
171                         {
172 #ifdef JP
173                         take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "ÆÇÆþ¤ê¿©ÎÁ", -1);
174 #else
175                                 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "poisonous food", -1);
176 #endif
177
178                                 (void)do_dec_stat(A_STR);
179                                 ident = TRUE;
180                                 break;
181                         }
182
183                         case SV_FOOD_SICKNESS:
184                         {
185 #ifdef JP
186                         take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "ÆÇÆþ¤ê¿©ÎÁ", -1);
187 #else
188                                 take_hit(DAMAGE_NOESCAPE, damroll(6, 6), "poisonous food", -1);
189 #endif
190
191                                 (void)do_dec_stat(A_CON);
192                                 ident = TRUE;
193                                 break;
194                         }
195
196                         case SV_FOOD_STUPIDITY:
197                         {
198 #ifdef JP
199                         take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "ÆÇÆþ¤ê¿©ÎÁ", -1);
200 #else
201                                 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "poisonous food", -1);
202 #endif
203
204                                 (void)do_dec_stat(A_INT);
205                                 ident = TRUE;
206                                 break;
207                         }
208
209                         case SV_FOOD_NAIVETY:
210                         {
211 #ifdef JP
212                         take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "ÆÇÆþ¤ê¿©ÎÁ", -1);
213 #else
214                                 take_hit(DAMAGE_NOESCAPE, damroll(8, 8), "poisonous food", -1);
215 #endif
216
217                                 (void)do_dec_stat(A_WIS);
218                                 ident = TRUE;
219                                 break;
220                         }
221
222                         case SV_FOOD_UNHEALTH:
223                         {
224 #ifdef JP
225                         take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "ÆÇÆþ¤ê¿©ÎÁ", -1);
226 #else
227                                 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "poisonous food", -1);
228 #endif
229
230                                 (void)do_dec_stat(A_CON);
231                                 ident = TRUE;
232                                 break;
233                         }
234
235                         case SV_FOOD_DISEASE:
236                         {
237 #ifdef JP
238                         take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "ÆÇÆþ¤ê¿©ÎÁ", -1);
239 #else
240                                 take_hit(DAMAGE_NOESCAPE, damroll(10, 10), "poisonous food", -1);
241 #endif
242
243                                 (void)do_dec_stat(A_STR);
244                                 ident = TRUE;
245                                 break;
246                         }
247
248                         case SV_FOOD_CURE_POISON:
249                         {
250                                 if (set_poisoned(0)) ident = TRUE;
251                                 break;
252                         }
253
254                         case SV_FOOD_CURE_BLINDNESS:
255                         {
256                                 if (set_blind(0)) ident = TRUE;
257                                 break;
258                         }
259
260                         case SV_FOOD_CURE_PARANOIA:
261                         {
262                                 if (set_afraid(0)) ident = TRUE;
263                                 break;
264                         }
265
266                         case SV_FOOD_CURE_CONFUSION:
267                         {
268                                 if (set_confused(0)) ident = TRUE;
269                                 break;
270                         }
271
272                         case SV_FOOD_CURE_SERIOUS:
273                         {
274                                 if (hp_player(damroll(4, 8))) ident = TRUE;
275                                 break;
276                         }
277
278                         case SV_FOOD_RESTORE_STR:
279                         {
280                                 if (do_res_stat(A_STR)) ident = TRUE;
281                                 break;
282                         }
283
284                         case SV_FOOD_RESTORE_CON:
285                         {
286                                 if (do_res_stat(A_CON)) ident = TRUE;
287                                 break;
288                         }
289
290                         case SV_FOOD_RESTORING:
291                         {
292                                 if (do_res_stat(A_STR)) ident = TRUE;
293                                 if (do_res_stat(A_INT)) ident = TRUE;
294                                 if (do_res_stat(A_WIS)) ident = TRUE;
295                                 if (do_res_stat(A_DEX)) ident = TRUE;
296                                 if (do_res_stat(A_CON)) ident = TRUE;
297                                 if (do_res_stat(A_CHR)) ident = TRUE;
298                                 break;
299                         }
300
301
302 #ifdef JP
303                 /* ¤½¤ì¤¾¤ì¤Î¿©¤Ùʪ¤Î´¶ÁÛ¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¸½ */
304                 case SV_FOOD_BISCUIT:
305                 {
306                         msg_print("´Å¤¯¤Æ¥µ¥¯¥µ¥¯¤·¤Æ¤È¤Æ¤â¤ª¤¤¤·¤¤¡£");
307                         ident = TRUE;
308                         break;
309                 }
310
311                 case SV_FOOD_JERKY:
312                 {
313                         msg_print("»õ¤´¤¿¤¨¤¬¤¢¤Ã¤Æ¤ª¤¤¤·¤¤¡£");
314                         ident = TRUE;
315                         break;
316                 }
317
318                 case SV_FOOD_SLIME_MOLD:
319                 {
320                         msg_print("¤³¤ì¤Ï¤Ê¤ó¤È¤â·ÁÍƤ·¤¬¤¿¤¤Ì£¤À¡£");
321                         ident = TRUE;
322                         break;
323                 }
324
325                 case SV_FOOD_RATION:
326                 {
327                         msg_print("¤³¤ì¤Ï¤ª¤¤¤·¤¤¡£");
328                         ident = TRUE;
329                         break;
330                 }
331 #else
332                         case SV_FOOD_RATION:
333                         case SV_FOOD_BISCUIT:
334                         case SV_FOOD_JERKY:
335                         case SV_FOOD_SLIME_MOLD:
336                         {
337                                 msg_print("That tastes good.");
338                                 ident = TRUE;
339                                 break;
340                         }
341 #endif
342
343
344                         case SV_FOOD_WAYBREAD:
345                         {
346 #ifdef JP
347                         msg_print("¤³¤ì¤Ï¤Ò¤¸¤ç¤¦¤ËÈþÌ£¤À¡£");
348 #else
349                                 msg_print("That tastes good.");
350 #endif
351
352                                 (void)set_poisoned(0);
353                                 (void)hp_player(damroll(4, 8));
354                                 ident = TRUE;
355                                 break;
356                         }
357
358 #ifdef JP
359                         case SV_FOOD_PINT_OF_ALE:
360                 {
361                         msg_print("¤Î¤É¤´¤·Á֤䤫¤À¡£");
362                         ident = TRUE;
363                         break;
364                 }
365
366                         case SV_FOOD_PINT_OF_WINE:
367                         {
368                                 msg_print("That tastes good.");
369                                 ident = TRUE;
370                                 break;
371                         }
372 #else
373                         case SV_FOOD_PINT_OF_ALE:
374                         case SV_FOOD_PINT_OF_WINE:
375                         {
376                                 msg_print("That tastes good.");
377                                 ident = TRUE;
378                                 break;
379                         }
380 #endif
381
382                 }
383                 }
384                 else
385                 {
386                 }
387         }
388
389         /* Combine / Reorder the pack (later) */
390         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
391
392         if (!(object_aware_p(o_ptr)))
393         {
394                 chg_virtue(V_KNOWLEDGE, -1);
395                 chg_virtue(V_PATIENCE, -1);
396                 chg_virtue(V_CHANCE, 1);
397         }
398
399         /* We have tried it */
400         object_tried(o_ptr);
401
402         /* The player is now aware of the object */
403         if (ident && !object_aware_p(o_ptr))
404         {
405                 object_aware(o_ptr);
406                 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
407         }
408
409         /* Window stuff */
410         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
411
412
413         /* Food can feed the player */
414         if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
415         {
416                 /* Reduced nutritional benefit */
417                 (void)set_food(p_ptr->food + (o_ptr->pval / 10));
418 #ifdef JP
419 msg_print("¤¢¤Ê¤¿¤Î¤è¤¦¤Ê¼Ô¤Ë¤È¤Ã¤Æ¿©ÎȤʤɶϤ«¤Ê±ÉÍܤˤ·¤«¤Ê¤é¤Ê¤¤¡£");
420 #else
421                 msg_print("Mere victuals hold scant sustenance for a being such as yourself.");
422 #endif
423
424                 if (p_ptr->food < PY_FOOD_ALERT)   /* Hungry */
425 #ifdef JP
426 msg_print("¤¢¤Ê¤¿¤Îµ²¤¨¤Ï¿·Á¯¤Ê·ì¤Ë¤è¤Ã¤Æ¤Î¤ßËþ¤¿¤µ¤ì¤ë¡ª");
427 #else
428                         msg_print("Your hunger can only be satisfied with fresh blood!");
429 #endif
430
431         }
432         else if (p_ptr->prace == RACE_SKELETON)
433         {
434                 if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
435                       (o_ptr->sval < SV_FOOD_BISCUIT)))
436                 {
437                         object_type forge;
438                         object_type *q_ptr = &forge;
439
440 #ifdef JP
441 msg_print("¿©¤Ùʪ¤¬¥¢¥´¤òÁÇÄ̤ꤷ¤ÆÍî¤Á¤¿¡ª");
442 #else
443                         msg_print("The food falls through your jaws!");
444 #endif
445
446
447                         /* Create the item */
448                         object_prep(q_ptr, lookup_kind(o_ptr->tval, o_ptr->sval));
449
450 #ifdef USE_SCRIPT
451                         q_ptr->python = object_create_callback(q_ptr);
452 #endif /* USE_SCRIPT */
453
454                         /* Drop the object from heaven */
455                         (void)drop_near(q_ptr, -1, py, px);
456                 }
457                 else
458                 {
459 #ifdef JP
460 msg_print("¿©¤Ùʪ¤¬¥¢¥´¤òÁÇÄ̤ꤷ¤ÆÍî¤Á¡¢¾Ã¤¨¤¿¡ª");
461 #else
462                         msg_print("The food falls through your jaws and vanishes!");
463 #endif
464
465                 }
466         }
467         else if ((p_ptr->prace == RACE_GOLEM) ||
468                  (p_ptr->prace == RACE_ZOMBIE) ||
469                  (p_ptr->prace == RACE_ENT) ||
470                  (p_ptr->prace == RACE_DEMON) ||
471                  (p_ptr->prace == RACE_ANDROID) ||
472                  (p_ptr->prace == RACE_SPECTRE) ||
473                  (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
474         {
475 #ifdef JP
476 msg_print("À¸¼Ô¤Î¿©Êª¤Ï¤¢¤Ê¤¿¤Ë¤È¤Ã¤Æ¤Û¤È¤ó¤É±ÉÍܤˤʤé¤Ê¤¤¡£");
477 #else
478                 msg_print("The food of mortals is poor sustenance for you.");
479 #endif
480
481                 set_food(p_ptr->food + ((o_ptr->pval) / 20));
482         }
483         else
484         {
485                 (void)set_food(p_ptr->food + o_ptr->pval);
486         }
487
488         /* Destroy a food in the pack */
489         if (item >= 0)
490         {
491                 inven_item_increase(item, -1);
492                 inven_item_describe(item);
493                 inven_item_optimize(item);
494         }
495
496         /* Destroy a food on the floor */
497         else
498         {
499                 floor_item_increase(0 - item, -1);
500                 floor_item_describe(0 - item);
501                 floor_item_optimize(0 - item);
502         }
503 }
504
505
506 /*
507  * Hook to determine if an object is eatable
508  */
509 static bool item_tester_hook_eatable(object_type *o_ptr)
510 {
511 /*      if ((o_ptr->tval==TV_FOOD) || ((o_ptr->tval==TV_CORPSE) && o_ptr->sval)) return (TRUE); */
512         if (o_ptr->tval==TV_FOOD) return (TRUE);
513
514         /* Assume not */
515         return (FALSE);
516 }
517
518
519 /*
520  * Eat some food (from the pack or floor)
521  */
522 void do_cmd_eat_food(void)
523 {
524         int         item;
525         cptr        q, s;
526
527
528         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
529         {
530                 set_action(ACTION_NONE);
531         }
532
533         /* Restrict choices to food */
534         item_tester_hook = item_tester_hook_eatable;
535
536         /* Get an item */
537 #ifdef JP
538         q = "¤É¤ì¤ò¿©¤Ù¤Þ¤¹¤«? ";
539         s = "¿©¤Ùʪ¤¬¤Ê¤¤¡£";
540 #else
541         q = "Eat which item? ";
542         s = "You have nothing to eat.";
543 #endif
544
545         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
546
547         /* Eat the object */
548         do_cmd_eat_food_aux(item);
549 }
550
551
552 /*
553  * Quaff a potion (from the pack or the floor)
554  */
555 static void do_cmd_quaff_potion_aux(int item)
556 {
557         int         ident, lev;
558         object_type     *o_ptr;
559         object_type forge;
560         object_type *q_ptr;
561
562
563         /* Take a turn */
564         energy_use = 100;
565
566         if (world_player)
567         {
568                 if (flush_failure) flush();
569 #ifdef JP
570                 msg_print("ÉÓ¤«¤é¿å¤¬Î®¤ì½Ð¤Æ¤³¤Ê¤¤¡ª");
571 #else
572                 msg_print("The potion doesn't flow out from a bottle.");
573 #endif
574
575                 sound(SOUND_FAIL);
576                 return;
577         }
578
579         if((p_ptr->pclass == CLASS_BARD) && p_ptr->magic_num1[0])
580         {
581                 stop_singing();
582         }
583
584         /* Get the item (in the pack) */
585         if (item >= 0)
586         {
587                 o_ptr = &inventory[item];
588         }
589
590         /* Get the item (on the floor) */
591         else
592         {
593                 o_ptr = &o_list[0 - item];
594         }
595
596         /* Get local object */
597         q_ptr = &forge;
598
599         /* Obtain a local object */
600         object_copy(q_ptr, o_ptr);
601
602         /* Single object */
603         q_ptr->number = 1;
604
605         /* Reduce and describe inventory */
606         if (item >= 0)
607         {
608                 inven_item_increase(item, -1);
609                 inven_item_describe(item);
610                 inven_item_optimize(item);
611         }
612
613         /* Reduce and describe floor item */
614         else
615         {
616                 floor_item_increase(0 - item, -1);
617                 floor_item_describe(0 - item);
618                 floor_item_optimize(0 - item);
619         }
620
621         /* Sound */
622         sound(SOUND_QUAFF);
623
624
625         /* Not identified yet */
626         ident = FALSE;
627
628         /* Object level */
629         lev = get_object_level(q_ptr);
630
631         /* Analyze the potion */
632         switch (q_ptr->sval)
633         {
634 #ifdef JP
635                 /* °û¤ß¤´¤¿¤¨¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¸½ */
636                 case SV_POTION_WATER:
637                 {
638                         msg_print("¸ý¤ÎÃ椬¤µ¤Ã¤Ñ¤ê¤·¤¿¡£");
639                         msg_print("¤Î¤É¤Î³é¤­¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
640                         ident = TRUE;
641                         break;
642                 }
643                 case SV_POTION_APPLE_JUICE:
644                 {
645                         msg_print("´Å¤¯¤Æ¥µ¥Ã¥Ñ¥ê¤È¤·¤Æ¤¤¤Æ¡¢¤È¤Æ¤â¤ª¤¤¤·¤¤¡£");
646                         msg_print("¤Î¤É¤Î³é¤­¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
647                         ident = TRUE;
648                         break;
649                 }
650                 case SV_POTION_SLIME_MOLD:
651                 {
652                         msg_print("¤Ê¤ó¤È¤âÉÔµ¤Ì£¤ÊÌ£¤À¡£");
653                         msg_print("¤Î¤É¤Î³é¤­¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
654                         ident = TRUE;
655                         break;
656                 }
657 #else
658                 case SV_POTION_WATER:
659                 case SV_POTION_APPLE_JUICE:
660                 case SV_POTION_SLIME_MOLD:
661                 {
662                         msg_print("You feel less thirsty.");
663                         ident = TRUE;
664                         break;
665                 }
666 #endif
667
668
669                 case SV_POTION_SLOWNESS:
670                 {
671                         if (set_slow(randint(25) + 15, FALSE)) ident = TRUE;
672                         break;
673                 }
674
675                 case SV_POTION_SALT_WATER:
676                 {
677 #ifdef JP
678                         msg_print("¤¦¤§¡ª»×¤ï¤ºÅǤ¤¤Æ¤·¤Þ¤Ã¤¿¡£");
679 #else
680                         msg_print("The potion makes you vomit!");
681 #endif
682
683                         (void)set_food(PY_FOOD_STARVE - 1);
684                         (void)set_poisoned(0);
685                         (void)set_paralyzed(p_ptr->paralyzed + 4);
686                         ident = TRUE;
687                         break;
688                 }
689
690                 case SV_POTION_POISON:
691                 {
692                         if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
693                         {
694                                 if (set_poisoned(p_ptr->poisoned + rand_int(15) + 10))
695                                 {
696                                         ident = TRUE;
697                                 }
698                         }
699                         break;
700                 }
701
702                 case SV_POTION_BLINDNESS:
703                 {
704                         if (!p_ptr->resist_blind)
705                         {
706                                 if (set_blind(p_ptr->blind + rand_int(100) + 100))
707                                 {
708                                         ident = TRUE;
709                                 }
710                         }
711                         break;
712                 }
713
714                 case SV_POTION_CONFUSION: /* Booze */
715                 {
716                         if (p_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1);
717                         else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN;
718                         if (!p_ptr->resist_conf)
719                         {
720                                 if (set_confused(rand_int(20) + 15))
721                                 {
722                                         ident = TRUE;
723                                 }
724                         }
725
726                         if (!p_ptr->resist_chaos)
727                         {
728                                 if (one_in_(2))
729                                 {
730                                         if (set_image(p_ptr->image + rand_int(150) + 150))
731                                         {
732                                                 ident = TRUE;
733                                         }
734                                 }
735                                 if (one_in_(13) && (p_ptr->pclass != CLASS_MONK))
736                                 {
737                                         ident = TRUE;
738                                         if (one_in_(3)) lose_all_info();
739                                         else wiz_dark();
740                                         teleport_player(100);
741                                         wiz_dark();
742 #ifdef JP
743 msg_print("ÃΤé¤Ê¤¤¾ì½ê¤ÇÌܤ¬Àä᤿¡£Æ¬Äˤ¬¤¹¤ë¡£");
744 msg_print("²¿¤â»×¤¤½Ð¤»¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ØÍ褿¤Î¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
745 #else
746                                         msg_print("You wake up somewhere with a sore head...");
747                                         msg_print("You can't remember a thing, or how you got here!");
748 #endif
749
750                                 }
751                         }
752                         break;
753                 }
754
755                 case SV_POTION_SLEEP:
756                 {
757                         if (!p_ptr->free_act)
758                         {
759 #ifdef JP
760                 msg_print("¤¢¤Ê¤¿¤Ï̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡£");
761 #else
762                 msg_print("You fall asleep.");
763 #endif
764
765
766                                 if (ironman_nightmare)
767                                 {
768 #ifdef JP
769 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤­¤¿¡£");
770 #else
771                                         msg_print("A horrible vision enters your mind.");
772 #endif
773
774
775                                         /* Pick a nightmare */
776                                         get_mon_num_prep(get_nightmare, NULL);
777
778                                         /* Have some nightmares */
779                                         have_nightmare(get_mon_num(MAX_DEPTH));
780
781                                         /* Remove the monster restriction */
782                                         get_mon_num_prep(NULL, NULL);
783                                 }
784                                 if (set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4))
785                                 {
786                                         ident = TRUE;
787                                 }
788                         }
789                         break;
790                 }
791
792                 case SV_POTION_LOSE_MEMORIES:
793                 {
794                         if (!p_ptr->hold_life && (p_ptr->exp > 0))
795                         {
796 #ifdef JP
797                                 msg_print("²áµî¤Îµ­²±¤¬Çö¤ì¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
798 #else
799                                 msg_print("You feel your memories fade.");
800 #endif
801                                 chg_virtue(V_KNOWLEDGE, -5);
802
803                                 lose_exp(p_ptr->exp / 4);
804                                 ident = TRUE;
805                         }
806                         break;
807                 }
808
809                 case SV_POTION_RUINATION:
810                 {
811 #ifdef JP
812                         msg_print("¿È¤â¿´¤â¼å¤Ã¤Æ¤­¤Æ¡¢Àºµ¤¤¬È´¤±¤Æ¤¤¤¯¤è¤¦¤À¡£");
813                         take_hit(DAMAGE_LOSELIFE, damroll(10, 10), "ÇËÌǤÎÌô", -1);
814 #else
815                         msg_print("Your nerves and muscles feel weak and lifeless!");
816                         take_hit(DAMAGE_LOSELIFE, damroll(10, 10), "a potion of Ruination", -1);
817 #endif
818
819                         (void)dec_stat(A_DEX, 25, TRUE);
820                         (void)dec_stat(A_WIS, 25, TRUE);
821                         (void)dec_stat(A_CON, 25, TRUE);
822                         (void)dec_stat(A_STR, 25, TRUE);
823                         (void)dec_stat(A_CHR, 25, TRUE);
824                         (void)dec_stat(A_INT, 25, TRUE);
825                         ident = TRUE;
826                         break;
827                 }
828
829                 case SV_POTION_DEC_STR:
830                 {
831                         if (do_dec_stat(A_STR)) ident = TRUE;
832                         break;
833                 }
834
835                 case SV_POTION_DEC_INT:
836                 {
837                         if (do_dec_stat(A_INT)) ident = TRUE;
838                         break;
839                 }
840
841                 case SV_POTION_DEC_WIS:
842                 {
843                         if (do_dec_stat(A_WIS)) ident = TRUE;
844                         break;
845                 }
846
847                 case SV_POTION_DEC_DEX:
848                 {
849                         if (do_dec_stat(A_DEX)) ident = TRUE;
850                         break;
851                 }
852
853                 case SV_POTION_DEC_CON:
854                 {
855                         if (do_dec_stat(A_CON)) ident = TRUE;
856                         break;
857                 }
858
859                 case SV_POTION_DEC_CHR:
860                 {
861                         if (do_dec_stat(A_CHR)) ident = TRUE;
862                         break;
863                 }
864
865                 case SV_POTION_DETONATIONS:
866                 {
867 #ifdef JP
868                         msg_print("ÂΤÎÃæ¤Ç·ã¤·¤¤Çúȯ¤¬µ¯¤­¤¿¡ª");
869                         take_hit(DAMAGE_NOESCAPE, damroll(50, 20), "Çúȯ¤ÎÌô", -1);
870 #else
871                         msg_print("Massive explosions rupture your body!");
872                         take_hit(DAMAGE_NOESCAPE, damroll(50, 20), "a potion of Detonation", -1);
873 #endif
874
875                         (void)set_stun(p_ptr->stun + 75);
876                         (void)set_cut(p_ptr->cut + 5000);
877                         ident = TRUE;
878                         break;
879                 }
880
881                 case SV_POTION_DEATH:
882                 {
883                         chg_virtue(V_VITALITY, -1);
884                         chg_virtue(V_UNLIFE, 5);
885 #ifdef JP
886                         msg_print("»à¤Îͽ´¶¤¬ÂÎÃæ¤ò¶î¤±¤á¤°¤Ã¤¿¡£");
887                         take_hit(DAMAGE_LOSELIFE, 5000, "»à¤ÎÌô", -1);
888 #else
889                         msg_print("A feeling of Death flows through your body.");
890                         take_hit(DAMAGE_LOSELIFE, 5000, "a potion of Death", -1);
891 #endif
892
893                         ident = TRUE;
894                         break;
895                 }
896
897                 case SV_POTION_INFRAVISION:
898                 {
899                         if (set_tim_infra(p_ptr->tim_infra + 100 + randint(100), FALSE))
900                         {
901                                 ident = TRUE;
902                         }
903                         break;
904                 }
905
906                 case SV_POTION_DETECT_INVIS:
907                 {
908                         if (set_tim_invis(p_ptr->tim_invis + 12 + randint(12), FALSE))
909                         {
910                                 ident = TRUE;
911                         }
912                         break;
913                 }
914
915                 case SV_POTION_SLOW_POISON:
916                 {
917                         if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;
918                         break;
919                 }
920
921                 case SV_POTION_CURE_POISON:
922                 {
923                         if (set_poisoned(0)) ident = TRUE;
924                         break;
925                 }
926
927                 case SV_POTION_BOLDNESS:
928                 {
929                         if (set_afraid(0)) ident = TRUE;
930                         break;
931                 }
932
933                 case SV_POTION_SPEED:
934                 {
935                         if (!p_ptr->fast)
936                         {
937                                 if (set_fast(randint(25) + 15, FALSE)) ident = TRUE;
938                         }
939                         else
940                         {
941                                 (void)set_fast(p_ptr->fast + 5, FALSE);
942                         }
943                         break;
944                 }
945
946                 case SV_POTION_RESIST_HEAT:
947                 {
948                         if (set_oppose_fire(p_ptr->oppose_fire + randint(10) + 10, FALSE))
949                         {
950                                 ident = TRUE;
951                         }
952                         break;
953                 }
954
955                 case SV_POTION_RESIST_COLD:
956                 {
957                         if (set_oppose_cold(p_ptr->oppose_cold + randint(10) + 10, FALSE))
958                         {
959                                 ident = TRUE;
960                         }
961                         break;
962                 }
963
964                 case SV_POTION_HEROISM:
965                 {
966                         if (set_afraid(0)) ident = TRUE;
967                         if (set_hero(p_ptr->hero + randint(25) + 25, FALSE)) ident = TRUE;
968                         if (hp_player(10)) ident = TRUE;
969                         break;
970                 }
971
972                 case SV_POTION_BESERK_STRENGTH:
973                 {
974                         if (set_afraid(0)) ident = TRUE;
975                         if (set_shero(p_ptr->shero + randint(25) + 25, FALSE)) ident = TRUE;
976                         if (hp_player(30)) ident = TRUE;
977                         break;
978                 }
979
980                 case SV_POTION_CURE_LIGHT:
981                 {
982                         if (hp_player(damroll(2, 8))) ident = TRUE;
983                         if (set_blind(0)) ident = TRUE;
984                         if (set_cut(p_ptr->cut - 10)) ident = TRUE;
985                         if (set_shero(0,TRUE)) ident = TRUE;
986                         break;
987                 }
988
989                 case SV_POTION_CURE_SERIOUS:
990                 {
991                         if (hp_player(damroll(4, 8))) ident = TRUE;
992                         if (set_blind(0)) ident = TRUE;
993                         if (set_confused(0)) ident = TRUE;
994                         if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
995                         if (set_shero(0,TRUE)) ident = TRUE;
996                         break;
997                 }
998
999                 case SV_POTION_CURE_CRITICAL:
1000                 {
1001                         if (hp_player(damroll(6, 8))) ident = TRUE;
1002                         if (set_blind(0)) ident = TRUE;
1003                         if (set_confused(0)) ident = TRUE;
1004                         if (set_poisoned(0)) ident = TRUE;
1005                         if (set_stun(0)) ident = TRUE;
1006                         if (set_cut(0)) ident = TRUE;
1007                         if (set_shero(0,TRUE)) ident = TRUE;
1008                         break;
1009                 }
1010
1011                 case SV_POTION_HEALING:
1012                 {
1013                         if (hp_player(300)) ident = TRUE;
1014                         if (set_blind(0)) ident = TRUE;
1015                         if (set_confused(0)) ident = TRUE;
1016                         if (set_poisoned(0)) ident = TRUE;
1017                         if (set_stun(0)) ident = TRUE;
1018                         if (set_cut(0)) ident = TRUE;
1019                         if (set_shero(0,TRUE)) ident = TRUE;
1020                         break;
1021                 }
1022
1023                 case SV_POTION_STAR_HEALING:
1024                 {
1025                         if (hp_player(1200)) ident = TRUE;
1026                         if (set_blind(0)) ident = TRUE;
1027                         if (set_confused(0)) ident = TRUE;
1028                         if (set_poisoned(0)) ident = TRUE;
1029                         if (set_stun(0)) ident = TRUE;
1030                         if (set_cut(0)) ident = TRUE;
1031                         if (set_shero(0,TRUE)) ident = TRUE;
1032                         break;
1033                 }
1034
1035                 case SV_POTION_LIFE:
1036                 {
1037                         chg_virtue(V_VITALITY, 1);
1038                         chg_virtue(V_UNLIFE, -5);
1039 #ifdef JP
1040                         msg_print("ÂÎÃæ¤ËÀ¸Ì¿ÎϤ¬Ëþ¤Á¤¢¤Õ¤ì¤Æ¤­¤¿¡ª");
1041 #else
1042                         msg_print("You feel life flow through your body!");
1043 #endif
1044
1045                         restore_level();
1046                         (void)set_poisoned(0);
1047                         (void)set_blind(0);
1048                         (void)set_confused(0);
1049                         (void)set_image(0);
1050                         (void)set_stun(0);
1051                         (void)set_cut(0);
1052                         (void)do_res_stat(A_STR);
1053                         (void)do_res_stat(A_CON);
1054                         (void)do_res_stat(A_DEX);
1055                         (void)do_res_stat(A_WIS);
1056                         (void)do_res_stat(A_INT);
1057                         (void)do_res_stat(A_CHR);
1058                         (void)set_shero(0,TRUE);
1059                         update_stuff();
1060                         hp_player(5000);
1061                         ident = TRUE;
1062                         break;
1063                 }
1064
1065                 case SV_POTION_RESTORE_MANA:
1066                 {
1067                         if (p_ptr->pclass == CLASS_MAGIC_EATER)
1068                         {
1069                                 int i;
1070                                 for (i = 0; i < 72; i++)
1071                                 {
1072                                         p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? 0x30000 : p_ptr->magic_num2[i]*0x05555;
1073                                         if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i]*0x10000) p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*0x10000L;
1074                                 }
1075                                 for (; i < 108; i++)
1076                                 {
1077                                         int k_idx = lookup_kind(TV_ROD, i-72);
1078                                         p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? 0x30000 : p_ptr->magic_num2[i]*0x5555)*k_info[k_idx].pval;
1079                                         if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
1080                                 }
1081 #ifdef JP
1082                                 msg_print("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£");
1083 #else
1084                                 msg_print("Your feel your head clear.");
1085 #endif
1086                                 p_ptr->window |= (PW_PLAYER);
1087                                 ident = TRUE;
1088                         }
1089                         else if (p_ptr->csp < p_ptr->msp)
1090                         {
1091                                 p_ptr->csp = p_ptr->msp;
1092                                 p_ptr->csp_frac = 0;
1093 #ifdef JP
1094                                 msg_print("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£");
1095 #else
1096                                 msg_print("Your feel your head clear.");
1097 #endif
1098
1099                                 p_ptr->redraw |= (PR_MANA);
1100                                 p_ptr->window |= (PW_PLAYER);
1101                                 p_ptr->window |= (PW_SPELL);
1102                                 ident = TRUE;
1103                         }
1104                         if (set_shero(0,TRUE)) ident = TRUE;
1105                         break;
1106                 }
1107
1108                 case SV_POTION_RESTORE_EXP:
1109                 {
1110                         if (restore_level()) ident = TRUE;
1111                         break;
1112                 }
1113
1114                 case SV_POTION_RES_STR:
1115                 {
1116                         if (do_res_stat(A_STR)) ident = TRUE;
1117                         break;
1118                 }
1119
1120                 case SV_POTION_RES_INT:
1121                 {
1122                         if (do_res_stat(A_INT)) ident = TRUE;
1123                         break;
1124                 }
1125
1126                 case SV_POTION_RES_WIS:
1127                 {
1128                         if (do_res_stat(A_WIS)) ident = TRUE;
1129                         break;
1130                 }
1131
1132                 case SV_POTION_RES_DEX:
1133                 {
1134                         if (do_res_stat(A_DEX)) ident = TRUE;
1135                         break;
1136                 }
1137
1138                 case SV_POTION_RES_CON:
1139                 {
1140                         if (do_res_stat(A_CON)) ident = TRUE;
1141                         break;
1142                 }
1143
1144                 case SV_POTION_RES_CHR:
1145                 {
1146                         if (do_res_stat(A_CHR)) ident = TRUE;
1147                         break;
1148                 }
1149
1150                 case SV_POTION_INC_STR:
1151                 {
1152                         if (do_inc_stat(A_STR)) ident = TRUE;
1153                         break;
1154                 }
1155
1156                 case SV_POTION_INC_INT:
1157                 {
1158                         if (do_inc_stat(A_INT)) ident = TRUE;
1159                         break;
1160                 }
1161
1162                 case SV_POTION_INC_WIS:
1163                 {
1164                         if (do_inc_stat(A_WIS)) ident = TRUE;
1165                         break;
1166                 }
1167
1168                 case SV_POTION_INC_DEX:
1169                 {
1170                         if (do_inc_stat(A_DEX)) ident = TRUE;
1171                         break;
1172                 }
1173
1174                 case SV_POTION_INC_CON:
1175                 {
1176                         if (do_inc_stat(A_CON)) ident = TRUE;
1177                         break;
1178                 }
1179
1180                 case SV_POTION_INC_CHR:
1181                 {
1182                         if (do_inc_stat(A_CHR)) ident = TRUE;
1183                         break;
1184                 }
1185
1186                 case SV_POTION_AUGMENTATION:
1187                 {
1188                         if (do_inc_stat(A_STR)) ident = TRUE;
1189                         if (do_inc_stat(A_INT)) ident = TRUE;
1190                         if (do_inc_stat(A_WIS)) ident = TRUE;
1191                         if (do_inc_stat(A_DEX)) ident = TRUE;
1192                         if (do_inc_stat(A_CON)) ident = TRUE;
1193                         if (do_inc_stat(A_CHR)) ident = TRUE;
1194                         break;
1195                 }
1196
1197                 case SV_POTION_ENLIGHTENMENT:
1198                 {
1199                         chg_virtue(V_ENLIGHTEN, 1);
1200 #ifdef JP
1201                         msg_print("¼«Ê¬¤ÎÃÖ¤«¤ì¤Æ¤¤¤ë¾õ¶·¤¬Ç¾Î¢¤ËÉ⤫¤ó¤Ç¤­¤¿...");
1202 #else
1203                         msg_print("An image of your surroundings forms in your mind...");
1204 #endif
1205
1206                         chg_virtue(V_KNOWLEDGE, 1);
1207                         chg_virtue(V_ENLIGHTEN, 1);
1208                         wiz_lite(FALSE, FALSE);
1209                         ident = TRUE;
1210                         break;
1211                 }
1212
1213                 case SV_POTION_STAR_ENLIGHTENMENT:
1214                 {
1215 #ifdef JP
1216                         msg_print("¹¹¤Ê¤ë·¼Ìؤò´¶¤¸¤¿...");
1217 #else
1218                         msg_print("You begin to feel more enlightened...");
1219 #endif
1220
1221                         chg_virtue(V_KNOWLEDGE, 1);
1222                         chg_virtue(V_ENLIGHTEN, 1);
1223                         msg_print(NULL);
1224                         wiz_lite(TRUE, FALSE);
1225                         (void)do_inc_stat(A_INT);
1226                         (void)do_inc_stat(A_WIS);
1227                         (void)detect_traps(DETECT_RAD_DEFAULT);
1228                         (void)detect_doors(DETECT_RAD_DEFAULT);
1229                         (void)detect_stairs(DETECT_RAD_DEFAULT);
1230                         (void)detect_treasure(DETECT_RAD_DEFAULT);
1231                         (void)detect_objects_gold(DETECT_RAD_DEFAULT);
1232                         (void)detect_objects_normal(DETECT_RAD_DEFAULT);
1233                         identify_pack();
1234                         self_knowledge();
1235                         ident = TRUE;
1236                         break;
1237                 }
1238
1239                 case SV_POTION_SELF_KNOWLEDGE:
1240                 {
1241 #ifdef JP
1242                         msg_print("¼«Ê¬¼«¿È¤Î¤³¤È¤¬¾¯¤·¤Ïʬ¤«¤Ã¤¿µ¤¤¬¤¹¤ë...");
1243 #else
1244                         msg_print("You begin to know yourself a little better...");
1245 #endif
1246
1247                         msg_print(NULL);
1248                         self_knowledge();
1249                         ident = TRUE;
1250                         break;
1251                 }
1252
1253                 case SV_POTION_EXPERIENCE:
1254                 {
1255                         if (p_ptr->prace == RACE_ANDROID) break;
1256                         chg_virtue(V_ENLIGHTEN, 1);
1257                         if (p_ptr->exp < PY_MAX_EXP)
1258                         {
1259                                 s32b ee = (p_ptr->exp / 2) + 10;
1260                                 if (ee > 100000L) ee = 100000L;
1261 #ifdef JP
1262                                 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1263 #else
1264                                 msg_print("You feel more experienced.");
1265 #endif
1266
1267                                 gain_exp(ee);
1268                                 ident = TRUE;
1269                         }
1270                         break;
1271                 }
1272
1273                 case SV_POTION_RESISTANCE:
1274                 {
1275                         (void)set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20, FALSE);
1276                         (void)set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20, FALSE);
1277                         (void)set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20, FALSE);
1278                         (void)set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20, FALSE);
1279                         (void)set_oppose_pois(p_ptr->oppose_pois + randint(20) + 20, FALSE);
1280                         ident = TRUE;
1281                         break;
1282                 }
1283
1284                 case SV_POTION_CURING:
1285                 {
1286                         if (hp_player(50)) ident = TRUE;
1287                         if (set_blind(0)) ident = TRUE;
1288                         if (set_poisoned(0)) ident = TRUE;
1289                         if (set_confused(0)) ident = TRUE;
1290                         if (set_stun(0)) ident = TRUE;
1291                         if (set_cut(0)) ident = TRUE;
1292                         if (set_image(0)) ident = TRUE;
1293                         break;
1294                 }
1295
1296                 case SV_POTION_INVULNERABILITY:
1297                 {
1298                         (void)set_invuln(p_ptr->invuln + randint(4) + 4, FALSE);
1299                         ident = TRUE;
1300                         break;
1301                 }
1302
1303                 case SV_POTION_NEW_LIFE:
1304                 {
1305                         do_cmd_rerate(FALSE);
1306                         get_max_stats();
1307                         p_ptr->update |= PU_BONUS;
1308                         if (p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3)
1309                         {
1310                                 chg_virtue(V_CHANCE, -5);
1311 #ifdef JP
1312 msg_print("Á´¤Æ¤ÎÆÍÁ³ÊÑ°Û¤¬¼£¤Ã¤¿¡£");
1313 #else
1314                                 msg_print("You are cured of all mutations.");
1315 #endif
1316
1317                                 p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
1318                                 p_ptr->update |= PU_BONUS;
1319                                 handle_stuff();
1320                                 mutant_regenerate_mod = calc_mutant_regenerate_mod();
1321                         }
1322                         ident = TRUE;
1323                         break;
1324                 }
1325
1326                 case SV_POTION_NEO_TSUYOSHI:
1327                 {
1328                         (void)set_image(0);
1329                         (void)set_tsuyoshi(p_ptr->tsuyoshi + randint(100) + 100, FALSE);
1330                         ident = TRUE;
1331                         break;
1332                 }
1333
1334                 case SV_POTION_TSUYOSHI:
1335                 {
1336 #ifdef JP
1337 msg_print("¡Ö¥ª¥¯¥ì·»¤µ¤ó¡ª¡×");
1338 #else
1339                         msg_print("Brother OKURE!");
1340 #endif
1341                         msg_print(NULL);
1342                         p_ptr->tsuyoshi = 1;
1343                         (void)set_tsuyoshi(0, TRUE);
1344                         if (!p_ptr->resist_chaos)
1345                         {
1346                                 (void)set_image(50 + randint(50));
1347                         }
1348                         ident = TRUE;
1349                         break;
1350                 }
1351                 
1352                 case SV_POTION_POLYMORPH:
1353                 {
1354                         if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
1355                         {
1356                                 chg_virtue(V_CHANCE, -5);
1357 #ifdef JP
1358 msg_print("Á´¤Æ¤ÎÆÍÁ³ÊÑ°Û¤¬¼£¤Ã¤¿¡£");
1359 #else
1360                                 msg_print("You are cured of all mutations.");
1361 #endif
1362
1363                                 p_ptr->muta1 = p_ptr->muta2 = p_ptr->muta3 = 0;
1364                                 p_ptr->update |= PU_BONUS;
1365                                 handle_stuff();
1366                         }
1367                         else
1368                         {
1369                                 do
1370                                 {
1371                                         if (one_in_(2))
1372                                         {
1373                                                 if(gain_random_mutation(0)) ident = TRUE;
1374                                         }
1375                                         else if (lose_mutation(0)) ident = TRUE;
1376                                 } while(!ident || one_in_(2));
1377                         }
1378                         break;
1379                 }
1380         }
1381
1382         if (p_ptr->prace == RACE_SKELETON)
1383         {
1384 #ifdef JP
1385 msg_print("±ÕÂΤΰìÉô¤Ï¤¢¤Ê¤¿¤Î¥¢¥´¤òÁÇÄ̤ꤷ¤ÆÍî¤Á¤¿¡ª");
1386 #else
1387                 msg_print("Some of the fluid falls through your jaws!");
1388 #endif
1389
1390                 (void)potion_smash_effect(0, py, px, q_ptr->k_idx);
1391         }
1392
1393         /* Combine / Reorder the pack (later) */
1394         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1395
1396         if (!(object_aware_p(o_ptr)))
1397         {
1398                 chg_virtue(V_PATIENCE, -1);
1399                 chg_virtue(V_CHANCE, 1);
1400                 chg_virtue(V_KNOWLEDGE, -1);
1401         }
1402
1403         /* The item has been tried */
1404         object_tried(q_ptr);
1405
1406         /* An identification was made */
1407         if (ident && !object_aware_p(q_ptr))
1408         {
1409                 object_aware(q_ptr);
1410                 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
1411         }
1412
1413         /* Window stuff */
1414         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1415
1416         /* Potions can feed the player */
1417         switch (p_ptr->mimic_form)
1418         {
1419         case MIMIC_NONE:
1420                 switch (p_ptr->prace)
1421                 {
1422                         case RACE_VAMPIRE:
1423                                 (void)set_food(p_ptr->food + (o_ptr->pval / 10));
1424                                 break;
1425                         case RACE_SKELETON:
1426                                 /* Do nothing */
1427                                 break;
1428                         case RACE_GOLEM:
1429                         case RACE_ZOMBIE:
1430                         case RACE_ENT:
1431                         case RACE_DEMON:
1432                         case RACE_SPECTRE:
1433                         case RACE_ANDROID:
1434                                 set_food(p_ptr->food + ((o_ptr->pval) / 20));
1435                                 break;
1436                         default:
1437                                 (void)set_food(p_ptr->food + o_ptr->pval);
1438                                 break;
1439                 }
1440                 break;
1441         case MIMIC_DEMON:
1442         case MIMIC_DEMON_LORD:
1443                 set_food(p_ptr->food + ((o_ptr->pval) / 20));
1444                 break;
1445         case MIMIC_VAMPIRE:
1446                 (void)set_food(p_ptr->food + (o_ptr->pval / 10));
1447                 break;
1448         default:
1449                 (void)set_food(p_ptr->food + o_ptr->pval);
1450                 break;
1451         }
1452 }
1453
1454
1455 void do_cmd_quaff_potion(void)
1456 {
1457         int  item;
1458         cptr q, s;
1459
1460         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1461         {
1462                 set_action(ACTION_NONE);
1463         }
1464
1465         /* Restrict choices to potions */
1466         item_tester_tval = TV_POTION;
1467
1468         /* Get an item */
1469 #ifdef JP
1470         q = "¤É¤ÎÌô¤ò°û¤ß¤Þ¤¹¤«? ";
1471         s = "°û¤á¤ëÌô¤¬¤Ê¤¤¡£";
1472 #else
1473         q = "Quaff which potion? ";
1474         s = "You have no potions to quaff.";
1475 #endif
1476
1477         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1478
1479         /* Quaff the potion */
1480         do_cmd_quaff_potion_aux(item);
1481 }
1482
1483
1484 /*
1485  * Read a scroll (from the pack or floor).
1486  *
1487  * Certain scrolls can be "aborted" without losing the scroll.  These
1488  * include scrolls with no effects but recharge or identify, which are
1489  * cancelled before use.  XXX Reading them still takes a turn, though.
1490  */
1491 static void do_cmd_read_scroll_aux(int item)
1492 {
1493         int         k, used_up, ident, lev;
1494         object_type *o_ptr;
1495         char        Rumor[1024];
1496
1497
1498         /* Get the item (in the pack) */
1499         if (item >= 0)
1500         {
1501                 o_ptr = &inventory[item];
1502         }
1503
1504         /* Get the item (on the floor) */
1505         else
1506         {
1507                 o_ptr = &o_list[0 - item];
1508         }
1509
1510
1511         /* Take a turn */
1512         energy_use = 100;
1513
1514         if (world_player)
1515         {
1516                 if (flush_failure) flush();
1517 #ifdef JP
1518                 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
1519 #else
1520                 msg_print("Nothing happen.");
1521 #endif
1522
1523                 sound(SOUND_FAIL);
1524                 return;
1525         }
1526
1527         if (p_ptr->pclass == CLASS_BERSERKER)
1528         {
1529 #ifdef JP
1530                 msg_print("´¬Êª¤Ê¤ó¤ÆÆɤá¤Ê¤¤¡£");
1531 #else
1532                 msg_print("You cannot read.");
1533 #endif
1534                 return;
1535         }
1536
1537         if((p_ptr->pclass == CLASS_BARD) && p_ptr->magic_num1[0])
1538         {
1539                 stop_singing();
1540         }
1541
1542         /* Not identified yet */
1543         ident = FALSE;
1544
1545         /* Object level */
1546         lev = get_object_level(o_ptr);
1547
1548         /* Assume the scroll will get used up */
1549         used_up = TRUE;
1550
1551         if (o_ptr->tval == TV_SCROLL)
1552         {
1553         /* Analyze the scroll */
1554         switch (o_ptr->sval)
1555         {
1556                 case SV_SCROLL_DARKNESS:
1557                 {
1558                         if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
1559                         {
1560                                 (void)set_blind(p_ptr->blind + 3 + randint(5));
1561                         }
1562                         if (unlite_area(10, 3)) ident = TRUE;
1563                         break;
1564                 }
1565
1566                 case SV_SCROLL_AGGRAVATE_MONSTER:
1567                 {
1568 #ifdef JP
1569                         msg_print("¥«¥ó¹â¤¯¤¦¤Ê¤ëÍͤʲ»¤¬ÊÕ¤ê¤òʤ¤Ã¤¿¡£");
1570 #else
1571                         msg_print("There is a high pitched humming noise.");
1572 #endif
1573
1574                         aggravate_monsters(0);
1575                         ident = TRUE;
1576                         break;
1577                 }
1578
1579                 case SV_SCROLL_CURSE_ARMOR:
1580                 {
1581                         if (curse_armor()) ident = TRUE;
1582                         break;
1583                 }
1584
1585                 case SV_SCROLL_CURSE_WEAPON:
1586                 {
1587                         if (curse_weapon(FALSE, INVEN_RARM)) ident = TRUE;
1588                         break;
1589                 }
1590
1591                 case SV_SCROLL_SUMMON_MONSTER:
1592                 {
1593                         for (k = 0; k < randint(3); k++)
1594                         {
1595                                 if (summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE))
1596                                 {
1597                                         ident = TRUE;
1598                                 }
1599                         }
1600                         break;
1601                 }
1602
1603                 case SV_SCROLL_SUMMON_UNDEAD:
1604                 {
1605                         for (k = 0; k < randint(3); k++)
1606                         {
1607                                 if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, TRUE, FALSE, FALSE, TRUE, TRUE))
1608                                 {
1609                                         ident = TRUE;
1610                                 }
1611                         }
1612                         break;
1613                 }
1614
1615                 case SV_SCROLL_SUMMON_PET:
1616                 {
1617                         if (summon_specific(-1, py, px, dun_level, 0, TRUE, TRUE, TRUE, FALSE, FALSE))
1618                         {
1619                                 ident = TRUE;
1620                         }
1621                         break;
1622                 }
1623
1624                 case SV_SCROLL_SUMMON_KIN:
1625                 {
1626                         if (summon_kin_player(TRUE, p_ptr->lev, py, px, TRUE))
1627                         {
1628                                 ident = TRUE;
1629                         }
1630                         break;
1631                 }
1632
1633                 case SV_SCROLL_TRAP_CREATION:
1634                 {
1635                         if (trap_creation(py, px)) ident = TRUE;
1636                         break;
1637                 }
1638
1639                 case SV_SCROLL_PHASE_DOOR:
1640                 {
1641                         teleport_player(10);
1642                         ident = TRUE;
1643                         break;
1644                 }
1645
1646                 case SV_SCROLL_TELEPORT:
1647                 {
1648                         teleport_player(100);
1649                         ident = TRUE;
1650                         break;
1651                 }
1652
1653                 case SV_SCROLL_TELEPORT_LEVEL:
1654                 {
1655                         (void)teleport_player_level();
1656                         ident = TRUE;
1657                         break;
1658                 }
1659
1660                 case SV_SCROLL_WORD_OF_RECALL:
1661                 {
1662                         if (!word_of_recall()) used_up = FALSE;
1663                         ident = TRUE;
1664                         break;
1665                 }
1666
1667                 case SV_SCROLL_IDENTIFY:
1668                 {
1669                         ident = TRUE;
1670                         if (!ident_spell(FALSE)) used_up = FALSE;
1671                         break;
1672                 }
1673
1674                 case SV_SCROLL_STAR_IDENTIFY:
1675                 {
1676                         ident = TRUE;
1677                         if (!identify_fully(FALSE)) used_up = FALSE;
1678                         break;
1679                 }
1680
1681                 case SV_SCROLL_REMOVE_CURSE:
1682                 {
1683                         if (remove_curse())
1684                         {
1685 #ifdef JP
1686                                 msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1687 #else
1688                                 msg_print("You feel as if someone is watching over you.");
1689 #endif
1690
1691                                 ident = TRUE;
1692                         }
1693                         break;
1694                 }
1695
1696                 case SV_SCROLL_STAR_REMOVE_CURSE:
1697                 {
1698                         if (remove_all_curse())
1699                         {
1700 #ifdef JP
1701                                 msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1702 #else
1703                                 msg_print("You feel as if someone is watching over you.");
1704 #endif
1705                         }
1706                         ident = TRUE;
1707                         break;
1708                 }
1709
1710                 case SV_SCROLL_ENCHANT_ARMOR:
1711                 {
1712                         ident = TRUE;
1713                         if (!enchant_spell(0, 0, 1)) used_up = FALSE;
1714                         break;
1715                 }
1716
1717                 case SV_SCROLL_ENCHANT_WEAPON_TO_HIT:
1718                 {
1719                         if (!enchant_spell(1, 0, 0)) used_up = FALSE;
1720                         ident = TRUE;
1721                         break;
1722                 }
1723
1724                 case SV_SCROLL_ENCHANT_WEAPON_TO_DAM:
1725                 {
1726                         if (!enchant_spell(0, 1, 0)) used_up = FALSE;
1727                         ident = TRUE;
1728                         break;
1729                 }
1730
1731                 case SV_SCROLL_STAR_ENCHANT_ARMOR:
1732                 {
1733                         if (!enchant_spell(0, 0, randint(3) + 2)) used_up = FALSE;
1734                         ident = TRUE;
1735                         break;
1736                 }
1737
1738                 case SV_SCROLL_STAR_ENCHANT_WEAPON:
1739                 {
1740                         if (!enchant_spell(randint(3), randint(3), 0)) used_up = FALSE;
1741                         ident = TRUE;
1742                         break;
1743                 }
1744
1745                 case SV_SCROLL_RECHARGING:
1746                 {
1747                         if (!recharge(130)) used_up = FALSE;
1748                         ident = TRUE;
1749                         break;
1750                 }
1751
1752                 case SV_SCROLL_MUNDANITY:
1753                 {
1754                         ident = TRUE;
1755                         if (!mundane_spell(FALSE)) used_up = FALSE;
1756                         break;
1757                 }
1758
1759                 case SV_SCROLL_LIGHT:
1760                 {
1761                         if (lite_area(damroll(2, 8), 2)) ident = TRUE;
1762                         break;
1763                 }
1764
1765                 case SV_SCROLL_MAPPING:
1766                 {
1767                         map_area(DETECT_RAD_MAP);
1768                         ident = TRUE;
1769                         break;
1770                 }
1771
1772                 case SV_SCROLL_DETECT_GOLD:
1773                 {
1774                         if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
1775                         if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
1776                         break;
1777                 }
1778
1779                 case SV_SCROLL_DETECT_ITEM:
1780                 {
1781                         if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
1782                         break;
1783                 }
1784
1785                 case SV_SCROLL_DETECT_TRAP:
1786                 {
1787                         if (detect_traps(DETECT_RAD_DEFAULT)) ident = TRUE;
1788                         break;
1789                 }
1790
1791                 case SV_SCROLL_DETECT_DOOR:
1792                 {
1793                         if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
1794                         if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
1795                         break;
1796                 }
1797
1798                 case SV_SCROLL_DETECT_INVIS:
1799                 {
1800                         if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
1801                         break;
1802                 }
1803
1804                 case SV_SCROLL_SATISFY_HUNGER:
1805                 {
1806                         if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
1807                         break;
1808                 }
1809
1810                 case SV_SCROLL_BLESSING:
1811                 {
1812                         if (set_blessed(p_ptr->blessed + randint(12) + 6, FALSE)) ident = TRUE;
1813                         break;
1814                 }
1815
1816                 case SV_SCROLL_HOLY_CHANT:
1817                 {
1818                         if (set_blessed(p_ptr->blessed + randint(24) + 12, FALSE)) ident = TRUE;
1819                         break;
1820                 }
1821
1822                 case SV_SCROLL_HOLY_PRAYER:
1823                 {
1824                         if (set_blessed(p_ptr->blessed + randint(48) + 24, FALSE)) ident = TRUE;
1825                         break;
1826                 }
1827
1828                 case SV_SCROLL_MONSTER_CONFUSION:
1829                 {
1830                         if (!(p_ptr->special_attack & ATTACK_CONFUSE))
1831                         {
1832 #ifdef JP
1833                                 msg_print("¼ê¤¬µ±¤­»Ï¤á¤¿¡£");
1834 #else
1835                                 msg_print("Your hands begin to glow.");
1836 #endif
1837
1838                                 p_ptr->special_attack |= ATTACK_CONFUSE;
1839                                 p_ptr->redraw |= (PR_STATUS);
1840                                 ident = TRUE;
1841                         }
1842                         break;
1843                 }
1844
1845                 case SV_SCROLL_PROTECTION_FROM_EVIL:
1846                 {
1847                         k = 3 * p_ptr->lev;
1848                         if (set_protevil(p_ptr->protevil + randint(25) + k, FALSE)) ident = TRUE;
1849                         break;
1850                 }
1851
1852                 case SV_SCROLL_RUNE_OF_PROTECTION:
1853                 {
1854                         warding_glyph();
1855                         ident = TRUE;
1856                         break;
1857                 }
1858
1859                 case SV_SCROLL_TRAP_DOOR_DESTRUCTION:
1860                 {
1861                         if (destroy_doors_touch()) ident = TRUE;
1862                         break;
1863                 }
1864
1865                 case SV_SCROLL_STAR_DESTRUCTION:
1866                 {
1867                         if (destroy_area(py, px, 13+rand_int(5), TRUE))
1868                                 ident = TRUE;
1869                         else
1870 #ifdef JP
1871 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Íɤ줿...");
1872 #else
1873                                 msg_print("The dungeon trembles...");
1874 #endif
1875
1876
1877                         break;
1878                 }
1879
1880                 case SV_SCROLL_DISPEL_UNDEAD:
1881                 {
1882                         if (dispel_undead(80)) ident = TRUE;
1883                         break;
1884                 }
1885
1886                 case SV_SCROLL_SPELL:
1887                 {
1888                         if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_IMITATOR) || (p_ptr->pclass == CLASS_MINDCRAFTER) || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_MAGIC_EATER) || (p_ptr->pclass == CLASS_RED_MAGE) || (p_ptr->pclass == CLASS_SAMURAI) || (p_ptr->pclass == CLASS_BLUE_MAGE) || (p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BERSERKER) || (p_ptr->pclass == CLASS_SMITH) || (p_ptr->pclass == CLASS_MIRROR_MASTER) || (p_ptr->pclass == CLASS_NINJA)) break;
1889                         p_ptr->add_spells++;
1890                         p_ptr->update |= (PU_SPELLS);
1891                         ident = TRUE;
1892                         break;
1893                 }
1894
1895                 case SV_SCROLL_GENOCIDE:
1896                 {
1897                         (void)symbol_genocide(300, TRUE);
1898                         ident = TRUE;
1899                         break;
1900                 }
1901
1902                 case SV_SCROLL_MASS_GENOCIDE:
1903                 {
1904                         (void)mass_genocide(300, TRUE);
1905                         ident = TRUE;
1906                         break;
1907                 }
1908
1909                 case SV_SCROLL_ACQUIREMENT:
1910                 {
1911                         acquirement(py, px, 1, TRUE, FALSE);
1912                         ident = TRUE;
1913                         break;
1914                 }
1915
1916                 case SV_SCROLL_STAR_ACQUIREMENT:
1917                 {
1918                         acquirement(py, px, randint(2) + 1, TRUE, FALSE);
1919                         ident = TRUE;
1920                         break;
1921                 }
1922
1923                 /* New Hengband scrolls */
1924                 case SV_SCROLL_FIRE:
1925                 {
1926                         fire_ball(GF_FIRE, 0, 666, 4);
1927                         /* Note: "Double" damage since it is centered on the player ... */
1928                         if (!(p_ptr->oppose_fire || p_ptr->resist_fire || p_ptr->immune_fire))
1929 #ifdef JP
1930 take_hit(DAMAGE_NOESCAPE, 50+randint(50), "±ê¤Î´¬Êª", -1);
1931 #else
1932                                 take_hit(DAMAGE_NOESCAPE, 50 + randint(50), "a Scroll of Fire", -1);
1933 #endif
1934
1935                         ident = TRUE;
1936                         break;
1937                 }
1938
1939
1940                 case SV_SCROLL_ICE:
1941                 {
1942                         fire_ball(GF_ICE, 0, 777, 4);
1943                         if (!(p_ptr->oppose_cold || p_ptr->resist_cold || p_ptr->immune_cold))
1944 #ifdef JP
1945 take_hit(DAMAGE_NOESCAPE, 100+randint(100), "ɹ¤Î´¬Êª", -1);
1946 #else
1947                                 take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "a Scroll of Ice", -1);
1948 #endif
1949
1950                         ident = TRUE;
1951                         break;
1952                 }
1953
1954                 case SV_SCROLL_CHAOS:
1955                 {
1956                         fire_ball(GF_CHAOS, 0, 1000, 4);
1957                         if (!p_ptr->resist_chaos)
1958 #ifdef JP
1959 take_hit(DAMAGE_NOESCAPE, 111+randint(111), "¥í¥°¥ë¥¹¤Î´¬Êª", -1);
1960 #else
1961                                 take_hit(DAMAGE_NOESCAPE, 111 + randint(111), "a Scroll of Logrus", -1);
1962 #endif
1963
1964                         ident = TRUE;
1965                         break;
1966                 }
1967
1968                 case SV_SCROLL_RUMOR:
1969                 {
1970                         errr err = 0;
1971
1972                         switch (randint(20))
1973                         {
1974                                 case 1:
1975 #ifdef JP
1976 err = get_rnd_line("chainswd_j.txt", 0, Rumor);
1977 #else
1978                                         err = get_rnd_line("chainswd.txt", 0, Rumor);
1979 #endif
1980
1981                                         break;
1982                                 case 2:
1983 #ifdef JP
1984 err = get_rnd_line("error_j.txt", 0, Rumor);
1985 #else
1986                                         err = get_rnd_line("error.txt", 0, Rumor);
1987 #endif
1988
1989                                         break;
1990                                 case 3:
1991                                 case 4:
1992                                 case 5:
1993 #ifdef JP
1994 err = get_rnd_line("death_j.txt", 0, Rumor);
1995 #else
1996                                         err = get_rnd_line("death.txt", 0, Rumor);
1997 #endif
1998
1999                                         break;
2000                                 default:
2001 #ifdef JP
2002 err = get_rnd_line_jonly("rumors_j.txt", 0, Rumor, 10);
2003 #else
2004                                         err = get_rnd_line("rumors.txt", 0, Rumor);
2005 #endif
2006
2007                                         break;
2008                         }
2009
2010                         /* An error occured */
2011 #ifdef JP
2012 if (err) strcpy(Rumor, "±³¤Î±½¤â¤¢¤ë¡£");
2013 #else
2014                         if (err) strcpy(Rumor, "Some rumors are wrong.");
2015 #endif
2016
2017
2018 #ifdef JP
2019 msg_print("´¬Êª¤Ë¤Ï¥á¥Ã¥»¡¼¥¸¤¬½ñ¤«¤ì¤Æ¤¤¤ë:");
2020 #else
2021                         msg_print("There is message on the scroll. It says:");
2022 #endif
2023
2024                         msg_print(NULL);
2025                         msg_format("%s", Rumor);
2026                         msg_print(NULL);
2027 #ifdef JP
2028 msg_print("´¬Êª¤Ï±ì¤òΩ¤Æ¤Æ¾Ã¤¨µî¤Ã¤¿¡ª");
2029 #else
2030                         msg_print("The scroll disappears in a puff of smoke!");
2031 #endif
2032
2033                         ident = TRUE;
2034                         break;
2035                 }
2036
2037                 case SV_SCROLL_ARTIFACT:
2038                 {
2039                         ident = TRUE;
2040                         if (!artifact_scroll()) used_up = FALSE;
2041                         break;
2042                 }
2043
2044                 case SV_SCROLL_RESET_RECALL:
2045                 {
2046                         ident = TRUE;
2047                         if (!reset_recall()) used_up = FALSE;
2048                         break;
2049                 }
2050         }
2051         }
2052         else if (o_ptr->tval == TV_SOFT_ARMOR)
2053         {
2054 #ifdef JP
2055                 msg_print("»ä¤Ï¶ìÏ«¤·¤Æ¡Ø¥°¥ì¡¼¥¿¡¼¡¦¥Ø¥ë=¥Ó¡¼¥¹¥È¡Ù¤òÅݤ·¤¿¡£");
2056                 msg_print("¤·¤«¤·¼ê¤ËÆþ¤Ã¤¿¤Î¤Ï¤³¤Î¤­¤¿¤Ê¤¤£Ô¥·¥ã¥Ä¤À¤±¤À¤Ã¤¿¡£");
2057 #else
2058                 msg_print("I had a very hard time to kill the Greater hell-beast, ");
2059                 msg_print("but all I got was this lousy t-shirt!");
2060 #endif
2061                 used_up = FALSE;
2062         }
2063         else if (o_ptr->name1 == ART_POWER)
2064         {
2065 #ifdef JP
2066                 msg_print("¡Ö°ì¤Ä¤Î»ØÎؤÏÁ´¤Æ¤òÅý¤Ù¡¢");
2067                 msg_print(NULL);
2068                 msg_print("°ì¤Ä¤Î»ØÎؤÏÁ´¤Æ¤ò¸«¤Ä¤±¡¢");
2069                 msg_print(NULL);
2070                 msg_print("°ì¤Ä¤Î»ØÎؤÏÁ´¤Æ¤òÊá¤é¤¨¤Æ");
2071                 msg_print(NULL);
2072                 msg_print("°Å°Ç¤ÎÃæ¤Ë·Ò¤®¤È¤á¤ë¡£¡×");
2073 #else
2074                 msg_print("'One Ring to rule them all, ");
2075                 msg_print(NULL);
2076                 msg_print("One Ring to find them, ");
2077                 msg_print(NULL);
2078                 msg_print("One Ring to bring them all ");
2079                 msg_print(NULL);
2080                 msg_print("and in the darkness bind them.'");
2081 #endif
2082                 used_up = FALSE;
2083         }
2084         else
2085         {
2086                 cptr q;
2087                 char o_name[MAX_NLEN];
2088                 char buf[1024];
2089
2090                 /* Save screen */
2091                 screen_save();
2092
2093                 q=format("book-%d_jp.txt",o_ptr->sval);
2094
2095                 /* Display object description */
2096                 object_desc(o_name, o_ptr, TRUE, 0);
2097
2098                 /* Build the filename */
2099                 path_build(buf, 1024, ANGBAND_DIR_FILE, q);
2100
2101                 /* Peruse the help file */
2102                 (void)show_file(TRUE, buf, o_name, 0, 0);
2103
2104                 /* Load screen */
2105                 screen_load();
2106
2107                 used_up=FALSE;
2108         }
2109
2110
2111         /* Combine / Reorder the pack (later) */
2112         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2113
2114         if (!(object_aware_p(o_ptr)))
2115         {
2116                 chg_virtue(V_PATIENCE, -1);
2117                 chg_virtue(V_CHANCE, 1);
2118                 chg_virtue(V_KNOWLEDGE, -1);
2119         }
2120
2121         /* The item was tried */
2122         object_tried(o_ptr);
2123
2124         /* An identification was made */
2125         if (ident && !object_aware_p(o_ptr))
2126         {
2127                 object_aware(o_ptr);
2128                 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2129         }
2130
2131         /* Window stuff */
2132         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2133
2134
2135         /* Hack -- allow certain scrolls to be "preserved" */
2136         if (!used_up)
2137         {
2138                 return;
2139         }
2140
2141         sound(SOUND_SCROLL);
2142
2143         /* Destroy a scroll in the pack */
2144         if (item >= 0)
2145         {
2146                 inven_item_increase(item, -1);
2147                 inven_item_describe(item);
2148                 inven_item_optimize(item);
2149         }
2150
2151         /* Destroy a scroll on the floor */
2152         else
2153         {
2154                 floor_item_increase(0 - item, -1);
2155                 floor_item_describe(0 - item);
2156                 floor_item_optimize(0 - item);
2157         }
2158
2159         /* Can save again */
2160 }
2161
2162
2163 /*
2164  * Hook to determine if an object is readable
2165  */
2166 static bool item_tester_hook_readable(object_type *o_ptr)
2167 {
2168         if ((o_ptr->tval==TV_SCROLL) || (o_ptr->tval==TV_PARCHEMENT) || ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_T_SHIRT)) || (o_ptr->name1 == ART_POWER)) return (TRUE);
2169
2170         /* Assume not */
2171         return (FALSE);
2172 }
2173
2174
2175 void do_cmd_read_scroll(void)
2176 {
2177         int  item;
2178         cptr q, s;
2179
2180         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2181         {
2182                 set_action(ACTION_NONE);
2183         }
2184
2185         /* Check some conditions */
2186         if (p_ptr->blind)
2187         {
2188 #ifdef JP
2189                 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡£");
2190 #else
2191                 msg_print("You can't see anything.");
2192 #endif
2193
2194                 return;
2195         }
2196         if (no_lite())
2197         {
2198 #ifdef JP
2199                 msg_print("ÌÀ¤«¤ê¤¬¤Ê¤¤¤Î¤Ç¡¢°Å¤¯¤ÆÆɤá¤Ê¤¤¡£");
2200 #else
2201                 msg_print("You have no light to read by.");
2202 #endif
2203
2204                 return;
2205         }
2206         if (p_ptr->confused)
2207         {
2208 #ifdef JP
2209                 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡£");
2210 #else
2211                 msg_print("You are too confused!");
2212 #endif
2213
2214                 return;
2215         }
2216
2217
2218         /* Restrict choices to scrolls */
2219         item_tester_hook = item_tester_hook_readable;
2220
2221         /* Get an item */
2222 #ifdef JP
2223         q = "¤É¤Î´¬Êª¤òÆɤߤޤ¹¤«? ";
2224         s = "Æɤá¤ë´¬Êª¤¬¤Ê¤¤¡£";
2225 #else
2226         q = "Read which scroll? ";
2227         s = "You have no scrolls to read.";
2228 #endif
2229
2230         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2231
2232         /* Read the scroll */
2233         do_cmd_read_scroll_aux(item);
2234 }
2235
2236
2237 static int staff_effect(int sval, bool *use_charge, bool magic)
2238 {
2239         int k;
2240         int ident = FALSE;
2241
2242         /* Analyze the staff */
2243         switch (sval)
2244         {
2245                 case SV_STAFF_DARKNESS:
2246                 {
2247                         if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
2248                         {
2249                                 if (set_blind(p_ptr->blind + 3 + randint(5))) ident = TRUE;
2250                         }
2251                         if (unlite_area(10, 3)) ident = TRUE;
2252                         break;
2253                 }
2254
2255                 case SV_STAFF_SLOWNESS:
2256                 {
2257                         if (set_slow(p_ptr->slow + randint(30) + 15, FALSE)) ident = TRUE;
2258                         break;
2259                 }
2260
2261                 case SV_STAFF_HASTE_MONSTERS:
2262                 {
2263                         if (speed_monsters()) ident = TRUE;
2264                         break;
2265                 }
2266
2267                 case SV_STAFF_SUMMONING:
2268                 {
2269                         for (k = 0; k < randint(4); k++)
2270                         {
2271                                 if (summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE))
2272                                 {
2273                                         ident = TRUE;
2274                                 }
2275                         }
2276                         break;
2277                 }
2278
2279                 case SV_STAFF_TELEPORTATION:
2280                 {
2281                         teleport_player(100);
2282                         ident = TRUE;
2283                         break;
2284                 }
2285
2286                 case SV_STAFF_IDENTIFY:
2287                 {
2288                         if (!ident_spell(FALSE)) *use_charge = FALSE;
2289                         ident = TRUE;
2290                         break;
2291                 }
2292
2293                 case SV_STAFF_REMOVE_CURSE:
2294                 {
2295                         if (remove_curse())
2296                         {
2297                                 if (magic)
2298                                 {
2299 #ifdef JP
2300                                         msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
2301 #else
2302                                         msg_print("You feel as if someone is watching over you.");
2303 #endif
2304                                 }
2305                                 else if (!p_ptr->blind)
2306                                 {
2307 #ifdef JP
2308                                         msg_print("¾ó¤Ï°ì½Ö¥Ö¥ë¡¼¤Ëµ±¤¤¤¿...");
2309 #else
2310                                         msg_print("The staff glows blue for a moment...");
2311 #endif
2312
2313                                 }
2314                                 ident = TRUE;
2315                         }
2316                         break;
2317                 }
2318
2319                 case SV_STAFF_STARLITE:
2320                 {
2321                         int num = damroll(5, 3);
2322                         int y, x;
2323                         int attempts;
2324
2325                         if (!p_ptr->blind && !magic)
2326                         {
2327 #ifdef JP
2328                                 msg_print("¾ó¤ÎÀ褬ÌÀ¤ë¤¯µ±¤¤¤¿...");
2329 #else
2330                                 msg_print("The end of the staff glows brightly...");
2331 #endif
2332
2333                         }
2334                         for (k = 0; k < num; k++)
2335                         {
2336                 attempts = 1000;
2337
2338                                 while(attempts--)
2339                                 {
2340                                         scatter(&y, &x, py, px, 4, 0);
2341
2342                                         if (!cave_floor_bold(y, x)) continue;
2343
2344                                         if ((y != py) || (x != px)) break;
2345                                 }
2346
2347                                 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2348                                                   (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
2349                         }
2350                         ident = TRUE;
2351                         break;
2352                 }
2353
2354                 case SV_STAFF_LITE:
2355                 {
2356                         if (lite_area(damroll(2, 8), 2)) ident = TRUE;
2357                         break;
2358                 }
2359
2360                 case SV_STAFF_MAPPING:
2361                 {
2362                         map_area(DETECT_RAD_MAP);
2363                         ident = TRUE;
2364                         break;
2365                 }
2366
2367                 case SV_STAFF_DETECT_GOLD:
2368                 {
2369                         if (detect_treasure(DETECT_RAD_DEFAULT)) ident = TRUE;
2370                         if (detect_objects_gold(DETECT_RAD_DEFAULT)) ident = TRUE;
2371                         break;
2372                 }
2373
2374                 case SV_STAFF_DETECT_ITEM:
2375                 {
2376                         if (detect_objects_normal(DETECT_RAD_DEFAULT)) ident = TRUE;
2377                         break;
2378                 }
2379
2380                 case SV_STAFF_DETECT_TRAP:
2381                 {
2382                         if (detect_traps(DETECT_RAD_DEFAULT)) ident = TRUE;
2383                         break;
2384                 }
2385
2386                 case SV_STAFF_DETECT_DOOR:
2387                 {
2388                         if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
2389                         if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
2390                         break;
2391                 }
2392
2393                 case SV_STAFF_DETECT_INVIS:
2394                 {
2395                         if (detect_monsters_invis(DETECT_RAD_DEFAULT)) ident = TRUE;
2396                         break;
2397                 }
2398
2399                 case SV_STAFF_DETECT_EVIL:
2400                 {
2401                         if (detect_monsters_evil(DETECT_RAD_DEFAULT)) ident = TRUE;
2402                         break;
2403                 }
2404
2405                 case SV_STAFF_CURE_LIGHT:
2406                 {
2407                         if (hp_player(damroll(2, 8))) ident = TRUE;
2408                         if (set_shero(0,TRUE)) ident = TRUE;
2409                         break;
2410                 }
2411
2412                 case SV_STAFF_CURING:
2413                 {
2414                         if (set_blind(0)) ident = TRUE;
2415                         if (set_poisoned(0)) ident = TRUE;
2416                         if (set_confused(0)) ident = TRUE;
2417                         if (set_stun(0)) ident = TRUE;
2418                         if (set_cut(0)) ident = TRUE;
2419                         if (set_image(0)) ident = TRUE;
2420                         if (set_shero(0,TRUE)) ident = TRUE;
2421                         break;
2422                 }
2423
2424                 case SV_STAFF_HEALING:
2425                 {
2426                         if (hp_player(300)) ident = TRUE;
2427                         if (set_stun(0)) ident = TRUE;
2428                         if (set_cut(0)) ident = TRUE;
2429                         if (set_shero(0,TRUE)) ident = TRUE;
2430                         break;
2431                 }
2432
2433                 case SV_STAFF_THE_MAGI:
2434                 {
2435                         if (do_res_stat(A_INT)) ident = TRUE;
2436                         if (p_ptr->csp < p_ptr->msp)
2437                         {
2438                                 p_ptr->csp = p_ptr->msp;
2439                                 p_ptr->csp_frac = 0;
2440                                 ident = TRUE;
2441 #ifdef JP
2442                                 msg_print("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£");
2443 #else
2444                                 msg_print("Your feel your head clear.");
2445 #endif
2446
2447                                 p_ptr->redraw |= (PR_MANA);
2448                                 p_ptr->window |= (PW_PLAYER);
2449                                 p_ptr->window |= (PW_SPELL);
2450                         }
2451                         if (set_shero(0,TRUE)) ident = TRUE;
2452                         break;
2453                 }
2454
2455                 case SV_STAFF_SLEEP_MONSTERS:
2456                 {
2457                         if (sleep_monsters()) ident = TRUE;
2458                         break;
2459                 }
2460
2461                 case SV_STAFF_SLOW_MONSTERS:
2462                 {
2463                         if (slow_monsters()) ident = TRUE;
2464                         break;
2465                 }
2466
2467                 case SV_STAFF_SPEED:
2468                 {
2469                         if (set_fast(randint(30) + 15, FALSE)) ident = TRUE;
2470                         break;
2471                 }
2472
2473                 case SV_STAFF_PROBING:
2474                 {
2475                         probing();
2476                         ident = TRUE;
2477                         break;
2478                 }
2479
2480                 case SV_STAFF_DISPEL_EVIL:
2481                 {
2482                         if (dispel_evil(80)) ident = TRUE;
2483                         break;
2484                 }
2485
2486                 case SV_STAFF_POWER:
2487                 {
2488                         if (dispel_monsters(150)) ident = TRUE;
2489                         break;
2490                 }
2491
2492                 case SV_STAFF_HOLINESS:
2493                 {
2494                         if (dispel_evil(150)) ident = TRUE;
2495                         k = 3 * p_ptr->lev;
2496                         if (set_protevil((magic ? 0 : p_ptr->protevil) + randint(25) + k, FALSE)) ident = TRUE;
2497                         if (set_poisoned(0)) ident = TRUE;
2498                         if (set_afraid(0)) ident = TRUE;
2499                         if (hp_player(50)) ident = TRUE;
2500                         if (set_stun(0)) ident = TRUE;
2501                         if (set_cut(0)) ident = TRUE;
2502                         break;
2503                 }
2504
2505                 case SV_STAFF_GENOCIDE:
2506                 {
2507                         (void)symbol_genocide((magic ? p_ptr->lev + 50 : 200), TRUE);
2508                         ident = TRUE;
2509                         break;
2510                 }
2511
2512                 case SV_STAFF_EARTHQUAKES:
2513                 {
2514                         if (earthquake(py, px, 10))
2515                                 ident = TRUE;
2516                         else
2517 #ifdef JP
2518 msg_print("¥À¥ó¥¸¥ç¥ó¤¬Íɤ줿¡£");
2519 #else
2520                                 msg_print("The dungeon trembles.");
2521 #endif
2522
2523
2524                         break;
2525                 }
2526
2527                 case SV_STAFF_DESTRUCTION:
2528                 {
2529                         if (destroy_area(py, px, 13+rand_int(5), TRUE))
2530                                 ident = TRUE;
2531
2532                         break;
2533                 }
2534
2535                 case SV_STAFF_ANIMATE_DEAD:
2536                 {
2537                         if (animate_dead(0, py, px))
2538                                 ident = TRUE;
2539
2540                         break;
2541                 }
2542
2543                 case SV_STAFF_MSTORM:
2544                 {
2545 #ifdef JP
2546                         msg_print("¶¯ÎϤÊËâÎϤ¬Å¨¤ò°ú¤­Îö¤¤¤¿¡ª");
2547 #else
2548                         msg_print("Mighty magics rend your enemies!");
2549 #endif
2550                         project(0, 5, py, px,
2551                                 (randint(200) + 300) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID | PROJECT_NO_REF, -1);
2552                         if ((p_ptr->pclass != CLASS_MAGE) && (p_ptr->pclass != CLASS_HIGH_MAGE) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_MAGIC_EATER) && (p_ptr->pclass != CLASS_BLUE_MAGE))
2553                         {
2554 #ifdef JP
2555                                 (void)take_hit(DAMAGE_NOESCAPE, 50, "¥³¥ó¥È¥í¡¼¥ë¤·Æñ¤¤¶¯ÎϤÊËâÎϤβòÊü", -1);
2556 #else
2557                                 (void)take_hit(DAMAGE_NOESCAPE, 50, "unleashing magics too mighty to control", -1);
2558 #endif
2559                         }
2560                         ident = TRUE;
2561
2562                         break;
2563                 }
2564         }
2565         return ident;
2566 }
2567
2568 /*
2569  * Use a staff.                 -RAK-
2570  *
2571  * One charge of one staff disappears.
2572  *
2573  * Hack -- staffs of identify can be "cancelled".
2574  */
2575 static void do_cmd_use_staff_aux(int item)
2576 {
2577         int         ident, chance, lev;
2578         object_type *o_ptr;
2579
2580
2581         /* Hack -- let staffs of identify get aborted */
2582         bool use_charge = TRUE;
2583
2584
2585         /* Get the item (in the pack) */
2586         if (item >= 0)
2587         {
2588                 o_ptr = &inventory[item];
2589         }
2590
2591         /* Get the item (on the floor) */
2592         else
2593         {
2594                 o_ptr = &o_list[0 - item];
2595         }
2596
2597
2598         /* Mega-Hack -- refuse to use a pile from the ground */
2599         if ((item < 0) && (o_ptr->number > 1))
2600         {
2601 #ifdef JP
2602                 msg_print("¤Þ¤º¤Ï¾ó¤ò½¦¤ï¤Ê¤±¤ì¤Ð¡£");
2603 #else
2604                 msg_print("You must first pick up the staffs.");
2605 #endif
2606
2607                 return;
2608         }
2609
2610
2611         /* Take a turn */
2612         energy_use = 100;
2613
2614         /* Extract the item level */
2615         lev = get_object_level(o_ptr);
2616         if (lev > 50) lev = 50 + (lev - 50)/2;
2617
2618         /* Base chance of success */
2619         chance = p_ptr->skill_dev;
2620
2621         /* Confusion hurts skill */
2622         if (p_ptr->confused) chance = chance / 2;
2623
2624         /* Hight level objects are harder */
2625         chance = chance - lev;
2626
2627         /* Give everyone a (slight) chance */
2628         if ((chance < USE_DEVICE) && (rand_int(USE_DEVICE - chance + 1) == 0))
2629         {
2630                 chance = USE_DEVICE;
2631         }
2632
2633         if (world_player)
2634         {
2635                 if (flush_failure) flush();
2636 #ifdef JP
2637                 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
2638 #else
2639                 msg_print("Nothing happen. Maybe this staff is freezing too.");
2640 #endif
2641
2642                 sound(SOUND_FAIL);
2643                 return;
2644         }
2645
2646         /* Roll for usage */
2647         if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
2648         {
2649                 if (flush_failure) flush();
2650 #ifdef JP
2651                 msg_print("¾ó¤ò¤¦¤Þ¤¯»È¤¨¤Ê¤«¤Ã¤¿¡£");
2652 #else
2653                 msg_print("You failed to use the staff properly.");
2654 #endif
2655
2656                 sound(SOUND_FAIL);
2657                 return;
2658         }
2659
2660         /* Notice empty staffs */
2661         if (o_ptr->pval <= 0)
2662         {
2663                 if (flush_failure) flush();
2664 #ifdef JP
2665                 msg_print("¤³¤Î¾ó¤Ë¤Ï¤â¤¦ËâÎϤ¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£");
2666 #else
2667                 msg_print("The staff has no charges left.");
2668 #endif
2669
2670                 o_ptr->ident |= (IDENT_EMPTY);
2671
2672                 /* Combine / Reorder the pack (later) */
2673                 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2674
2675                 return;
2676         }
2677
2678
2679         /* Sound */
2680         sound(SOUND_ZAP);
2681
2682         ident = staff_effect(o_ptr->sval, &use_charge, FALSE);
2683
2684         if (!(object_aware_p(o_ptr)))
2685         {
2686                 chg_virtue(V_PATIENCE, -1);
2687                 chg_virtue(V_CHANCE, 1);
2688                 chg_virtue(V_KNOWLEDGE, -1);
2689         }
2690
2691         /* Combine / Reorder the pack (later) */
2692         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
2693
2694         /* Tried the item */
2695         object_tried(o_ptr);
2696
2697         /* An identification was made */
2698         if (ident && !object_aware_p(o_ptr))
2699         {
2700                 object_aware(o_ptr);
2701                 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
2702         }
2703
2704         /* Window stuff */
2705         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
2706
2707
2708         /* Hack -- some uses are "free" */
2709         if (!use_charge) return;
2710
2711
2712         /* Use a single charge */
2713         o_ptr->pval--;
2714
2715         /* XXX Hack -- unstack if necessary */
2716         if ((item >= 0) && (o_ptr->number > 1))
2717         {
2718                 object_type forge;
2719                 object_type *q_ptr;
2720
2721                 /* Get local object */
2722                 q_ptr = &forge;
2723
2724                 /* Obtain a local object */
2725                 object_copy(q_ptr, o_ptr);
2726
2727                 /* Modify quantity */
2728                 q_ptr->number = 1;
2729
2730                 /* Restore the charges */
2731                 o_ptr->pval++;
2732
2733                 /* Unstack the used item */
2734                 o_ptr->number--;
2735                 p_ptr->total_weight -= q_ptr->weight;
2736                 item = inven_carry(q_ptr);
2737
2738                 /* Message */
2739 #ifdef JP
2740                 msg_print("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
2741 #else
2742                 msg_print("You unstack your staff.");
2743 #endif
2744
2745         }
2746
2747         /* Describe charges in the pack */
2748         if (item >= 0)
2749         {
2750                 inven_item_charges(item);
2751         }
2752
2753         /* Describe charges on the floor */
2754         else
2755         {
2756                 floor_item_charges(0 - item);
2757         }
2758 }
2759
2760
2761 void do_cmd_use_staff(void)
2762 {
2763         int  item;
2764         cptr q, s;
2765
2766         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
2767         {
2768                 set_action(ACTION_NONE);
2769         }
2770
2771         /* Restrict choices to wands */
2772         item_tester_tval = TV_STAFF;
2773
2774         /* Get an item */
2775 #ifdef JP
2776         q = "¤É¤Î¾ó¤ò»È¤¤¤Þ¤¹¤«? ";
2777         s = "»È¤¨¤ë¾ó¤¬¤Ê¤¤¡£";
2778 #else
2779         q = "Use which staff? ";
2780         s = "You have no staff to use.";
2781 #endif
2782
2783         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
2784
2785         do_cmd_use_staff_aux(item);
2786 }
2787
2788
2789 static int wand_effect(int sval, int dir, bool magic)
2790 {
2791         int ident = FALSE;
2792
2793         /* XXX Hack -- Wand of wonder can do anything before it */
2794         if (sval == SV_WAND_WONDER)
2795         {
2796                 int vir = virtue_number(V_CHANCE);
2797                 sval = rand_int(SV_WAND_WONDER);
2798
2799                 if (vir)
2800                 {
2801                         if (p_ptr->virtues[vir - 1] > 0)
2802                         {
2803                                 while (randint(300) < p_ptr->virtues[vir - 1]) sval++;
2804                                 if (sval > SV_WAND_COLD_BALL) sval = rand_int(4) + SV_WAND_ACID_BALL;
2805                         }
2806                         else
2807                         {
2808                                 while (randint(300) < (0-p_ptr->virtues[vir - 1])) sval--;
2809                                 if (sval < SV_WAND_HEAL_MONSTER) sval = rand_int(3) + SV_WAND_HEAL_MONSTER;
2810                         }
2811                 }
2812                 if (sval < SV_WAND_TELEPORT_AWAY)
2813                         chg_virtue(V_CHANCE, 1);
2814         }
2815
2816         /* Analyze the wand */
2817         switch (sval)
2818         {
2819                 case SV_WAND_HEAL_MONSTER:
2820                 {
2821                         if (heal_monster(dir, damroll(10, 10))) ident = TRUE;
2822                         break;
2823                 }
2824
2825                 case SV_WAND_HASTE_MONSTER:
2826                 {
2827                         if (speed_monster(dir)) ident = TRUE;
2828                         break;
2829                 }
2830
2831                 case SV_WAND_CLONE_MONSTER:
2832                 {
2833                         if (clone_monster(dir)) ident = TRUE;
2834                         break;
2835                 }
2836
2837                 case SV_WAND_TELEPORT_AWAY:
2838                 {
2839                         if (teleport_monster(dir)) ident = TRUE;
2840                         break;
2841                 }
2842
2843                 case SV_WAND_DISARMING:
2844                 {
2845                         if (disarm_trap(dir)) ident = TRUE;
2846                         break;
2847                 }
2848
2849                 case SV_WAND_TRAP_DOOR_DEST:
2850                 {
2851                         if (destroy_door(dir)) ident = TRUE;
2852                         break;
2853                 }
2854
2855                 case SV_WAND_STONE_TO_MUD:
2856                 {
2857                         if (wall_to_mud(dir)) ident = TRUE;
2858                         break;
2859                 }
2860
2861                 case SV_WAND_LITE:
2862                 {
2863 #ifdef JP
2864                         msg_print("ÀĤ¯µ±¤¯¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
2865 #else
2866                         msg_print("A line of blue shimmering light appears.");
2867 #endif
2868
2869                         (void)lite_line(dir);
2870                         ident = TRUE;
2871                         break;
2872                 }
2873
2874                 case SV_WAND_SLEEP_MONSTER:
2875                 {
2876                         if (sleep_monster(dir)) ident = TRUE;
2877                         break;
2878                 }
2879
2880                 case SV_WAND_SLOW_MONSTER:
2881                 {
2882                         if (slow_monster(dir)) ident = TRUE;
2883                         break;
2884                 }
2885
2886                 case SV_WAND_CONFUSE_MONSTER:
2887                 {
2888                         if (confuse_monster(dir, p_ptr->lev)) ident = TRUE;
2889                         break;
2890                 }
2891
2892                 case SV_WAND_FEAR_MONSTER:
2893                 {
2894                         if (fear_monster(dir, p_ptr->lev)) ident = TRUE;
2895                         break;
2896                 }
2897
2898                 case SV_WAND_DRAIN_LIFE:
2899                 {
2900                         if (drain_life(dir, 80 + p_ptr->lev)) ident = TRUE;
2901                         break;
2902                 }
2903
2904                 case SV_WAND_POLYMORPH:
2905                 {
2906                         if (poly_monster(dir)) ident = TRUE;
2907                         break;
2908                 }
2909
2910                 case SV_WAND_STINKING_CLOUD:
2911                 {
2912                         fire_ball(GF_POIS, dir, 12 + p_ptr->lev / 4, 2);
2913                         ident = TRUE;
2914                         break;
2915                 }
2916
2917                 case SV_WAND_MAGIC_MISSILE:
2918                 {
2919                         fire_bolt_or_beam(20, GF_MISSILE, dir, damroll(2 + p_ptr->lev / 10, 6));
2920                         ident = TRUE;
2921                         break;
2922                 }
2923
2924                 case SV_WAND_ACID_BOLT:
2925                 {
2926                         fire_bolt_or_beam(20, GF_ACID, dir, damroll(6 + p_ptr->lev / 7, 8));
2927                         ident = TRUE;
2928                         break;
2929                 }
2930
2931                 case SV_WAND_CHARM_MONSTER:
2932                 {
2933                         if (charm_monster(dir, MAX(20, p_ptr->lev)))
2934                         ident = TRUE;
2935                         break;
2936                 }
2937
2938                 case SV_WAND_FIRE_BOLT:
2939                 {
2940                         fire_bolt_or_beam(20, GF_FIRE, dir, damroll(7 + p_ptr->lev / 6, 8));
2941                         ident = TRUE;
2942                         break;
2943                 }
2944
2945                 case SV_WAND_COLD_BOLT:
2946                 {
2947                         fire_bolt_or_beam(20, GF_COLD, dir, damroll(5 + p_ptr->lev / 8, 8));
2948                         ident = TRUE;
2949                         break;
2950                 }
2951
2952                 case SV_WAND_ACID_BALL:
2953                 {
2954                         fire_ball(GF_ACID, dir, 60 + 3 * p_ptr->lev / 4, 2);
2955                         ident = TRUE;
2956                         break;
2957                 }
2958
2959                 case SV_WAND_ELEC_BALL:
2960                 {
2961                         fire_ball(GF_ELEC, dir, 40 + 3 * p_ptr->lev / 4, 2);
2962                         ident = TRUE;
2963                         break;
2964                 }
2965
2966                 case SV_WAND_FIRE_BALL:
2967                 {
2968                         fire_ball(GF_FIRE, dir, 70 + 3 * p_ptr->lev / 4, 2);
2969                         ident = TRUE;
2970                         break;
2971                 }
2972
2973                 case SV_WAND_COLD_BALL:
2974                 {
2975                         fire_ball(GF_COLD, dir, 50 + 3 * p_ptr->lev / 4, 2);
2976                         ident = TRUE;
2977                         break;
2978                 }
2979
2980                 case SV_WAND_WONDER:
2981                 {
2982 #ifdef JP
2983                         msg_print("¤ª¤Ã¤È¡¢Ææ¤ÎËâË¡ËÀ¤ò»ÏÆ°¤µ¤»¤¿¡£");
2984 #else
2985                         msg_print("Oops.  Wand of wonder activated.");
2986 #endif
2987
2988                         break;
2989                 }
2990
2991                 case SV_WAND_DRAGON_FIRE:
2992                 {
2993                         fire_ball(GF_FIRE, dir, 200, -3);
2994                         ident = TRUE;
2995                         break;
2996                 }
2997
2998                 case SV_WAND_DRAGON_COLD:
2999                 {
3000                         fire_ball(GF_COLD, dir, 180, -3);
3001                         ident = TRUE;
3002                         break;
3003                 }
3004
3005                 case SV_WAND_DRAGON_BREATH:
3006                 {
3007                         switch (randint(5))
3008                         {
3009                                 case 1:
3010                                 {
3011                                         fire_ball(GF_ACID, dir, 240, -3);
3012                                         break;
3013                                 }
3014
3015                                 case 2:
3016                                 {
3017                                         fire_ball(GF_ELEC, dir, 210, -3);
3018                                         break;
3019                                 }
3020
3021                                 case 3:
3022                                 {
3023                                         fire_ball(GF_FIRE, dir, 240, -3);
3024                                         break;
3025                                 }
3026
3027                                 case 4:
3028                                 {
3029                                         fire_ball(GF_COLD, dir, 210, -3);
3030                                         break;
3031                                 }
3032
3033                                 default:
3034                                 {
3035                                         fire_ball(GF_POIS, dir, 180, -3);
3036                                         break;
3037                                 }
3038                         }
3039
3040                         ident = TRUE;
3041                         break;
3042                 }
3043
3044                 case SV_WAND_DISINTEGRATE:
3045                 {
3046                         fire_ball(GF_DISINTEGRATE, dir, 200 + randint(p_ptr->lev * 2), 2);
3047                         ident = TRUE;
3048                         break;
3049                 }
3050
3051                 case SV_WAND_ROCKETS:
3052                 {
3053 #ifdef JP
3054 msg_print("¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡ª");
3055 #else
3056                         msg_print("You launch a rocket!");
3057 #endif
3058
3059                         fire_rocket(GF_ROCKET, dir, 250 + p_ptr->lev * 3, 2);
3060                         ident = TRUE;
3061                         break;
3062                 }
3063
3064                 case SV_WAND_STRIKING:
3065                 {
3066                         fire_bolt(GF_METEOR, dir, damroll(15 + p_ptr->lev / 3, 13));
3067                         ident = TRUE;
3068                         break;
3069                 }
3070
3071                 case SV_WAND_GENOCIDE:
3072                 {
3073                         fire_ball_hide(GF_GENOCIDE, dir, magic ? p_ptr->lev + 50 : 250, 0);
3074                         ident = TRUE;
3075                         break;
3076                 }
3077         }
3078         return ident;
3079 }
3080
3081
3082 /*
3083  * Aim a wand (from the pack or floor).
3084  *
3085  * Use a single charge from a single item.
3086  * Handle "unstacking" in a logical manner.
3087  *
3088  * For simplicity, you cannot use a stack of items from the
3089  * ground.  This would require too much nasty code.
3090  *
3091  * There are no wands which can "destroy" themselves, in the inventory
3092  * or on the ground, so we can ignore this possibility.  Note that this
3093  * required giving "wand of wonder" the ability to ignore destruction
3094  * by electric balls.
3095  *
3096  * All wands can be "cancelled" at the "Direction?" prompt for free.
3097  *
3098  * Note that the basic "bolt" wands do slightly less damage than the
3099  * basic "bolt" rods, but the basic "ball" wands do the same damage
3100  * as the basic "ball" rods.
3101  */
3102 static void do_cmd_aim_wand_aux(int item)
3103 {
3104         int         lev, ident, chance, dir;
3105         object_type *o_ptr;
3106         bool old_target_pet = target_pet;
3107
3108         /* Get the item (in the pack) */
3109         if (item >= 0)
3110         {
3111                 o_ptr = &inventory[item];
3112         }
3113
3114         /* Get the item (on the floor) */
3115         else
3116         {
3117                 o_ptr = &o_list[0 - item];
3118         }
3119
3120         /* Mega-Hack -- refuse to aim a pile from the ground */
3121         if ((item < 0) && (o_ptr->number > 1))
3122         {
3123 #ifdef JP
3124                 msg_print("¤Þ¤º¤ÏËâË¡ËÀ¤ò½¦¤ï¤Ê¤±¤ì¤Ð¡£");
3125 #else
3126                 msg_print("You must first pick up the wands.");
3127 #endif
3128
3129                 return;
3130         }
3131
3132
3133         /* Allow direction to be cancelled for free */
3134         if (object_aware_p(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
3135                                       || o_ptr->sval == SV_WAND_HASTE_MONSTER))
3136                         target_pet = TRUE;
3137         if (!get_aim_dir(&dir))
3138         {
3139                 target_pet = old_target_pet;
3140                 return;
3141         }
3142         target_pet = old_target_pet;
3143
3144         /* Take a turn */
3145         energy_use = 100;
3146
3147         /* Get the level */
3148         lev = get_object_level(o_ptr);
3149         if (lev > 50) lev = 50 + (lev - 50)/2;
3150
3151         /* Base chance of success */
3152         chance = p_ptr->skill_dev;
3153
3154         /* Confusion hurts skill */
3155         if (p_ptr->confused) chance = chance / 2;
3156
3157         /* Hight level objects are harder */
3158         chance = chance - lev;
3159
3160         /* Give everyone a (slight) chance */
3161         if ((chance < USE_DEVICE) && (rand_int(USE_DEVICE - chance + 1) == 0))
3162         {
3163                 chance = USE_DEVICE;
3164         }
3165
3166         if (world_player)
3167         {
3168                 if (flush_failure) flush();
3169 #ifdef JP
3170                 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
3171 #else
3172                 msg_print("Nothing happen. Maybe this wand is freezing too.");
3173 #endif
3174
3175                 sound(SOUND_FAIL);
3176                 return;
3177         }
3178
3179         /* Roll for usage */
3180         if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
3181         {
3182                 if (flush_failure) flush();
3183 #ifdef JP
3184                 msg_print("ËâË¡ËÀ¤ò¤¦¤Þ¤¯»È¤¨¤Ê¤«¤Ã¤¿¡£");
3185 #else
3186                 msg_print("You failed to use the wand properly.");
3187 #endif
3188
3189                 sound(SOUND_FAIL);
3190                 return;
3191         }
3192
3193         /* The wand is already empty! */
3194         if (o_ptr->pval <= 0)
3195         {
3196                 if (flush_failure) flush();
3197 #ifdef JP
3198                 msg_print("¤³¤ÎËâË¡ËÀ¤Ë¤Ï¤â¤¦ËâÎϤ¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£");
3199 #else
3200                 msg_print("The wand has no charges left.");
3201 #endif
3202
3203                 o_ptr->ident |= (IDENT_EMPTY);
3204
3205                 /* Combine / Reorder the pack (later) */
3206                 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3207
3208                 return;
3209         }
3210
3211         /* Sound */
3212         sound(SOUND_ZAP);
3213
3214         ident = wand_effect(o_ptr->sval, dir, FALSE);
3215
3216         /* Combine / Reorder the pack (later) */
3217         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3218
3219         if (!(object_aware_p(o_ptr)))
3220         {
3221                 chg_virtue(V_PATIENCE, -1);
3222                 chg_virtue(V_CHANCE, 1);
3223                 chg_virtue(V_KNOWLEDGE, -1);
3224         }
3225
3226         /* Mark it as tried */
3227         object_tried(o_ptr);
3228
3229         /* Apply identification */
3230         if (ident && !object_aware_p(o_ptr))
3231         {
3232                 object_aware(o_ptr);
3233                 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
3234         }
3235
3236         /* Window stuff */
3237         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3238
3239
3240         /* Use a single charge */
3241         o_ptr->pval--;
3242
3243         /* Describe the charges in the pack */
3244         if (item >= 0)
3245         {
3246                 inven_item_charges(item);
3247         }
3248
3249         /* Describe the charges on the floor */
3250         else
3251         {
3252                 floor_item_charges(0 - item);
3253         }
3254 }
3255
3256
3257 void do_cmd_aim_wand(void)
3258 {
3259         int     item;
3260         cptr    q, s;
3261
3262         /* Restrict choices to wands */
3263         item_tester_tval = TV_WAND;
3264
3265         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3266         {
3267                 set_action(ACTION_NONE);
3268         }
3269
3270         /* Get an item */
3271 #ifdef JP
3272         q = "¤É¤ÎËâË¡ËÀ¤ÇÁÀ¤¤¤Þ¤¹¤«? ";
3273         s = "»È¤¨¤ëËâË¡ËÀ¤¬¤Ê¤¤¡£";
3274 #else
3275         q = "Aim which wand? ";
3276         s = "You have no wand to aim.";
3277 #endif
3278
3279         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3280
3281         /* Aim the wand */
3282         do_cmd_aim_wand_aux(item);
3283 }
3284
3285
3286 static int rod_effect(int sval, int dir, bool *use_charge, bool magic)
3287 {
3288         int ident = FALSE;
3289
3290         /* Analyze the rod */
3291         switch (sval)
3292         {
3293                 case SV_ROD_DETECT_TRAP:
3294                 {
3295                         if (detect_traps(DETECT_RAD_DEFAULT)) ident = TRUE;
3296                         break;
3297                 }
3298
3299                 case SV_ROD_DETECT_DOOR:
3300                 {
3301                         if (detect_doors(DETECT_RAD_DEFAULT)) ident = TRUE;
3302                         if (detect_stairs(DETECT_RAD_DEFAULT)) ident = TRUE;
3303                         break;
3304                 }
3305
3306                 case SV_ROD_IDENTIFY:
3307                 {
3308                         ident = TRUE;
3309                         if (!ident_spell(FALSE)) *use_charge = FALSE;
3310                         break;
3311                 }
3312
3313                 case SV_ROD_RECALL:
3314                 {
3315                         if (!word_of_recall()) *use_charge = FALSE;
3316                         ident = TRUE;
3317                         break;
3318                 }
3319
3320                 case SV_ROD_ILLUMINATION:
3321                 {
3322                         if (lite_area(damroll(2, 8), 2)) ident = TRUE;
3323                         break;
3324                 }
3325
3326                 case SV_ROD_MAPPING:
3327                 {
3328                         map_area(DETECT_RAD_MAP);
3329                         ident = TRUE;
3330                         break;
3331                 }
3332
3333                 case SV_ROD_DETECTION:
3334                 {
3335                         detect_all(DETECT_RAD_DEFAULT);
3336                         ident = TRUE;
3337                         break;
3338                 }
3339
3340                 case SV_ROD_PROBING:
3341                 {
3342                         probing();
3343                         ident = TRUE;
3344                         break;
3345                 }
3346
3347                 case SV_ROD_CURING:
3348                 {
3349                         if (set_blind(0)) ident = TRUE;
3350                         if (set_poisoned(0)) ident = TRUE;
3351                         if (set_confused(0)) ident = TRUE;
3352                         if (set_stun(0)) ident = TRUE;
3353                         if (set_cut(0)) ident = TRUE;
3354                         if (set_image(0)) ident = TRUE;
3355                         if (set_shero(0,TRUE)) ident = TRUE;
3356                         break;
3357                 }
3358
3359                 case SV_ROD_HEALING:
3360                 {
3361                         if (hp_player(500)) ident = TRUE;
3362                         if (set_stun(0)) ident = TRUE;
3363                         if (set_cut(0)) ident = TRUE;
3364                         if (set_shero(0,TRUE)) ident = TRUE;
3365                         break;
3366                 }
3367
3368                 case SV_ROD_RESTORATION:
3369                 {
3370                         if (restore_level()) ident = TRUE;
3371                         if (do_res_stat(A_STR)) ident = TRUE;
3372                         if (do_res_stat(A_INT)) ident = TRUE;
3373                         if (do_res_stat(A_WIS)) ident = TRUE;
3374                         if (do_res_stat(A_DEX)) ident = TRUE;
3375                         if (do_res_stat(A_CON)) ident = TRUE;
3376                         if (do_res_stat(A_CHR)) ident = TRUE;
3377                         break;
3378                 }
3379
3380                 case SV_ROD_SPEED:
3381                 {
3382                         if (set_fast(randint(30) + 15, FALSE)) ident = TRUE;
3383                         break;
3384                 }
3385
3386                 case SV_ROD_PESTICIDE:
3387                 {
3388                         if (dispel_monsters(4)) ident = TRUE;
3389                         break;
3390                 }
3391
3392                 case SV_ROD_TELEPORT_AWAY:
3393                 {
3394                         if (teleport_monster(dir)) ident = TRUE;
3395                         break;
3396                 }
3397
3398                 case SV_ROD_DISARMING:
3399                 {
3400                         if (disarm_trap(dir)) ident = TRUE;
3401                         break;
3402                 }
3403
3404                 case SV_ROD_LITE:
3405                 {
3406 #ifdef JP
3407                         msg_print("ÀĤ¯µ±¤¯¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
3408 #else
3409                         msg_print("A line of blue shimmering light appears.");
3410 #endif
3411
3412                         (void)lite_line(dir);
3413                         ident = TRUE;
3414                         break;
3415                 }
3416
3417                 case SV_ROD_SLEEP_MONSTER:
3418                 {
3419                         if (sleep_monster(dir)) ident = TRUE;
3420                         break;
3421                 }
3422
3423                 case SV_ROD_SLOW_MONSTER:
3424                 {
3425                         if (slow_monster(dir)) ident = TRUE;
3426                         break;
3427                 }
3428
3429                 case SV_ROD_DRAIN_LIFE:
3430                 {
3431                         if (drain_life(dir, 70 + 3 * p_ptr->lev / 2)) ident = TRUE;
3432                         break;
3433                 }
3434
3435                 case SV_ROD_POLYMORPH:
3436                 {
3437                         if (poly_monster(dir)) ident = TRUE;
3438                         break;
3439                 }
3440
3441                 case SV_ROD_ACID_BOLT:
3442                 {
3443                         fire_bolt_or_beam(10, GF_ACID, dir, damroll(6 + p_ptr->lev / 7, 8));
3444                         ident = TRUE;
3445                         break;
3446                 }
3447
3448                 case SV_ROD_ELEC_BOLT:
3449                 {
3450                         fire_bolt_or_beam(10, GF_ELEC, dir, damroll(4 + p_ptr->lev / 9, 8));
3451                         ident = TRUE;
3452                         break;
3453                 }
3454
3455                 case SV_ROD_FIRE_BOLT:
3456                 {
3457                         fire_bolt_or_beam(10, GF_FIRE, dir, damroll(7 + p_ptr->lev / 6, 8));
3458                         ident = TRUE;
3459                         break;
3460                 }
3461
3462                 case SV_ROD_COLD_BOLT:
3463                 {
3464                         fire_bolt_or_beam(10, GF_COLD, dir, damroll(5 + p_ptr->lev / 8, 8));
3465                         ident = TRUE;
3466                         break;
3467                 }
3468
3469                 case SV_ROD_ACID_BALL:
3470                 {
3471                         fire_ball(GF_ACID, dir, 60 + p_ptr->lev, 2);
3472                         ident = TRUE;
3473                         break;
3474                 }
3475
3476                 case SV_ROD_ELEC_BALL:
3477                 {
3478                         fire_ball(GF_ELEC, dir, 40 + p_ptr->lev, 2);
3479                         ident = TRUE;
3480                         break;
3481                 }
3482
3483                 case SV_ROD_FIRE_BALL:
3484                 {
3485                         fire_ball(GF_FIRE, dir, 70 + p_ptr->lev, 2);
3486                         ident = TRUE;
3487                         break;
3488                 }
3489
3490                 case SV_ROD_COLD_BALL:
3491                 {
3492                         fire_ball(GF_COLD, dir, 50 + p_ptr->lev, 2);
3493                         ident = TRUE;
3494                         break;
3495                 }
3496
3497                 case SV_ROD_HAVOC:
3498                 {
3499                         call_chaos();
3500                         ident = TRUE;
3501                         break;
3502                 }
3503
3504                 case SV_ROD_STONE_TO_MUD:
3505                 {
3506                         if (wall_to_mud(dir)) ident = TRUE;
3507                         break;
3508                 }
3509
3510                 case SV_ROD_AGGRAVATE:
3511                 {
3512                         aggravate_monsters(0);
3513                         ident = TRUE;
3514                         break;
3515                 }
3516         }
3517         return ident;
3518 }
3519
3520 /*
3521  * Activate (zap) a Rod
3522  *
3523  * Unstack fully charged rods as needed.
3524  *
3525  * Hack -- rods of perception/genocide can be "cancelled"
3526  * All rods can be cancelled at the "Direction?" prompt
3527  *
3528  * pvals are defined for each rod in k_info. -LM-
3529  */
3530 static void do_cmd_zap_rod_aux(int item)
3531 {
3532         int         ident, chance, dir, lev, fail;
3533         object_type *o_ptr;
3534         bool success;
3535
3536         /* Hack -- let perception get aborted */
3537         bool use_charge = TRUE;
3538
3539         object_kind *k_ptr;
3540
3541         /* Get the item (in the pack) */
3542         if (item >= 0)
3543         {
3544                 o_ptr = &inventory[item];
3545         }
3546
3547         /* Get the item (on the floor) */
3548         else
3549         {
3550                 o_ptr = &o_list[0 - item];
3551         }
3552
3553
3554         /* Mega-Hack -- refuse to zap a pile from the ground */
3555         if ((item < 0) && (o_ptr->number > 1))
3556         {
3557 #ifdef JP
3558                 msg_print("¤Þ¤º¤Ï¥í¥Ã¥É¤ò½¦¤ï¤Ê¤±¤ì¤Ð¡£");
3559 #else
3560                 msg_print("You must first pick up the rods.");
3561 #endif
3562
3563                 return;
3564         }
3565
3566
3567         /* Get a direction (unless KNOWN not to need it) */
3568         if (((o_ptr->sval >= SV_ROD_MIN_DIRECTION) && (o_ptr->sval != SV_ROD_HAVOC) && (o_ptr->sval != SV_ROD_AGGRAVATE) && (o_ptr->sval != SV_ROD_PESTICIDE)) ||
3569              !object_aware_p(o_ptr))
3570         {
3571                 /* Get a direction, allow cancel */
3572                 if (!get_aim_dir(&dir)) return;
3573         }
3574
3575
3576         /* Take a turn */
3577         energy_use = 100;
3578
3579         /* Extract the item level */
3580         lev = get_object_level(o_ptr);
3581
3582         /* Base chance of success */
3583         chance = p_ptr->skill_dev;
3584
3585         /* Confusion hurts skill */
3586         if (p_ptr->confused) chance = chance / 2;
3587
3588         fail = lev+5;
3589         if (chance > fail) fail -= (chance - fail)*2;
3590         else chance -= (fail - chance)*2;
3591         if (fail < USE_DEVICE) fail = USE_DEVICE;
3592         if (chance < USE_DEVICE) chance = USE_DEVICE;
3593
3594         if (world_player)
3595         {
3596                 if (flush_failure) flush();
3597 #ifdef JP
3598                 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
3599 #else
3600                 msg_print("Nothing happen. Maybe this rod is freezing too.");
3601 #endif
3602
3603                 sound(SOUND_FAIL);
3604                 return;
3605         }
3606
3607         if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3608         else if (chance > fail)
3609         {
3610                 if (rand_int(chance*2) < fail) success = FALSE;
3611                 else success = TRUE;
3612         }
3613         else
3614         {
3615                 if (rand_int(fail*2) < chance) success = TRUE;
3616                 else success = FALSE;
3617         }
3618
3619         /* Roll for usage */
3620         if (!success)
3621         {
3622                 if (flush_failure) flush();
3623 #ifdef JP
3624                 msg_print("¤¦¤Þ¤¯¥í¥Ã¥É¤ò»È¤¨¤Ê¤«¤Ã¤¿¡£");
3625 #else
3626                 msg_print("You failed to use the rod properly.");
3627 #endif
3628
3629                 sound(SOUND_FAIL);
3630                 return;
3631         }
3632
3633         k_ptr = &k_info[o_ptr->k_idx];
3634
3635         /* A single rod is still charging */
3636         if ((o_ptr->number == 1) && (o_ptr->timeout))
3637         {
3638                 if (flush_failure) flush();
3639 #ifdef JP
3640                 msg_print("¤³¤Î¥í¥Ã¥É¤Ï¤Þ¤ÀËâÎϤò½¼Å¶¤·¤Æ¤¤¤ëºÇÃæ¤À¡£");
3641 #else
3642                 msg_print("The rod is still charging.");
3643 #endif
3644
3645                 return;
3646         }
3647         /* A stack of rods lacks enough energy. */
3648         else if ((o_ptr->number > 1) && (o_ptr->timeout > k_ptr->pval * (o_ptr->number - 1)))
3649         {
3650                 if (flush_failure) flush();
3651 #ifdef JP
3652 msg_print("¤½¤Î¥í¥Ã¥É¤Ï¤Þ¤À½¼Å¶Ãæ¤Ç¤¹¡£");
3653 #else
3654                 msg_print("The rods are all still charging.");
3655 #endif
3656
3657                 return;
3658         }
3659
3660         /* Sound */
3661         sound(SOUND_ZAP);
3662
3663         ident = rod_effect(o_ptr->sval, dir, &use_charge, FALSE);
3664
3665         /* Increase the timeout by the rod kind's pval. -LM- */
3666         if (use_charge) o_ptr->timeout += k_ptr->pval;
3667
3668         /* Combine / Reorder the pack (later) */
3669         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
3670
3671         if (!(object_aware_p(o_ptr)))
3672         {
3673                 chg_virtue(V_PATIENCE, -1);
3674                 chg_virtue(V_CHANCE, 1);
3675                 chg_virtue(V_KNOWLEDGE, -1);
3676         }
3677
3678         /* Tried the object */
3679         object_tried(o_ptr);
3680
3681         /* Successfully determined the object function */
3682         if (ident && !object_aware_p(o_ptr))
3683         {
3684                 object_aware(o_ptr);
3685                 gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
3686         }
3687
3688         /* Window stuff */
3689         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3690 }
3691
3692
3693 void do_cmd_zap_rod(void)
3694 {
3695         int item;
3696         cptr q, s;
3697
3698         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
3699         {
3700                 set_action(ACTION_NONE);
3701         }
3702
3703         /* Restrict choices to rods */
3704         item_tester_tval = TV_ROD;
3705
3706         /* Get an item */
3707 #ifdef JP
3708         q = "¤É¤Î¥í¥Ã¥É¤ò¿¶¤ê¤Þ¤¹¤«? ";
3709         s = "»È¤¨¤ë¥í¥Ã¥É¤¬¤Ê¤¤¡£";
3710 #else
3711         q = "Zap which rod? ";
3712         s = "You have no rod to zap.";
3713 #endif
3714
3715         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
3716
3717         /* Zap the rod */
3718         do_cmd_zap_rod_aux(item);
3719 }
3720
3721
3722 /*
3723  * Hook to determine if an object is activatable
3724  */
3725 static bool item_tester_hook_activate(object_type *o_ptr)
3726 {
3727         u32b f1, f2, f3;
3728
3729         /* Not known */
3730         if (!object_known_p(o_ptr)) return (FALSE);
3731
3732         /* Extract the flags */
3733         object_flags(o_ptr, &f1, &f2, &f3);
3734
3735         /* Check activation flag */
3736         if (f3 & (TR3_ACTIVATE)) return (TRUE);
3737
3738         if ((o_ptr->tval > TV_CAPTURE) && o_ptr->xtra3)
3739         {
3740                 switch(o_ptr->xtra3)
3741                 case ESSENCE_TMP_RES_ACID:
3742                 case ESSENCE_TMP_RES_ELEC:
3743                 case ESSENCE_TMP_RES_FIRE:
3744                 case ESSENCE_TMP_RES_COLD:
3745                 case ESSENCE_EARTHQUAKE:
3746                         return (TRUE);
3747         }
3748
3749         /* Assume not */
3750         return (FALSE);
3751 }
3752
3753
3754 /*
3755  * Hack -- activate the ring of power
3756  */
3757 void ring_of_power(int dir)
3758 {
3759         /* Pick a random effect */
3760         switch (randint(10))
3761         {
3762                 case 1:
3763                 case 2:
3764                 {
3765                         /* Message */
3766 #ifdef JP
3767                         msg_print("¤¢¤Ê¤¿¤Ï°­À­¤Î¥ª¡¼¥é¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡£");
3768 #else
3769                         msg_print("You are surrounded by a malignant aura.");
3770 #endif
3771
3772                         sound(SOUND_EVIL);
3773
3774                         /* Decrease all stats (permanently) */
3775                         (void)dec_stat(A_STR, 50, TRUE);
3776                         (void)dec_stat(A_INT, 50, TRUE);
3777                         (void)dec_stat(A_WIS, 50, TRUE);
3778                         (void)dec_stat(A_DEX, 50, TRUE);
3779                         (void)dec_stat(A_CON, 50, TRUE);
3780                         (void)dec_stat(A_CHR, 50, TRUE);
3781
3782                         /* Lose some experience (permanently) */
3783                         p_ptr->exp -= (p_ptr->exp / 4);
3784                         p_ptr->max_exp -= (p_ptr->exp / 4);
3785                         check_experience();
3786
3787                         break;
3788                 }
3789
3790                 case 3:
3791                 {
3792                         /* Message */
3793 #ifdef JP
3794                         msg_print("¤¢¤Ê¤¿¤Ï¶¯ÎϤʥª¡¼¥é¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡£");
3795 #else
3796                         msg_print("You are surrounded by a powerful aura.");
3797 #endif
3798
3799
3800                         /* Dispel monsters */
3801                         dispel_monsters(1000);
3802
3803                         break;
3804                 }
3805
3806                 case 4:
3807                 case 5:
3808                 case 6:
3809                 {
3810                         /* Mana Ball */
3811                         fire_ball(GF_MANA, dir, 600, 3);
3812
3813                         break;
3814                 }
3815
3816                 case 7:
3817                 case 8:
3818                 case 9:
3819                 case 10:
3820                 {
3821                         /* Mana Bolt */
3822                         fire_bolt(GF_MANA, dir, 500);
3823
3824                         break;
3825                 }
3826         }
3827 }
3828
3829
3830 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
3831 {
3832         u16b *who = (u16b*)(u);
3833
3834         int w1 = who[a];
3835         int w2 = who[b];
3836
3837         monster_type *m_ptr1 = &m_list[w1];
3838         monster_type *m_ptr2 = &m_list[w2];
3839         monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
3840         monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
3841
3842         if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
3843         if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
3844
3845         if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
3846         if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
3847
3848         if (r_ptr1->level > r_ptr2->level) return TRUE;
3849         if (r_ptr2->level > r_ptr1->level) return FALSE;
3850
3851         if (m_ptr1->hp > m_ptr2->hp) return TRUE;
3852         if (m_ptr2->hp > m_ptr1->hp) return FALSE;
3853         
3854         return w1 <= w2;
3855 }
3856
3857 /*
3858  * Activate a wielded object.  Wielded objects never stack.
3859  * And even if they did, activatable objects never stack.
3860  *
3861  * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
3862  * But one could, for example, easily make an activatable "Ring of Plasma".
3863  *
3864  * Note that it always takes a turn to activate an artifact, even if
3865  * the user hits "escape" at the "direction" prompt.
3866  */
3867 static void do_cmd_activate_aux(int item)
3868 {
3869         int         k, dir, lev, chance, fail;
3870         object_type *o_ptr;
3871         bool success;
3872
3873
3874         /* Get the item (in the pack) */
3875         if (item >= 0)
3876         {
3877                 o_ptr = &inventory[item];
3878         }
3879
3880         /* Get the item (on the floor) */
3881         else
3882         {
3883                 o_ptr = &o_list[0 - item];
3884         }
3885
3886         /* Take a turn */
3887         energy_use = 100;
3888
3889         /* Extract the item level */
3890         lev = get_object_level(o_ptr);
3891
3892         /* Hack -- use artifact level instead */
3893         if (artifact_p(o_ptr)) lev = a_info[o_ptr->name1].level;
3894         else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
3895
3896         /* Base chance of success */
3897         chance = p_ptr->skill_dev;
3898
3899         /* Confusion hurts skill */
3900         if (p_ptr->confused) chance = chance / 2;
3901
3902         fail = lev+5;
3903         if (chance > fail) fail -= (chance - fail)*2;
3904         else chance -= (fail - chance)*2;
3905         if (fail < USE_DEVICE) fail = USE_DEVICE;
3906         if (chance < USE_DEVICE) chance = USE_DEVICE;
3907
3908         if (world_player)
3909         {
3910                 if (flush_failure) flush();
3911 #ifdef JP
3912                 msg_print("»ß¤Þ¤Ã¤¿»þ¤ÎÃæ¤Ç¤Ï¤¦¤Þ¤¯Æ¯¤«¤Ê¤¤¤è¤¦¤À¡£");
3913 #else
3914                 msg_print("It shows no reaction.");
3915 #endif
3916
3917                 sound(SOUND_FAIL);
3918                 return;
3919         }
3920
3921         if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
3922         else if (chance > fail)
3923         {
3924                 if (rand_int(chance*2) < fail) success = FALSE;
3925                 else success = TRUE;
3926         }
3927         else
3928         {
3929                 if (rand_int(fail*2) < chance) success = TRUE;
3930                 else success = FALSE;
3931         }
3932
3933         /* Roll for usage */
3934         if (!success)
3935         {
3936                 if (flush_failure) flush();
3937 #ifdef JP
3938                 msg_print("¤¦¤Þ¤¯»ÏÆ°¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Ê¤«¤Ã¤¿¡£");
3939 #else
3940                 msg_print("You failed to activate it properly.");
3941 #endif
3942
3943                 sound(SOUND_FAIL);
3944                 return;
3945         }
3946
3947         /* Check the recharge */
3948         if (o_ptr->timeout)
3949         {
3950 #ifdef JP
3951                 msg_print("¤½¤ì¤ÏÈù¤«¤Ë²»¤òΩ¤Æ¡¢µ±¤­¡¢¾Ã¤¨¤¿...");
3952 #else
3953                 msg_print("It whines, glows and fades...");
3954 #endif
3955
3956                 return;
3957         }
3958
3959
3960         /* Activate the artifact */
3961 #ifdef JP
3962         msg_print("»ÏÆ°¤µ¤»¤¿...");
3963 #else
3964         msg_print("You activate it...");
3965 #endif
3966
3967
3968         /* Sound */
3969         sound(SOUND_ZAP);
3970
3971
3972         if (o_ptr->art_name && o_ptr->xtra2)
3973         {
3974                 (void)activate_random_artifact(o_ptr);
3975
3976                 /* Window stuff */
3977                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3978
3979                 /* Success */
3980                 return;
3981         }
3982
3983         /* Artifacts */
3984         else if (o_ptr->name1)
3985         {
3986                 /* Choose effect */
3987                 switch (o_ptr->name1)
3988                 {
3989                         case ART_GALADRIEL:
3990                         {
3991 #ifdef JP
3992                                 msg_print("ààÎÜÉÓ¤«¤éÀ¡¤ó¤À¸÷¤¬¤¢¤Õ¤ì½Ð¤¿...");
3993 #else
3994                                 msg_print("The phial wells with clear light...");
3995 #endif
3996
3997                                 lite_area(damroll(2, 15), 3);
3998                                 o_ptr->timeout = rand_int(10) + 10;
3999                                 break;
4000                         }
4001
4002                         case ART_ELENDIL:
4003                         {
4004 #ifdef JP
4005                                 msg_print("À±¤¬âÁ¤·¤¯µ±¤¤¤¿...");
4006 #else
4007                                 msg_print("The star shines brightly...");
4008 #endif
4009
4010                                 map_area(DETECT_RAD_MAP);
4011                                 lite_area(damroll(2, 15), 3);
4012                                 o_ptr->timeout = rand_int(50) + 50;
4013                                 break;
4014                         }
4015
4016                         case ART_THRAIN:
4017                         {
4018 #ifdef JP
4019 msg_print("¤½¤ÎÊõÀФÏÀÖ¤¯ÌÀ¤ë¤¯¸÷¤Ã¤¿¡ª");
4020 #else
4021                                 msg_print("The Jewel flashes bright red!");
4022 #endif
4023
4024                                 chg_virtue(V_KNOWLEDGE, 1);
4025                                 chg_virtue(V_ENLIGHTEN, 1);
4026                                 wiz_lite(FALSE, FALSE);
4027 #ifdef JP
4028 msg_print("¤½¤ÎÊõÀФϤ¢¤Ê¤¿¤ÎÂÎÎϤòÃ¥¤Ã¤¿...");
4029 take_hit(DAMAGE_LOSELIFE, damroll(3,8), "¿³È½¤ÎÊõÀÐ", -1);
4030 #else
4031                                 msg_print("The Jewel drains your vitality...");
4032                                 take_hit(DAMAGE_LOSELIFE, damroll(3, 8), "the Jewel of Judgement", -1);
4033 #endif
4034
4035                                 (void)detect_traps(DETECT_RAD_DEFAULT);
4036                                 (void)detect_doors(DETECT_RAD_DEFAULT);
4037                                 (void)detect_stairs(DETECT_RAD_DEFAULT);
4038
4039 #ifdef JP
4040 if (get_check("µ¢´Ô¤ÎÎϤò»È¤¤¤Þ¤¹¤«¡©"))
4041 #else
4042                                 if (get_check("Activate recall? "))
4043 #endif
4044
4045                                 {
4046                                         (void)word_of_recall();
4047                                 }
4048
4049                                 o_ptr->timeout = rand_int(20) + 20;
4050                                 break;
4051                         }
4052
4053                         case ART_CARLAMMAS:
4054                         {
4055 #ifdef JP
4056                                 msg_print("¥¢¥ß¥å¥ì¥Ã¥È¤«¤é±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
4057 #else
4058                                 msg_print("The amulet lets out a shrill wail...");
4059 #endif
4060
4061                                 k = 3 * p_ptr->lev;
4062                                 (void)set_protevil(randint(25) + k, FALSE);
4063                                 o_ptr->timeout = rand_int(225) + 225;
4064                                 break;
4065                         }
4066
4067                         case ART_INGWE:
4068                         {
4069 #ifdef JP
4070                                 msg_print("¥¢¥ß¥å¥ì¥Ã¥È¤ÏÊÕ¤ê¤òÁ±¤Î¥ª¡¼¥é¤ÇËþ¤¿¤·¤¿...");
4071 #else
4072                                 msg_print("The amulet floods the area with goodness...");
4073 #endif
4074
4075                                 dispel_evil(p_ptr->lev * 5);
4076                                 o_ptr->timeout = rand_int(200) + 200;
4077                                 break;
4078                         }
4079
4080                         case ART_YATA:
4081                         {
4082 #ifdef JP
4083                                 msg_print("¶À¤ÏÊÕ¤ê¤òÁ±¤Î¥ª¡¼¥é¤ÇËþ¤¿¤·¤¿...");
4084 #else
4085                                 msg_print("The mirror floods the area with goodness...");
4086 #endif
4087
4088                                 dispel_evil(p_ptr->lev * 5);
4089                                 o_ptr->timeout = rand_int(200) + 200;
4090                                 break;
4091                         }
4092
4093                         case ART_BARAHIR:
4094                         {
4095 #ifdef JP
4096 msg_print("¤¢¤Ê¤¿¤Ï¥Õ¥é¥­¥¢¤ËŨ¤òÄù¤á»¦¤¹¤è¤¦Ì¿¤¸¤¿¡£");
4097 #else
4098                                 msg_print("You order Frakir to strangle your opponent.");
4099 #endif
4100
4101                                 if (!get_aim_dir(&dir)) return;
4102                                 if (drain_life(dir, 100))
4103                                 o_ptr->timeout = rand_int(100) + 100;
4104                                 break;
4105                         }
4106
4107                         case ART_TULKAS:
4108                         {
4109 #ifdef JP
4110                                 msg_print("»ØÎؤÏÌÀ¤ë¤¯µ±¤¤¤¿...");
4111 #else
4112                                 msg_print("The ring glows brightly...");
4113 #endif
4114
4115                                 (void)set_fast(randint(75) + 75, FALSE);
4116                                 o_ptr->timeout = rand_int(150) + 150;
4117                                 break;
4118                         }
4119
4120                         case ART_NARYA:
4121                         {
4122 #ifdef JP
4123                                 msg_print("»ØÎؤϿ¼¹È¤Ëµ±¤¤¤¿...");
4124 #else
4125                                 msg_print("The ring glows deep red...");
4126 #endif
4127
4128                                 if (!get_aim_dir(&dir)) return;
4129                                 fire_ball(GF_FIRE, dir, 300, 3);
4130                                 o_ptr->timeout = rand_int(225) + 225;
4131                                 break;
4132                         }
4133
4134                         case ART_NENYA:
4135                         {
4136 #ifdef JP
4137                                 msg_print("»ØÎؤÏÇò¤¯ÌÀ¤ë¤¯µ±¤¤¤¿...");
4138 #else
4139                                 msg_print("The ring glows bright white...");
4140 #endif
4141
4142                                 if (!get_aim_dir(&dir)) return;
4143                                 fire_ball(GF_COLD, dir, 400, 3);
4144                                 o_ptr->timeout = rand_int(325) + 325;
4145                                 break;
4146                         }
4147
4148                         case ART_VILYA:
4149                         case ART_GOURYU:
4150                         {
4151 #ifdef JP
4152                                 msg_print("»ØÎؤϿ¼¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿...");
4153 #else
4154                                 msg_print("The ring glows deep blue...");
4155 #endif
4156
4157                                 if (!get_aim_dir(&dir)) return;
4158                                 fire_ball(GF_ELEC, dir, 500, 3);
4159                                 o_ptr->timeout = rand_int(425) + 425;
4160                                 break;
4161                         }
4162
4163                         case ART_POWER:
4164                         case ART_AHO:
4165                         {
4166 #ifdef JP
4167                                 msg_print("»ØÎؤϼ¿¹õ¤Ëµ±¤¤¤¿...");
4168 #else
4169                                 msg_print("The ring glows intensely black...");
4170 #endif
4171
4172                                 if (!get_aim_dir(&dir)) return;
4173                                 ring_of_power(dir);
4174                                 o_ptr->timeout = rand_int(450) + 450;
4175                                 break;
4176                         }
4177
4178                         case ART_RAZORBACK:
4179                         {
4180                                 int num = damroll(5, 3);
4181                                 int y, x;
4182                                 int attempts;
4183
4184 #ifdef JP
4185                                 msg_print("³»¤¬°ðºÊ¤Çʤ¤ï¤ì¤¿...");
4186 #else
4187                                 msg_print("Your armor is surrounded by lightning...");
4188 #endif
4189
4190
4191                                 for (k = 0; k < num; k++)
4192                                 {
4193                 attempts = 1000;
4194
4195                                         while(attempts--)
4196                                         {
4197                                                 scatter(&y, &x, py, px, 4, 0);
4198
4199                                                 if (!cave_floor_bold(y, x)) continue;
4200
4201                                                 if ((y != py) || (x != px)) break;
4202                                         }
4203
4204                                         project(0, 3, y, x, 150, GF_ELEC,
4205                                                           (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
4206                                 }
4207
4208                                 o_ptr->timeout = 1000;
4209                                 break;
4210                         }
4211
4212                         case ART_BLADETURNER:
4213                         {
4214                                 if (!get_aim_dir(&dir)) return;
4215 #ifdef JP
4216                                 msg_print("¤¢¤Ê¤¿¤Ï¥¨¥ì¥á¥ó¥È¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
4217 #else
4218                                 msg_print("You breathe the elements.");
4219 #endif
4220
4221                                 fire_ball(GF_MISSILE, dir, 300, 4);
4222 #ifdef JP
4223                                 msg_print("¥¢¡¼¥Þ¡¼¤¬ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤¿...");
4224 #else
4225                                 msg_print("Your armor glows many colours...");
4226 #endif
4227
4228                                 (void)set_afraid(0);
4229                                 (void)set_hero(randint(50) + 50, FALSE);
4230                                 (void)hp_player(10);
4231                                 (void)set_blessed(randint(50) + 50, FALSE);
4232                                 (void)set_oppose_acid(randint(50) + 50, FALSE);
4233                                 (void)set_oppose_elec(randint(50) + 50, FALSE);
4234                                 (void)set_oppose_fire(randint(50) + 50, FALSE);
4235                                 (void)set_oppose_cold(randint(50) + 50, FALSE);
4236                                 (void)set_oppose_pois(randint(50) + 50, FALSE);
4237                                 o_ptr->timeout = 400;
4238                                 break;
4239                         }
4240
4241                         case ART_SOULKEEPER:
4242                         {
4243 #ifdef JP
4244                                 msg_print("¥¢¡¼¥Þ¡¼¤¬Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤¿...");
4245                                 msg_print("¤Ò¤¸¤ç¤¦¤Ëµ¤Ê¬¤¬¤è¤¤...");
4246 #else
4247                                 msg_print("Your armor glows a bright white...");
4248                                 msg_print("You feel much better...");
4249 #endif
4250
4251                                 (void)hp_player(1000);
4252                                 (void)set_cut(0);
4253                                 o_ptr->timeout = 888;
4254                                 break;
4255                         }
4256
4257                         case ART_BELEGENNON:
4258                         {
4259 #ifdef JP
4260 msg_print("Å·¹ñ¤Î²Î¤¬Ê¹¤³¤¨¤ë...");
4261 #else
4262                                 msg_print("A heavenly choir sings...");
4263 #endif
4264
4265                                 (void)set_poisoned(0);
4266                                 (void)set_cut(0);
4267                                 (void)set_stun(0);
4268                                 (void)set_confused(0);
4269                                 (void)set_blind(0);
4270                                 (void)set_hero(randint(25) + 25, FALSE);
4271                                 (void)hp_player(777);
4272                                 o_ptr->timeout = 300;
4273                                 break;
4274                         }
4275
4276                         case ART_CELEBORN:
4277                         {
4278 #ifdef JP
4279                                 msg_print("¥¢¡¼¥Þ¡¼¤¬¿¼¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿...");
4280 #else
4281                                 msg_print("Your armor glows deep blue...");
4282 #endif
4283
4284                                 (void)symbol_genocide(200, TRUE);
4285                                 o_ptr->timeout = 500;
4286                                 break;
4287                         }
4288
4289                         case ART_CASPANION:
4290                         {
4291 #ifdef JP
4292                                 msg_print("¥¢¡¼¥Þ¡¼¤¬ÀÖ¤¯ÌÀ¤ë¤¯µ±¤¤¤¿...");
4293 #else
4294                                 msg_print("Your armor glows bright red...");
4295 #endif
4296
4297                                 destroy_doors_touch();
4298                                 o_ptr->timeout = 10;
4299                                 break;
4300                         }
4301
4302                         case ART_DOR:
4303                         case ART_TERROR:
4304                         case ART_STONEMASK:
4305                         {
4306                                 turn_monsters(40 + p_ptr->lev);
4307                                 o_ptr->timeout = 3 * (p_ptr->lev + 10);
4308
4309                                 break;
4310                         }
4311
4312                         case ART_HOLHENNETH:
4313                         {
4314 #ifdef JP
4315                                 msg_print("¥Ø¥ë¥á¥Ã¥È¤¬Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤¿...");
4316                                 msg_print("¿´¤Ë¥¤¥á¡¼¥¸¤¬É⤫¤ó¤Ç¤­¤¿...");
4317 #else
4318                                 msg_print("Your helm glows bright white...");
4319                                 msg_print("An image forms in your mind...");
4320 #endif
4321
4322                                 detect_all(DETECT_RAD_DEFAULT);
4323                                 o_ptr->timeout = rand_int(55) + 55;
4324                                 break;
4325                         }
4326
4327                         case ART_GONDOR:
4328                         {
4329 #ifdef JP
4330                                 msg_print("²¦´§¤¬¿¼¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿...");
4331                                 msg_print("ÂÎÆâ¤ËÃȤ«¤¤¸ÝÆ°¤¬´¶¤¸¤é¤ì¤ë...");
4332 #else
4333                                 msg_print("Your crown glows deep blue...");
4334                                 msg_print("You feel a warm tingling inside...");
4335 #endif
4336
4337                                 (void)hp_player(700);
4338                                 (void)set_cut(0);
4339                                 o_ptr->timeout = 250;
4340                                 break;
4341                         }
4342
4343                         case ART_COLLUIN:
4344                         case ART_SEIRYU:
4345                         {
4346 #ifdef JP
4347                                 msg_format("%s¤¬ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤¿...", o_ptr->name1 == ART_COLLUIN ? "¥¯¥í¡¼¥¯" : "³»");
4348 #else
4349                                 msg_format("Your cloak glows many colours...");
4350 #endif
4351
4352                                 (void)set_oppose_acid(randint(20) + 20, FALSE);
4353                                 (void)set_oppose_elec(randint(20) + 20, FALSE);
4354                                 (void)set_oppose_fire(randint(20) + 20, FALSE);
4355                                 (void)set_oppose_cold(randint(20) + 20, FALSE);
4356                                 (void)set_oppose_pois(randint(20) + 20, FALSE);
4357                                 o_ptr->timeout = 111;
4358                                 break;
4359                         }
4360
4361                         case ART_HOLCOLLETH:
4362                         {
4363 #ifdef JP
4364                                 msg_print("¥¯¥í¡¼¥¯¤¬¿¼¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿...");
4365 #else
4366                                 msg_print("Your cloak glows deep blue...");
4367 #endif
4368
4369                                 sleep_monsters_touch();
4370                                 o_ptr->timeout = 55;
4371                                 break;
4372                         }
4373
4374                         case ART_THINGOL:
4375                         {
4376 #ifdef JP
4377                                 msg_print("¥¯¥í¡¼¥¯¤¬²«¿§¤¯ÌÀ¤ë¤¯µ±¤¤¤¿...");
4378 #else
4379                                 msg_print("Your cloak glows bright yellow...");
4380 #endif
4381
4382                                 recharge(130);
4383                                 o_ptr->timeout = 70;
4384                                 break;
4385                         }
4386
4387                         case ART_COLANNON:
4388                         {
4389 #ifdef JP
4390                                 msg_print("¥¯¥í¡¼¥¯¤¬ÊÕ¤ê¤Î¶õ´Ö¤ò¤æ¤¬¤Þ¤»¤¿...");
4391 #else
4392                                 msg_print("Your cloak twists space around you...");
4393 #endif
4394
4395                                 teleport_player(100);
4396                                 o_ptr->timeout = 45;
4397                                 break;
4398                         }
4399
4400                         case ART_LUTHIEN:
4401                         {
4402 #ifdef JP
4403                                 msg_print("¥¯¥í¡¼¥¯¤¬¿¼¹È¤Ëµ±¤¤¤¿...");
4404 #else
4405                                 msg_print("Your cloak glows a deep red...");
4406 #endif
4407
4408                                 restore_level();
4409                                 o_ptr->timeout = 450;
4410                                 break;
4411                         }
4412
4413                         case ART_CAMMITHRIM:
4414                         {
4415 #ifdef JP
4416                                 msg_print("¥°¥í¡¼¥Ö¤¬âÁ¤·¤¤¤¯¤é¤¤¤ËÌÀ¤ë¤¯µ±¤¤¤¿...");
4417 #else
4418                                 msg_print("Your gloves glow extremely brightly...");
4419 #endif
4420
4421                                 if (!get_aim_dir(&dir)) return;
4422                                 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
4423                                 o_ptr->timeout = 2;
4424                                 break;
4425                         }
4426
4427                         case ART_PAURHACH:
4428                         {
4429 #ifdef JP
4430                                 msg_print("¥¬¥ó¥È¥ì¥Ã¥È¤¬±ê¤Ëʤ¤ï¤ì¤¿...");
4431 #else
4432                                 msg_print("Your gauntlets are covered in fire...");
4433 #endif
4434
4435                                 if (!get_aim_dir(&dir)) return;
4436                                 fire_bolt(GF_FIRE, dir, damroll(9, 8));
4437                                 o_ptr->timeout = rand_int(8) + 8;
4438                                 break;
4439                         }
4440
4441                         case ART_PAURNIMMEN:
4442                         {
4443 #ifdef JP
4444                                 msg_print("¥¬¥ó¥È¥ì¥Ã¥È¤¬Î䵤¤Ëʤ¤ï¤ì¤¿...");
4445 #else
4446                                 msg_print("Your gauntlets are covered in frost...");
4447 #endif
4448
4449                                 if (!get_aim_dir(&dir)) return;
4450                                 fire_bolt(GF_COLD, dir, damroll(6, 8));
4451                                 o_ptr->timeout = rand_int(7) + 7;
4452                                 break;
4453                         }
4454
4455                         case ART_PAURAEGEN:
4456                         {
4457 #ifdef JP
4458                                 msg_print("¥¬¥ó¥È¥ì¥Ã¥È¤¬²Ð²Ö¤Ëʤ¤ï¤ì¤¿...");
4459 #else
4460                                 msg_print("Your gauntlets are covered in sparks...");
4461 #endif
4462
4463                                 if (!get_aim_dir(&dir)) return;
4464                                 fire_bolt(GF_ELEC, dir, damroll(4, 8));
4465                                 o_ptr->timeout = rand_int(5) + 5;
4466                                 break;
4467                         }
4468
4469                         case ART_PAURNEN:
4470                         {
4471 #ifdef JP
4472                                 msg_print("¥¬¥ó¥È¥ì¥Ã¥È¤¬»À¤Ëʤ¤ï¤ì¤¿...");
4473 #else
4474                                 msg_print("Your gauntlets are covered in acid...");
4475 #endif
4476
4477                                 if (!get_aim_dir(&dir)) return;
4478                                 fire_bolt(GF_ACID, dir, damroll(5, 8));
4479                                 o_ptr->timeout = rand_int(6) + 6;
4480                                 break;
4481                         }
4482
4483                         case ART_FINGOLFIN:
4484                         {
4485 #ifdef JP
4486                                 msg_print("¥»¥¹¥¿¥¹¤ËËâË¡¤Î¥È¥²¤¬¸½¤ì¤¿...");
4487 #else
4488                                 msg_print("Your cesti grows magical spikes...");
4489 #endif
4490
4491                                 if (!get_aim_dir(&dir)) return;
4492                                 fire_bolt(GF_ARROW, dir, 150);
4493                                 o_ptr->timeout = rand_int(90) + 90;
4494                                 break;
4495                         }
4496
4497                         case ART_FEANOR:
4498                         {
4499 #ifdef JP
4500                                 msg_print("¥Ö¡¼¥Ä¤¬¥°¥ê¡¼¥ó¤ËÌÀ¤ë¤¯µ±¤¤¤¿...");
4501 #else
4502                                 msg_print("Your boots glow bright green...");
4503 #endif
4504
4505                                 (void)set_fast(randint(20) + 20, FALSE);
4506                                 o_ptr->timeout = 200;
4507                                 break;
4508                         }
4509
4510                         case ART_DAL:
4511                         {
4512 #ifdef JP
4513                                 msg_print("¥Ö¡¼¥Ä¤¬¿¼¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿...");
4514 #else
4515                                 msg_print("Your boots glow deep blue...");
4516 #endif
4517
4518                                 (void)set_afraid(0);
4519                                 (void)set_poisoned(0);
4520                                 o_ptr->timeout = 5;
4521                                 break;
4522                         }
4523
4524                         case ART_NARTHANC:
4525                         {
4526 #ifdef JP
4527                                 msg_print("¥À¥¬¡¼¤¬±ê¤Ëʤ¤ï¤ì¤¿...");
4528 #else
4529                                 msg_print("Your dagger is covered in fire...");
4530 #endif
4531
4532                                 if (!get_aim_dir(&dir)) return;
4533                                 fire_bolt(GF_FIRE, dir, damroll(9, 8));
4534                                 o_ptr->timeout = rand_int(8) + 8;
4535                                 break;
4536                         }
4537
4538                         case ART_NIMTHANC:
4539                         {
4540 #ifdef JP
4541                                 msg_print("¥À¥¬¡¼¤¬Î䵤¤Ëʤ¤ï¤ì¤¿...");
4542 #else
4543                                 msg_print("Your dagger is covered in frost...");
4544 #endif
4545
4546                                 if (!get_aim_dir(&dir)) return;
4547                                 fire_bolt(GF_COLD, dir, damroll(6, 8));
4548                                 o_ptr->timeout = rand_int(7) + 7;
4549                                 break;
4550                         }
4551
4552                         case ART_DETHANC:
4553                         {
4554 #ifdef JP
4555                                 msg_print("¥À¥¬¡¼¤¬²Ð²Ö¤Ëʤ¤ï¤ì¤¿...");
4556 #else
4557                                 msg_print("Your dagger is covered in sparks...");
4558 #endif
4559
4560                                 if (!get_aim_dir(&dir)) return;
4561                                 fire_bolt(GF_ELEC, dir, damroll(4, 8));
4562                                 o_ptr->timeout = rand_int(5) + 5;
4563                                 break;
4564                         }
4565
4566                         case ART_RILIA:
4567                         {
4568 #ifdef JP
4569                                 msg_print("¥À¥¬¡¼¤¬¿¼¤¤Îп§¤Ë¸ÝÆ°¤·¤Æ¤¤¤ë...");
4570 #else
4571                                 msg_print("Your dagger throbs deep green...");
4572 #endif
4573
4574                                 if (!get_aim_dir(&dir)) return;
4575                                 fire_ball(GF_POIS, dir, 12, 3);
4576                                 o_ptr->timeout = rand_int(4) + 4;
4577                                 break;
4578                         }
4579
4580                         case ART_NUMAHOKO:
4581                         {
4582 #ifdef JP
4583                                 msg_print("Ì·¤¬¿¼¤¤ÀÄ¿§¤Ë¸ÝÆ°¤·¤Æ¤¤¤ë...");
4584 #else
4585                                 msg_print("Your dagger throbs deep blue...");
4586 #endif
4587
4588                                 if (!get_aim_dir(&dir)) return;
4589                                 fire_ball(GF_WATER, dir, 200, 3);
4590                                 o_ptr->timeout = 250;
4591                                 break;
4592                         }
4593
4594                         case ART_BELANGIL:
4595                         {
4596 #ifdef JP
4597                                 msg_print("¥À¥¬¡¼¤¬Î䵤¤Ëʤ¤ï¤ì¤¿...");
4598 #else
4599                                 msg_print("Your dagger is covered in frost...");
4600 #endif
4601
4602                                 if (!get_aim_dir(&dir)) return;
4603                                 fire_ball(GF_COLD, dir, 48, 2);
4604                                 o_ptr->timeout = rand_int(5) + 5;
4605                                 break;
4606                         }
4607
4608                         case ART_KUSANAGI:
4609                         case ART_ANGUIREL:
4610                         {
4611                                 switch (randint(13))
4612                                 {
4613                                 case 1: case 2: case 3: case 4: case 5:
4614                                         teleport_player(10);
4615                                         break;
4616                                 case 6: case 7: case 8: case 9: case 10:
4617                                         teleport_player(222);
4618                                         break;
4619                                 case 11: case 12:
4620                                         (void)stair_creation();
4621                                         break;
4622                                 default:
4623 #ifdef JP
4624 if (get_check("¤³¤Î³¬¤òµî¤ê¤Þ¤¹¤«¡©"))
4625 #else
4626                                         if (get_check("Leave this level? "))
4627 #endif
4628
4629                                         {
4630                                                 if (autosave_l) do_cmd_save_game(TRUE);
4631
4632                                                 /* Leaving */
4633                                                 p_ptr->leaving = TRUE;
4634                                         }
4635                                 }
4636                                 o_ptr->timeout = 35;
4637                                 break;
4638                         }
4639
4640                         case ART_KAMUI:
4641                         {
4642                                 teleport_player(222);
4643                                 o_ptr->timeout = 25;
4644                                 break;
4645                         }
4646
4647                         case ART_RINGIL:
4648                         {
4649 #ifdef JP
4650                                 msg_print("¥½¡¼¥É¤¬ÀĤ¯·ã¤·¤¯µ±¤¤¤¿...");
4651 #else
4652                                 msg_print("Your sword glows an intense blue...");
4653 #endif
4654
4655                                 if (!get_aim_dir(&dir)) return;
4656                                 fire_ball(GF_COLD, dir, 100, 2);
4657                                 o_ptr->timeout = 200;
4658                                 break;
4659                         }
4660
4661                         case ART_DAWN:
4662                         {
4663 #ifdef JP
4664 msg_print("¶Ç¤Î»ÕÃĤò¾¤´­¤·¤¿¡£");
4665 #else
4666                                 msg_print("You summon the Legion of the Dawn.");
4667 #endif
4668
4669                                 (void)summon_specific(-1, py, px, dun_level, SUMMON_DAWN, TRUE, TRUE, TRUE, FALSE, FALSE);
4670                                 o_ptr->timeout = 500 + randint(500);
4671                                 break;
4672                         }
4673
4674                         case ART_ANDURIL:
4675                         {
4676 #ifdef JP
4677                                 msg_print("¥½¡¼¥É¤¬ÀÖ¤¯·ã¤·¤¯µ±¤¤¤¿...");
4678 #else
4679                                 msg_print("Your sword glows an intense red...");
4680 #endif
4681
4682                                 if (!get_aim_dir(&dir)) return;
4683                                 fire_ball(GF_FIRE, dir, 72, 2);
4684                                 o_ptr->timeout = 400;
4685                                 break;
4686                         }
4687
4688                         case ART_THEODEN:
4689                         {
4690 #ifdef JP
4691                                  msg_print("¥¢¥Ã¥¯¥¹¤Î¿Ï¤¬¹õ¤¯µ±¤¤¤¿...");
4692 #else
4693                                 msg_print("Your axe blade glows black...");
4694 #endif
4695
4696                                 if (!get_aim_dir(&dir)) return;
4697                                 drain_life(dir, 120);
4698                                 o_ptr->timeout = 400;
4699                                 break;
4700                         }
4701
4702                         case ART_RUNESPEAR:
4703                         {
4704 #ifdef JP
4705 msg_print("¤¢¤Ê¤¿¤ÎÁä¤ÏÅŵ¤¤Ç¥¹¥Ñ¡¼¥¯¤·¤Æ¤¤¤ë...");
4706 #else
4707                                 msg_print("Your spear crackles with electricity...");
4708 #endif
4709
4710                                 if (!get_aim_dir(&dir)) return;
4711                                 fire_ball(GF_ELEC, dir, 100, 3);
4712                                 o_ptr->timeout = 200;
4713                                 break;
4714                         }
4715
4716                         case ART_AEGLOS:
4717                         {
4718 #ifdef JP
4719                                 msg_print("¥¹¥Ô¥¢¤¬Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤¿...");
4720 #else
4721                                 msg_print("Your spear glows a bright white...");
4722 #endif
4723
4724                                 if (!get_aim_dir(&dir)) return;
4725                                 fire_ball(GF_COLD, dir, 100, 3);
4726                                 o_ptr->timeout = 200;
4727                                 break;
4728                         }
4729
4730                         case ART_OROME:
4731                         {
4732 #ifdef JP
4733                                 msg_print("¥¹¥Ô¥¢¤¬¸ÝÆ°¤·¤¿...");
4734 #else
4735                                 msg_print("Your spear pulsates...");
4736 #endif
4737
4738                                 if (!get_aim_dir(&dir)) return;
4739                                 wall_to_mud(dir);
4740                                 o_ptr->timeout = 5;
4741                                 break;
4742                         }
4743
4744                         case ART_NAIN:
4745                         {
4746 #ifdef JP
4747                                 msg_print("¤Ä¤ë¤Ï¤·¤¬¸ÝÆ°¤·¤¿...");
4748 #else
4749                                 msg_print("Your mattock pulsates...");
4750 #endif
4751
4752                                 if (!get_aim_dir(&dir)) return;
4753                                 wall_to_mud(dir);
4754                                 o_ptr->timeout = 2;
4755                                 break;
4756                         }
4757
4758                         case ART_EONWE:
4759                         {
4760 #ifdef JP
4761                                 msg_print("¥¢¥Ã¥¯¥¹¤«¤é¤Ò¤É¤¯±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
4762 #else
4763                                 msg_print("Your axe lets out a long, shrill note...");
4764 #endif
4765
4766                                 (void)mass_genocide(200, TRUE);
4767                                 o_ptr->timeout = 1000;
4768                                 break;
4769                         }
4770
4771                         case ART_LOTHARANG:
4772                         {
4773 #ifdef JP
4774                                 msg_print("¥Ð¥È¥ë¡¦¥¢¥Ã¥¯¥¹¤¬¿¼»ç¤Î¸÷¤òÊü¼Í¤·¤¿...");
4775 #else
4776                                 msg_print("Your battle axe radiates deep purple...");
4777 #endif
4778
4779                                 hp_player(damroll(4, 8));
4780                                 (void)set_cut((p_ptr->cut / 2) - 50);
4781                                 o_ptr->timeout = rand_int(3) + 3;
4782                                 break;
4783                         }
4784
4785                         case ART_ULMO:
4786                         {
4787 #ifdef JP
4788                                 msg_print("¥È¥é¥¤¥Ç¥ó¥È¤¬¿¼¹È¤Ëµ±¤¤¤¿...");
4789 #else
4790                                 msg_print("Your trident glows deep red...");
4791 #endif
4792
4793                                 if (!get_aim_dir(&dir)) return;
4794                                 teleport_monster(dir);
4795                                 o_ptr->timeout = 150;
4796                                 break;
4797                         }
4798
4799                         case ART_AVAVIR:
4800                         {
4801 #ifdef JP
4802                                 msg_print("Âç³ù¤¬½À¤é¤«¤¯Çò¤¯µ±¤¤¤¿...");
4803 #else
4804                                 msg_print("Your scythe glows soft white...");
4805 #endif
4806                                 if (!word_of_recall()) return;
4807                                 o_ptr->timeout = 200;
4808                                 break;
4809                         }
4810
4811                         case ART_MAGATAMA:
4812                         {
4813 #ifdef JP
4814                                 msg_print("¸û¶Ì¤¬½À¤é¤«¤¯Çò¤¯µ±¤¤¤¿...");
4815 #else
4816                                 msg_print("Your scythe glows soft white...");
4817 #endif
4818                                 if (!word_of_recall()) return;
4819                                 o_ptr->timeout = 200;
4820                                 break;
4821                         }
4822
4823                         case ART_TOTILA:
4824                         {
4825 #ifdef JP
4826                                 msg_print("¥Õ¥ì¥¤¥ë¤¬ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤¿...");
4827 #else
4828                                 msg_print("Your flail glows in scintillating colours...");
4829 #endif
4830
4831                                 if (!get_aim_dir(&dir)) return;
4832                                 confuse_monster(dir, 20);
4833                                 o_ptr->timeout = 15;
4834                                 break;
4835                         }
4836
4837                         case ART_FIRESTAR:
4838                         {
4839 #ifdef JP
4840                                 msg_print("¥â¡¼¥Ë¥ó¥°¥¹¥¿¡¼¤«¤é±ê¤¬¿á¤­½Ð¤·¤¿...");
4841 #else
4842                                 msg_print("Your morning star rages in fire...");
4843 #endif
4844
4845                                 if (!get_aim_dir(&dir)) return;
4846                                 fire_ball(GF_FIRE, dir, 72, 3);
4847                                 o_ptr->timeout = 100;
4848                                 break;
4849                         }
4850
4851                         case ART_GOTHMOG:
4852                         {
4853 #ifdef JP
4854                                 msg_print("¥à¥Á¤¬¿¼¤¤ÀÖ¿§¤Ëµ±¤¤¤¿...");
4855 #else
4856                                 msg_print("Your whip glows deep red...");
4857 #endif
4858
4859                                 if (!get_aim_dir(&dir)) return;
4860                                 fire_ball(GF_FIRE, dir, 120, 3);
4861                                 o_ptr->timeout = 15;
4862                                 break;
4863                         }
4864
4865                         case ART_TARATOL:
4866                         {
4867 #ifdef JP
4868                                 msg_print("¥á¥¤¥¹¤¬¥°¥ê¡¼¥ó¤ËÌÀ¤ë¤¯µ±¤¤¤¿...");
4869 #else
4870                                 msg_print("Your mace glows bright green...");
4871 #endif
4872
4873                                 (void)set_fast(randint(20) + 20, FALSE);
4874                                 o_ptr->timeout = rand_int(100) + 100;
4875                                 break;
4876                         }
4877
4878                         case ART_ERIRIL:
4879                         {
4880 #ifdef JP
4881                                 msg_print("¥¯¥©¡¼¥¿¡¼¥¹¥¿¥Ã¥Õ¤¬²«¿§¤¯µ±¤¤¤¿...");
4882 #else
4883                                 msg_print("Your quarterstaff glows yellow...");
4884 #endif
4885
4886                                 if (!ident_spell(FALSE)) return;
4887                                 o_ptr->timeout = 10;
4888                                 break;
4889                         }
4890
4891                         case ART_OLORIN:
4892                         {
4893 #ifdef JP
4894                                 msg_print("¾ó¤¬ÌÀ¤ë¤¯µ±¤¤¤¿...");
4895 #else
4896                                 msg_print("Your quarterstaff glows brightly...");
4897 #endif
4898
4899                                 detect_all(DETECT_RAD_DEFAULT);
4900                                 probing();
4901                                 identify_fully(FALSE);
4902                                 o_ptr->timeout = 1000;
4903                                 break;
4904                         }
4905
4906                         case ART_TURMIL:
4907                         {
4908 #ifdef JP
4909                                 msg_print("¥Ï¥ó¥Þ¡¼¤¬Çò¤¯µ±¤¤¤¿...");
4910 #else
4911                                 msg_print("Your hammer glows white...");
4912 #endif
4913
4914                                 if (!get_aim_dir(&dir)) return;
4915                                 drain_life(dir, 90);
4916                                 o_ptr->timeout = 70;
4917                                 break;
4918                         }
4919
4920                         case ART_BRAND:
4921                         {
4922 #ifdef JP
4923                                 msg_print("¥¯¥í¥¹¥Ü¥¦¤¬¿¼¹È¤Ëµ±¤¤¤¿...");
4924 #else
4925                                 msg_print("Your crossbow glows deep red...");
4926 #endif
4927
4928                                 (void)brand_bolts();
4929                                 o_ptr->timeout = 999;
4930                                 break;
4931                         }
4932                         case ART_CRIMSON:
4933                         {
4934                                 int num = 1;
4935                                 int i;
4936                                 int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_NO_REF;
4937                                 int tx, ty;
4938 #ifdef JP
4939                                 msg_print("¤»¤Ã¤«¤¯¤À¤«¤é¡Ø¥¯¥ê¥à¥¾¥ó¡Ù¤ò¤Ö¤Ã¤Ñ¤Ê¤¹¤¼¡ª");
4940 #else
4941                                 msg_print("I'll fire CRIMSON! SEKKAKUDAKARA!");
4942 #endif
4943
4944                                 if (!get_aim_dir(&dir)) return;
4945
4946                                 /* Use the given direction */
4947                                 tx = px + 99 * ddx[dir];
4948                                 ty = py + 99 * ddy[dir];
4949
4950                                 /* Hack -- Use an actual "target" */
4951                                 if ((dir == 5) && target_okay())
4952                                 {
4953                                         tx = target_col;
4954                                         ty = target_row;
4955                                 }
4956
4957                                 if (p_ptr->pclass == CLASS_ARCHER)
4958                                 {
4959                                         /* Extra shot at level 10 */
4960                                         if (p_ptr->lev >= 10) num++;
4961
4962                                         /* Extra shot at level 30 */
4963                                         if (p_ptr->lev >= 30) num++;
4964
4965                                         /* Extra shot at level 45 */
4966                                         if (p_ptr->lev >= 45) num++;
4967                                 }
4968
4969                                 for (i = 0; i < num; i++)
4970                                         project(0, p_ptr->lev/20+1, ty, tx, p_ptr->lev*6, GF_ROCKET, flg, -1);
4971                                 o_ptr->timeout = 15;
4972                                 break;
4973                         }
4974                         case ART_PALANTIR:
4975                         {
4976                                 monster_type *m_ptr;
4977                                 monster_race *r_ptr;
4978                                 int i;
4979
4980 #ifdef JP
4981                                 msg_print("´ñ̯¤Ê¾ì½ê¤¬Æ¬¤ÎÃæ¤ËÉ⤫¤ó¤À¡¥¡¥¡¥");
4982 #else
4983                                 msg_print("Some strange places show up in your mind. And you see ...");
4984 #endif
4985
4986                                 /* Process the monsters (backwards) */
4987                                 for (i = m_max - 1; i >= 1; i--)
4988                                 {
4989                                         /* Access the monster */
4990                                         m_ptr = &m_list[i];
4991
4992                                         /* Ignore "dead" monsters */
4993                                         if (!m_ptr->r_idx) continue;
4994
4995                                         r_ptr = &r_info[m_ptr->r_idx];
4996
4997                                         if(r_ptr->flags1 & RF1_UNIQUE)
4998                                         {
4999 #ifdef JP
5000                                                 msg_format("%s¡¥ ",r_name + r_ptr->name);
5001 #else
5002                                                 msg_format("%s. ",r_name + r_ptr->name);
5003 #endif
5004                                         }
5005                                 }
5006                                 o_ptr->timeout = 200;
5007                                 break;
5008                         }
5009
5010                         case ART_STONE_LORE:
5011                         {
5012 #ifdef JP
5013                                 msg_print("ÀФ¬±£¤µ¤ì¤¿ÈëÌ©¤ò¼Ì¤·½Ð¤·¤¿¡¥¡¥¡¥");
5014 #else
5015                                 msg_print("The stone reveals hidden mysteries...");
5016 #endif
5017                                 if (!ident_spell(FALSE)) return;
5018
5019                                 if (mp_ptr->spell_book)
5020                                 {
5021                                         /* Sufficient mana */
5022                                         if (20 <= p_ptr->csp)
5023                                         {
5024                                                 /* Use some mana */
5025                                                 p_ptr->csp -= 20;
5026                                         }
5027
5028                                         /* Over-exert the player */
5029                                         else
5030                                         {
5031                                                 int oops = 20 - p_ptr->csp;
5032
5033                                                 /* No mana left */
5034                                                 p_ptr->csp = 0;
5035                                                 p_ptr->csp_frac = 0;
5036
5037                                                 /* Message */
5038 #ifdef JP
5039                                                 msg_print("ÀФòÀ©¸æ¤Ç¤­¤Ê¤¤¡ª");
5040 #else
5041                                                 msg_print("You are too weak to control the stone!");
5042 #endif
5043
5044                                                 /* Hack -- Bypass free action */
5045                                                 (void)set_paralyzed(p_ptr->paralyzed +
5046                                                         randint(5 * oops + 1));
5047
5048                                                 /* Confusing. */
5049                                                 (void)set_confused(p_ptr->confused +
5050                                                         randint(5 * oops + 1));
5051                                         }
5052
5053                                         /* Redraw mana */
5054                                         p_ptr->redraw |= (PR_MANA);
5055                                 }
5056
5057 #ifdef JP
5058                                 take_hit(DAMAGE_LOSELIFE, damroll(1, 12), "´í¸±¤ÊÈëÌ©", -1);
5059 #else
5060                                 take_hit(DAMAGE_LOSELIFE, damroll(1, 12), "perilous secrets", -1);
5061 #endif
5062
5063                                 /* Confusing. */
5064                                 if (rand_int(5) == 0) (void)set_confused(p_ptr->confused +
5065                                         randint(10));
5066
5067                                 /* Exercise a little care... */
5068                                 if (rand_int(20) == 0)
5069 #ifdef JP
5070                                         take_hit(DAMAGE_LOSELIFE, damroll(4, 10), "´í¸±¤ÊÈëÌ©", -1);
5071 #else
5072                                         take_hit(DAMAGE_LOSELIFE, damroll(4, 10), "perilous secrets", -1);
5073 #endif
5074                                 o_ptr->timeout = 0;
5075                                 break;
5076                         }
5077
5078                         case ART_BOROMIR:
5079                         {
5080                                 msg_print("You wind a mighty blast; your enemies tremble!");
5081                                 (void)turn_monsters((3 * p_ptr->lev / 2) + 10);
5082                                 o_ptr->timeout = rand_int(40) + 40;
5083                                 break;
5084                         }
5085                         case ART_FARAMIR:
5086                         {
5087 #ifdef JP
5088                                 msg_print("¤¢¤Ê¤¿¤Ï³²Ãî¤ò°ìÁݤ·¤¿¡£");
5089 #else
5090                                 msg_print("You exterminate small life.");
5091 #endif
5092                                 (void)dispel_monsters(4);
5093                                 o_ptr->timeout = rand_int(55) + 55;
5094                                 break;
5095                         }
5096
5097                         case ART_HIMRING:
5098                         {
5099 #ifdef JP
5100                                 msg_print("Æߤ¤²»¤¬ÊÕ¤ê¤òÊñ¤ß¤³¤ó¤À¡£");
5101 #else
5102                                 msg_print("A shrill wailing sound surrounds you.");
5103 #endif
5104                                 (void)set_protevil(randint(25) + p_ptr->lev, FALSE);
5105                                 o_ptr->timeout = rand_int(200) + 200;
5106                                 break;
5107                         }
5108
5109                         case ART_ICANUS:
5110                         {
5111
5112 #ifdef JP
5113                                 msg_print("¥í¡¼¥Ö¤¬½ã¿è¤ÊËâÎϤǿ̤¨¤¿¡£");
5114 #else
5115                                 msg_print("The robe pulsates with raw mana...");
5116 #endif
5117                                 if (!get_aim_dir(&dir)) return;
5118                                 fire_bolt(GF_MANA, dir, 120);
5119                                 o_ptr->timeout = rand_int(120) + 120;
5120                                 break;
5121                         }
5122                         case ART_HURIN:
5123                         {
5124                                 (void)set_fast(randint(50) + 50, FALSE);
5125                                 hp_player(10);
5126                                 set_afraid(0);
5127                                 set_hero(randint(50) + 50, FALSE);
5128                                 o_ptr->timeout = rand_int(200) + 100;
5129                                 break;
5130                         }
5131                         case ART_GIL_GALAD:
5132                         {
5133 #ifdef JP
5134                                 msg_print("¥·¡¼¥ë¥É¤¬âÁ¤·¤¤¸÷¤Çµ±¤¤¤¿¡¥¡¥¡¥");
5135 #else
5136                                 msg_print("Your shield gleams with blinding light...");
5137 #endif
5138                                 fire_ball(GF_LITE, 0, 300, 6);
5139                                 confuse_monsters(3 * p_ptr->lev / 2);
5140                                 o_ptr->timeout = 250;
5141                                 break;
5142                         }
5143                         case ART_YENDOR:
5144                         {
5145 #ifdef JP
5146                                 msg_print("¥«¡¼¥É¤¬Çò¤¯µ±¤¤¤¿¡¥¡¥¡¥");
5147 #else
5148                                 msg_print("Your card gleams with blinding light...");
5149 #endif
5150                                 if (!recharge(1000)) return;
5151                                 o_ptr->timeout = 200;
5152                                 break;
5153                         }
5154                         case ART_MURAMASA:
5155                         {
5156 #ifdef JP
5157                                 if (get_check("ËÜÅö¤Ë»È¤¤¤Þ¤¹¤«¡©"))
5158 #else
5159                                 if (get_check("Are you sure?!"))
5160 #endif
5161                                 {
5162 #ifdef JP
5163                                         msg_print("¼Àµ¤¬¿Ì¤¨¤¿¡¥¡¥¡¥");
5164 #else
5165                                         msg_print("The Muramasa pulsates...");
5166 #endif
5167                                         do_inc_stat(A_STR);
5168                                         if (one_in_(2))
5169                                         {
5170 #ifdef JP
5171                                                 msg_print("¼Àµ¤Ï²õ¤ì¤¿¡ª");
5172 #else
5173                                                 msg_print("The Muramasa is destroyed!");
5174 #endif
5175                                                 curse_weapon(TRUE, item);
5176                                         }
5177                                 }
5178                                 break;
5179                         }
5180                         case ART_FLY_STONE:
5181                         {
5182 #ifdef JP
5183                                 msg_print("ÀФ¬ÀÄÇò¤¯¸÷¤Ã¤¿¡¥¡¥¡¥");
5184 #else
5185                                 msg_print("Your stone glows pale...");
5186 #endif
5187
5188                                 if (!get_aim_dir(&dir)) return;
5189                                 fire_ball(GF_MANA, dir, 400, 4);
5190                                 o_ptr->timeout = rand_int(250) + 250;
5191                                 break;
5192                         }
5193                         case ART_TAIKOBO:
5194                         {
5195                                 int x, y;
5196
5197                                 if (!get_rep_dir2(&dir)) return;
5198                                 y = py+ddy[dir];
5199                                 x = px+ddx[dir];
5200                                 tsuri_dir = dir;
5201                                 if (!(cave[y][x].feat == FEAT_DEEP_WATER) && !(cave[y][x].feat == FEAT_SHAL_WATER))
5202                                 {
5203 #ifdef JP
5204                                         msg_print("¤½¤³¤ÏΦÃϤÀ¡£");
5205 #else
5206                                         msg_print("There is no fishing place.");
5207 #endif
5208                                         return;
5209                                 }
5210                                 else if (cave[y][x].m_idx)
5211                                 {
5212                                         char m_name[80];
5213                                         monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5214 #ifdef JP
5215                                         msg_format("%s¤¬¼ÙËâ¤À¡ª", m_name);
5216 #else
5217                                         msg_format("%^s is stand in your way.", m_name);
5218 #endif
5219                                         energy_use = 0;
5220                                         return;
5221                                 }
5222                                 set_action(ACTION_FISH);
5223                                 p_ptr->redraw |= (PR_STATE);
5224                                 break;
5225                         }
5226                         case ART_JONES:
5227                         {
5228                                 if (!get_aim_dir(&dir)) return;
5229 #ifdef JP
5230                                 msg_print("¥à¥Á¤ò¿­¤Ð¤·¤¿¡£");
5231 #else
5232                                 msg_print("You stretched your wip.");
5233 #endif
5234
5235                                 fetch(dir, 500, TRUE);
5236                                 o_ptr->timeout = rand_int(25) + 25;
5237                                 break;
5238                         }
5239                         case ART_ARRYU:
5240                         {
5241                                 bool pet = (randint(5) != 1);
5242
5243                                 if (summon_specific((pet ? -1 : 0), py, px, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, TRUE, FALSE, pet, FALSE, (bool)(!pet)))
5244                                 {
5245
5246                                         if (pet)
5247 #ifdef JP
5248                                                 msg_print("¥Ï¥¦¥ó¥É¤¬¤¢¤Ê¤¿¤Î²¼ËͤȤ·¤Æ½Ð¸½¤·¤¿¡£");
5249 #else
5250                                         msg_print("A group of hounds appear as your servant.");
5251 #endif
5252
5253                                         else
5254 #ifdef JP
5255                                                 msg_print("¥Ï¥¦¥ó¥É¤Ï¤¢¤Ê¤¿¤Ë²ç¤ò¸þ¤±¤Æ¤¤¤ë¡ª");
5256 #else
5257                                                 msg_print("A group of hounds appear as your enemy!");
5258 #endif
5259
5260                                 }
5261
5262                                 o_ptr->timeout = 300 + randint(150);
5263                                 break;
5264                         }
5265
5266                         case ART_GAEBOLG:
5267                         {
5268 #ifdef JP
5269                                 msg_print("¥¹¥Ô¥¢¤ÏâÁ¤·¤¯µ±¤¤¤¿...");
5270 #else
5271                                 msg_print("Your spear grows brightly...");
5272 #endif
5273
5274                                 if (!get_aim_dir(&dir)) return;
5275                                 fire_ball(GF_LITE, dir, 200, 3);
5276                                 o_ptr->timeout = rand_int(200) + 200;
5277                                 break;
5278                         }
5279
5280                         case ART_INROU:
5281                         {
5282                                 int count = 0, i;
5283                                 monster_type *m_ptr;
5284 #ifndef JP
5285                                 cptr kakusan = "";
5286 #endif
5287
5288                                 if (summon_named_creature(py, px, MON_SUKE, FALSE, FALSE, TRUE, TRUE))
5289                                 {
5290 #ifdef JP
5291                                         msg_print("¡Ø½õ¤µ¤ó¡Ù¤¬¸½¤ì¤¿¡£");
5292 #else
5293                                         msg_print("Suke-san apperars.");
5294                                         kakusan = "Suke-san";
5295 #endif
5296                                         count++;
5297                                 }
5298                                 if (summon_named_creature(py, px, MON_KAKU, FALSE, FALSE, TRUE, TRUE))
5299                                 {
5300 #ifdef JP
5301                                         msg_print("¡Ø³Ê¤µ¤ó¡Ù¤¬¸½¤ì¤¿¡£");
5302 #else
5303                                         msg_print("Kaku-san appears.");
5304                                         kakusan = "Kaku-san";
5305 #endif
5306                                         count++;
5307                                 }
5308                                 if (!count)
5309                                 {
5310                                         for (i = m_max - 1; i > 0; i--)
5311                                         {
5312                                                 m_ptr = &m_list[i];
5313                                                 if (!m_ptr->r_idx) continue;
5314                                                 if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
5315                                                 if (!los(m_ptr->fy, m_ptr->fx, py, px)) continue;
5316                                                 count++;
5317                                                 break;
5318                                         }
5319                                 }
5320
5321                                 if (count)
5322                                 {
5323 #ifdef JP
5324                                         msg_print("¡Ö¼Ô¤É¤â¡¢¤Ò¤«¤¨¤ª¤í¤¦¡ª¡ª¡ª¤³¤Î¤ªÊý¤ò¤É¤Ê¤¿¤È¤³¤³¤í¤¨¤ë¡£¡×");
5325 #else
5326                                         msg_format("%^s says 'WHO do you think this person is! Bow your head, down your knees!'", kakusan);
5327 #endif
5328
5329                                         sukekaku = TRUE;
5330                                         stun_monsters(120);
5331                                         confuse_monsters(120);
5332                                         turn_monsters(120);
5333                                         stasis_monsters(120);
5334                                         sukekaku = FALSE;
5335                                 }
5336                                 else
5337                                 {
5338 #ifdef JP
5339                                         msg_print("¤·¤«¤·¡¢²¿¤âµ¯¤­¤Ê¤«¤Ã¤¿¡£");
5340 #else
5341                                         msg_print("Nothing happen.");
5342 #endif
5343                                 }
5344                                 o_ptr->timeout = rand_int(150) + 150;
5345                                 break;
5346                         }
5347
5348                         case ART_HYOUSIGI:
5349                         {
5350 #ifdef JP
5351                                 msg_print("Çï»ÒÌÚ¤òÂǤä¿¡£");
5352 #else
5353                                 msg_print("You beat Your wooden clappers.");
5354 #endif
5355                                 aggravate_monsters(0);
5356                                 break;
5357                         }
5358
5359                         case ART_MATOI:
5360                         case ART_AEGISFANG:
5361                         {
5362                                 set_hero(randint(25)+25, FALSE);
5363                                 hp_player(10);
5364                                 o_ptr->timeout = rand_int(30) + 30;
5365                                 break;
5366                         }
5367
5368                         case ART_EARENDIL:
5369                         {
5370                                 (void)set_poisoned(0);
5371                                 (void)set_confused(0);
5372                                 (void)set_blind(0);
5373                                 (void)set_stun(0);
5374                                 (void)set_cut(0);
5375                                 (void)set_image(0);
5376
5377                                 o_ptr->timeout = 100;
5378                                 break;
5379                         }
5380
5381                         case ART_BOLISHOI:
5382                         {
5383                                 if (!get_aim_dir(&dir)) return;
5384                                 (void)charm_animal(dir, p_ptr->lev);
5385
5386                                 o_ptr->timeout = 200;
5387                                 break;
5388                         }
5389
5390                         case ART_ARUNRUTH:
5391                         {
5392 #ifdef JP
5393                                 msg_print("¥½¡¼¥É¤¬Ã¸¤¤¥Ö¥ë¡¼¤Ëµ±¤¤¤¿...");
5394 #else
5395                                 msg_print("Your sword glows a pale blue...");
5396 #endif
5397                                 if (!get_aim_dir(&dir)) return;
5398                                 fire_bolt(GF_COLD, dir, damroll(12, 8));
5399                                 o_ptr->timeout = 50;
5400                                 break;
5401                         }
5402                         case ART_BLOOD:
5403                         {
5404                                 int dummy, i;
5405 #ifdef JP
5406                                 msg_print("³ù¤¬ÌÀ¤ë¤¯µ±¤¤¤¿...");
5407 #else
5408                                 msg_print("Your scythe glows brightly!");
5409 #endif
5410                                 o_ptr->art_flags1 = a_info[ART_BLOOD].flags1;
5411                                 o_ptr->art_flags2 = a_info[ART_BLOOD].flags2;
5412                                 dummy = randint(2)+randint(2);
5413                                 for (i = 0; i < dummy; i++)
5414                                         o_ptr->art_flags1 |= (TR1_CHAOTIC << rand_int(18));
5415                                 dummy = randint(2);
5416                                 for (i = 0; i < dummy; i++)
5417                                         random_resistance(o_ptr, FALSE, randint(34) + 4);
5418                                 dummy = 2;
5419                                 for (i = 0; i < dummy; i++)
5420                                 {
5421                                         int tmp = rand_int(11);
5422                                         if (tmp < 6) o_ptr->art_flags1 |= (TR1_STR << tmp);
5423                                         else o_ptr->art_flags1 |= (TR1_STEALTH << (tmp - 6));
5424                                 }
5425                                 o_ptr->timeout = 3333;
5426                                 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5427                                 p_ptr->update |= (PU_BONUS | PU_HP);
5428                                 break;
5429                         }
5430                         case ART_KESHO:
5431                         {
5432 #ifdef JP
5433                                 msg_print("Î϶¯¤¯»Í¸Ô¤òƧ¤ó¤À¡£");
5434 #else
5435                                 msg_print("You stamp. (as if you are in a ring.)");
5436 #endif
5437                                 (void)set_hero(randint(20) + 20, FALSE);
5438                                 dispel_evil(p_ptr->lev * 3);
5439                                 o_ptr->timeout = 100 + randint(100);
5440                                 break;
5441                         }
5442                         case ART_MOOK:
5443                         {
5444 #ifdef JP
5445                                 msg_print("¥¯¥í¡¼¥¯¤¬Çò¤¯µ±¤¤¤¿...");
5446 #else
5447                                 msg_print("Your cloak grows white.");
5448 #endif
5449                                 (void)set_oppose_cold(randint(20) + 20, FALSE);
5450                                 o_ptr->timeout = 40 + randint(40);
5451                                 break;
5452                         }
5453                         case ART_VIOLET:
5454                         {
5455 #ifdef JP
5456                                 msg_print("¥à¥Á¤«¤é±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
5457 #else
5458                                 msg_print("The whip lets out a shrill wail...");
5459 #endif
5460
5461                                 k = 3 * p_ptr->lev;
5462                                 (void)set_protevil(randint(25) + k, FALSE);
5463                                 o_ptr->timeout = rand_int(225) + 225;
5464                                 break;
5465                         }
5466                         case ART_JIZO:
5467                         {
5468                                 bool pet = (randint(5) != 1);
5469
5470                                 if (summon_named_creature(py, px, MON_JIZOTAKO, FALSE, TRUE, FALSE, pet))
5471                                 {
5472                                         if (pet)
5473 #ifdef JP
5474                                                 msg_print("Âý¤¬¤¢¤Ê¤¿¤Î²¼ËͤȤ·¤Æ½Ð¸½¤·¤¿¡£");
5475 #else
5476                                         msg_print("A group of octopuses appear as your servant.");
5477 #endif
5478
5479                                         else
5480 #ifdef JP
5481                                                 msg_print("Âý¤Ï¤¢¤Ê¤¿¤òâˤó¤Ç¤¤¤ë¡ª");
5482 #else
5483                                                 msg_print("A group of octopuses appear as your enemy!");
5484 #endif
5485
5486                                 }
5487
5488                                 o_ptr->timeout = 300 + randint(150);
5489                                 break;
5490                         }
5491
5492                         case ART_FUNDIN:
5493                         {
5494 #ifdef JP
5495                                 msg_print("Å´µå¤ÏÊÕ¤ê¤òÁ±¤Î¥ª¡¼¥é¤ÇËþ¤¿¤·¤¿...");
5496 #else
5497                                 msg_print("The iron ball floods the area with goodness...");
5498 #endif
5499
5500                                 dispel_evil(p_ptr->lev * 5);
5501                                 o_ptr->timeout = rand_int(100) + 100;
5502                                 break;
5503                         }
5504
5505                         case ART_NIGHT:
5506                         {
5507 #ifdef JP
5508                                 msg_print("¥¢¥ß¥å¥ì¥Ã¥È¤¬¿¼¤¤°Ç¤Ëʤ¤ï¤ì¤¿...");
5509 #else
5510                                 msg_print("Your amulet is coverd in pitch-darkness...");
5511 #endif
5512                                 if (!get_aim_dir(&dir)) return;
5513                                 fire_ball(GF_DARK, dir, 250, 4);
5514                                 o_ptr->timeout = rand_int(150) + 150;
5515                                 break;
5516                         }
5517                 }
5518
5519                 /* Window stuff */
5520                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
5521
5522                 /* Done */
5523                 return;
5524         }
5525
5526         else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_ACID))
5527         {
5528                 (void)set_oppose_acid(randint(20) + 20, FALSE);
5529                 o_ptr->timeout = rand_int(50) + 50;
5530                 return;
5531         }
5532
5533         else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_ELEC))
5534         {
5535                 (void)set_oppose_elec(randint(20) + 20, FALSE);
5536                 o_ptr->timeout = rand_int(50) + 50;
5537                 return;
5538         }
5539
5540         else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_FIRE))
5541         {
5542                 (void)set_oppose_fire(randint(20) + 20, FALSE);
5543                 o_ptr->timeout = rand_int(50) + 50;
5544                 return;
5545         }
5546
5547         else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_COLD))
5548         {
5549                 (void)set_oppose_cold(randint(20) + 20, FALSE);
5550                 o_ptr->timeout = rand_int(50) + 50;
5551                 return;
5552         }
5553
5554         else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_EARTHQUAKE))
5555         {
5556                 earthquake(py, px, 5);
5557                 o_ptr->timeout = 100 + randint(100);
5558
5559                 /* Window stuff */
5560                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
5561
5562                 /* Done */
5563                 return;
5564         }
5565
5566
5567         else if (o_ptr->name2 == EGO_TRUMP)
5568         {
5569                 teleport_player(100);
5570                 o_ptr->timeout = 50 + randint(50);
5571
5572                 /* Window stuff */
5573                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
5574
5575                 /* Done */
5576                 return;
5577         }
5578
5579
5580         else if (o_ptr->name2 == EGO_LITE_ILLUMINATION)
5581         {
5582                 if (!o_ptr->xtra4 && ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
5583                 {
5584 #ifdef JP
5585                         msg_print("dzÎÁ¤¬¤Ê¤¤¡£");
5586 #else
5587                         msg_print("It has no fuel.");
5588 #endif
5589                         energy_use = 0;
5590                         return;
5591                 }
5592                 lite_area(damroll(2, 15), 3);
5593                 o_ptr->timeout = rand_int(10) + 10;
5594
5595                 /* Window stuff */
5596                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
5597
5598                 return;
5599         }
5600
5601
5602         else if (o_ptr->name2 == EGO_EARTHQUAKES)
5603         {
5604                 earthquake(py, px, 5);
5605                 o_ptr->timeout = 100 + randint(100);
5606
5607                 /* Window stuff */
5608                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
5609
5610                 /* Done */
5611                 return;
5612         }
5613
5614
5615         else if (o_ptr->name2 == EGO_JUMP)
5616         {
5617                 teleport_player(10);
5618                 o_ptr->timeout = 10 + randint(10);
5619
5620                 /* Window stuff */
5621                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
5622
5623                 /* Done */
5624                 return;
5625         }
5626
5627
5628         /* Hack -- Dragon Scale Mail can be activated as well */
5629         else if (o_ptr->tval == TV_DRAG_ARMOR)
5630         {
5631                 /* Get a direction for breathing (or abort) */
5632                 if (!get_aim_dir(&dir)) return;
5633
5634                 /* Branch on the sub-type */
5635                 switch (o_ptr->sval)
5636                 {
5637                         case SV_DRAGON_BLUE:
5638                         {
5639 #ifdef JP
5640                                 msg_print("¤¢¤Ê¤¿¤Ï°ðºÊ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
5641 #else
5642                                 msg_print("You breathe lightning.");
5643 #endif
5644
5645                                 fire_ball(GF_ELEC, dir, 100, -2);
5646                                 o_ptr->timeout = rand_int(150) + 150;
5647                                 break;
5648                         }
5649
5650                         case SV_DRAGON_WHITE:
5651                         {
5652 #ifdef JP
5653                                 msg_print("¤¢¤Ê¤¿¤ÏÎ䵤¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
5654 #else
5655                                 msg_print("You breathe frost.");
5656 #endif
5657
5658                                 fire_ball(GF_COLD, dir, 110, -2);
5659                                 o_ptr->timeout = rand_int(150) + 150;
5660                                 break;
5661                         }
5662
5663                         case SV_DRAGON_BLACK:
5664                         {
5665 #ifdef JP
5666                                 msg_print("¤¢¤Ê¤¿¤Ï»À¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
5667 #else
5668                                 msg_print("You breathe acid.");
5669 #endif
5670
5671                                 fire_ball(GF_ACID, dir, 130, -2);
5672                                 o_ptr->timeout = rand_int(150) + 150;
5673                                 break;
5674                         }
5675
5676                         case SV_DRAGON_GREEN:
5677                         {
5678 #ifdef JP
5679                                 msg_print("¤¢¤Ê¤¿¤ÏÆÇ¥¬¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
5680 #else
5681                                 msg_print("You breathe poison gas.");
5682 #endif
5683
5684                                 fire_ball(GF_POIS, dir, 150, -2);
5685                                 o_ptr->timeout = rand_int(180) + 180;
5686                                 break;
5687                         }
5688
5689                         case SV_DRAGON_RED:
5690                         {
5691 #ifdef JP
5692                                 msg_print("¤¢¤Ê¤¿¤Ï²Ð±ê¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
5693 #else
5694                                 msg_print("You breathe fire.");
5695 #endif
5696
5697                                 fire_ball(GF_FIRE, dir, 200, -2);
5698                                 o_ptr->timeout = rand_int(200) + 200;
5699                                 break;
5700                         }
5701
5702                         case SV_DRAGON_MULTIHUED:
5703                         {
5704                                 chance = rand_int(5);
5705 #ifdef JP
5706                                 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
5707                                            ((chance == 1) ? "°ðºÊ" :
5708                                             ((chance == 2) ? "Î䵤" :
5709                                              ((chance == 3) ? "»À" :
5710                                               ((chance == 4) ? "ÆÇ¥¬¥¹" : "²Ð±ê")))));
5711 #else
5712                                 msg_format("You breathe %s.",
5713                                            ((chance == 1) ? "lightning" :
5714                                             ((chance == 2) ? "frost" :
5715                                              ((chance == 3) ? "acid" :
5716                                               ((chance == 4) ? "poison gas" : "fire")))));
5717 #endif
5718
5719                                 fire_ball(((chance == 1) ? GF_ELEC :
5720                                            ((chance == 2) ? GF_COLD :
5721                                             ((chance == 3) ? GF_ACID :
5722                                              ((chance == 4) ? GF_POIS : GF_FIRE)))),
5723                                           dir, 250, -2);
5724                                 o_ptr->timeout = rand_int(200) + 200;
5725                                 break;
5726                         }
5727
5728                         case SV_DRAGON_BRONZE:
5729                         {
5730 #ifdef JP
5731                                 msg_print("¤¢¤Ê¤¿¤Ïº®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
5732 #else
5733                                 msg_print("You breathe confusion.");
5734 #endif
5735
5736                                 fire_ball(GF_CONFUSION, dir, 120, -2);
5737                                 o_ptr->timeout = rand_int(180) + 180;
5738                                 break;
5739                         }
5740
5741                         case SV_DRAGON_GOLD:
5742                         {
5743 #ifdef JP
5744                                 msg_print("¤¢¤Ê¤¿¤Ï¹ì²»¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
5745 #else
5746                                 msg_print("You breathe sound.");
5747 #endif
5748
5749                                 fire_ball(GF_SOUND, dir, 130, -2);
5750                                 o_ptr->timeout = rand_int(180) + 180;
5751                                 break;
5752                         }
5753
5754                         case SV_DRAGON_CHAOS:
5755                         {
5756                                 chance = rand_int(2);
5757 #ifdef JP
5758                                 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
5759                                            ((chance == 1 ? "¥«¥ª¥¹" : "Îô²½")));
5760 #else
5761                                 msg_format("You breathe %s.",
5762                                            ((chance == 1 ? "chaos" : "disenchantment")));
5763 #endif
5764
5765                                 fire_ball((chance == 1 ? GF_CHAOS : GF_DISENCHANT),
5766                                           dir, 220, -2);
5767                                 o_ptr->timeout = rand_int(200) + 200;
5768                                 break;
5769                         }
5770
5771                         case SV_DRAGON_LAW:
5772                         {
5773                                 chance = rand_int(2);
5774 #ifdef JP
5775                                 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
5776                                            ((chance == 1 ? "¹ì²»" : "ÇËÊÒ")));
5777 #else
5778                                 msg_format("You breathe %s.",
5779                                            ((chance == 1 ? "sound" : "shards")));
5780 #endif
5781
5782                                 fire_ball((chance == 1 ? GF_SOUND : GF_SHARDS),
5783                                           dir, 230, -2);
5784                                 o_ptr->timeout = rand_int(200) + 200;
5785                                 break;
5786                         }
5787
5788                         case SV_DRAGON_BALANCE:
5789                         {
5790                                 chance = rand_int(4);
5791 #ifdef JP
5792                                 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿",
5793                                            ((chance == 1) ? "¥«¥ª¥¹" :
5794                                             ((chance == 2) ? "Îô²½" :
5795                                              ((chance == 3) ? "¹ì²»" : "ÇËÊÒ"))));
5796 #else
5797                                 msg_format("You breathe %s.",
5798                                            ((chance == 1) ? "chaos" :
5799                                             ((chance == 2) ? "disenchantment" :
5800                                              ((chance == 3) ? "sound" : "shards"))));
5801 #endif
5802
5803                                 fire_ball(((chance == 1) ? GF_CHAOS :
5804                                            ((chance == 2) ? GF_DISENCHANT :
5805                                             ((chance == 3) ? GF_SOUND : GF_SHARDS))),
5806                                           dir, 250, -2);
5807                                 o_ptr->timeout = rand_int(200) + 200;
5808                                 break;
5809                         }
5810
5811                         case SV_DRAGON_SHINING:
5812                         {
5813                                 chance = rand_int(2);
5814 #ifdef JP
5815                                 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
5816                                            ((chance == 0 ? "Á®¸÷" : "°Å¹õ")));
5817 #else
5818                                 msg_format("You breathe %s.",
5819                                            ((chance == 0 ? "light" : "darkness")));
5820 #endif
5821
5822                                 fire_ball((chance == 0 ? GF_LITE : GF_DARK), dir, 200, -2);
5823                                 o_ptr->timeout = rand_int(200) + 200;
5824                                 break;
5825                         }
5826
5827                         case SV_DRAGON_POWER:
5828                         {
5829 #ifdef JP
5830 msg_print("¤¢¤Ê¤¿¤Ï¥¨¥ì¥á¥ó¥È¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
5831 #else
5832                                 msg_print("You breathe the elements.");
5833 #endif
5834
5835                                 fire_ball(GF_MISSILE, dir, 300, -3);
5836                                 o_ptr->timeout = rand_int(200) + 200;
5837                                 break;
5838                         }
5839                 }
5840
5841                 /* Window stuff */
5842                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
5843
5844                 /* Success */
5845                 return;
5846         }
5847
5848         else if (o_ptr->tval == TV_RING)
5849         {
5850                 if (o_ptr->name2)
5851                 {
5852                         bool success = TRUE;
5853
5854                         switch (o_ptr->name2)
5855                         {
5856                         case EGO_RING_HERO:
5857                                 (void)set_afraid(0);
5858                                 (void)set_hero(randint(25) + 25, FALSE);
5859                                 (void)hp_player(10);
5860                                 o_ptr->timeout = randint(100)+100;
5861                                 break;
5862                         case EGO_RING_MAGIC_MIS:
5863                                 if (!get_aim_dir(&dir)) return;
5864                                 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
5865                                 o_ptr->timeout = 2;
5866                                 break;
5867                         case EGO_RING_FIRE_BOLT:
5868                                 if (!get_aim_dir(&dir)) return;
5869                                 fire_bolt(GF_FIRE, dir, damroll(9, 8));
5870                                 o_ptr->timeout = rand_int(8) + 8;
5871                                 break;
5872                         case EGO_RING_COLD_BOLT:
5873                                 if (!get_aim_dir(&dir)) return;
5874                                 fire_bolt(GF_COLD, dir, damroll(6, 8));
5875                                 o_ptr->timeout = rand_int(7) + 7;
5876                                 break;
5877                         case EGO_RING_ELEC_BOLT:
5878                                 if (!get_aim_dir(&dir)) return;
5879                                 fire_bolt(GF_ELEC, dir, damroll(4, 8));
5880                                 o_ptr->timeout = rand_int(5) + 5;
5881                                 break;
5882                         case EGO_RING_ACID_BOLT:
5883                                 if (!get_aim_dir(&dir)) return;
5884                                 fire_bolt(GF_FIRE, dir, damroll(5, 8));
5885                                 o_ptr->timeout = rand_int(6) + 6;
5886                                 break;
5887                         case EGO_RING_MANA_BOLT:
5888                                 if (!get_aim_dir(&dir)) return;
5889                                 fire_bolt(GF_MANA, dir, 120);
5890                                 o_ptr->timeout = rand_int(120)+120;
5891                                 break;
5892                         case EGO_RING_FIRE_BALL:
5893                                 if (!get_aim_dir(&dir)) return;
5894                                 fire_ball(GF_FIRE, dir, 100, 2);
5895                                 o_ptr->timeout = rand_int(80) + 80;
5896                                 break;
5897                         case EGO_RING_COLD_BALL:
5898                                 if (!get_aim_dir(&dir)) return;
5899                                 fire_ball(GF_COLD, dir, 100, 2);
5900                                 o_ptr->timeout = rand_int(80) + 80;
5901                                 break;
5902                         case EGO_RING_ELEC_BALL:
5903                                 if (!get_aim_dir(&dir)) return;
5904                                 fire_ball(GF_ELEC, dir, 100, 2);
5905                                 o_ptr->timeout = rand_int(80) + 80;
5906                                 break;
5907                         case EGO_RING_ACID_BALL:
5908                                 if (!get_aim_dir(&dir)) return;
5909                                 fire_ball(GF_ACID, dir, 100, 2);
5910                                 o_ptr->timeout = rand_int(80) + 80;
5911                                 break;
5912                         case EGO_RING_MANA_BALL:
5913                                 if (!get_aim_dir(&dir)) return;
5914                                 fire_ball(GF_MANA, dir, 250, 2);
5915                                 o_ptr->timeout = 300;
5916                                 break;
5917                         case EGO_RING_DRAGON_F:
5918                                 if (!get_aim_dir(&dir)) return;
5919                                 fire_ball(GF_FIRE, dir, 200, -2);
5920                                 if (o_ptr->sval == SV_RING_FLAMES)
5921                                 {
5922                                         (void)set_oppose_fire(randint(20) + 20, FALSE);
5923                                         o_ptr->timeout = 200;
5924                                 }
5925                                 else o_ptr->timeout = 250;
5926                                 break;
5927                         case EGO_RING_DRAGON_C:
5928                                 if (!get_aim_dir(&dir)) return;
5929                                 fire_ball(GF_COLD, dir, 200, -2);
5930                                 if (o_ptr->sval == SV_RING_ICE)
5931                                 {
5932                                         (void)set_oppose_cold(randint(20) + 20, FALSE);
5933                                         o_ptr->timeout = 200;
5934                                 }
5935                                 else o_ptr->timeout = 250;
5936                                 break;
5937                         case EGO_RING_M_DETECT:
5938                                 (void)detect_monsters_invis(255);
5939                                 (void)detect_monsters_normal(255);
5940                                 o_ptr->timeout = 150;
5941                                 break;
5942                         case EGO_RING_D_SPEED:
5943                                 (void)set_fast(randint(30) + 15, FALSE);
5944                                 o_ptr->timeout = 100;
5945                                 break;
5946                         case EGO_RING_BERSERKER:
5947                                 (void)set_shero(randint(25) + 25, FALSE);
5948                                 o_ptr->timeout = rand_int(75)+75;
5949                                 break;
5950                         case EGO_RING_TELE_AWAY:
5951                                 if (!get_aim_dir(&dir)) return;
5952                                 teleport_monster(dir);
5953                                 o_ptr->timeout = 150;
5954                                 break;
5955                         case EGO_RING_TRUE:
5956                         {
5957                                 int v = randint(25)+25;
5958                                 (void)set_afraid(0);
5959                                 (void)set_hero(v, FALSE);
5960                                 (void)hp_player(10);
5961                                 (void)set_blessed(v, FALSE);
5962                                 (void)set_oppose_acid(v, FALSE);
5963                                 (void)set_oppose_elec(v, FALSE);
5964                                 (void)set_oppose_fire(v, FALSE);
5965                                 (void)set_oppose_cold(v, FALSE);
5966                                 (void)set_oppose_pois(v, FALSE);
5967                                 (void)set_ultimate_res(v, FALSE);
5968                                 o_ptr->timeout = 777;
5969                                 break;
5970                         }
5971                         default:
5972                                 success = FALSE;
5973                                 break;
5974                         }
5975                         if (success) return;
5976                 }
5977
5978                 /* Get a direction for breathing (or abort) */
5979                 if (!get_aim_dir(&dir)) return;
5980
5981                 switch (o_ptr->sval)
5982                 {
5983                         case SV_RING_ACID:
5984                         {
5985                                 fire_ball(GF_ACID, dir, 100, 2);
5986                                 (void)set_oppose_acid(randint(20) + 20, FALSE);
5987                                 o_ptr->timeout = rand_int(50) + 50;
5988                                 break;
5989                         }
5990
5991                         case SV_RING_ICE:
5992                         {
5993                                 fire_ball(GF_COLD, dir, 100, 2);
5994                                 (void)set_oppose_cold(randint(20) + 20, FALSE);
5995                                 o_ptr->timeout = rand_int(50) + 50;
5996                                 break;
5997                         }
5998
5999                         case SV_RING_FLAMES:
6000                         {
6001                                 fire_ball(GF_FIRE, dir, 100, 2);
6002                                 (void)set_oppose_fire(randint(20) + 20, FALSE);
6003                                 o_ptr->timeout = rand_int(50) + 50;
6004                                 break;
6005                         }
6006
6007                         case SV_RING_ELEC:
6008                         {
6009                                 fire_ball(GF_ELEC, dir, 100, 2);
6010                                 (void)set_oppose_elec(randint(20) + 20, FALSE);
6011                                 o_ptr->timeout = rand_int(50) + 50;
6012                                 break;
6013                         }
6014                 }
6015
6016                 /* Window stuff */
6017                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
6018
6019                 /* Success */
6020                 return;
6021         }
6022
6023         else if (o_ptr->tval == TV_AMULET)
6024         {
6025                 if (o_ptr->name2)
6026                 {
6027                         switch (o_ptr->name2)
6028                         {
6029                         case EGO_AMU_IDENT:
6030                                 if (!ident_spell(FALSE)) return;
6031                                 o_ptr->timeout = 10;
6032                                 break;
6033                         case EGO_AMU_CHARM:
6034                                 if (!get_aim_dir(&dir)) return;
6035                                 charm_monster(dir, MAX(20, p_ptr->lev));
6036                                 o_ptr->timeout = 200;
6037                                 break;
6038                         case EGO_AMU_JUMP:
6039                                 teleport_player(10);
6040                                 o_ptr->timeout = rand_int(10) + 10;
6041                                 break;
6042                         case EGO_AMU_TELEPORT:
6043                                 teleport_player(100);
6044                                 o_ptr->timeout = rand_int(50) + 50;
6045                                 break;
6046                         case EGO_AMU_D_DOOR:
6047                                 (void)dimension_door();
6048                                 o_ptr->timeout = 200;
6049                                 break;
6050                         case EGO_AMU_RES_FIRE_:
6051                                 (void)set_oppose_fire(randint(20) + 20, FALSE);
6052                                 o_ptr->timeout = rand_int(50) + 50;
6053                                 break;
6054                         case EGO_AMU_RES_COLD_:
6055                                 (void)set_oppose_cold(randint(20) + 20, FALSE);
6056                                 o_ptr->timeout = rand_int(50) + 50;
6057                                 break;
6058                         case EGO_AMU_RES_ELEC_:
6059                                 (void)set_oppose_elec(randint(20) + 20, FALSE);
6060                                 o_ptr->timeout = rand_int(50) + 50;
6061                                 break;
6062                         case EGO_AMU_RES_ACID_:
6063                                 (void)set_oppose_acid(randint(20) + 20, FALSE);
6064                                 o_ptr->timeout = rand_int(50) + 50;
6065                                 break;
6066                         case EGO_AMU_DETECTION:
6067                                 detect_all(DETECT_RAD_DEFAULT);
6068                                 o_ptr->timeout = rand_int(55)+55;
6069                                 break;
6070                         }
6071                 }
6072                 return;
6073         }
6074
6075         else if (o_ptr->tval == TV_WHISTLE)
6076         {
6077 #if 0
6078                 if (cursed_p(o_ptr))
6079                 {
6080 #ifdef JP
6081                         msg_print("¥«¥ó¹â¤¤²»¤¬¶Á¤­ÅϤä¿¡£");
6082 #else
6083                         msg_print("You produce a shrill whistling sound.");
6084 #endif
6085                         aggravate_monsters(0);
6086                 }
6087                 else
6088 #endif
6089                 {
6090                         int pet_ctr, i;
6091                         u16b *who;
6092                         int max_pet = 0;
6093                         u16b dummy_why;
6094
6095                         /* Allocate the "who" array */
6096                         C_MAKE(who, max_m_idx, u16b);
6097
6098                         /* Process the monsters (backwards) */
6099                         for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
6100                         {
6101                                 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
6102                                   who[max_pet++] = pet_ctr;
6103                         }
6104
6105                         /* Select the sort method */
6106                         ang_sort_comp = ang_sort_comp_pet;
6107                         ang_sort_swap = ang_sort_swap_hook;
6108
6109                         ang_sort(who, &dummy_why, max_pet);
6110
6111                         /* Process the monsters (backwards) */
6112                         for (i = 0; i < max_pet; i++)
6113                         {
6114                                 pet_ctr = who[i];
6115                                 teleport_to_player(pet_ctr, 100);
6116                         }
6117                 }
6118                 o_ptr->timeout = 100+randint(100);
6119                 return;
6120         }
6121         else if (o_ptr->tval == TV_CAPTURE)
6122         {
6123                 if(!o_ptr->pval)
6124                 {
6125                         bool old_target_pet = target_pet;
6126                         target_pet = TRUE;
6127                         if (!get_aim_dir(&dir))
6128                         {
6129                                 target_pet = old_target_pet;
6130                                 return;
6131                         }
6132                         target_pet = old_target_pet;
6133
6134                         if(fire_ball(GF_CAPTURE, dir, 0, 0))
6135                         {
6136                                 o_ptr->pval = cap_mon;
6137                                 o_ptr->xtra3 = cap_mspeed;
6138                                 o_ptr->xtra4 = cap_hp;
6139                                 o_ptr->xtra5 = cap_maxhp;
6140                                 if (cap_nickname)
6141                                 {
6142                                         cptr t;
6143                                         char *s;
6144                                         char buf[80] = "";
6145
6146                                         if (o_ptr->inscription)
6147                                                 strcpy(buf, quark_str(o_ptr->inscription));
6148                                         s = buf;
6149                                         for (s = buf;*s && (*s != '#'); s++)
6150                                         {
6151 #ifdef JP
6152                                                 if (iskanji(*s)) s++;
6153 #endif
6154                                         }
6155                                         *s = '#';
6156                                         s++;
6157 #ifdef JP
6158  /*nothing*/
6159 #else
6160                                         *s++ = '\'';
6161 #endif
6162                                         t = quark_str(cap_nickname);
6163                                         while (*t)
6164                                         {
6165                                                 *s = *t;
6166                                                 s++;
6167                                                 t++;
6168                                         }
6169 #ifdef JP
6170  /*nothing*/
6171 #else
6172                                         *s++ = '\'';
6173 #endif
6174                                         *s = '\0';
6175                                         o_ptr->inscription = quark_add(buf);
6176                                 }
6177                         }
6178                 }
6179                 else
6180                 {
6181                         bool success = FALSE;
6182                         if (!get_rep_dir2(&dir)) return;
6183                         if (cave_floor_bold(py+ddy[dir],px+ddx[dir]))
6184                         {
6185                                 if (place_monster_aux(py + ddy[dir], px + ddx[dir], o_ptr->pval, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE))
6186                                 {
6187                                         if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
6188                                         if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
6189                                         if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
6190                                         m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
6191                                         if (o_ptr->inscription)
6192                                         {
6193                                                 char buf[80];
6194                                                 cptr t;
6195 #ifndef JP
6196                                                 bool quote = FALSE;
6197 #endif
6198
6199                                                 t = quark_str(o_ptr->inscription);
6200                                                 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
6201                                                 {
6202 #ifdef JP
6203                                                         if (iskanji(*t)) t++;
6204 #endif
6205                                                 }
6206                                                 if (*t)
6207                                                 {
6208                                                         char *s = buf;
6209                                                         t++;
6210 #ifdef JP
6211                                                         /* nothing */
6212 #else
6213                                                         if (*t =='\'')
6214                                                         {
6215                                                                 t++;
6216                                                                 quote = TRUE;
6217                                                         }
6218 #endif
6219                                                         while(*t)
6220                                                         {
6221                                                                 *s = *t;
6222                                                                 t++;
6223                                                                 s++;
6224                                                         }
6225 #ifdef JP
6226                                                         /* nothing */
6227 #else
6228                                                         if (quote && *(s-1) =='\'')
6229                                                                 s--;
6230 #endif
6231                                                         *s = '\0';
6232                                                         m_list[hack_m_idx_ii].nickname = quark_add(buf);
6233                                                         t = quark_str(o_ptr->inscription);
6234                                                         s = buf;
6235                                                         while(*t && (*t != '#'))
6236                                                         {
6237                                                                 *s = *t;
6238                                                                 t++;
6239                                                                 s++;
6240                                                         }
6241                                                         *s = '\0';
6242                                                         o_ptr->inscription = quark_add(buf);
6243                                                 }
6244                                         }
6245                                         o_ptr->pval = 0;
6246                                         o_ptr->xtra3 = 0;
6247                                         o_ptr->xtra4 = 0;
6248                                         o_ptr->xtra5 = 0;
6249                                         success = TRUE;
6250                                 }
6251                         }
6252                         if (!success)
6253 #ifdef JP
6254                                 msg_print("¤ª¤Ã¤È¡¢²òÊü¤Ë¼ºÇÔ¤·¤¿¡£");
6255 #else
6256                                 msg_print("Oops.  You failed to release your pet.");
6257 #endif
6258                 }
6259                 return;
6260         }
6261
6262         /* Mistake */
6263 #ifdef JP
6264         msg_print("¤ª¤Ã¤È¡¢¤³¤Î¥¢¥¤¥Æ¥à¤Ï»ÏÆ°¤Ç¤­¤Ê¤¤¡£");
6265 #else
6266         msg_print("Oops.  That object cannot be activated.");
6267 #endif
6268
6269 }
6270
6271
6272 void do_cmd_activate(void)
6273 {
6274         int     item;
6275         cptr    q, s;
6276
6277
6278         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
6279         {
6280                 set_action(ACTION_NONE);
6281         }
6282
6283         item_tester_no_ryoute = TRUE;
6284         /* Prepare the hook */
6285         item_tester_hook = item_tester_hook_activate;
6286
6287         /* Get an item */
6288 #ifdef JP
6289         q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò»ÏÆ°¤µ¤»¤Þ¤¹¤«? ";
6290         s = "»ÏÆ°¤Ç¤­¤ë¥¢¥¤¥Æ¥à¤òÁõÈ÷¤·¤Æ¤¤¤Ê¤¤¡£";
6291 #else
6292         q = "Activate which item? ";
6293         s = "You have nothing to activate.";
6294 #endif
6295
6296         if (!get_item(&item, q, s, (USE_EQUIP))) return;
6297
6298         /* Activate the item */
6299         do_cmd_activate_aux(item);
6300 }
6301
6302
6303 /*
6304  * Hook to determine if an object is useable
6305  */
6306 static bool item_tester_hook_use(object_type *o_ptr)
6307 {
6308         u32b f1, f2, f3;
6309
6310         /* Ammo */
6311         if (o_ptr->tval == p_ptr->tval_ammo)
6312                 return (TRUE);
6313
6314         /* Useable object */
6315         switch (o_ptr->tval)
6316         {
6317                 case TV_SPIKE:
6318                 case TV_STAFF:
6319                 case TV_WAND:
6320                 case TV_ROD:
6321                 case TV_SCROLL:
6322                 case TV_POTION:
6323                 case TV_FOOD:
6324                 {
6325                         return (TRUE);
6326                 }
6327
6328                 default:
6329                 {
6330                         int i;
6331
6332                         /* Not known */
6333                         if (!object_known_p(o_ptr)) return (FALSE);
6334
6335                         /* HACK - only items from the equipment can be activated */
6336                         for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
6337                         {
6338                                 if (&inventory[i] == o_ptr)
6339                                 {
6340                                         /* Extract the flags */
6341                                         object_flags(o_ptr, &f1, &f2, &f3);
6342
6343                                         /* Check activation flag */
6344                                         if (f3 & TR3_ACTIVATE) return (TRUE);
6345                                 }
6346                         }
6347                 }
6348         }
6349
6350         /* Assume not */
6351         return (FALSE);
6352 }
6353
6354
6355 /*
6356  * Use an item
6357  * XXX - Add actions for other item types
6358  */
6359 void do_cmd_use(void)
6360 {
6361         int         item;
6362         object_type *o_ptr;
6363         cptr        q, s;
6364
6365         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
6366         {
6367                 set_action(ACTION_NONE);
6368         }
6369
6370         item_tester_no_ryoute = TRUE;
6371         /* Prepare the hook */
6372         item_tester_hook = item_tester_hook_use;
6373
6374         /* Get an item */
6375 #ifdef JP
6376 q = "¤É¤ì¤ò»È¤¤¤Þ¤¹¤«¡©";
6377 s = "»È¤¨¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£";
6378 #else
6379         q = "Use which item? ";
6380         s = "You have nothing to use.";
6381 #endif
6382
6383         if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR))) return;
6384
6385         /* Get the item (in the pack) */
6386         if (item >= 0)
6387         {
6388                 o_ptr = &inventory[item];
6389         }
6390         /* Get the item (on the floor) */
6391         else
6392         {
6393                 o_ptr = &o_list[0 - item];
6394         }
6395
6396         switch (o_ptr->tval)
6397         {
6398                 /* Spike a door */
6399                 case TV_SPIKE:
6400                 {
6401                         do_cmd_spike();
6402                         break;
6403                 }
6404
6405                 /* Eat some food */
6406                 case TV_FOOD:
6407                 {
6408                         do_cmd_eat_food_aux(item);
6409                         break;
6410                 }
6411
6412                 /* Aim a wand */
6413                 case TV_WAND:
6414                 {
6415                         do_cmd_aim_wand_aux(item);
6416                         break;
6417                 }
6418
6419                 /* Use a staff */
6420                 case TV_STAFF:
6421                 {
6422                         do_cmd_use_staff_aux(item);
6423                         break;
6424                 }
6425
6426                 /* Zap a rod */
6427                 case TV_ROD:
6428                 {
6429                         do_cmd_zap_rod_aux(item);
6430                         break;
6431                 }
6432
6433                 /* Quaff a potion */
6434                 case TV_POTION:
6435                 {
6436                         do_cmd_quaff_potion_aux(item);
6437                         break;
6438                 }
6439
6440                 /* Read a scroll */
6441                 case TV_SCROLL:
6442                 {
6443                         /* Check some conditions */
6444                         if (p_ptr->blind)
6445                         {
6446 #ifdef JP
6447 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡£");
6448 #else
6449                                 msg_print("You can't see anything.");
6450 #endif
6451
6452                                 return;
6453                         }
6454                         if (no_lite())
6455                         {
6456 #ifdef JP
6457 msg_print("ÌÀ¤«¤ê¤¬¤Ê¤¤¤Î¤Ç¡¢°Å¤¯¤ÆÆɤá¤Ê¤¤¡£");
6458 #else
6459                                 msg_print("You have no light to read by.");
6460 #endif
6461
6462                                 return;
6463                         }
6464                         if (p_ptr->confused)
6465                         {
6466 #ifdef JP
6467 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡ª");
6468 #else
6469                                 msg_print("You are too confused!");
6470 #endif
6471
6472                                 return;
6473                         }
6474
6475                   do_cmd_read_scroll_aux(item);
6476                   break;
6477                 }
6478
6479                 /* Fire ammo */
6480                 case TV_SHOT:
6481                 case TV_ARROW:
6482                 case TV_BOLT:
6483                 {
6484                         do_cmd_fire_aux(item, &inventory[INVEN_BOW]);
6485                         break;
6486                 }
6487
6488                 /* Activate an artifact */
6489                 default:
6490                 {
6491                         do_cmd_activate_aux(item);
6492                         break;
6493                 }
6494         }
6495 }
6496
6497 static bool select_magic_eater(int mode)
6498 {
6499         int ext=0;
6500         char choice;
6501         bool flag, redraw;
6502         int tval = 0;
6503         int             ask = TRUE, i = 0;
6504         char            out_val[160];
6505
6506         int menu_line = (use_menu ? 1 : 0);
6507
6508 #ifdef ALLOW_REPEAT
6509         int sn;
6510         if (repeat_pull(&sn))
6511         {
6512                 /* Verify the spell */
6513                 if (sn > 71 && !(p_ptr->magic_num1[sn] > k_info[lookup_kind(TV_ROD, i)].pval * (p_ptr->magic_num2[sn] - 1) * 0x10000L))
6514                         return sn;
6515                 else if (sn < 72 && !(p_ptr->magic_num1[sn] < 0x10000))
6516                         return sn;
6517         }
6518         
6519 #endif /* ALLOW_REPEAT */
6520
6521         for (i = 0; i < 108; i++)
6522         {
6523                 if (p_ptr->magic_num2[i]) break;
6524         }
6525         if (i == 108)
6526         {
6527 #ifdef JP
6528                 msg_print("ËâË¡¤ò³Ð¤¨¤Æ¤¤¤Ê¤¤¡ª");
6529 #else
6530                 msg_print("You don't have any magic!");
6531 #endif
6532                 return -1;
6533         }
6534
6535         if (use_menu)
6536         {
6537                 screen_save();
6538
6539                 while(!tval)
6540                 {
6541 #ifdef JP
6542                         prt(format(" %s ¾ó", (menu_line == 1) ? "¡Õ" : "  "), 2, 14);
6543                         prt(format(" %s ËâË¡ËÀ", (menu_line == 2) ? "¡Õ" : "  "), 3, 14);
6544                         prt(format(" %s ¥í¥Ã¥É", (menu_line == 3) ? "¡Õ" : "  "), 4, 14);
6545                         prt("¤É¤Î¼ïÎà¤ÎËâË¡¤ò»È¤¤¤Þ¤¹¤«¡©", 0, 0);
6546 #else
6547                         prt(format(" %s staff", (menu_line == 1) ? "> " : "  "), 2, 14);
6548                         prt(format(" %s wand", (menu_line == 2) ? "> " : "  "), 3, 14);
6549                         prt(format(" %s rod", (menu_line == 3) ? "> " : "  "), 4, 14);
6550                         prt("Which type of magic do you usu?", 0, 0);
6551 #endif
6552                         choice = inkey();
6553                         switch(choice)
6554                         {
6555                         case ESCAPE:
6556                         case 'z':
6557                         case 'Z':
6558                                 screen_load();
6559                                 return -1;
6560                         case '2':
6561                         case 'j':
6562                         case 'J':
6563                                 menu_line++;
6564                                 break;
6565                         case '8':
6566                         case 'k':
6567                         case 'K':
6568                                 menu_line+= 2;
6569                                 break;
6570                         case '\r':
6571                         case 'x':
6572                         case 'X':
6573                                 ext = (menu_line-1)*36;
6574                                 if (menu_line == 1) tval = TV_STAFF;
6575                                 else if (menu_line == 2) tval = TV_WAND;
6576                                 else tval = TV_ROD;
6577                                 break;
6578                         }
6579                         if (menu_line > 3) menu_line -= 3;
6580                 }
6581                 screen_load();
6582         }
6583         else
6584         {
6585         while (TRUE)
6586         {
6587 #ifdef JP
6588                 if (!get_com("[A] ¾ó, [B] ËâË¡ËÀ, [C] ¥í¥Ã¥É:", &choice, TRUE))
6589 #else
6590                 if (!get_com("[A] staff, [B] wand, [C] rod:", &choice, TRUE))
6591 #endif
6592                 {
6593                         return -1;
6594                 }
6595                 if (choice == 'A' || choice == 'a')
6596                 {
6597                         ext = 0;
6598                         tval = TV_STAFF;
6599                         break;
6600                 }
6601                 if (choice == 'B' || choice == 'b')
6602                 {
6603                         ext = 36;
6604                         tval = TV_WAND;
6605                         break;
6606                 }
6607                 if (choice == 'C' || choice == 'c')
6608                 {
6609                         ext = 72;
6610                         tval = TV_ROD;
6611                         break;
6612                 }
6613         }
6614         }
6615         for (i = ext; i < ext + 36; i++)
6616         {
6617                 if (p_ptr->magic_num2[i])
6618                 {
6619                         if (use_menu) menu_line = i-ext+1;
6620                         break;
6621                 }
6622         }
6623         if (i == ext+36)
6624         {
6625 #ifdef JP
6626                 msg_print("¤½¤Î¼ïÎà¤ÎËâË¡¤Ï³Ð¤¨¤Æ¤¤¤Ê¤¤¡ª");
6627 #else
6628                 msg_print("You don't have that type of magic!");
6629 #endif
6630                 return -1;
6631         }
6632
6633         /* Nothing chosen yet */
6634         flag = FALSE;
6635
6636         /* No redraw yet */
6637         redraw = FALSE;
6638
6639         /* Build a prompt */
6640 #ifdef JP
6641 (void) strnfmt(out_val, 78, "('*'¤Ç°ìÍ÷, ESC¤ÇÃæÃÇ) ¤É¤ÎËâÎϤò»È¤¤¤Þ¤¹¤«¡©");
6642 #else
6643         (void)strnfmt(out_val, 78, "(*=List, ESC=exit) Use which power? ");
6644 #endif
6645         if (use_menu) screen_save();
6646
6647         /* Get a spell from the user */
6648
6649         choice = (always_show_list || use_menu) ? ESCAPE:1;
6650         while (!flag)
6651         {
6652                 if( choice==ESCAPE ) choice = ' '; 
6653                 else if( !get_com(out_val, &choice, FALSE) )break; 
6654
6655                 if (use_menu && choice != ' ')
6656                 {
6657                         switch(choice)
6658                         {
6659                                 case '0':
6660                                 {
6661                                         screen_load();
6662                                         return (FALSE);
6663                                         break;
6664                                 }
6665
6666                                 case '8':
6667                                 case 'k':
6668                                 case 'K':
6669                                 {
6670                                         do
6671                                         {
6672                                                 menu_line += 35;
6673                                                 if (menu_line > 36) menu_line -= 36;
6674                                         } while(!p_ptr->magic_num2[menu_line+ext-1]);
6675                                         break;
6676                                 }
6677
6678                                 case '2':
6679                                 case 'j':
6680                                 case 'J':
6681                                 {
6682                                         do
6683                                         {
6684                                                 menu_line++;
6685                                                 if (menu_line > 36) menu_line -= 36;
6686                                         } while(!p_ptr->magic_num2[menu_line+ext-1]);
6687                                         break;
6688                                 }
6689
6690                                 case '4':
6691                                 case 'h':
6692                                 case 'H':
6693                                 case '6':
6694                                 case 'l':
6695                                 case 'L':
6696                                 {
6697                                         bool reverse = FALSE;
6698                                         if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
6699                                         if (menu_line > 18)
6700                                         {
6701                                                 menu_line -= 18;
6702                                                 reverse = TRUE;
6703                                         }
6704                                         else menu_line+=18;
6705                                         while(!p_ptr->magic_num2[menu_line+ext-1])
6706                                         {
6707                                                 if (reverse)
6708                                                 {
6709                                                         menu_line--;
6710                                                         if (menu_line < 2) reverse = FALSE;
6711                                                 }
6712                                                 else
6713                                                 {
6714                                                         menu_line++;
6715                                                         if (menu_line > 35) reverse = TRUE;
6716                                                 }
6717                                         }
6718                                         break;
6719                                 }
6720
6721                                 case 'x':
6722                                 case 'X':
6723                                 case '\r':
6724                                 {
6725                                         i = menu_line - 1;
6726                                         ask = FALSE;
6727                                         break;
6728                                 }
6729                         }
6730                 }
6731                 /* Request redraw */
6732                 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
6733                 {
6734                         /* Show the list */
6735                         if (!redraw || use_menu)
6736                         {
6737                                 byte y, x = 0;
6738                                 int ctr, chance;
6739                                 int k_idx;
6740                                 char dummy[80];
6741                                 int x1, y1, level;
6742                                 byte col;
6743
6744                                 strcpy(dummy, "");
6745
6746                                 /* Show list */
6747                                 redraw = TRUE;
6748
6749                                 /* Save the screen */
6750                                 if (!use_menu) screen_save();
6751
6752                                 for (y = 1; y < 20; y++)
6753                                         prt("", y, x);
6754
6755                                 y = 1;
6756
6757                                 /* Print header(s) */
6758 #ifdef JP
6759                                 prt(format("                           %s ¼ºÎ¨                           %s ¼ºÎ¨", (tval == TV_ROD ? "  ¾õÂÖ  " : "»ÈÍѲó¿ô"), (tval == TV_ROD ? "  ¾õÂÖ  " : "»ÈÍѲó¿ô")), y++, x);
6760 #else
6761                                 prt(format("                           %s Fail                           %s Fail", (tval == TV_ROD ? "  Stat  " : " Charges"), (tval == TV_ROD ? "  Stat  " : " Charges")), y++, x);
6762 #endif
6763
6764                                 /* Print list */
6765                                 for (ctr = 0; ctr < 36; ctr++)
6766                                 {
6767                                         if (!p_ptr->magic_num2[ctr+ext]) continue;
6768
6769                                         k_idx = lookup_kind(tval, ctr);
6770
6771                                         if (use_menu)
6772                                         {
6773                                                 if (ctr == (menu_line-1))
6774 #ifdef JP
6775                                                         strcpy(dummy, "¡Õ");
6776 #else
6777                                                         strcpy(dummy, "> ");
6778 #endif
6779                                                 else strcpy(dummy, "  ");
6780                                                 
6781                                         }
6782                                         /* letter/number for power selection */
6783                                         else
6784                                         {
6785                                                 char letter;
6786                                                 if (ctr < 26)
6787                                                         letter = I2A(ctr);
6788                                                 else
6789                                                         letter = '0' + ctr - 26;
6790                                                 sprintf(dummy, "%c)",letter);
6791                                         }
6792                                         x1 = ((ctr < 18) ? x : x + 40);
6793                                         y1 = ((ctr < 18) ? y + ctr : y + ctr - 18);
6794                                         level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
6795                                         chance = level * 4 / 5 + 20;
6796                                         chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
6797                                         level /= 2;
6798                                         if (p_ptr->lev > level)
6799                                         {
6800                                                 chance -= 3 * (p_ptr->lev - level);
6801                                         }
6802                                         if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance += 10;
6803                                         if (p_ptr->heavy_spell) chance += 20;
6804                                         if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
6805                                         else if (p_ptr->easy_spell) chance-=3;
6806                                         else if (p_ptr->dec_mana) chance-=2;
6807                                         chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
6808                                         /* Stunning makes spells harder */
6809                                         if (p_ptr->stun > 50) chance += 25;
6810                                         else if (p_ptr->stun) chance += 15;
6811
6812                                         if (chance > 95) chance = 95;
6813
6814                                         if(p_ptr->dec_mana) chance--;
6815                                         if (p_ptr->heavy_spell) chance += 5;
6816
6817                                         col = TERM_WHITE;
6818
6819                                         if (k_idx)
6820                                         {
6821                                                 if (tval == TV_ROD)
6822                                                 {
6823 strcat(dummy, format(
6824 #ifdef JP
6825         " %-22.22s ½¼Å¶:%2d/%2d%3d%%",
6826 #else
6827         " %-22.22s   (%2d/%2d) %3d%%",
6828 #endif
6829         k_name + k_info[k_idx].name, 
6830         p_ptr->magic_num1[ctr+ext] ? 
6831         (p_ptr->magic_num1[ctr+ext] - 1) / (0x10000L * k_info[k_idx].pval) +1 : 0, 
6832         p_ptr->magic_num2[ctr+ext], chance));
6833                                                         if (p_ptr->magic_num1[ctr+ext] > k_info[k_idx].pval * (p_ptr->magic_num2[ctr+ext]-1) * 0x10000L) col = TERM_RED;
6834                                                 }
6835                                                 else
6836                                                 {
6837                                                         strcat(dummy, format(" %-22.22s    %2d/%2d %3d%%", k_name + k_info[k_idx].name, (s16b)(p_ptr->magic_num1[ctr+ext]/0x10000), p_ptr->magic_num2[ctr+ext], chance));
6838                                                         if (p_ptr->magic_num1[ctr+ext] < 0x10000L) col = TERM_RED;
6839                                                 }
6840                                         }
6841                                         else
6842                                                 strcpy(dummy, "");
6843                                         c_prt(col, dummy, y1, x1);
6844                                 }
6845                         }
6846
6847                         /* Hide the list */
6848                         else
6849                         {
6850                                 /* Hide list */
6851                                 redraw = FALSE;
6852
6853                                 /* Restore the screen */
6854                                 screen_load();
6855                         }
6856
6857                         /* Redo asking */
6858                         continue;
6859                 }
6860
6861                 if (!use_menu)
6862                 {
6863                         if (isalpha(choice))
6864                         {
6865                                 /* Note verify */
6866                                 ask = (isupper(choice));
6867
6868                                 /* Lowercase */
6869                                 if (ask) choice = tolower(choice);
6870
6871                                 /* Extract request */
6872                                 i = (islower(choice) ? A2I(choice) : -1);
6873                         }
6874                         else
6875                         {
6876                                 ask = FALSE; /* Can't uppercase digits */
6877
6878                                 i = choice - '0' + 26;
6879                         }
6880                 }
6881
6882                 /* Totally Illegal */
6883                 if ((i < 0) || (i > 36) || !p_ptr->magic_num2[i+ext])
6884                 {
6885                         bell();
6886                         continue;
6887                 }
6888
6889                 if (mode == 0)
6890                 {
6891                         /* Verify it */
6892                         if (ask)
6893                         {
6894                                 char tmp_val[160];
6895
6896                                 /* Prompt */
6897 #ifdef JP
6898                                 (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡© ", k_name + k_info[lookup_kind(tval ,i)].name);
6899 #else
6900                                 (void) strnfmt(tmp_val, 78, "Use %s?", k_name + k_info[lookup_kind(tval ,i)].name);
6901 #endif
6902
6903                                 /* Belay that order */
6904                                 if (!get_check(tmp_val)) continue;
6905                         }
6906                         if (tval == TV_ROD)
6907                         {
6908                                 if (p_ptr->magic_num1[ext+i]  > k_info[lookup_kind(tval, i)].pval * (p_ptr->magic_num2[ext+i] - 1) * 0x10000L)
6909                                 {
6910 #ifdef JP
6911                                         msg_print("¤½¤ÎËâË¡¤Ï¤Þ¤À½¼Å¶¤·¤Æ¤¤¤ëºÇÃæ¤À¡£");
6912 #else
6913                                         msg_print("The magic are still charging.");
6914 #endif
6915                                         msg_print(NULL);
6916                                         if (use_menu) ask = TRUE;
6917                                         continue;
6918                                 }
6919                         }
6920                         else
6921                         {
6922                                 if (p_ptr->magic_num1[ext+i] < 0x10000L)
6923                                 {
6924 #ifdef JP
6925                                         msg_print("¤½¤ÎËâË¡¤Ï»ÈÍѲó¿ô¤¬ÀÚ¤ì¤Æ¤¤¤ë¡£");
6926 #else
6927                                         msg_print("The magic has no charges left.");
6928 #endif
6929                                         msg_print(NULL);
6930                                         if (use_menu) ask = TRUE;
6931                                         continue;
6932                                 }
6933                         }
6934                 }
6935
6936                 /* Stop the loop */
6937                 flag = TRUE;
6938         }
6939
6940         /* Restore the screen */
6941         if (redraw) screen_load();
6942
6943         if (!flag) return -1;
6944
6945 #ifdef ALLOW_REPEAT
6946         repeat_push(ext+i);
6947 #endif /* ALLOW_REPEAT */
6948         return ext+i;
6949 }
6950
6951 void do_cmd_magic_eater(void)
6952 {
6953         int item, dir, chance, level, k_idx, tval, sval;
6954         bool use_charge = TRUE;
6955
6956         /* Not when confused */
6957         if (p_ptr->confused)
6958         {
6959 #ifdef JP
6960 msg_print("º®Í𤷤Ƥ¤¤Æ¾§¤¨¤é¤ì¤Ê¤¤¡ª");
6961 #else
6962                 msg_print("You are too confused!");
6963 #endif
6964
6965                 return;
6966         }
6967
6968         item = select_magic_eater(0);
6969         if (item == -1)
6970         {
6971                 energy_use = 0;
6972                 return;
6973         }
6974         if (item > 71) {tval = TV_ROD;sval = item - 72;}
6975         else if (item > 35) {tval = TV_WAND;sval = item - 36;}
6976         else {tval = TV_STAFF;sval = item;}
6977         k_idx = lookup_kind(tval, sval);
6978
6979         level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
6980         chance = level * 4 / 5 + 20;
6981         chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
6982         level /= 2;
6983         if (p_ptr->lev > level)
6984         {
6985                 chance -= 3 * (p_ptr->lev - level);
6986         }
6987         if (p_ptr->pseikaku == SEIKAKU_NAMAKE) chance += 10;
6988         if (p_ptr->heavy_spell) chance += 20;
6989         if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
6990         else if (p_ptr->easy_spell) chance-=3;
6991         else if (p_ptr->dec_mana) chance-=2;
6992         chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
6993         /* Stunning makes spells harder */
6994         if (p_ptr->stun > 50) chance += 25;
6995         else if (p_ptr->stun) chance += 15;
6996
6997         if (chance > 95) chance = 95;
6998
6999         if(p_ptr->dec_mana) chance--;
7000         if (p_ptr->heavy_spell) chance += 5;
7001
7002         if (rand_int(100) < chance)
7003         {
7004                 if (flush_failure) flush();
7005
7006 #ifdef JP
7007 msg_print("¼öʸ¤ò¤¦¤Þ¤¯¾§¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡ª");
7008 #else
7009                 msg_format("You failed to get the magic off!");
7010 #endif
7011
7012                 sound(SOUND_FAIL);
7013                 if (randint(100) >= chance)
7014                         chg_virtue(V_CHANCE,-1);
7015                 energy_use = 100;
7016
7017                 return;
7018         }
7019         else
7020         {
7021                 if (tval == TV_ROD)
7022                 {
7023                         if ((sval >= SV_ROD_MIN_DIRECTION) && (sval != SV_ROD_HAVOC) && (sval != SV_ROD_AGGRAVATE) && (sval != SV_ROD_PESTICIDE))
7024                                 if (!get_aim_dir(&dir)) return;
7025                         rod_effect(sval, dir, &use_charge, TRUE);
7026                         if (!use_charge) return;
7027                 }
7028                 else if (tval == TV_WAND)
7029                 {
7030                         if (!get_aim_dir(&dir)) return;
7031                         wand_effect(sval, dir, TRUE);
7032                 }
7033                 else
7034                 {
7035                         staff_effect(sval, &use_charge, TRUE);
7036                         if (!use_charge) return;
7037                 }
7038                 if (randint(100) < chance)
7039                         chg_virtue(V_CHANCE,1);
7040         }
7041         energy_use = 100;
7042         if (tval == TV_ROD) p_ptr->magic_num1[item] += k_info[k_idx].pval * 0x10000L;
7043         else p_ptr->magic_num1[item] -= 0x10000L;
7044 }