OSDN Git Service

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