OSDN Git Service

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