OSDN Git Service

2661d256ef8a9e258d9a0645eeb37ccc7d17f960
[hengband/hengband.git] / src / cmd-activate.c
1 /*!
2 * @file cmd-activate.c
3 * @brief プレイヤーの発動コマンド実装
4 * @date 2018/09/07
5 * @details
6 * cmd6.cより分離。
7 */
8
9 #include "angband.h"
10 #include "cmd-activate.h"
11 #include "object-hook.h"
12 #include "spells-summon.h"
13
14 /*!
15 * @brief ペット入りモンスターボールをソートするための比較関数
16 * @param u 所持品配列の参照ポインタ
17 * @param v 未使用
18 * @param a 所持品ID1
19 * @param b 所持品ID2
20 * @return 1の方が大であればTRUE
21 */
22 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
23 {
24         u16b *who = (u16b*)(u);
25
26         int w1 = who[a];
27         int w2 = who[b];
28
29         monster_type *m_ptr1 = &m_list[w1];
30         monster_type *m_ptr2 = &m_list[w2];
31         monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
32         monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
33
34         /* Unused */
35         (void)v;
36
37         if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
38         if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
39
40         if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
41         if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
42
43         if (r_ptr1->level > r_ptr2->level) return TRUE;
44         if (r_ptr2->level > r_ptr1->level) return FALSE;
45
46         if (m_ptr1->hp > m_ptr2->hp) return TRUE;
47         if (m_ptr2->hp > m_ptr1->hp) return FALSE;
48
49         return w1 <= w2;
50 }
51
52
53 /*!
54  * @brief 装備を発動するコマンドのサブルーチン /
55  * Activate a wielded object.  Wielded objects never stack.
56  * And even if they did, activatable objects never stack.
57  * @param item 発動するオブジェクトの所持品ID
58  * @return なし
59  * @details
60  * <pre>
61  * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
62  * But one could, for example, easily make an activatable "Ring of Plasma".
63  * Note that it always takes a turn to activate an artifact, even if
64  * the user hits "escape" at the "direction" prompt.
65  * </pre>
66  */
67 void do_cmd_activate_aux(INVENTORY_IDX item)
68 {
69         DIRECTION dir;
70         DEPTH lev;
71         int chance, fail;
72         object_type *o_ptr;
73         bool success;
74
75
76         /* Get the item (in the pack) */
77         if (item >= 0)
78         {
79                 o_ptr = &inventory[item];
80         }
81
82         /* Get the item (on the floor) */
83         else
84         {
85                 o_ptr = &o_list[0 - item];
86         }
87
88         p_ptr->energy_use = 100;
89
90         /* Extract the item level */
91         lev = k_info[o_ptr->k_idx].level;
92
93         /* Hack -- use artifact level instead */
94         if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
95         else if (object_is_random_artifact(o_ptr))
96         {
97                 const activation_type* const act_ptr = find_activation_info(o_ptr);
98                 if (act_ptr) {
99                         lev = act_ptr->level;
100                 }
101         }
102         else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
103
104         /* Base chance of success */
105         chance = p_ptr->skill_dev;
106
107         /* Confusion hurts skill */
108         if (p_ptr->confused) chance = chance / 2;
109
110         fail = lev+5;
111         if (chance > fail) fail -= (chance - fail)*2;
112         else chance -= (fail - chance)*2;
113         if (fail < USE_DEVICE) fail = USE_DEVICE;
114         if (chance < USE_DEVICE) chance = USE_DEVICE;
115
116         if (world_player)
117         {
118                 if (flush_failure) flush();
119                 msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
120                 sound(SOUND_FAIL);
121                 return;
122         }
123
124         if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
125         else if (chance > fail)
126         {
127                 if (randint0(chance*2) < fail) success = FALSE;
128                 else success = TRUE;
129         }
130         else
131         {
132                 if (randint0(fail*2) < chance) success = TRUE;
133                 else success = FALSE;
134         }
135
136         /* Roll for usage */
137         if (!success)
138         {
139                 if (flush_failure) flush();
140                 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
141                 sound(SOUND_FAIL);
142                 return;
143         }
144
145         /* Check the recharge */
146         if (o_ptr->timeout)
147         {
148                 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
149                 return;
150         }
151
152         /* Some lights need enough fuel for activation */
153         if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
154                 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
155         {
156                 msg_print(_("燃料がない。", "It has no fuel."));
157                 p_ptr->energy_use = 0;
158                 return;
159         }
160
161         /* Activate the artifact */
162         msg_print(_("始動させた...", "You activate it..."));
163
164         sound(SOUND_ZAP);
165
166         /* Activate object */
167         if (activation_index(o_ptr))
168         {
169                 (void)activate_artifact(o_ptr);
170
171                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
172
173                 /* Success */
174                 return;
175         }
176
177         /* Special items */
178         else if (o_ptr->tval == TV_WHISTLE)
179         {
180                 if (music_singing_any()) stop_singing();
181                 if (hex_spelling_any()) stop_hex_spell_all();
182
183                 {
184                         IDX pet_ctr, i;
185                         IDX *who;
186                         int max_pet = 0;
187                         u16b dummy_why;
188
189                         /* Allocate the "who" array */
190                         C_MAKE(who, max_m_idx, IDX);
191
192                         /* Process the monsters (backwards) */
193                         for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
194                         {
195                                 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
196                                   who[max_pet++] = pet_ctr;
197                         }
198
199                         /* Select the sort method */
200                         ang_sort_comp = ang_sort_comp_pet;
201                         ang_sort_swap = ang_sort_swap_hook;
202
203                         ang_sort(who, &dummy_why, max_pet);
204
205                         /* Process the monsters (backwards) */
206                         for (i = 0; i < max_pet; i++)
207                         {
208                                 pet_ctr = who[i];
209                                 teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
210                         }
211
212                         /* Free the "who" array */
213                         C_KILL(who, max_m_idx, IDX);
214                 }
215                 o_ptr->timeout = 100 + randint1(100);
216                 return;
217         }
218         else if (o_ptr->tval == TV_CAPTURE)
219         {
220                 if(!o_ptr->pval)
221                 {
222                         bool old_target_pet = target_pet;
223                         target_pet = TRUE;
224                         if (!get_aim_dir(&dir))
225                         {
226                                 target_pet = old_target_pet;
227                                 return;
228                         }
229                         target_pet = old_target_pet;
230
231                         if(fire_ball(GF_CAPTURE, dir, 0, 0))
232                         {
233                                 o_ptr->pval = (PARAMETER_VALUE)cap_mon;
234                                 o_ptr->xtra3 = (XTRA8)cap_mspeed;
235                                 o_ptr->xtra4 = (XTRA16)cap_hp;
236                                 o_ptr->xtra5 = (XTRA16)cap_maxhp;
237                                 if (cap_nickname)
238                                 {
239                                         cptr t;
240                                         char *s;
241                                         char buf[80] = "";
242
243                                         if (o_ptr->inscription)
244                                                 strcpy(buf, quark_str(o_ptr->inscription));
245                                         s = buf;
246                                         for (s = buf;*s && (*s != '#'); s++)
247                                         {
248 #ifdef JP
249                                                 if (iskanji(*s)) s++;
250 #endif
251                                         }
252                                         *s = '#';
253                                         s++;
254 #ifdef JP
255  /*nothing*/
256 #else
257                                         *s++ = '\'';
258 #endif
259                                         t = quark_str(cap_nickname);
260                                         while (*t)
261                                         {
262                                                 *s = *t;
263                                                 s++;
264                                                 t++;
265                                         }
266 #ifdef JP
267  /*nothing*/
268 #else
269                                         *s++ = '\'';
270 #endif
271                                         *s = '\0';
272                                         o_ptr->inscription = quark_add(buf);
273                                 }
274                         }
275                 }
276                 else
277                 {
278                         success = FALSE;
279                         if (!get_direction(&dir, FALSE, FALSE)) return;
280                         if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
281                         {
282                                 if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
283                                 {
284                                         if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
285                                         if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
286                                         if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
287                                         m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
288                                         if (o_ptr->inscription)
289                                         {
290                                                 char buf[80];
291                                                 cptr t;
292 #ifndef JP
293                                                 bool quote = FALSE;
294 #endif
295
296                                                 t = quark_str(o_ptr->inscription);
297                                                 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
298                                                 {
299 #ifdef JP
300                                                         if (iskanji(*t)) t++;
301 #endif
302                                                 }
303                                                 if (*t)
304                                                 {
305                                                         char *s = buf;
306                                                         t++;
307 #ifdef JP
308                                                         /* nothing */
309 #else
310                                                         if (*t =='\'')
311                                                         {
312                                                                 t++;
313                                                                 quote = TRUE;
314                                                         }
315 #endif
316                                                         while(*t)
317                                                         {
318                                                                 *s = *t;
319                                                                 t++;
320                                                                 s++;
321                                                         }
322 #ifdef JP
323                                                         /* nothing */
324 #else
325                                                         if (quote && *(s-1) =='\'')
326                                                                 s--;
327 #endif
328                                                         *s = '\0';
329                                                         m_list[hack_m_idx_ii].nickname = quark_add(buf);
330                                                         t = quark_str(o_ptr->inscription);
331                                                         s = buf;
332                                                         while(*t && (*t != '#'))
333                                                         {
334                                                                 *s = *t;
335                                                                 t++;
336                                                                 s++;
337                                                         }
338                                                         *s = '\0';
339                                                         o_ptr->inscription = quark_add(buf);
340                                                 }
341                                         }
342                                         o_ptr->pval = 0;
343                                         o_ptr->xtra3 = 0;
344                                         o_ptr->xtra4 = 0;
345                                         o_ptr->xtra5 = 0;
346                                         success = TRUE;
347                                 }
348                         }
349                         if (!success)
350                                 msg_print(_("おっと、解放に失敗した。", "Oops.  You failed to release your pet."));
351                 }
352                 calc_android_exp();
353                 return;
354         }
355
356         /* Mistake */
357         msg_print(_("おっと、このアイテムは始動できない。", "Oops.  That object cannot be activated."));
358 }
359
360 /*!
361  * @brief 装備を発動するコマンドのメインルーチン /
362  * @return なし
363  */
364 void do_cmd_activate(void)
365 {
366         OBJECT_IDX item;
367         cptr q, s;
368
369         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
370         {
371                 set_action(ACTION_NONE);
372         }
373
374         item_tester_hook = item_tester_hook_activate;
375
376         q = _("どのアイテムを始動させますか? ", "Activate which item? ");
377         s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
378
379         if (!get_item(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
380
381         /* Activate the item */
382         do_cmd_activate_aux(item);
383 }
384
385 /*!
386 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
387 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
388 * @param o_ptr 対象のオブジェクト構造体ポインタ
389 * @return 発動実行の是非を返す。
390 */
391 static bool activate_dragon_breath(object_type *o_ptr)
392 {
393         BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
394         int type[20];
395         cptr name[20];
396         int i, t, n = 0;
397         DIRECTION dir;
398
399         if (!get_aim_dir(&dir)) return FALSE;
400
401         object_flags(o_ptr, flgs);
402
403         for (i = 0; dragonbreath_info[i].flag != 0; i++)
404         {
405                 if (have_flag(flgs, dragonbreath_info[i].flag))
406                 {
407                         type[n] = dragonbreath_info[i].type;
408                         name[n] = dragonbreath_info[i].name;
409                         n++;
410                 }
411         }
412
413         /* Paranoia */
414         if (n == 0) return FALSE;
415
416         /* Stop speaking */
417         if (music_singing_any()) stop_singing();
418         if (hex_spelling_any()) stop_hex_spell_all();
419
420         t = randint0(n);
421         msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
422         fire_breath(type[t], dir, 250, 4);
423
424         return TRUE;
425 }
426
427 /*!
428  * @brief アイテムの発動効果を処理する。
429  * @param o_ptr 対象のオブジェクト構造体ポインタ
430  * @return 発動実行の是非を返す。
431  */
432 bool activate_artifact(object_type *o_ptr)
433 {
434         PLAYER_LEVEL plev = p_ptr->lev;
435         int k, dummy = 0;
436         DIRECTION dir;
437         cptr name = k_name + k_info[o_ptr->k_idx].name;
438         const activation_type* const act_ptr = find_activation_info(o_ptr);
439
440         /* Paranoia */
441         if (!act_ptr) {
442                 /* Maybe forgot adding information to activation_info table ? */
443                 msg_print("Activation information is not found.");
444                 return FALSE;
445         }
446
447         /* Activate for attack */
448         switch (act_ptr->index)
449         {
450         case ACT_SUNLIGHT:
451         {
452                 if (!get_aim_dir(&dir)) return FALSE;
453                 msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
454                 (void)lite_line(dir, damroll(6, 8));
455                 break;
456         }
457
458         case ACT_BO_MISS_1:
459         {
460                 msg_print(_("それは眩しいくらいに明るく輝いている...", "It glows extremely brightly..."));
461                 if (!get_aim_dir(&dir)) return FALSE;
462                 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
463                 break;
464         }
465
466         case ACT_BA_POIS_1:
467         {
468                 msg_print(_("それは濃緑色に脈動している...", "It throbs deep green..."));
469                 if (!get_aim_dir(&dir)) return FALSE;
470                 fire_ball(GF_POIS, dir, 12, 3);
471                 break;
472         }
473
474         case ACT_BO_ELEC_1:
475         {
476                 msg_print(_("それは火花に覆われた...", "It is covered in sparks..."));
477                 if (!get_aim_dir(&dir)) return FALSE;
478                 fire_bolt(GF_ELEC, dir, damroll(4, 8));
479                 break;
480         }
481
482         case ACT_BO_ACID_1:
483         {
484                 msg_print(_("それは酸に覆われた...", "It is covered in acid..."));
485                 if (!get_aim_dir(&dir)) return FALSE;
486                 fire_bolt(GF_ACID, dir, damroll(5, 8));
487                 break;
488         }
489
490         case ACT_BO_COLD_1:
491         {
492                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
493                 if (!get_aim_dir(&dir)) return FALSE;
494                 fire_bolt(GF_COLD, dir, damroll(6, 8));
495                 break;
496         }
497
498         case ACT_BO_FIRE_1:
499         {
500                 msg_print(_("それは炎に覆われた...", "It is covered in fire..."));
501                 if (!get_aim_dir(&dir)) return FALSE;
502                 fire_bolt(GF_FIRE, dir, damroll(9, 8));
503                 break;
504         }
505
506         case ACT_BA_COLD_1:
507         {
508                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
509                 if (!get_aim_dir(&dir)) return FALSE;
510                 fire_ball(GF_COLD, dir, 48, 2);
511                 break;
512         }
513
514         case ACT_BA_COLD_2:
515         {
516                 msg_print(_("それは青く激しく輝いた...", "It glows an intense blue..."));
517                 if (!get_aim_dir(&dir)) return FALSE;
518                 fire_ball(GF_COLD, dir, 100, 2);
519                 break;
520         }
521
522         case ACT_BA_COLD_3:
523         {
524                 msg_print(_("明るく白色に輝いている...", "It glows bright white..."));
525                 if (!get_aim_dir(&dir)) return FALSE;
526                 fire_ball(GF_COLD, dir, 400, 3);
527                 break;
528         }
529
530         case ACT_BA_FIRE_1:
531         {
532                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
533                 if (!get_aim_dir(&dir)) return FALSE;
534                 fire_ball(GF_FIRE, dir, 72, 2);
535                 break;
536         }
537
538         case ACT_BA_FIRE_2:
539         {
540                 msg_format(_("%sから炎が吹き出した...", "The %s rages in fire..."), name);
541                 if (!get_aim_dir(&dir)) return FALSE;
542                 fire_ball(GF_FIRE, dir, 120, 3);
543                 break;
544         }
545
546         case ACT_BA_FIRE_3:
547         {
548                 msg_print(_("深赤色に輝いている...", "It glows deep red..."));
549                 if (!get_aim_dir(&dir)) return FALSE;
550                 fire_ball(GF_FIRE, dir, 300, 3);
551                 break;
552         }
553
554         case ACT_BA_FIRE_4:
555         {
556                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
557                 if (!get_aim_dir(&dir)) return FALSE;
558                 fire_ball(GF_FIRE, dir, 100, 2);
559                 break;
560         }
561
562         case ACT_BA_ELEC_2:
563         {
564                 msg_print(_("電気がパチパチ音を立てた...", "It crackles with electricity..."));
565                 if (!get_aim_dir(&dir)) return FALSE;
566                 fire_ball(GF_ELEC, dir, 100, 3);
567                 break;
568         }
569
570         case ACT_BA_ELEC_3:
571         {
572                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
573                 if (!get_aim_dir(&dir)) return FALSE;
574                 fire_ball(GF_ELEC, dir, 500, 3);
575                 break;
576         }
577
578         case ACT_BA_ACID_1:
579         {
580                 msg_print(_("それは黒く激しく輝いた...", "It glows an intense black..."));
581                 if (!get_aim_dir(&dir)) return FALSE;
582                 fire_ball(GF_ACID, dir, 100, 2);
583                 break;
584         }
585
586         case ACT_BA_NUKE_1:
587         {
588                 msg_print(_("それは緑に激しく輝いた...", "It glows an intense green..."));
589                 if (!get_aim_dir(&dir)) return FALSE;
590                 fire_ball(GF_NUKE, dir, 100, 2);
591                 break;
592         }
593
594         case ACT_HYPODYNAMIA_1:
595         {
596                 msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
597                 if (!get_aim_dir(&dir)) return FALSE;
598                 if (hypodynamic_bolt(dir, 100))
599                         break;
600         }
601
602         case ACT_HYPODYNAMIA_2:
603         {
604                 msg_print(_("黒く輝いている...", "It glows black..."));
605                 if (!get_aim_dir(&dir)) return FALSE;
606                 hypodynamic_bolt(dir, 120);
607                 break;
608         }
609
610         case ACT_DRAIN_1:
611         {
612                 if (!get_aim_dir(&dir)) return FALSE;
613                 for (dummy = 0; dummy < 3; dummy++)
614                 {
615                         if (hypodynamic_bolt(dir, 50))
616                                 hp_player(50);
617                 }
618                 break;
619         }
620
621         case ACT_BO_MISS_2:
622         {
623                 msg_print(_("魔法のトゲが現れた...", "It grows magical spikes..."));
624                 if (!get_aim_dir(&dir)) return FALSE;
625                 fire_bolt(GF_ARROW, dir, 150);
626                 break;
627         }
628
629         case ACT_WHIRLWIND:
630         {
631                 massacre();
632                 break;
633         }
634
635         case ACT_DRAIN_2:
636         {
637                 if (!get_aim_dir(&dir)) return FALSE;
638                 for (dummy = 0; dummy < 3; dummy++)
639                 {
640                         if (hypodynamic_bolt(dir, 100))
641                                 hp_player(100);
642                 }
643                 break;
644         }
645
646
647         case ACT_CALL_CHAOS:
648         {
649                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
650                 call_chaos();
651                 break;
652         }
653
654         case ACT_ROCKET:
655         {
656                 if (!get_aim_dir(&dir)) return FALSE;
657                 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
658                 fire_ball(GF_ROCKET, dir, 250 + plev * 3, 2);
659                 break;
660         }
661
662         case ACT_DISP_EVIL:
663         {
664                 msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
665                 dispel_evil(p_ptr->lev * 5);
666                 break;
667         }
668
669         case ACT_BA_MISS_3:
670         {
671                 if (!get_aim_dir(&dir)) return FALSE;
672                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
673                 fire_breath(GF_MISSILE, dir, 300, 4);
674                 break;
675         }
676
677         case ACT_DISP_GOOD:
678         {
679                 msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
680                 dispel_good(p_ptr->lev * 5);
681                 break;
682         }
683
684         case ACT_BO_MANA:
685         {
686                 msg_format(_("%sに魔法のトゲが現れた...", "The %s grows magical spikes..."), name);
687                 if (!get_aim_dir(&dir)) return FALSE;
688                 fire_bolt(GF_ARROW, dir, 150);
689                 break;
690         }
691
692         case ACT_BA_WATER:
693         {
694                 msg_format(_("%sが深い青色に鼓動している...", "The %s throbs deep blue..."), name);
695                 if (!get_aim_dir(&dir)) return FALSE;
696                 fire_ball(GF_WATER, dir, 200, 3);
697                 break;
698         }
699
700         case ACT_BA_DARK:
701         {
702                 msg_format(_("%sが深い闇に覆われた...", "The %s is coverd in pitch-darkness..."), name);
703                 if (!get_aim_dir(&dir)) return FALSE;
704                 fire_ball(GF_DARK, dir, 250, 4);
705                 break;
706         }
707
708         case ACT_BA_MANA:
709         {
710                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
711                 if (!get_aim_dir(&dir)) return FALSE;
712                 fire_ball(GF_MANA, dir, 250, 4);
713                 break;
714         }
715
716         case ACT_PESTICIDE:
717         {
718                 msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
719                 (void)dispel_monsters(4);
720                 break;
721         }
722
723         case ACT_BLINDING_LIGHT:
724         {
725                 msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
726                 fire_ball(GF_LITE, 0, 300, 6);
727                 confuse_monsters(3 * p_ptr->lev / 2);
728                 break;
729         }
730
731         case ACT_BIZARRE:
732         {
733                 msg_format(_("%sは漆黒に輝いた...", "The %s glows intensely black..."), name);
734                 if (!get_aim_dir(&dir)) return FALSE;
735                 ring_of_power(dir);
736                 break;
737         }
738
739         case ACT_CAST_BA_STAR:
740         {
741                 HIT_POINT num = damroll(5, 3);
742                 POSITION y = 0, x = 0;
743                 int attempts;
744                 msg_format(_("%sが稲妻で覆われた...", "The %s is surrounded by lightning..."), name);
745                 for (k = 0; k < num; k++)
746                 {
747                         attempts = 1000;
748
749                         while (attempts--)
750                         {
751                                 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
752                                 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
753                                 if (!player_bold(y, x)) break;
754                         }
755
756                         project(0, 3, y, x, 150, GF_ELEC,
757                                 (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
758                 }
759
760                 break;
761         }
762
763         case ACT_BLADETURNER:
764         {
765                 if (!get_aim_dir(&dir)) return FALSE;
766                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
767                 fire_breath(GF_MISSILE, dir, 300, 4);
768                 msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
769                 (void)set_afraid(0);
770                 (void)set_hero(randint1(50) + 50, FALSE);
771                 (void)hp_player(10);
772                 (void)set_blessed(randint1(50) + 50, FALSE);
773                 (void)set_oppose_acid(randint1(50) + 50, FALSE);
774                 (void)set_oppose_elec(randint1(50) + 50, FALSE);
775                 (void)set_oppose_fire(randint1(50) + 50, FALSE);
776                 (void)set_oppose_cold(randint1(50) + 50, FALSE);
777                 (void)set_oppose_pois(randint1(50) + 50, FALSE);
778                 break;
779         }
780
781         case ACT_BR_FIRE:
782         {
783                 if (!get_aim_dir(&dir)) return FALSE;
784                 fire_breath(GF_FIRE, dir, 200, 2);
785                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
786                 {
787                         (void)set_oppose_fire(randint1(20) + 20, FALSE);
788                 }
789                 break;
790         }
791
792         case ACT_BR_COLD:
793         {
794                 if (!get_aim_dir(&dir)) return FALSE;
795                 fire_breath(GF_COLD, dir, 200, 2);
796                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
797                 {
798                         (void)set_oppose_cold(randint1(20) + 20, FALSE);
799                 }
800                 break;
801         }
802
803         case ACT_BR_DRAGON:
804         {
805                 if (!activate_dragon_breath(o_ptr)) return FALSE;
806                 break;
807         }
808
809         /* Activate for other offensive action */
810         case ACT_CONFUSE:
811         {
812                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
813                 if (!get_aim_dir(&dir)) return FALSE;
814                 confuse_monster(dir, 20);
815                 break;
816         }
817
818         case ACT_SLEEP:
819         {
820                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
821                 sleep_monsters_touch();
822                 break;
823         }
824
825         case ACT_QUAKE:
826         {
827                 earthquake(p_ptr->y, p_ptr->x, 5);
828                 break;
829         }
830
831         case ACT_TERROR:
832         {
833                 turn_monsters(40 + p_ptr->lev);
834                 break;
835         }
836
837         case ACT_TELE_AWAY:
838         {
839                 if (!get_aim_dir(&dir)) return FALSE;
840                 (void)fire_beam(GF_AWAY_ALL, dir, plev);
841                 break;
842         }
843
844         case ACT_BANISH_EVIL:
845         {
846                 if (banish_evil(100))
847                 {
848                         msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
849                 }
850                 break;
851         }
852
853         case ACT_GENOCIDE:
854         {
855                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
856                 (void)symbol_genocide(200, TRUE);
857                 break;
858         }
859
860         case ACT_MASS_GENO:
861         {
862                 msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
863                 (void)mass_genocide(200, TRUE);
864                 break;
865         }
866
867         case ACT_SCARE_AREA:
868         {
869                 if (music_singing_any()) stop_singing();
870                 if (hex_spelling_any()) stop_hex_spell_all();
871                 msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
872                         "You wind a mighty blast; your enemies tremble!"));
873                 (void)turn_monsters((3 * p_ptr->lev / 2) + 10);
874                 break;
875         }
876
877         case ACT_AGGRAVATE:
878         {
879                 if (o_ptr->name1 == ART_HYOUSIGI)
880                 {
881                         msg_print(_("拍子木を打った。", "You beat Your wooden clappers."));
882                 }
883                 else
884                 {
885                         msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
886                 }
887                 aggravate_monsters(0);
888                 break;
889         }
890
891         /* Activate for summoning / charming */
892
893         case ACT_CHARM_ANIMAL:
894         {
895                 if (!get_aim_dir(&dir)) return FALSE;
896                 (void)charm_animal(dir, plev);
897                 break;
898         }
899
900         case ACT_CHARM_UNDEAD:
901         {
902                 if (!get_aim_dir(&dir)) return FALSE;
903                 (void)control_one_undead(dir, plev);
904                 break;
905         }
906
907         case ACT_CHARM_OTHER:
908         {
909                 if (!get_aim_dir(&dir)) return FALSE;
910                 (void)charm_monster(dir, plev * 2);
911                 break;
912         }
913
914         case ACT_CHARM_ANIMALS:
915         {
916                 (void)charm_animals(plev * 2);
917                 break;
918         }
919
920         case ACT_CHARM_OTHERS:
921         {
922                 charm_monsters(plev * 2);
923                 break;
924         }
925
926         case ACT_SUMMON_ANIMAL:
927         {
928                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
929                 break;
930         }
931
932         case ACT_SUMMON_PHANTOM:
933         {
934                 msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
935                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
936                 break;
937         }
938
939         case ACT_SUMMON_ELEMENTAL:
940         {
941                 bool pet = one_in_(3);
942                 BIT_FLAGS mode = 0L;
943
944                 if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
945                 if (pet) mode |= PM_FORCE_PET;
946                 else mode |= PM_NO_PET;
947
948                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode, '\0'))
949                 {
950                         msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
951                         if (pet)
952                                 msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
953                         else
954                                 msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
955                 }
956
957                 break;
958         }
959
960         case ACT_SUMMON_DEMON:
961         {
962                 cast_summon_demon((plev * 3) / 2);
963                 break;
964         }
965
966         case ACT_SUMMON_UNDEAD:
967         {
968                 bool pet = one_in_(3);
969                 int type;
970                 BIT_FLAGS mode = 0L;
971
972                 type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
973
974                 if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
975                 if (pet) mode |= PM_FORCE_PET;
976                 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
977
978                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode, '\0'))
979                 {
980                         msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
981                                 "Cold winds begin to blow around you, carrying with them the stench of decay..."));
982                         if (pet)
983                                 msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
984                                         "Ancient, long-dead forms arise from the ground to serve you!"));
985                         else
986                                 msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
987                                         "'The dead arise... to punish you for disturbing them!'"));
988                 }
989
990                 break;
991         }
992
993         case ACT_SUMMON_HOUND:
994         {
995                 BIT_FLAGS mode = PM_ALLOW_GROUP;
996                 bool pet = !one_in_(5);
997                 if (pet) mode |= PM_FORCE_PET;
998                 else mode |= PM_NO_PET;
999
1000                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode, '\0'))
1001                 {
1002
1003                         if (pet)
1004                                 msg_print(_("ハウンドがあなたの下僕として出現した。",
1005                                         "A group of hounds appear as your servant."));
1006                         else
1007                                 msg_print(_("ハウンドはあなたに牙を向けている!",
1008                                         "A group of hounds appear as your enemy!"));
1009                 }
1010
1011                 break;
1012         }
1013
1014         case ACT_SUMMON_DAWN:
1015         {
1016                 msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
1017                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
1018                 break;
1019         }
1020
1021         case ACT_SUMMON_OCTOPUS:
1022         {
1023                 BIT_FLAGS mode = PM_ALLOW_GROUP;
1024                 bool pet = !one_in_(5);
1025                 if (pet) mode |= PM_FORCE_PET;
1026
1027                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_JIZOTAKO, mode))
1028                 {
1029                         if (pet)
1030                                 msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
1031                         else
1032                                 msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
1033                 }
1034
1035                 break;
1036         }
1037
1038         /* Activate for healing */
1039
1040         case ACT_CHOIR_SINGS:
1041         {
1042                 msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
1043                 (void)cure_critical_wounds(777);
1044                 (void)set_hero(randint1(25) + 25, FALSE);
1045                 break;
1046         }
1047
1048         case ACT_CURE_LW:
1049         {
1050                 (void)set_afraid(0);
1051                 (void)hp_player(30);
1052                 break;
1053         }
1054
1055         case ACT_CURE_MW:
1056         {
1057                 msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
1058                 (void)cure_serious_wounds(4, 8);
1059                 break;
1060         }
1061
1062         case ACT_CURE_POISON:
1063         {
1064                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1065                 (void)set_afraid(0);
1066                 (void)set_poisoned(0);
1067                 break;
1068         }
1069
1070         case ACT_REST_EXP:
1071         {
1072                 msg_print(_("深紅に輝いている...", "It glows a deep red..."));
1073                 restore_level();
1074                 break;
1075         }
1076
1077         case ACT_REST_ALL:
1078         {
1079                 msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
1080                 (void)restore_all_status();
1081                 (void)restore_level();
1082                 break;
1083         }
1084
1085         case ACT_CURE_700:
1086         {
1087                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1088                 msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
1089                 (void)cure_critical_wounds(700);
1090                 break;
1091         }
1092
1093         case ACT_CURE_1000:
1094         {
1095                 msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
1096                 msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
1097                 (void)cure_critical_wounds(1000);
1098                 break;
1099         }
1100
1101         case ACT_CURING:
1102         {
1103                 msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
1104                 true_healing(0);
1105                 break;
1106         }
1107
1108         case ACT_CURE_MANA_FULL:
1109         {
1110                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
1111                 restore_mana(TRUE);
1112                 break;
1113         }
1114
1115         /* Activate for timed effect */
1116
1117         case ACT_ESP:
1118         {
1119                 (void)set_tim_esp(randint1(30) + 25, FALSE);
1120                 break;
1121         }
1122
1123         case ACT_BERSERK:
1124         {
1125                 (void)berserk(randint1(25) + 25);
1126                 break;
1127         }
1128
1129         case ACT_PROT_EVIL:
1130         {
1131                 msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
1132                 k = 3 * p_ptr->lev;
1133                 (void)set_protevil(randint1(25) + k, FALSE);
1134                 break;
1135         }
1136
1137         case ACT_RESIST_ALL:
1138         {
1139                 msg_print(_("様々な色に輝いている...", "It glows many colours..."));
1140                 (void)set_oppose_acid(randint1(40) + 40, FALSE);
1141                 (void)set_oppose_elec(randint1(40) + 40, FALSE);
1142                 (void)set_oppose_fire(randint1(40) + 40, FALSE);
1143                 (void)set_oppose_cold(randint1(40) + 40, FALSE);
1144                 (void)set_oppose_pois(randint1(40) + 40, FALSE);
1145                 break;
1146         }
1147
1148         case ACT_SPEED:
1149         {
1150                 msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
1151                 (void)set_fast(randint1(20) + 20, FALSE);
1152                 break;
1153         }
1154
1155         case ACT_XTRA_SPEED:
1156         {
1157                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1158                 (void)set_fast(randint1(75) + 75, FALSE);
1159                 break;
1160         }
1161
1162         case ACT_WRAITH:
1163         {
1164                 set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
1165                 break;
1166         }
1167
1168         case ACT_INVULN:
1169         {
1170                 (void)set_invuln(randint1(8) + 8, FALSE);
1171                 break;
1172         }
1173
1174         case ACT_HERO:
1175         {
1176                 (void)heroism(25);
1177                 break;
1178         }
1179
1180         case ACT_HERO_SPEED:
1181         {
1182                 (void)set_fast(randint1(50) + 50, FALSE);
1183                 (void)heroism(50);
1184                 break;
1185         }
1186
1187         case ACT_RESIST_ACID:
1188         {
1189                 msg_format(_("%sが黒く輝いた...", "The %s grows black."), name);
1190                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
1191                 {
1192                         if (!get_aim_dir(&dir)) return FALSE;
1193                         fire_ball(GF_ACID, dir, 100, 2);
1194                 }
1195                 (void)set_oppose_acid(randint1(20) + 20, FALSE);
1196                 break;
1197         }
1198
1199         case ACT_RESIST_FIRE:
1200         {
1201                 msg_format(_("%sが赤く輝いた...", "The %s grows red."), name);
1202                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
1203                 {
1204                         if (!get_aim_dir(&dir)) return FALSE;
1205                         fire_ball(GF_FIRE, dir, 100, 2);
1206                 }
1207                 (void)set_oppose_fire(randint1(20) + 20, FALSE);
1208                 break;
1209         }
1210
1211         case ACT_RESIST_COLD:
1212         {
1213                 msg_format(_("%sが白く輝いた...", "The %s grows white."), name);
1214                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
1215                 {
1216                         if (!get_aim_dir(&dir)) return FALSE;
1217                         fire_ball(GF_COLD, dir, 100, 2);
1218                 }
1219                 (void)set_oppose_cold(randint1(20) + 20, FALSE);
1220                 break;
1221         }
1222
1223         case ACT_RESIST_ELEC:
1224         {
1225                 msg_format(_("%sが青く輝いた...", "The %s grows blue."), name);
1226                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
1227                 {
1228                         if (!get_aim_dir(&dir)) return FALSE;
1229                         fire_ball(GF_ELEC, dir, 100, 2);
1230                 }
1231                 (void)set_oppose_elec(randint1(20) + 20, FALSE);
1232                 break;
1233         }
1234
1235         case ACT_RESIST_POIS:
1236         {
1237                 msg_format(_("%sが緑に輝いた...", "The %s grows green."), name);
1238                 (void)set_oppose_pois(randint1(20) + 20, FALSE);
1239                 break;
1240         }
1241
1242         /* Activate for general purpose effect (detection etc.) */
1243
1244         case ACT_LIGHT:
1245         {
1246                 msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
1247                 lite_area(damroll(2, 15), 3);
1248                 break;
1249         }
1250
1251         case ACT_MAP_LIGHT:
1252         {
1253                 msg_print(_("眩しく輝いた...", "It shines brightly..."));
1254                 map_area(DETECT_RAD_MAP);
1255                 lite_area(damroll(2, 15), 3);
1256                 break;
1257         }
1258
1259         case ACT_DETECT_ALL:
1260         {
1261                 msg_print(_("白く明るく輝いている...", "It glows bright white..."));
1262                 msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
1263                 detect_all(DETECT_RAD_DEFAULT);
1264                 break;
1265         }
1266
1267         case ACT_DETECT_XTRA:
1268         {
1269                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1270                 detect_all(DETECT_RAD_DEFAULT);
1271                 probing();
1272                 identify_fully(FALSE);
1273                 break;
1274         }
1275
1276         case ACT_ID_FULL:
1277         {
1278                 msg_print(_("黄色く輝いている...", "It glows yellow..."));
1279                 identify_fully(FALSE);
1280                 break;
1281         }
1282
1283         case ACT_ID_PLAIN:
1284         {
1285                 if (!ident_spell(FALSE)) return FALSE;
1286                 break;
1287         }
1288
1289         case ACT_RUNE_EXPLO:
1290         {
1291                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1292                 explosive_rune();
1293                 break;
1294         }
1295
1296         case ACT_RUNE_PROT:
1297         {
1298                 msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
1299                 warding_glyph();
1300                 break;
1301         }
1302
1303         case ACT_SATIATE:
1304         {
1305                 (void)set_food(PY_FOOD_MAX - 1);
1306                 break;
1307         }
1308
1309         case ACT_DEST_DOOR:
1310         {
1311                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1312                 destroy_doors_touch();
1313                 break;
1314         }
1315
1316         case ACT_STONE_MUD:
1317         {
1318                 msg_print(_("鼓動している...", "It pulsates..."));
1319                 if (!get_aim_dir(&dir)) return FALSE;
1320                 wall_to_mud(dir, 20 + randint1(30));
1321                 break;
1322         }
1323
1324         case ACT_RECHARGE:
1325         {
1326                 recharge(130);
1327                 break;
1328         }
1329
1330         case ACT_ALCHEMY:
1331         {
1332                 msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
1333                 (void)alchemy();
1334                 break;
1335         }
1336
1337         case ACT_DIM_DOOR:
1338         {
1339                 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
1340                 if (!dimension_door()) return FALSE;
1341                 break;
1342         }
1343
1344
1345         case ACT_TELEPORT:
1346         {
1347                 msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
1348                 teleport_player(100, 0L);
1349                 break;
1350         }
1351
1352         case ACT_RECALL:
1353         {
1354                 msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
1355                 if (!word_of_recall()) return FALSE;
1356                 break;
1357         }
1358
1359         case ACT_JUDGE:
1360         {
1361                 msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
1362                 chg_virtue(V_KNOWLEDGE, 1);
1363                 chg_virtue(V_ENLIGHTEN, 1);
1364                 wiz_lite(FALSE);
1365
1366                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1367                 take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
1368
1369                 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
1370                 (void)detect_doors(DETECT_RAD_DEFAULT);
1371                 (void)detect_stairs(DETECT_RAD_DEFAULT);
1372
1373                 if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
1374                 {
1375                         (void)word_of_recall();
1376                 }
1377
1378                 break;
1379         }
1380
1381         case ACT_TELEKINESIS:
1382         {
1383                 if (!get_aim_dir(&dir)) return FALSE;
1384                 msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
1385                 fetch(dir, 500, TRUE);
1386                 break;
1387         }
1388
1389         case ACT_DETECT_UNIQUE:
1390         {
1391                 int i;
1392                 monster_type *m_ptr;
1393                 monster_race *r_ptr;
1394                 msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
1395                 /* Process the monsters (backwards) */
1396                 for (i = m_max - 1; i >= 1; i--)
1397                 {
1398                         /* Access the monster */
1399                         m_ptr = &m_list[i];
1400
1401                         /* Ignore "dead" monsters */
1402                         if (!m_ptr->r_idx) continue;
1403
1404                         r_ptr = &r_info[m_ptr->r_idx];
1405
1406                         if (r_ptr->flags1 & RF1_UNIQUE)
1407                         {
1408                                 msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
1409                         }
1410                 }
1411                 break;
1412         }
1413
1414         case ACT_ESCAPE:
1415         {
1416                 switch (randint1(13))
1417                 {
1418                 case 1: case 2: case 3: case 4: case 5:
1419                         teleport_player(10, 0L);
1420                         break;
1421                 case 6: case 7: case 8: case 9: case 10:
1422                         teleport_player(222, 0L);
1423                         break;
1424                 case 11: case 12:
1425                         (void)stair_creation();
1426                         break;
1427                 default:
1428                         if (get_check(_("この階を去りますか?", "Leave this level? ")))
1429                         {
1430                                 if (autosave_l) do_cmd_save_game(TRUE);
1431
1432                                 /* Leaving */
1433                                 p_ptr->leaving = TRUE;
1434                         }
1435                 }
1436                 break;
1437         }
1438
1439         case ACT_DISP_CURSE_XTRA:
1440         {
1441                 msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
1442                 (void)remove_all_curse();
1443                 (void)probing();
1444                 break;
1445         }
1446
1447         case ACT_BRAND_FIRE_BOLTS:
1448         {
1449                 msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
1450                 (void)brand_bolts();
1451                 break;
1452         }
1453
1454         case ACT_RECHARGE_XTRA:
1455         {
1456                 msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
1457                 if (!recharge(1000)) return FALSE;
1458                 break;
1459         }
1460
1461         case ACT_LORE:
1462         {
1463                 msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
1464                 if (!ident_spell(FALSE)) return FALSE;
1465
1466                 if (mp_ptr->spell_book)
1467                 {
1468                         /* Sufficient mana */
1469                         if (20 <= p_ptr->csp)
1470                         {
1471                                 /* Use some mana */
1472                                 p_ptr->csp -= 20;
1473                         }
1474
1475                         /* Over-exert the player */
1476                         else
1477                         {
1478                                 int oops = 20 - p_ptr->csp;
1479
1480                                 /* No mana left */
1481                                 p_ptr->csp = 0;
1482                                 p_ptr->csp_frac = 0;
1483
1484                                 msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
1485                                 /* Hack -- Bypass free action */
1486                                 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1487
1488                                 /* Confusing. */
1489                                 (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
1490                         }
1491                         p_ptr->redraw |= (PR_MANA);
1492                 }
1493                 take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
1494                 /* Confusing. */
1495                 if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
1496
1497                 /* Exercise a little care... */
1498                 if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
1499                 break;
1500         }
1501
1502         case ACT_SHIKOFUMI:
1503         {
1504                 msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
1505                 (void)set_afraid(0);
1506                 (void)set_hero(randint1(20) + 20, FALSE);
1507                 dispel_evil(p_ptr->lev * 3);
1508                 break;
1509         }
1510
1511         case ACT_PHASE_DOOR:
1512         {
1513                 teleport_player(10, 0L);
1514                 break;
1515         }
1516
1517         case ACT_DETECT_ALL_MONS:
1518         {
1519                 (void)detect_monsters_invis(255);
1520                 (void)detect_monsters_normal(255);
1521                 break;
1522         }
1523
1524         case ACT_ULTIMATE_RESIST:
1525         {
1526                 TIME_EFFECT v = randint1(25) + 25;
1527                 (void)set_afraid(0);
1528                 (void)set_hero(v, FALSE);
1529                 (void)hp_player(10);
1530                 (void)set_blessed(v, FALSE);
1531                 (void)set_oppose_acid(v, FALSE);
1532                 (void)set_oppose_elec(v, FALSE);
1533                 (void)set_oppose_fire(v, FALSE);
1534                 (void)set_oppose_cold(v, FALSE);
1535                 (void)set_oppose_pois(v, FALSE);
1536                 (void)set_ultimate_res(v, FALSE);
1537                 break;
1538         }
1539
1540
1541         /* Unique activation */
1542         case ACT_CAST_OFF:
1543         {
1544                 INVENTORY_IDX inv;
1545                 int t;
1546                 OBJECT_IDX o_idx;
1547                 GAME_TEXT o_name[MAX_NLEN];
1548                 object_type forge;
1549
1550                 /* Cast off activated item */
1551                 for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
1552                 {
1553                         if (o_ptr == &inventory[inv]) break;
1554                 }
1555
1556                 /* Paranoia */
1557                 if (inv > INVEN_FEET) return FALSE;
1558
1559                 object_copy(&forge, o_ptr);
1560                 inven_item_increase(inv, (0 - o_ptr->number));
1561                 inven_item_optimize(inv);
1562                 o_idx = drop_near(&forge, 0, p_ptr->y, p_ptr->x);
1563                 o_ptr = &o_list[o_idx];
1564
1565                 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1566                 msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
1567
1568                 /* Get effects */
1569                 msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
1570                 t = 20 + randint1(20);
1571                 (void)set_blind(p_ptr->blind + t);
1572                 (void)set_afraid(0);
1573                 (void)set_tim_esp(p_ptr->tim_esp + t, FALSE);
1574                 (void)set_tim_regen(p_ptr->tim_regen + t, FALSE);
1575                 (void)set_hero(p_ptr->hero + t, FALSE);
1576                 (void)set_blessed(p_ptr->blessed + t, FALSE);
1577                 (void)set_fast(p_ptr->fast + t, FALSE);
1578                 (void)set_shero(p_ptr->shero + t, FALSE);
1579                 if (p_ptr->pclass == CLASS_FORCETRAINER)
1580                 {
1581                         P_PTR_KI = plev * 5 + 190;
1582                         msg_print(_("気が爆発寸前になった。", "Your force are immediatly before explosion."));
1583                 }
1584
1585                 break;
1586         }
1587
1588         case ACT_FALLING_STAR:
1589         {
1590                 msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade..."));
1591                 msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'"));
1592                 massacre();
1593                 break;
1594         }
1595
1596         case ACT_GRAND_CROSS:
1597         {
1598                 msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
1599                 project(0, 8, p_ptr->y, p_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
1600                 break;
1601         }
1602
1603         case ACT_TELEPORT_LEVEL:
1604         {
1605                 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return FALSE;
1606                 teleport_level(0);
1607                 break;
1608         }
1609
1610         case ACT_STRAIN_HASTE:
1611         {
1612                 int t;
1613                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1614                 take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1);
1615                 t = 25 + randint1(25);
1616                 (void)set_fast(p_ptr->fast + t, FALSE);
1617                 break;
1618         }
1619
1620         case ACT_FISHING:
1621         {
1622                 POSITION x, y;
1623
1624                 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
1625                 y = p_ptr->y + ddy[dir];
1626                 x = p_ptr->x + ddx[dir];
1627                 p_ptr->fishing_dir = dir;
1628                 if (!cave_have_flag_bold(y, x, FF_WATER))
1629                 {
1630                         msg_print(_("そこは水辺ではない。", "There is no fishing place."));
1631                         return FALSE;
1632                 }
1633                 else if (cave[y][x].m_idx)
1634                 {
1635                         GAME_TEXT m_name[MAX_NLEN];
1636                         monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
1637                         msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
1638                         p_ptr->energy_use = 0;
1639                         return FALSE;
1640                 }
1641                 set_action(ACTION_FISH);
1642                 p_ptr->redraw |= (PR_STATE);
1643                 break;
1644         }
1645
1646         case ACT_INROU:
1647         {
1648                 int count = 0, i;
1649                 monster_type *m_ptr;
1650                 cptr kakusan = "";
1651
1652                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_SUKE, PM_FORCE_PET))
1653                 {
1654                         msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
1655                         kakusan = "Suke-san";
1656                         count++;
1657                 }
1658                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_KAKU, PM_FORCE_PET))
1659                 {
1660                         msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
1661                         kakusan = "Kaku-san";
1662                         count++;
1663                 }
1664                 if (!count)
1665                 {
1666                         for (i = m_max - 1; i > 0; i--)
1667                         {
1668                                 m_ptr = &m_list[i];
1669                                 if (!m_ptr->r_idx) continue;
1670                                 if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
1671                                 if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
1672                                 if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
1673                                 count++;
1674                                 break;
1675                         }
1676                 }
1677
1678                 if (count)
1679                 {
1680                         msg_format(_("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
1681                                 "%^s says 'WHO do you think this person is! Bow your head, down your knees!'"), kakusan);
1682                         sukekaku = TRUE;
1683                         stun_monsters(120);
1684                         confuse_monsters(120);
1685                         turn_monsters(120);
1686                         stasis_monsters(120);
1687                         sukekaku = FALSE;
1688                 }
1689                 else
1690                 {
1691                         msg_print(_("しかし、何も起きなかった。", "Nothing happen."));
1692                 }
1693                 break;
1694         }
1695
1696         case ACT_MURAMASA:
1697         {
1698                 /* Only for Muramasa */
1699                 if (o_ptr->name1 != ART_MURAMASA) return FALSE;
1700                 if (get_check(_("本当に使いますか?", "Are you sure?!")))
1701                 {
1702                         msg_print(_("村正が震えた...", "The Muramasa pulsates..."));
1703                         do_inc_stat(A_STR);
1704                         if (one_in_(2))
1705                         {
1706                                 msg_print(_("村正は壊れた!", "The Muramasa is destroyed!"));
1707                                 curse_weapon_object(TRUE, o_ptr);
1708                         }
1709                 }
1710                 break;
1711         }
1712
1713         case ACT_BLOODY_MOON:
1714         {
1715                 /* Only for Bloody Moon */
1716                 if (o_ptr->name1 != ART_BLOOD) return FALSE;
1717                 msg_print(_("鎌が明るく輝いた...", "Your scythe glows brightly!"));
1718                 get_bloody_moon_flags(o_ptr);
1719                 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1720                 p_ptr->update |= (PU_BONUS | PU_HP);
1721                 break;
1722         }
1723
1724         case ACT_CRIMSON:
1725         {
1726                 int num = 1;
1727                 int i;
1728                 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1729                 int tx, ty;
1730
1731                 /* Only for Crimson */
1732                 if (o_ptr->name1 != ART_CRIMSON) return FALSE;
1733
1734                 msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
1735
1736                 if (!get_aim_dir(&dir)) return FALSE;
1737
1738                 /* Use the given direction */
1739                 tx = p_ptr->x + 99 * ddx[dir];
1740                 ty = p_ptr->y + 99 * ddy[dir];
1741
1742                 /* Hack -- Use an actual "target" */
1743                 if ((dir == 5) && target_okay())
1744                 {
1745                         tx = target_col;
1746                         ty = target_row;
1747                 }
1748
1749                 if (p_ptr->pclass == CLASS_ARCHER)
1750                 {
1751                         /* Extra shot at level 10 */
1752                         if (p_ptr->lev >= 10) num++;
1753
1754                         /* Extra shot at level 30 */
1755                         if (p_ptr->lev >= 30) num++;
1756
1757                         /* Extra shot at level 45 */
1758                         if (p_ptr->lev >= 45) num++;
1759                 }
1760
1761                 for (i = 0; i < num; i++)
1762                         project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
1763                 break;
1764         }
1765
1766         default:
1767         {
1768                 msg_format(_("Unknown activation effect: %d.", "Unknown activation effect: %d."), act_ptr->index);
1769                 return FALSE;
1770         }
1771         }
1772
1773         /* Set activation timeout */
1774         if (act_ptr->timeout.constant >= 0) {
1775                 o_ptr->timeout = (s16b)act_ptr->timeout.constant;
1776                 if (act_ptr->timeout.dice > 0) {
1777                         o_ptr->timeout += randint1(act_ptr->timeout.dice);
1778                 }
1779         }
1780         else {
1781                 /* Activations that have special timeout */
1782                 switch (act_ptr->index) {
1783                 case ACT_BR_FIRE:
1784                         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
1785                         break;
1786                 case ACT_BR_COLD:
1787                         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
1788                         break;
1789                 case ACT_TERROR:
1790                         o_ptr->timeout = 3 * (p_ptr->lev + 10);
1791                         break;
1792                 case ACT_MURAMASA:
1793                         /* Nothing to do */
1794                         break;
1795                 default:
1796                         msg_format("Special timeout is not implemented: %d.", act_ptr->index);
1797                         return FALSE;
1798                 }
1799         }
1800
1801         return TRUE;
1802 }
1803
1804 /*!
1805  * @brief 固定アーティファクト『ブラッディムーン』の特性を変更する。
1806  * @details スレイ2d2種、及びone_resistance()による耐性1d2種、pval2種を得る。
1807  * @param o_ptr 対象のオブジェクト構造体(ブラッディムーン)のポインタ
1808  * @return なし
1809  */
1810 void get_bloody_moon_flags(object_type *o_ptr)
1811 {
1812         int dummy, i;
1813
1814         for (i = 0; i < TR_FLAG_SIZE; i++)
1815                 o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
1816
1817         dummy = randint1(2) + randint1(2);
1818         for (i = 0; i < dummy; i++)
1819         {
1820                 int flag = randint0(26);
1821                 if (flag >= 20) add_flag(o_ptr->art_flags, TR_KILL_UNDEAD + flag - 20);
1822                 else if (flag == 19) add_flag(o_ptr->art_flags, TR_KILL_ANIMAL);
1823                 else if (flag == 18) add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
1824                 else add_flag(o_ptr->art_flags, TR_CHAOTIC + flag);
1825         }
1826
1827         dummy = randint1(2);
1828         for (i = 0; i < dummy; i++) one_resistance(o_ptr);
1829
1830         for (i = 0; i < 2; i++)
1831         {
1832                 int tmp = randint0(11);
1833                 if (tmp < 6) add_flag(o_ptr->art_flags, TR_STR + tmp);
1834                 else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
1835         }
1836 }
1837
1838