OSDN Git Service

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