OSDN Git Service

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