OSDN Git Service

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