OSDN Git Service

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