OSDN Git Service

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