OSDN Git Service

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