OSDN Git Service

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