OSDN Git Service

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