OSDN Git Service

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