OSDN Git Service

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