OSDN Git Service

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