OSDN Git Service

64da2f7a4b3159909b9fc61d123a74c3fff4e03d
[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(INVENTORY_IDX 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(SOUND_ZAP);
163
164         /* Activate object */
165         if (activation_index(o_ptr))
166         {
167                 (void)activate_artifact(o_ptr);
168
169                 /* Window stuff */
170                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
171
172                 /* Success */
173                 return;
174         }
175
176         /* Special items */
177         else if (o_ptr->tval == TV_WHISTLE)
178         {
179                 if (music_singing_any()) stop_singing();
180                 if (hex_spelling_any()) stop_hex_spell_all();
181
182 #if 0
183                 if (object_is_cursed(o_ptr))
184                 {
185                         msg_print(_("カン高い音が響き渡った。", "You produce a shrill whistling sound."));
186                         aggravate_monsters(0);
187                 }
188                 else
189 #endif
190                 {
191                         IDX pet_ctr, i;
192                         IDX *who;
193                         int max_pet = 0;
194                         u16b dummy_why;
195
196                         /* Allocate the "who" array */
197                         C_MAKE(who, max_m_idx, IDX);
198
199                         /* Process the monsters (backwards) */
200                         for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
201                         {
202                                 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
203                                   who[max_pet++] = pet_ctr;
204                         }
205
206                         /* Select the sort method */
207                         ang_sort_comp = ang_sort_comp_pet;
208                         ang_sort_swap = ang_sort_swap_hook;
209
210                         ang_sort(who, &dummy_why, max_pet);
211
212                         /* Process the monsters (backwards) */
213                         for (i = 0; i < max_pet; i++)
214                         {
215                                 pet_ctr = who[i];
216                                 teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
217                         }
218
219                         /* Free the "who" array */
220                         C_KILL(who, max_m_idx, IDX);
221                 }
222                 o_ptr->timeout = 100+randint1(100);
223                 return;
224         }
225         else if (o_ptr->tval == TV_CAPTURE)
226         {
227                 if(!o_ptr->pval)
228                 {
229                         bool old_target_pet = target_pet;
230                         target_pet = TRUE;
231                         if (!get_aim_dir(&dir))
232                         {
233                                 target_pet = old_target_pet;
234                                 return;
235                         }
236                         target_pet = old_target_pet;
237
238                         if(fire_ball(GF_CAPTURE, dir, 0, 0))
239                         {
240                                 o_ptr->pval = (PARAMETER_VALUE)cap_mon;
241                                 o_ptr->xtra3 = (XTRA8)cap_mspeed;
242                                 o_ptr->xtra4 = (XTRA16)cap_hp;
243                                 o_ptr->xtra5 = (XTRA16)cap_maxhp;
244                                 if (cap_nickname)
245                                 {
246                                         cptr t;
247                                         char *s;
248                                         char buf[80] = "";
249
250                                         if (o_ptr->inscription)
251                                                 strcpy(buf, quark_str(o_ptr->inscription));
252                                         s = buf;
253                                         for (s = buf;*s && (*s != '#'); s++)
254                                         {
255 #ifdef JP
256                                                 if (iskanji(*s)) s++;
257 #endif
258                                         }
259                                         *s = '#';
260                                         s++;
261 #ifdef JP
262  /*nothing*/
263 #else
264                                         *s++ = '\'';
265 #endif
266                                         t = quark_str(cap_nickname);
267                                         while (*t)
268                                         {
269                                                 *s = *t;
270                                                 s++;
271                                                 t++;
272                                         }
273 #ifdef JP
274  /*nothing*/
275 #else
276                                         *s++ = '\'';
277 #endif
278                                         *s = '\0';
279                                         o_ptr->inscription = quark_add(buf);
280                                 }
281                         }
282                 }
283                 else
284                 {
285                         success = FALSE;
286                         if (!get_rep_dir2(&dir)) return;
287                         if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
288                         {
289                                 if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
290                                 {
291                                         if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
292                                         if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
293                                         if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
294                                         m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
295                                         if (o_ptr->inscription)
296                                         {
297                                                 char buf[80];
298                                                 cptr t;
299 #ifndef JP
300                                                 bool quote = FALSE;
301 #endif
302
303                                                 t = quark_str(o_ptr->inscription);
304                                                 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
305                                                 {
306 #ifdef JP
307                                                         if (iskanji(*t)) t++;
308 #endif
309                                                 }
310                                                 if (*t)
311                                                 {
312                                                         char *s = buf;
313                                                         t++;
314 #ifdef JP
315                                                         /* nothing */
316 #else
317                                                         if (*t =='\'')
318                                                         {
319                                                                 t++;
320                                                                 quote = TRUE;
321                                                         }
322 #endif
323                                                         while(*t)
324                                                         {
325                                                                 *s = *t;
326                                                                 t++;
327                                                                 s++;
328                                                         }
329 #ifdef JP
330                                                         /* nothing */
331 #else
332                                                         if (quote && *(s-1) =='\'')
333                                                                 s--;
334 #endif
335                                                         *s = '\0';
336                                                         m_list[hack_m_idx_ii].nickname = quark_add(buf);
337                                                         t = quark_str(o_ptr->inscription);
338                                                         s = buf;
339                                                         while(*t && (*t != '#'))
340                                                         {
341                                                                 *s = *t;
342                                                                 t++;
343                                                                 s++;
344                                                         }
345                                                         *s = '\0';
346                                                         o_ptr->inscription = quark_add(buf);
347                                                 }
348                                         }
349                                         o_ptr->pval = 0;
350                                         o_ptr->xtra3 = 0;
351                                         o_ptr->xtra4 = 0;
352                                         o_ptr->xtra5 = 0;
353                                         success = TRUE;
354                                 }
355                         }
356                         if (!success)
357                                 msg_print(_("おっと、解放に失敗した。", "Oops.  You failed to release your pet."));
358                 }
359                 calc_android_exp();
360                 return;
361         }
362
363         /* Mistake */
364         msg_print(_("おっと、このアイテムは始動できない。", "Oops.  That object cannot be activated."));
365 }
366
367 /*!
368  * @brief 装備を発動するコマンドのメインルーチン /
369  * @return なし
370  */
371 void do_cmd_activate(void)
372 {
373         OBJECT_IDX item;
374         cptr q, s;
375
376         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
377         {
378                 set_action(ACTION_NONE);
379         }
380
381         item_tester_no_ryoute = TRUE;
382         /* Prepare the hook */
383         item_tester_hook = item_tester_hook_activate;
384
385         /* Get an item */
386         q = _("どのアイテムを始動させますか? ", "Activate which item? ");
387         s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
388
389         if (!get_item(&item, q, s, (USE_EQUIP))) return;
390
391         /* Activate the item */
392         do_cmd_activate_aux(item);
393 }
394
395 /*!
396 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
397 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
398 * @param o_ptr 対象のオブジェクト構造体ポインタ
399 * @return 発動実行の是非を返す。
400 */
401 static bool activate_dragon_breath(object_type *o_ptr)
402 {
403         u32b flgs[TR_FLAG_SIZE]; /* for resistance flags */
404         int type[20];
405         cptr name[20];
406         int i, dir, t, n = 0;
407
408         if (!get_aim_dir(&dir)) return FALSE;
409
410         object_flags(o_ptr, flgs);
411
412         for (i = 0; dragonbreath_info[i].flag != 0; i++)
413         {
414                 if (have_flag(flgs, dragonbreath_info[i].flag))
415                 {
416                         type[n] = dragonbreath_info[i].type;
417                         name[n] = dragonbreath_info[i].name;
418                         n++;
419                 }
420         }
421
422         /* Paranoia */
423         if (n == 0) return FALSE;
424
425         /* Stop speaking */
426         if (music_singing_any()) stop_singing();
427         if (hex_spelling_any()) stop_hex_spell_all();
428
429         t = randint0(n);
430         msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
431         fire_breath(type[t], dir, 250, 4);
432
433         return TRUE;
434 }
435
436 /*!
437  * @brief アイテムの発動効果を処理する。
438  * @param o_ptr 対象のオブジェクト構造体ポインタ
439  * @return 発動実行の是非を返す。
440  */
441 bool activate_artifact(object_type *o_ptr)
442 {
443         PLAYER_LEVEL plev = p_ptr->lev;
444         int k, dummy = 0;
445         DIRECTION dir;
446         cptr name = k_name + k_info[o_ptr->k_idx].name;
447         const activation_type* const act_ptr = find_activation_info(o_ptr);
448
449         /* Paranoia */
450         if (!act_ptr) {
451                 /* Maybe forgot adding information to activation_info table ? */
452                 msg_print("Activation information is not found.");
453                 return FALSE;
454         }
455
456         /* Activate for attack */
457         switch (act_ptr->index)
458         {
459         case ACT_SUNLIGHT:
460         {
461                 if (!get_aim_dir(&dir)) return FALSE;
462                 msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
463                 (void)lite_line(dir, damroll(6, 8));
464                 break;
465         }
466
467         case ACT_BO_MISS_1:
468         {
469                 msg_print(_("それは眩しいくらいに明るく輝いている...", "It glows extremely brightly..."));
470                 if (!get_aim_dir(&dir)) return FALSE;
471                 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
472                 break;
473         }
474
475         case ACT_BA_POIS_1:
476         {
477                 msg_print(_("それは濃緑色に脈動している...", "It throbs deep green..."));
478                 if (!get_aim_dir(&dir)) return FALSE;
479                 fire_ball(GF_POIS, dir, 12, 3);
480                 break;
481         }
482
483         case ACT_BO_ELEC_1:
484         {
485                 msg_print(_("それは火花に覆われた...", "It is covered in sparks..."));
486                 if (!get_aim_dir(&dir)) return FALSE;
487                 fire_bolt(GF_ELEC, dir, damroll(4, 8));
488                 break;
489         }
490
491         case ACT_BO_ACID_1:
492         {
493                 msg_print(_("それは酸に覆われた...", "It is covered in acid..."));
494                 if (!get_aim_dir(&dir)) return FALSE;
495                 fire_bolt(GF_ACID, dir, damroll(5, 8));
496                 break;
497         }
498
499         case ACT_BO_COLD_1:
500         {
501                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
502                 if (!get_aim_dir(&dir)) return FALSE;
503                 fire_bolt(GF_COLD, dir, damroll(6, 8));
504                 break;
505         }
506
507         case ACT_BO_FIRE_1:
508         {
509                 msg_print(_("それは炎に覆われた...", "It is covered in fire..."));
510                 if (!get_aim_dir(&dir)) return FALSE;
511                 fire_bolt(GF_FIRE, dir, damroll(9, 8));
512                 break;
513         }
514
515         case ACT_BA_COLD_1:
516         {
517                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
518                 if (!get_aim_dir(&dir)) return FALSE;
519                 fire_ball(GF_COLD, dir, 48, 2);
520                 break;
521         }
522
523         case ACT_BA_COLD_2:
524         {
525                 msg_print(_("それは青く激しく輝いた...", "It glows an intense blue..."));
526                 if (!get_aim_dir(&dir)) return FALSE;
527                 fire_ball(GF_COLD, dir, 100, 2);
528                 break;
529         }
530
531         case ACT_BA_COLD_3:
532         {
533                 msg_print(_("明るく白色に輝いている...", "It glows bright white..."));
534                 if (!get_aim_dir(&dir)) return FALSE;
535                 fire_ball(GF_COLD, dir, 400, 3);
536                 break;
537         }
538
539         case ACT_BA_FIRE_1:
540         {
541                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
542                 if (!get_aim_dir(&dir)) return FALSE;
543                 fire_ball(GF_FIRE, dir, 72, 2);
544                 break;
545         }
546
547         case ACT_BA_FIRE_2:
548         {
549                 msg_format(_("%sから炎が吹き出した...", "The %s rages in fire..."), name);
550                 if (!get_aim_dir(&dir)) return FALSE;
551                 fire_ball(GF_FIRE, dir, 120, 3);
552                 break;
553         }
554
555         case ACT_BA_FIRE_3:
556         {
557                 msg_print(_("深赤色に輝いている...", "It glows deep red..."));
558                 if (!get_aim_dir(&dir)) return FALSE;
559                 fire_ball(GF_FIRE, dir, 300, 3);
560                 break;
561         }
562
563         case ACT_BA_FIRE_4:
564         {
565                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
566                 if (!get_aim_dir(&dir)) return FALSE;
567                 fire_ball(GF_FIRE, dir, 100, 2);
568                 break;
569         }
570
571         case ACT_BA_ELEC_2:
572         {
573                 msg_print(_("電気がパチパチ音を立てた...", "It crackles with electricity..."));
574                 if (!get_aim_dir(&dir)) return FALSE;
575                 fire_ball(GF_ELEC, dir, 100, 3);
576                 break;
577         }
578
579         case ACT_BA_ELEC_3:
580         {
581                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
582                 if (!get_aim_dir(&dir)) return FALSE;
583                 fire_ball(GF_ELEC, dir, 500, 3);
584                 break;
585         }
586
587         case ACT_BA_ACID_1:
588         {
589                 msg_print(_("それは黒く激しく輝いた...", "It glows an intense black..."));
590                 if (!get_aim_dir(&dir)) return FALSE;
591                 fire_ball(GF_ACID, dir, 100, 2);
592                 break;
593         }
594
595         case ACT_BA_NUKE_1:
596         {
597                 msg_print(_("それは緑に激しく輝いた...", "It glows an intense green..."));
598                 if (!get_aim_dir(&dir)) return FALSE;
599                 fire_ball(GF_NUKE, dir, 100, 2);
600                 break;
601         }
602
603         case ACT_HYPODYNAMIA_1:
604         {
605                 msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
606                 if (!get_aim_dir(&dir)) return FALSE;
607                 if (hypodynamic_bolt(dir, 100))
608                         break;
609         }
610
611         case ACT_HYPODYNAMIA_2:
612         {
613                 msg_print(_("黒く輝いている...", "It glows black..."));
614                 if (!get_aim_dir(&dir)) return FALSE;
615                 hypodynamic_bolt(dir, 120);
616                 break;
617         }
618
619         case ACT_DRAIN_1:
620         {
621                 if (!get_aim_dir(&dir)) return FALSE;
622                 for (dummy = 0; dummy < 3; dummy++)
623                 {
624                         if (hypodynamic_bolt(dir, 50))
625                                 hp_player(50);
626                 }
627                 break;
628         }
629
630         case ACT_BO_MISS_2:
631         {
632                 msg_print(_("魔法のトゲが現れた...", "It grows magical spikes..."));
633                 if (!get_aim_dir(&dir)) return FALSE;
634                 fire_bolt(GF_ARROW, dir, 150);
635                 break;
636         }
637
638         case ACT_WHIRLWIND:
639         {
640                 {
641                         int y = 0, x = 0;
642                         cave_type       *c_ptr;
643                         monster_type    *m_ptr;
644
645                         for (dir = 0; dir <= 9; dir++)
646                         {
647                                 y = p_ptr->y + ddy[dir];
648                                 x = p_ptr->x + ddx[dir];
649                                 c_ptr = &cave[y][x];
650
651                                 /* Get the monster */
652                                 m_ptr = &m_list[c_ptr->m_idx];
653
654                                 /* Hack -- attack monsters */
655                                 if (c_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
656                                         py_attack(y, x, 0);
657                         }
658                 }
659                 break;
660         }
661
662         case ACT_DRAIN_2:
663         {
664                 if (!get_aim_dir(&dir)) return FALSE;
665                 for (dummy = 0; dummy < 3; dummy++)
666                 {
667                         if (hypodynamic_bolt(dir, 100))
668                                 hp_player(100);
669                 }
670                 break;
671         }
672
673
674         case ACT_CALL_CHAOS:
675         {
676                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
677                 call_chaos();
678                 break;
679         }
680
681         case ACT_ROCKET:
682         {
683                 if (!get_aim_dir(&dir)) return FALSE;
684                 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
685                 fire_ball(GF_ROCKET, dir, 250 + plev * 3, 2);
686                 break;
687         }
688
689         case ACT_DISP_EVIL:
690         {
691                 msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
692                 dispel_evil(p_ptr->lev * 5);
693                 break;
694         }
695
696         case ACT_BA_MISS_3:
697         {
698                 if (!get_aim_dir(&dir)) return FALSE;
699                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
700                 fire_breath(GF_MISSILE, dir, 300, 4);
701                 break;
702         }
703
704         case ACT_DISP_GOOD:
705         {
706                 msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
707                 dispel_good(p_ptr->lev * 5);
708                 break;
709         }
710
711         case ACT_BO_MANA:
712         {
713                 msg_format(_("%sに魔法のトゲが現れた...", "The %s grows magical spikes..."), name);
714                 if (!get_aim_dir(&dir)) return FALSE;
715                 fire_bolt(GF_ARROW, dir, 150);
716                 break;
717         }
718
719         case ACT_BA_WATER:
720         {
721                 msg_format(_("%sが深い青色に鼓動している...", "The %s throbs deep blue..."), name);
722                 if (!get_aim_dir(&dir)) return FALSE;
723                 fire_ball(GF_WATER, dir, 200, 3);
724                 break;
725         }
726
727         case ACT_BA_DARK:
728         {
729                 msg_format(_("%sが深い闇に覆われた...", "The %s is coverd in pitch-darkness..."), name);
730                 if (!get_aim_dir(&dir)) return FALSE;
731                 fire_ball(GF_DARK, dir, 250, 4);
732                 break;
733         }
734
735         case ACT_BA_MANA:
736         {
737                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
738                 if (!get_aim_dir(&dir)) return FALSE;
739                 fire_ball(GF_MANA, dir, 250, 4);
740                 break;
741         }
742
743         case ACT_PESTICIDE:
744         {
745                 msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
746                 (void)dispel_monsters(4);
747                 break;
748         }
749
750         case ACT_BLINDING_LIGHT:
751         {
752                 msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
753                 fire_ball(GF_LITE, 0, 300, 6);
754                 confuse_monsters(3 * p_ptr->lev / 2);
755                 break;
756         }
757
758         case ACT_BIZARRE:
759         {
760                 msg_format(_("%sは漆黒に輝いた...", "The %s glows intensely black..."), name);
761                 if (!get_aim_dir(&dir)) return FALSE;
762                 ring_of_power(dir);
763                 break;
764         }
765
766         case ACT_CAST_BA_STAR:
767         {
768                 HIT_POINT num = damroll(5, 3);
769                 POSITION y = 0, x = 0;
770                 int attempts;
771                 msg_format(_("%sが稲妻で覆われた...", "The %s is surrounded by lightning..."), name);
772                 for (k = 0; k < num; k++)
773                 {
774                         attempts = 1000;
775
776                         while (attempts--)
777                         {
778                                 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
779                                 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
780                                 if (!player_bold(y, x)) break;
781                         }
782
783                         project(0, 3, y, x, 150, GF_ELEC,
784                                 (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
785                 }
786
787                 break;
788         }
789
790         case ACT_BLADETURNER:
791         {
792                 if (!get_aim_dir(&dir)) return FALSE;
793                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
794                 fire_breath(GF_MISSILE, dir, 300, 4);
795                 msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
796                 (void)set_afraid(0);
797                 (void)set_hero(randint1(50) + 50, FALSE);
798                 (void)hp_player(10);
799                 (void)set_blessed(randint1(50) + 50, FALSE);
800                 (void)set_oppose_acid(randint1(50) + 50, FALSE);
801                 (void)set_oppose_elec(randint1(50) + 50, FALSE);
802                 (void)set_oppose_fire(randint1(50) + 50, FALSE);
803                 (void)set_oppose_cold(randint1(50) + 50, FALSE);
804                 (void)set_oppose_pois(randint1(50) + 50, FALSE);
805                 break;
806         }
807
808         case ACT_BR_FIRE:
809         {
810                 if (!get_aim_dir(&dir)) return FALSE;
811                 fire_breath(GF_FIRE, dir, 200, 2);
812                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
813                 {
814                         (void)set_oppose_fire(randint1(20) + 20, FALSE);
815                 }
816                 break;
817         }
818
819         case ACT_BR_COLD:
820         {
821                 if (!get_aim_dir(&dir)) return FALSE;
822                 fire_breath(GF_COLD, dir, 200, 2);
823                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
824                 {
825                         (void)set_oppose_cold(randint1(20) + 20, FALSE);
826                 }
827                 break;
828         }
829
830         case ACT_BR_DRAGON:
831         {
832                 if (!activate_dragon_breath(o_ptr)) return FALSE;
833                 break;
834         }
835
836         /* Activate for other offensive action */
837         case ACT_CONFUSE:
838         {
839                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
840                 if (!get_aim_dir(&dir)) return FALSE;
841                 confuse_monster(dir, 20);
842                 break;
843         }
844
845         case ACT_SLEEP:
846         {
847                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
848                 sleep_monsters_touch();
849                 break;
850         }
851
852         case ACT_QUAKE:
853         {
854                 earthquake(p_ptr->y, p_ptr->x, 5);
855                 break;
856         }
857
858         case ACT_TERROR:
859         {
860                 turn_monsters(40 + p_ptr->lev);
861                 break;
862         }
863
864         case ACT_TELE_AWAY:
865         {
866                 if (!get_aim_dir(&dir)) return FALSE;
867                 (void)fire_beam(GF_AWAY_ALL, dir, plev);
868                 break;
869         }
870
871         case ACT_BANISH_EVIL:
872         {
873                 if (banish_evil(100))
874                 {
875                         msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
876                 }
877                 break;
878         }
879
880         case ACT_GENOCIDE:
881         {
882                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
883                 (void)symbol_genocide(200, TRUE);
884                 break;
885         }
886
887         case ACT_MASS_GENO:
888         {
889                 msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
890                 (void)mass_genocide(200, TRUE);
891                 break;
892         }
893
894         case ACT_SCARE_AREA:
895         {
896                 if (music_singing_any()) stop_singing();
897                 if (hex_spelling_any()) stop_hex_spell_all();
898                 msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
899                         "You wind a mighty blast; your enemies tremble!"));
900                 (void)turn_monsters((3 * p_ptr->lev / 2) + 10);
901                 break;
902         }
903
904         case ACT_AGGRAVATE:
905         {
906                 if (o_ptr->name1 == ART_HYOUSIGI)
907                 {
908                         msg_print(_("拍子木を打った。", "You beat Your wooden clappers."));
909                 }
910                 else
911                 {
912                         msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
913                 }
914                 aggravate_monsters(0);
915                 break;
916         }
917
918         /* Activate for summoning / charming */
919
920         case ACT_CHARM_ANIMAL:
921         {
922                 if (!get_aim_dir(&dir)) return FALSE;
923                 (void)charm_animal(dir, plev);
924                 break;
925         }
926
927         case ACT_CHARM_UNDEAD:
928         {
929                 if (!get_aim_dir(&dir)) return FALSE;
930                 (void)control_one_undead(dir, plev);
931                 break;
932         }
933
934         case ACT_CHARM_OTHER:
935         {
936                 if (!get_aim_dir(&dir)) return FALSE;
937                 (void)charm_monster(dir, plev * 2);
938                 break;
939         }
940
941         case ACT_CHARM_ANIMALS:
942         {
943                 (void)charm_animals(plev * 2);
944                 break;
945         }
946
947         case ACT_CHARM_OTHERS:
948         {
949                 charm_monsters(plev * 2);
950                 break;
951         }
952
953         case ACT_SUMMON_ANIMAL:
954         {
955                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
956                 break;
957         }
958
959         case ACT_SUMMON_PHANTOM:
960         {
961                 msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
962                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
963                 break;
964         }
965
966         case ACT_SUMMON_ELEMENTAL:
967         {
968                 bool pet = one_in_(3);
969                 BIT_FLAGS mode = 0L;
970
971                 if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
972                 if (pet) mode |= PM_FORCE_PET;
973                 else mode |= PM_NO_PET;
974
975                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode))
976                 {
977                         msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
978                         if (pet)
979                                 msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
980                         else
981                                 msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
982                 }
983
984                 break;
985         }
986
987         case ACT_SUMMON_DEMON:
988         {
989                 bool pet = one_in_(3);
990                 BIT_FLAGS mode = 0L;
991
992                 if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
993                 if (pet) mode |= PM_FORCE_PET;
994                 else mode |= PM_NO_PET;
995
996                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_DEMON, mode))
997                 {
998                         msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
999                         if (pet)
1000                                 msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
1001                         else
1002                                 msg_print(_("「NON SERVIAM! Wretch! お前の魂を頂くぞ!」", "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
1003                 }
1004
1005                 break;
1006         }
1007
1008         case ACT_SUMMON_UNDEAD:
1009         {
1010                 bool pet = one_in_(3);
1011                 int type;
1012                 BIT_FLAGS mode = 0L;
1013
1014                 type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
1015
1016                 if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
1017                 if (pet) mode |= PM_FORCE_PET;
1018                 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
1019
1020                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode))
1021                 {
1022                         msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
1023                                 "Cold winds begin to blow around you, carrying with them the stench of decay..."));
1024                         if (pet)
1025                                 msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
1026                                         "Ancient, long-dead forms arise from the ground to serve you!"));
1027                         else
1028                                 msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
1029                                         "'The dead arise... to punish you for disturbing them!'"));
1030                 }
1031
1032                 break;
1033         }
1034
1035         case ACT_SUMMON_HOUND:
1036         {
1037                 BIT_FLAGS mode = PM_ALLOW_GROUP;
1038                 bool pet = !one_in_(5);
1039                 if (pet) mode |= PM_FORCE_PET;
1040                 else mode |= PM_NO_PET;
1041
1042                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode))
1043                 {
1044
1045                         if (pet)
1046                                 msg_print(_("ハウンドがあなたの下僕として出現した。",
1047                                         "A group of hounds appear as your servant."));
1048                         else
1049                                 msg_print(_("ハウンドはあなたに牙を向けている!",
1050                                         "A group of hounds appear as your enemy!"));
1051                 }
1052
1053                 break;
1054         }
1055
1056         case ACT_SUMMON_DAWN:
1057         {
1058                 msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
1059                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
1060                 break;
1061         }
1062
1063         case ACT_SUMMON_OCTOPUS:
1064         {
1065                 BIT_FLAGS mode = PM_ALLOW_GROUP;
1066                 bool pet = !one_in_(5);
1067                 if (pet) mode |= PM_FORCE_PET;
1068
1069                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_JIZOTAKO, mode))
1070                 {
1071                         if (pet)
1072                                 msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
1073                         else
1074                                 msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
1075                 }
1076
1077                 break;
1078         }
1079
1080         /* Activate for healing */
1081
1082         case ACT_CHOIR_SINGS:
1083         {
1084                 msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
1085                 (void)cure_critical_wounds(777);
1086                 (void)set_hero(randint1(25) + 25, FALSE);
1087                 break;
1088         }
1089
1090         case ACT_CURE_LW:
1091         {
1092                 (void)set_afraid(0);
1093                 (void)hp_player(30);
1094                 break;
1095         }
1096
1097         case ACT_CURE_MW:
1098         {
1099                 msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
1100                 (void)cure_serious_wounds(4, 8);
1101                 break;
1102         }
1103
1104         case ACT_CURE_POISON:
1105         {
1106                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1107                 (void)set_afraid(0);
1108                 (void)set_poisoned(0);
1109                 break;
1110         }
1111
1112         case ACT_REST_EXP:
1113         {
1114                 msg_print(_("深紅に輝いている...", "It glows a deep red..."));
1115                 restore_level();
1116                 break;
1117         }
1118
1119         case ACT_REST_ALL:
1120         {
1121                 msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
1122                 (void)restore_all_status();
1123                 (void)restore_level();
1124                 break;
1125         }
1126
1127         case ACT_CURE_700:
1128         {
1129                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1130                 msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
1131                 (void)cure_critical_wounds(700);
1132                 break;
1133         }
1134
1135         case ACT_CURE_1000:
1136         {
1137                 msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
1138                 msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
1139                 (void)cure_critical_wounds(1000);
1140                 break;
1141         }
1142
1143         case ACT_CURING:
1144         {
1145                 msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
1146                 true_healing(0);
1147                 break;
1148         }
1149
1150         case ACT_CURE_MANA_FULL:
1151         {
1152                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
1153                 restore_mana(TRUE);
1154                 break;
1155         }
1156
1157         /* Activate for timed effect */
1158
1159         case ACT_ESP:
1160         {
1161                 (void)set_tim_esp(randint1(30) + 25, FALSE);
1162                 break;
1163         }
1164
1165         case ACT_BERSERK:
1166         {
1167                 (void)berserk(randint1(25) + 25);
1168                 break;
1169         }
1170
1171         case ACT_PROT_EVIL:
1172         {
1173                 msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
1174                 k = 3 * p_ptr->lev;
1175                 (void)set_protevil(randint1(25) + k, FALSE);
1176                 break;
1177         }
1178
1179         case ACT_RESIST_ALL:
1180         {
1181                 msg_print(_("様々な色に輝いている...", "It glows many colours..."));
1182                 (void)set_oppose_acid(randint1(40) + 40, FALSE);
1183                 (void)set_oppose_elec(randint1(40) + 40, FALSE);
1184                 (void)set_oppose_fire(randint1(40) + 40, FALSE);
1185                 (void)set_oppose_cold(randint1(40) + 40, FALSE);
1186                 (void)set_oppose_pois(randint1(40) + 40, FALSE);
1187                 break;
1188         }
1189
1190         case ACT_SPEED:
1191         {
1192                 msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
1193                 (void)set_fast(randint1(20) + 20, FALSE);
1194                 break;
1195         }
1196
1197         case ACT_XTRA_SPEED:
1198         {
1199                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1200                 (void)set_fast(randint1(75) + 75, FALSE);
1201                 break;
1202         }
1203
1204         case ACT_WRAITH:
1205         {
1206                 set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
1207                 break;
1208         }
1209
1210         case ACT_INVULN:
1211         {
1212                 (void)set_invuln(randint1(8) + 8, FALSE);
1213                 break;
1214         }
1215
1216         case ACT_HERO:
1217         {
1218                 (void)heroism(25);
1219                 break;
1220         }
1221
1222         case ACT_HERO_SPEED:
1223         {
1224                 (void)set_fast(randint1(50) + 50, FALSE);
1225                 (void)heroism(50);
1226                 break;
1227         }
1228
1229         case ACT_RESIST_ACID:
1230         {
1231                 msg_format(_("%sが黒く輝いた...", "The %s grows black."), name);
1232                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
1233                 {
1234                         if (!get_aim_dir(&dir)) return FALSE;
1235                         fire_ball(GF_ACID, dir, 100, 2);
1236                 }
1237                 (void)set_oppose_acid(randint1(20) + 20, FALSE);
1238                 break;
1239         }
1240
1241         case ACT_RESIST_FIRE:
1242         {
1243                 msg_format(_("%sが赤く輝いた...", "The %s grows red."), name);
1244                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
1245                 {
1246                         if (!get_aim_dir(&dir)) return FALSE;
1247                         fire_ball(GF_FIRE, dir, 100, 2);
1248                 }
1249                 (void)set_oppose_fire(randint1(20) + 20, FALSE);
1250                 break;
1251         }
1252
1253         case ACT_RESIST_COLD:
1254         {
1255                 msg_format(_("%sが白く輝いた...", "The %s grows white."), name);
1256                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
1257                 {
1258                         if (!get_aim_dir(&dir)) return FALSE;
1259                         fire_ball(GF_COLD, dir, 100, 2);
1260                 }
1261                 (void)set_oppose_cold(randint1(20) + 20, FALSE);
1262                 break;
1263         }
1264
1265         case ACT_RESIST_ELEC:
1266         {
1267                 msg_format(_("%sが青く輝いた...", "The %s grows blue."), name);
1268                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
1269                 {
1270                         if (!get_aim_dir(&dir)) return FALSE;
1271                         fire_ball(GF_ELEC, dir, 100, 2);
1272                 }
1273                 (void)set_oppose_elec(randint1(20) + 20, FALSE);
1274                 break;
1275         }
1276
1277         case ACT_RESIST_POIS:
1278         {
1279                 msg_format(_("%sが緑に輝いた...", "The %s grows green."), name);
1280                 (void)set_oppose_pois(randint1(20) + 20, FALSE);
1281                 break;
1282         }
1283
1284         /* Activate for general purpose effect (detection etc.) */
1285
1286         case ACT_LIGHT:
1287         {
1288                 msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
1289                 lite_area(damroll(2, 15), 3);
1290                 break;
1291         }
1292
1293         case ACT_MAP_LIGHT:
1294         {
1295                 msg_print(_("眩しく輝いた...", "It shines brightly..."));
1296                 map_area(DETECT_RAD_MAP);
1297                 lite_area(damroll(2, 15), 3);
1298                 break;
1299         }
1300
1301         case ACT_DETECT_ALL:
1302         {
1303                 msg_print(_("白く明るく輝いている...", "It glows bright white..."));
1304                 msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
1305                 detect_all(DETECT_RAD_DEFAULT);
1306                 break;
1307         }
1308
1309         case ACT_DETECT_XTRA:
1310         {
1311                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1312                 detect_all(DETECT_RAD_DEFAULT);
1313                 probing();
1314                 identify_fully(FALSE);
1315                 break;
1316         }
1317
1318         case ACT_ID_FULL:
1319         {
1320                 msg_print(_("黄色く輝いている...", "It glows yellow..."));
1321                 identify_fully(FALSE);
1322                 break;
1323         }
1324
1325         case ACT_ID_PLAIN:
1326         {
1327                 if (!ident_spell(FALSE)) return FALSE;
1328                 break;
1329         }
1330
1331         case ACT_RUNE_EXPLO:
1332         {
1333                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1334                 explosive_rune();
1335                 break;
1336         }
1337
1338         case ACT_RUNE_PROT:
1339         {
1340                 msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
1341                 warding_glyph();
1342                 break;
1343         }
1344
1345         case ACT_SATIATE:
1346         {
1347                 (void)set_food(PY_FOOD_MAX - 1);
1348                 break;
1349         }
1350
1351         case ACT_DEST_DOOR:
1352         {
1353                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1354                 destroy_doors_touch();
1355                 break;
1356         }
1357
1358         case ACT_STONE_MUD:
1359         {
1360                 msg_print(_("鼓動している...", "It pulsates..."));
1361                 if (!get_aim_dir(&dir)) return FALSE;
1362                 wall_to_mud(dir, 20 + randint1(30));
1363                 break;
1364         }
1365
1366         case ACT_RECHARGE:
1367         {
1368                 recharge(130);
1369                 break;
1370         }
1371
1372         case ACT_ALCHEMY:
1373         {
1374                 msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
1375                 (void)alchemy();
1376                 break;
1377         }
1378
1379         case ACT_DIM_DOOR:
1380         {
1381                 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
1382                 if (!dimension_door()) return FALSE;
1383                 break;
1384         }
1385
1386
1387         case ACT_TELEPORT:
1388         {
1389                 msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
1390                 teleport_player(100, 0L);
1391                 break;
1392         }
1393
1394         case ACT_RECALL:
1395         {
1396                 msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
1397                 if (!word_of_recall()) return FALSE;
1398                 break;
1399         }
1400
1401         case ACT_JUDGE:
1402         {
1403                 msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
1404                 chg_virtue(V_KNOWLEDGE, 1);
1405                 chg_virtue(V_ENLIGHTEN, 1);
1406                 wiz_lite(FALSE);
1407
1408                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1409                 take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
1410
1411                 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
1412                 (void)detect_doors(DETECT_RAD_DEFAULT);
1413                 (void)detect_stairs(DETECT_RAD_DEFAULT);
1414
1415                 if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
1416                 {
1417                         (void)word_of_recall();
1418                 }
1419
1420                 break;
1421         }
1422
1423         case ACT_TELEKINESIS:
1424         {
1425                 if (!get_aim_dir(&dir)) return FALSE;
1426                 msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
1427                 fetch(dir, 500, TRUE);
1428                 break;
1429         }
1430
1431         case ACT_DETECT_UNIQUE:
1432         {
1433                 int i;
1434                 monster_type *m_ptr;
1435                 monster_race *r_ptr;
1436                 msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
1437                 /* Process the monsters (backwards) */
1438                 for (i = m_max - 1; i >= 1; i--)
1439                 {
1440                         /* Access the monster */
1441                         m_ptr = &m_list[i];
1442
1443                         /* Ignore "dead" monsters */
1444                         if (!m_ptr->r_idx) continue;
1445
1446                         r_ptr = &r_info[m_ptr->r_idx];
1447
1448                         if (r_ptr->flags1 & RF1_UNIQUE)
1449                         {
1450                                 msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
1451                         }
1452                 }
1453                 break;
1454         }
1455
1456         case ACT_ESCAPE:
1457         {
1458                 switch (randint1(13))
1459                 {
1460                 case 1: case 2: case 3: case 4: case 5:
1461                         teleport_player(10, 0L);
1462                         break;
1463                 case 6: case 7: case 8: case 9: case 10:
1464                         teleport_player(222, 0L);
1465                         break;
1466                 case 11: case 12:
1467                         (void)stair_creation();
1468                         break;
1469                 default:
1470                         if (get_check(_("この階を去りますか?", "Leave this level? ")))
1471                         {
1472                                 if (autosave_l) do_cmd_save_game(TRUE);
1473
1474                                 /* Leaving */
1475                                 p_ptr->leaving = TRUE;
1476                         }
1477                 }
1478                 break;
1479         }
1480
1481         case ACT_DISP_CURSE_XTRA:
1482         {
1483                 msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
1484                 if (remove_all_curse())
1485                 {
1486                         msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you."));
1487                 }
1488                 (void)probing();
1489                 break;
1490         }
1491
1492         case ACT_BRAND_FIRE_BOLTS:
1493         {
1494                 msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
1495                 (void)brand_bolts();
1496                 break;
1497         }
1498
1499         case ACT_RECHARGE_XTRA:
1500         {
1501                 msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
1502                 if (!recharge(1000)) return FALSE;
1503                 break;
1504         }
1505
1506         case ACT_LORE:
1507         {
1508                 msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
1509                 if (!ident_spell(FALSE)) return FALSE;
1510
1511                 if (mp_ptr->spell_book)
1512                 {
1513                         /* Sufficient mana */
1514                         if (20 <= p_ptr->csp)
1515                         {
1516                                 /* Use some mana */
1517                                 p_ptr->csp -= 20;
1518                         }
1519
1520                         /* Over-exert the player */
1521                         else
1522                         {
1523                                 int oops = 20 - p_ptr->csp;
1524
1525                                 /* No mana left */
1526                                 p_ptr->csp = 0;
1527                                 p_ptr->csp_frac = 0;
1528
1529                                 /* Message */
1530                                 msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
1531                                 /* Hack -- Bypass free action */
1532                                 (void)set_paralyzed(p_ptr->paralyzed +
1533                                         randint1(5 * oops + 1));
1534
1535                                 /* Confusing. */
1536                                 (void)set_confused(p_ptr->confused +
1537                                         randint1(5 * oops + 1));
1538                         }
1539
1540                         /* Redraw mana */
1541                         p_ptr->redraw |= (PR_MANA);
1542                 }
1543                 take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
1544                 /* Confusing. */
1545                 if (one_in_(5)) (void)set_confused(p_ptr->confused +
1546                         randint1(10));
1547
1548                 /* Exercise a little care... */
1549                 if (one_in_(20))
1550                         take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
1551                 break;
1552         }
1553
1554         case ACT_SHIKOFUMI:
1555         {
1556                 msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
1557                 (void)set_afraid(0);
1558                 (void)set_hero(randint1(20) + 20, FALSE);
1559                 dispel_evil(p_ptr->lev * 3);
1560                 break;
1561         }
1562
1563         case ACT_PHASE_DOOR:
1564         {
1565                 teleport_player(10, 0L);
1566                 break;
1567         }
1568
1569         case ACT_DETECT_ALL_MONS:
1570         {
1571                 (void)detect_monsters_invis(255);
1572                 (void)detect_monsters_normal(255);
1573                 break;
1574         }
1575
1576         case ACT_ULTIMATE_RESIST:
1577         {
1578                 TIME_EFFECT v = randint1(25) + 25;
1579                 (void)set_afraid(0);
1580                 (void)set_hero(v, FALSE);
1581                 (void)hp_player(10);
1582                 (void)set_blessed(v, FALSE);
1583                 (void)set_oppose_acid(v, FALSE);
1584                 (void)set_oppose_elec(v, FALSE);
1585                 (void)set_oppose_fire(v, FALSE);
1586                 (void)set_oppose_cold(v, FALSE);
1587                 (void)set_oppose_pois(v, FALSE);
1588                 (void)set_ultimate_res(v, FALSE);
1589                 break;
1590         }
1591
1592
1593         /* Unique activation */
1594         case ACT_CAST_OFF:
1595         {
1596                 INVENTORY_IDX inv;
1597                 int 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                 POSITION 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